Suspend failed ESP32 MQTT and NTP uplinks for power saving
Share one bounded WiFi outage and recovery schedule across MQTT, automatic NTP, Companion station ownership and WebConfig. Preserve enabled settings and foreground access while allowing normal sleep after confirmed physical shutdown. Honor failed SDK client stops before handing off WiFi, protect clean teardown and reconfiguration, and retry transient ESP-NOW channel restoration without repeated disconnects. Add production-method, SDK failure and real sleep regressions to CI. Validation: native MQTT/NTP/clock/reconnect suites; production power and wrapper failure tests; browser, room HTTP, OTA and combined bridge regressions; Full Heltec V4 repeater, room and companion builds with capability, flash and linked-memory checks.
This commit is contained in:
1 parent
f62cc7b527
commit
6b3f7df4d0
37 files changed
+3258
-82
No files matched your search
@@ -0,0 +1,116 @@
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace mesh {
|
||||
namespace wifi {
|
||||
|
||||
static constexpr uint32_t kNetworkFailureGraceMs = 5UL * 60UL * 1000UL;
|
||||
static constexpr uint32_t kNetworkRecoveryProbeMs = 2UL * 60UL * 1000UL;
|
||||
static constexpr uint32_t kNetworkRecoveryIntervalMs = 30UL * 60UL * 1000UL;
|
||||
static constexpr uint32_t kNetworkHealthyMs = 30000UL;
|
||||
|
||||
// MQTT and its NTP bootstrap share one outage clock. A successful WiFi
|
||||
// association or time reply alone is not proof that an MQTT destination works.
|
||||
// Failed attempts must never extend either the grace period or the cooldown.
|
||||
class NetworkPowerPolicy {
|
||||
public:
|
||||
enum class Action { Run, Suspend, Resume };
|
||||
|
||||
Action update(uint32_t now, bool useful_network, bool foreground,
|
||||
bool requested_probe = false) {
|
||||
if (!_started) {
|
||||
_started = true;
|
||||
_since = now;
|
||||
}
|
||||
if (useful_network) {
|
||||
const bool was_suspended = _suspended;
|
||||
_suspended = false;
|
||||
_probing = false;
|
||||
_since = now;
|
||||
return was_suspended ? Action::Resume : Action::Run;
|
||||
}
|
||||
if (_suspended) {
|
||||
if (foreground || requested_probe
|
||||
|| now - _since >= kNetworkRecoveryIntervalMs) {
|
||||
_suspended = false;
|
||||
_probing = true;
|
||||
_since = now;
|
||||
return Action::Resume;
|
||||
}
|
||||
return Action::Suspend;
|
||||
}
|
||||
if (foreground) return Action::Run;
|
||||
const uint32_t budget = _probing
|
||||
? kNetworkRecoveryProbeMs : kNetworkFailureGraceMs;
|
||||
if (now - _since >= budget) {
|
||||
_suspended = true;
|
||||
_probing = false;
|
||||
_since = now;
|
||||
return Action::Suspend;
|
||||
}
|
||||
return Action::Run;
|
||||
}
|
||||
|
||||
bool suspended() const { return _suspended; }
|
||||
|
||||
private:
|
||||
bool _started = false;
|
||||
bool _suspended = false;
|
||||
bool _probing = false;
|
||||
uint32_t _since = 0;
|
||||
};
|
||||
|
||||
enum class NetworkPowerHold : uint8_t {
|
||||
CompanionClient = 1,
|
||||
WebConfig = 2,
|
||||
OtaSeeder = 4
|
||||
};
|
||||
|
||||
// One program-wide handoff between the MQTT owner task and the station/UI
|
||||
// owners. Only the worker publishes suspension, after stopping TLS and SNTP.
|
||||
// Foreground owners publish holds; they never stop the worker's transports.
|
||||
class NetworkPowerControl {
|
||||
public:
|
||||
bool managed() const { return _managed.load(std::memory_order_acquire); }
|
||||
void setManaged(bool value) {
|
||||
_managed.store(value, std::memory_order_release);
|
||||
if (!value) {
|
||||
_suspended.store(false, std::memory_order_release);
|
||||
_probe.store(false, std::memory_order_release);
|
||||
}
|
||||
}
|
||||
bool backgroundSuspended() const {
|
||||
return managed() && _suspended.load(std::memory_order_acquire);
|
||||
}
|
||||
void setSuspended(bool value) {
|
||||
_suspended.store(value, std::memory_order_release);
|
||||
}
|
||||
void setHold(NetworkPowerHold owner, bool value) {
|
||||
const uint8_t mask = static_cast<uint8_t>(owner);
|
||||
if (value) _holds.fetch_or(mask, std::memory_order_acq_rel);
|
||||
else _holds.fetch_and(static_cast<uint8_t>(~mask), std::memory_order_acq_rel);
|
||||
}
|
||||
bool foregroundActive() const {
|
||||
return _holds.load(std::memory_order_acquire) != 0;
|
||||
}
|
||||
void requestProbe() { _probe.store(true, std::memory_order_release); }
|
||||
bool consumeProbeRequest() {
|
||||
return _probe.exchange(false, std::memory_order_acq_rel);
|
||||
}
|
||||
|
||||
private:
|
||||
std::atomic<bool> _managed{false};
|
||||
std::atomic<bool> _suspended{false};
|
||||
std::atomic<bool> _probe{false};
|
||||
std::atomic<uint8_t> _holds{0};
|
||||
};
|
||||
|
||||
inline NetworkPowerControl& networkPower() {
|
||||
static NetworkPowerControl control;
|
||||
return control;
|
||||
}
|
||||
|
||||
} // namespace wifi
|
||||
} // namespace mesh
|
||||
@@ -89,6 +89,15 @@ static constexpr uint32_t MQTT_NTP_NON_ESP_SETTLE_MS = 5000UL;
|
||||
#endif
|
||||
static constexpr unsigned long MQTT_NTP_MIN_VALID_EPOCH = 1767225600UL;
|
||||
|
||||
static uint32_t mqttNtpFailureRetryAt(uint32_t now) {
|
||||
#ifdef ESP_PLATFORM
|
||||
const uint32_t deadline = now + mesh::wifi::kNetworkRecoveryIntervalMs;
|
||||
return deadline == 0 ? 1 : deadline;
|
||||
#else
|
||||
return MQTTConnectionPolicy::ntpRetryAt(now);
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool mqttNtpRefreshDue(uint32_t now, uint32_t last_sync,
|
||||
uint32_t retry_at) {
|
||||
return MQTTConnectionPolicy::ntpRefreshDue(now, last_sync, retry_at);
|
||||
@@ -1346,6 +1355,10 @@ void MQTTBridge::finishStopped() {
|
||||
// Timezone is inline class storage (_timezone_storage) - nothing to delete.
|
||||
// The shared JSON document's pools were freed by releaseRuntimeBuffers() above.
|
||||
_initialized = false;
|
||||
#ifdef ESP_PLATFORM
|
||||
_network_suspended.store(false, std::memory_order_release);
|
||||
mesh::wifi::networkPower().setManaged(false);
|
||||
#endif
|
||||
// A clean task stop already cancels this on its owning core. The second
|
||||
// cancellation is intentionally idempotent and also releases the lease
|
||||
// after the lifecycle's bounded forced-stop fallback.
|
||||
@@ -1449,6 +1462,16 @@ void MQTTBridge::LifecycleOps::onStopComplete(bool clean) {
|
||||
// ---------------------------------------------------------------------------
|
||||
// FreeRTOS task entry point
|
||||
// ---------------------------------------------------------------------------
|
||||
void MQTTBridge::applyTimezoneRules() {
|
||||
TimeChangeRule dst_rule, std_rule;
|
||||
if (!timezoneRulesFromString(_obs->timezone_string, dst_rule, std_rule)) {
|
||||
TimeChangeRule utc = {"UTC", Last, Sun, Mar, 0, 0};
|
||||
dst_rule = utc;
|
||||
std_rule = utc;
|
||||
}
|
||||
_timezone_storage.setRules(dst_rule, std_rule);
|
||||
}
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
void MQTTBridge::mqttTask(void* parameter) {
|
||||
MQTTBridge* bridge = static_cast<MQTTBridge*>(parameter);
|
||||
@@ -1559,10 +1582,168 @@ bool MQTTBridge::waitUnlessStopping(uint32_t delay_ms) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MQTTBridge::serviceNetworkPower(uint32_t now) {
|
||||
auto& control = mesh::wifi::networkPower();
|
||||
bool useful_network = false;
|
||||
for (int i = 0; i < RUNTIME_MQTT_SLOTS; ++i) {
|
||||
const uint32_t acknowledgments = _slots[i].client
|
||||
? _slots[i].client->getPublishAck() : 0;
|
||||
const bool broker_replied = acknowledgments != 0
|
||||
&& acknowledgments != _network_publish_acks[i];
|
||||
_network_publish_acks[i] = acknowledgments;
|
||||
// A flapping CONNACK must not buy another full outage window forever.
|
||||
// A PUBACK proves delivery immediately; a quiet connection must stay up
|
||||
// for 30 seconds, leaving time to prove recovery within the probe window.
|
||||
if (_slots[i].enabled && _slots[i].connected
|
||||
&& (broker_replied || (now - static_cast<uint32_t>(_slots[i].connected_at_ms)
|
||||
>= mesh::wifi::kNetworkHealthyMs))) {
|
||||
useful_network = true;
|
||||
}
|
||||
}
|
||||
wifi_mode_t mode = WIFI_MODE_NULL;
|
||||
const bool ap_active = esp_wifi_get_mode(&mode) == ESP_OK && (mode & WIFI_MODE_AP);
|
||||
bool foreground = control.foregroundActive() || ap_active
|
||||
|| (_board && _board->isOTAUpdateRunning())
|
||||
|| _ntp_force_requested || _ntp_diag_requested;
|
||||
#ifdef WITH_SNMP
|
||||
foreground = foreground || (_snmp_agent && _snmp_agent->isRunning()
|
||||
&& WiFi.status() == WL_CONNECTED);
|
||||
#endif
|
||||
const auto action = _network_power_policy.update(
|
||||
now, useful_network, foreground, control.consumeProbeRequest());
|
||||
if (action == mesh::wifi::NetworkPowerPolicy::Action::Suspend) {
|
||||
const bool newly_suspended = !_network_suspended.load(std::memory_order_acquire);
|
||||
if (newly_suspended) {
|
||||
cancelNtpRefresh();
|
||||
_ntp_sync_pending = false;
|
||||
for (int i = 0; i < RUNTIME_MQTT_SLOTS; ++i) {
|
||||
_slot_attempt_pending[i] = false;
|
||||
if (_slots[i].client && _slots[i].client->isStarted()) {
|
||||
_slots[i].client->disconnect();
|
||||
// The wrapper only clears isStarted after SDK stop succeeds. Never
|
||||
// hand station ownership off while any transport still runs.
|
||||
if (_slots[i].client->isStarted()) return false;
|
||||
}
|
||||
_slots[i].connected = false;
|
||||
_slots[i].connected_at_ms = 0;
|
||||
_status_publish_pending[i] = false;
|
||||
}
|
||||
updateCachedConnectionStatus();
|
||||
_network_suspended.store(true, std::memory_order_release);
|
||||
control.setSuspended(true); // TLS/SNTP teardown precedes the handoff.
|
||||
MQTT_DEBUG_PRINTLN("Network unavailable; suspending background WiFi for 30 minutes");
|
||||
}
|
||||
if (_manage_wifi && !control.foregroundActive()
|
||||
&& !(_board && _board->isOTAUpdateRunning())
|
||||
&& mqttStationWiFiMutationAllowed()
|
||||
&& (newly_suspended || (!mesh::wifi::espNowChannelConstrained()
|
||||
&& WiFi.getMode() != WIFI_OFF))) {
|
||||
WiFi.setAutoReconnect(false);
|
||||
WiFi.disconnect(false, false);
|
||||
if (mesh::wifi::espNowChannelConstrained()) {
|
||||
// ESP-NOW is an independent radio owner. Stop failed STA attempts,
|
||||
// keeping its driver, protocol and fixed channel available.
|
||||
_network_espnow_restore_pending =
|
||||
mesh::wifi::restoreEspNowChannel() != ESP_OK;
|
||||
_network_espnow_restore_at = static_cast<uint32_t>(millis()) + 1000U;
|
||||
} else if (WiFi.getMode() != WIFI_OFF) {
|
||||
WiFi.mode(WIFI_OFF);
|
||||
}
|
||||
}
|
||||
serviceEspNowChannelRestore(static_cast<uint32_t>(millis()));
|
||||
return false;
|
||||
}
|
||||
_network_espnow_restore_pending = false;
|
||||
if (_network_suspended.exchange(false, std::memory_order_acq_rel)) {
|
||||
// Publish before restarting: the Companion/role loop must not reclaim
|
||||
// WiFi underneath a new association or TLS handshake.
|
||||
control.setSuspended(false);
|
||||
_last_wifi_check = now - 10001UL;
|
||||
_wifi_status_initialized = false;
|
||||
_last_slot_reconnect_ms = now - MQTTConnectionPolicy::kReconnectGuardMs;
|
||||
for (int i = 0; i < RUNTIME_MQTT_SLOTS; ++i) {
|
||||
_slots[i].circuit_breaker_tripped = false;
|
||||
_slots[i].last_reconnect_attempt = now - MQTTConnectionPolicy::reconnectDelayMs(
|
||||
_slots[i].reconnect_backoff, static_cast<uint8_t>(i));
|
||||
}
|
||||
_ntp_refresh_retry_at = 0;
|
||||
_ntp_sync_pending = !_fresh_ntp_this_boot.load(std::memory_order_acquire);
|
||||
if (_manage_wifi) initializeWiFiInTask();
|
||||
MQTT_DEBUG_PRINTLN("Starting bounded network recovery probe");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MQTTBridge::serviceEspNowChannelRestore(uint32_t now) {
|
||||
if (!_network_espnow_restore_pending) return;
|
||||
if (!_manage_wifi || !_network_suspended.load(std::memory_order_acquire)
|
||||
|| !mesh::wifi::espNowChannelConstrained()) {
|
||||
_network_espnow_restore_pending = false;
|
||||
return;
|
||||
}
|
||||
// Disconnect and scan completion are asynchronous. Retry only a failed
|
||||
// channel write, once per second, without another station disconnect or
|
||||
// driver mode change. Foreground owners retain their channel throughout.
|
||||
if (mesh::wifi::networkPower().foregroundActive()
|
||||
|| (_board && _board->isOTAUpdateRunning())
|
||||
|| !mqttStationWiFiMutationAllowed()
|
||||
|| static_cast<int32_t>(now - _network_espnow_restore_at) < 0) return;
|
||||
_network_espnow_restore_pending = mesh::wifi::restoreEspNowChannel() != ESP_OK;
|
||||
_network_espnow_restore_at = static_cast<uint32_t>(millis()) + 1000U;
|
||||
}
|
||||
|
||||
void MQTTBridge::serviceBackgroundNtp(uint32_t now) {
|
||||
if (WiFi.status() != WL_CONNECTED) {
|
||||
pollNtpRefresh(now);
|
||||
return;
|
||||
}
|
||||
// A retained/admin-set clock can start MQTT without a blocking multi-server
|
||||
// NTP walk. It is not credited as a fresh internet reply or useful network.
|
||||
if (!_ntp_synced.load(std::memory_order_acquire)) {
|
||||
uint32_t system_time = 0;
|
||||
MQTTConnectionPolicy::checkedRtcEpoch(static_cast<int64_t>(time(nullptr)),
|
||||
MQTT_NTP_MIN_VALID_EPOCH, system_time);
|
||||
const uint32_t rtc_time = _rtc ? _rtc->getCurrentTime() : 0;
|
||||
const auto source = MQTTConnectionPolicy::chooseFallbackClock(
|
||||
false, system_time, rtc_time, MQTT_NTP_MIN_VALID_EPOCH);
|
||||
if (source != MQTTConnectionPolicy::ClockSource::None) {
|
||||
const uint32_t epoch = source == MQTTConnectionPolicy::ClockSource::Rtc
|
||||
? rtc_time : system_time;
|
||||
struct timeval accepted = {static_cast<time_t>(epoch), 0};
|
||||
settimeofday(&accepted, nullptr);
|
||||
if (_rtc) {
|
||||
_rtc->setCurrentTime(epoch);
|
||||
if (epoch < rtc_time) {
|
||||
_backward_clock_reset_epoch.store(epoch, std::memory_order_release);
|
||||
}
|
||||
}
|
||||
_ntp_synced.store(true, std::memory_order_release);
|
||||
}
|
||||
}
|
||||
pollNtpRefresh(now);
|
||||
if (_ntp_refresh_pending) return;
|
||||
const bool bootstrap = _ntp_sync_pending
|
||||
|| !_fresh_ntp_this_boot.load(std::memory_order_acquire);
|
||||
const bool retry_due = _ntp_refresh_retry_at == 0
|
||||
|| mqttNtpRefreshDue(now, _last_ntp_sync, _ntp_refresh_retry_at);
|
||||
if ((bootstrap && retry_due)
|
||||
|| mqttNtpRefreshDue(now, _last_ntp_sync, _ntp_refresh_retry_at)) {
|
||||
_ntp_sync_pending = false;
|
||||
refreshNTP();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// mqttTaskLoop() - main loop running on Core 0
|
||||
// ---------------------------------------------------------------------------
|
||||
void MQTTBridge::mqttTaskLoop() {
|
||||
_network_power_policy = mesh::wifi::NetworkPowerPolicy();
|
||||
_network_suspended.store(false, std::memory_order_release);
|
||||
_network_espnow_restore_pending = false;
|
||||
mesh::wifi::networkPower().setManaged(true);
|
||||
// Timezone configuration is independent of whether an NTP server answers.
|
||||
// The old blocking bootstrap applied these rules as a side effect.
|
||||
applyTimezoneRules();
|
||||
// An active OTA/setup AP can outlive MQTT's start request. Stay stoppable
|
||||
// while waiting, and leave slot/TLS work until station initialization ran.
|
||||
while (!_stop_requested && !initializeWiFiInTask()) {
|
||||
@@ -1586,10 +1767,21 @@ void MQTTBridge::mqttTaskLoop() {
|
||||
if (_stop_requested) {
|
||||
MQTT_DEBUG_PRINTLN("MQTT task: cooperative stop - tearing down clients on Core 0");
|
||||
cancelNtpRefresh();
|
||||
bool transports_stopped = true;
|
||||
for (int i = 0; i < RUNTIME_MQTT_SLOTS; i++) {
|
||||
teardownSlot(i);
|
||||
if (_slots[i].client && _slots[i].client->isStarted()) transports_stopped = false;
|
||||
}
|
||||
if (!transports_stopped) {
|
||||
// Retain clients, tokens and the stop acknowledgment until SDK stop
|
||||
// actually succeeds. end() still owns the explicitly dirty timeout
|
||||
// fallback; this worker must never label a failed stop as clean.
|
||||
vTaskDelay(pdMS_TO_TICKS(100));
|
||||
continue;
|
||||
}
|
||||
destroySlotClients();
|
||||
_network_suspended.store(false, std::memory_order_release);
|
||||
mesh::wifi::networkPower().setManaged(false);
|
||||
_stop_acked.store(true, std::memory_order_release); // teardown precedes Core 1 release
|
||||
return;
|
||||
}
|
||||
@@ -1613,6 +1805,15 @@ void MQTTBridge::mqttTaskLoop() {
|
||||
|
||||
unsigned long now = millis();
|
||||
|
||||
// The MQTT and NTP schedulers share this single WiFi outage budget.
|
||||
// Quiesce on the owner core before an external Companion station owner
|
||||
// sees the suspension flag; failed timers cannot wake each other up.
|
||||
if (!serviceNetworkPower(static_cast<uint32_t>(now))) {
|
||||
processPacketQueue();
|
||||
vTaskDelay(pdMS_TO_TICKS(250));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Periodic heap + publish-health snapshot. Gated behind MQTT_MEMORY_DEBUG (a
|
||||
// dedicated diagnostics flag, NOT enabled on production or plain MQTT_DEBUG builds)
|
||||
// so it stays off by default -- the same data is available on demand via the
|
||||
@@ -1644,21 +1845,7 @@ void MQTTBridge::mqttTaskLoop() {
|
||||
}
|
||||
}
|
||||
|
||||
// Check for pending NTP sync (triggered from WiFi event handler)
|
||||
if (_ntp_sync_pending && WiFi.status() == WL_CONNECTED) {
|
||||
_ntp_sync_pending = false;
|
||||
syncTimeWithNTP();
|
||||
}
|
||||
|
||||
// Retry NTP every 30s if initial sync failed (slots can't start without valid time)
|
||||
if (!_ntp_synced.load(std::memory_order_acquire)
|
||||
&& WiFi.status() == WL_CONNECTED) {
|
||||
static unsigned long last_ntp_retry = 0;
|
||||
if (now - last_ntp_retry >= 30000) {
|
||||
last_ntp_retry = now;
|
||||
syncTimeWithNTP();
|
||||
}
|
||||
}
|
||||
serviceBackgroundNtp(static_cast<uint32_t>(now));
|
||||
|
||||
// Process a CLI-requested forced NTP sync (queued from Core 1). Running it here
|
||||
// keeps all NTP I/O on Core 0; requestForcedNtpSync() blocks the CLI thread until
|
||||
@@ -1793,16 +1980,8 @@ void MQTTBridge::mqttTaskLoop() {
|
||||
// Periodic configuration check (throttled to avoid spam)
|
||||
checkConfigurationMismatch();
|
||||
|
||||
// Periodic NTP refresh (once per day) - lightweight, non-blocking.
|
||||
// Uses async SNTP instead of the heavy syncTimeWithNTP() which blocks Core 0
|
||||
// for up to 20+ seconds with DNS lookups, UDP sockets, and retry loops.
|
||||
pollNtpRefresh(now);
|
||||
if (WiFi.status() == WL_CONNECTED
|
||||
&& !_ntp_refresh_pending
|
||||
&& mqttNtpRefreshDue(now, _last_ntp_sync,
|
||||
_ntp_refresh_retry_at)) {
|
||||
refreshNTP();
|
||||
}
|
||||
// Automatic boot/reconnect/daily NTP is serviced above as one bounded
|
||||
// asynchronous operation. Explicit administrator diagnostics remain separate.
|
||||
|
||||
// Publish status updates (handle millis() overflow correctly).
|
||||
// Read the toggle live from prefs (like mqtt.packets/rx/tx below) so a
|
||||
@@ -2142,10 +2321,14 @@ bool MQTTBridge::setupSlot(int index) {
|
||||
// transport handles are reused; setCredentials / setServer overwrite the config
|
||||
// fields in place before connect() restarts the ESP-IDF client.
|
||||
if (slot.initial_connect_done) {
|
||||
if (slot.client->connected()) {
|
||||
if (slot.client->isStarted()) {
|
||||
_slot_attempt_pending[index] = false;
|
||||
slot.client->disconnect();
|
||||
}
|
||||
if (slot.client->isStarted()) {
|
||||
slot.last_reconnect_attempt = millis();
|
||||
return false;
|
||||
}
|
||||
// Clear TLS verification fields so a stale CA-bundle attach or cert
|
||||
// pointer from a prior preset doesn't override the new one.
|
||||
esp_mqtt_client_config_t* cfg = slot.client->getMqttConfig();
|
||||
@@ -2375,6 +2558,7 @@ void MQTTBridge::teardownSlot(int index, bool force) {
|
||||
delay(50);
|
||||
#endif
|
||||
}
|
||||
if (slot.client && !force && slot.client->isStarted()) return;
|
||||
|
||||
// Invalidate the token but keep the buffer: the client survives teardown and still
|
||||
// holds this pointer in its config (see MQTTSlot::auth_token).
|
||||
@@ -3062,6 +3246,7 @@ void MQTTBridge::setSlotPreset(int slot_index, const char* preset_name) {
|
||||
#ifdef ESP_PLATFORM
|
||||
if (_mqtt_task_handle != nullptr) {
|
||||
_slot_reconfigure_pending[slot_index] = true;
|
||||
mesh::wifi::networkPower().requestProbe();
|
||||
MQTT_DEBUG_PRINTLN("MQTT%d reconfigure queued (preset: %s)", slot_index + 1, preset_name);
|
||||
return;
|
||||
}
|
||||
@@ -3077,6 +3262,12 @@ void MQTTBridge::applySlotPreset(int slot_index, const char* preset_name) {
|
||||
MQTTSlot& slot = _slots[slot_index];
|
||||
|
||||
teardownSlot(slot_index);
|
||||
if (slot.client && slot.client->isStarted()) {
|
||||
// Keep the requested preset queued and the running SDK's current config
|
||||
// untouched until its owning task can complete the failed stop.
|
||||
_slot_reconfigure_pending[slot_index] = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(preset_name, MQTT_PRESET_NONE) == 0 || preset_name[0] == '\0') {
|
||||
slot.enabled = false;
|
||||
@@ -4460,7 +4651,21 @@ void MQTTBridge::refreshNTP() {
|
||||
#endif
|
||||
_ntp_refresh_previous_epoch =
|
||||
_rtc ? (unsigned long)_rtc->getCurrentTime() : 0;
|
||||
#ifdef ESP_PLATFORM
|
||||
const char* servers[kMaxNtpServers];
|
||||
int server_count = 0;
|
||||
fillNtpServerList(_obs, servers, server_count);
|
||||
const int first = _background_ntp_server % server_count;
|
||||
// Let SNTP try three servers within one 15-second request, rotating through
|
||||
// the configured list across probes instead of blocking on every server.
|
||||
configTime(0, 0, servers[first], servers[(first + 1) % server_count],
|
||||
servers[(first + 2) % server_count]);
|
||||
// A blackholed leading server can consume the whole SDK receive timeout.
|
||||
// Advance by one so every server eventually leads, even with six entries.
|
||||
_background_ntp_server = static_cast<uint8_t>((first + 1) % server_count);
|
||||
#else
|
||||
configTime(0, 0, effectiveNtpPrimary(_obs));
|
||||
#endif
|
||||
_ntp_refresh_retry_at = 0;
|
||||
_ntp_refresh_started_at = millis();
|
||||
_ntp_refresh_pending = true;
|
||||
@@ -4473,7 +4678,7 @@ void MQTTBridge::pollNtpRefresh(uint32_t now) {
|
||||
const uint32_t elapsed = now - _ntp_refresh_started_at;
|
||||
if (WiFi.status() != WL_CONNECTED) {
|
||||
cancelNtpRefresh();
|
||||
_ntp_refresh_retry_at = mqttNtpRetryAt(now);
|
||||
_ntp_refresh_retry_at = mqttNtpFailureRetryAt(now);
|
||||
MQTT_DEBUG_PRINTLN("NTP refresh aborted; WiFi disconnected");
|
||||
return;
|
||||
}
|
||||
@@ -4514,7 +4719,7 @@ void MQTTBridge::pollNtpRefresh(uint32_t now) {
|
||||
// The ESP status is edge-like and may reset after it is read, so retry the
|
||||
// whole operation instead of waiting on a completion that was consumed.
|
||||
cancelNtpRefresh();
|
||||
_ntp_refresh_retry_at = mqttNtpRetryAt(now);
|
||||
_ntp_refresh_retry_at = mqttNtpFailureRetryAt(now);
|
||||
MQTT_DEBUG_PRINTLN(
|
||||
"NTP refresh returned implausible time %lld; retry scheduled",
|
||||
(long long)raw_system_time);
|
||||
@@ -4523,7 +4728,7 @@ void MQTTBridge::pollNtpRefresh(uint32_t now) {
|
||||
|
||||
if (elapsed >= MQTT_NTP_REFRESH_TIMEOUT_MS) {
|
||||
cancelNtpRefresh();
|
||||
_ntp_refresh_retry_at = mqttNtpRetryAt(now);
|
||||
_ntp_refresh_retry_at = mqttNtpFailureRetryAt(now);
|
||||
MQTT_DEBUG_PRINTLN("NTP refresh timed out; retry scheduled");
|
||||
}
|
||||
}
|
||||
@@ -4845,6 +5050,7 @@ void MQTTBridge::runNtpEstimateProbe() {
|
||||
|
||||
bool MQTTBridge::requestNtpTimeEstimate() {
|
||||
if (!isRunning() || _stop_requested.load(std::memory_order_acquire)
|
||||
|| isNetworkSuspended()
|
||||
|| WiFi.status() != WL_CONNECTED || _ntp_estimate_requested) return false;
|
||||
_ntp_estimate_done = false;
|
||||
_ntp_estimate_ok = false;
|
||||
|
||||
@@ -25,6 +25,7 @@ class MeshSNMPAgent; // Forward declaration
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include "helpers/esp32/SntpOperationCoordinator.h"
|
||||
#include "helpers/WiFiNetworkPowerPolicy.h"
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
#include <freertos/queue.h>
|
||||
@@ -447,6 +448,17 @@ private:
|
||||
unsigned long _last_wifi_reconnect_attempt;
|
||||
uint8_t _wifi_reconnect_backoff_attempt; // 0..5 -> 15s, 30s, 60s, 120s, 300s; reset on connect
|
||||
unsigned long _last_slot_reconnect_ms; // guards against concurrent TLS handshakes (15 s inter-slot gap)
|
||||
#ifdef ESP_PLATFORM
|
||||
mesh::wifi::NetworkPowerPolicy _network_power_policy;
|
||||
std::atomic<bool> _network_suspended{false};
|
||||
uint8_t _background_ntp_server = 0;
|
||||
uint32_t _network_publish_acks[RUNTIME_MQTT_SLOTS] = {};
|
||||
bool _network_espnow_restore_pending = false;
|
||||
uint32_t _network_espnow_restore_at = 0;
|
||||
bool serviceNetworkPower(uint32_t now);
|
||||
void serviceEspNowChannelRestore(uint32_t now);
|
||||
void serviceBackgroundNtp(uint32_t now);
|
||||
#endif
|
||||
|
||||
AlertFaultPolicy::OutageSnapshot wifiOutage() const {
|
||||
return AlertFaultPolicy::unpackOutageSnapshot(
|
||||
@@ -550,6 +562,7 @@ private:
|
||||
void getClientVersion(char* buffer, size_t buffer_size) const;
|
||||
void logMemoryStatus();
|
||||
void refreshOriginFromPrefs();
|
||||
void applyTimezoneRules();
|
||||
// begin()/end()-scoped PSRAM buffers. Each allocation is independent so a
|
||||
// transient heap shortage degrades to the existing stack fallback instead
|
||||
// of making the bridge unusable.
|
||||
@@ -606,6 +619,15 @@ public:
|
||||
void requestStop();
|
||||
bool isStopping() const { return _lifecycle.isStopInProgress(); }
|
||||
bool isRunning() const override { return _initialized; }
|
||||
// Configured and still scheduling recovery, but transports are quiesced.
|
||||
// Do not conflate automatic suspension with a persisted bridge disable.
|
||||
bool isNetworkSuspended() const {
|
||||
#ifdef ESP_PLATFORM
|
||||
return _network_suspended.load(std::memory_order_acquire);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
void loop() override;
|
||||
void onPacketReceived(mesh::Packet *packet) override;
|
||||
void sendPacket(mesh::Packet *packet) override;
|
||||
|
||||
@@ -368,6 +368,7 @@ WebConfigServer::WebConfigServer(Callbacks* callbacks, void* mqtt_prefs, bool ow
|
||||
|
||||
WebConfigServer::~WebConfigServer() {
|
||||
detachRoutes();
|
||||
mesh::wifi::networkPower().setHold(mesh::wifi::NetworkPowerHold::WebConfig, false);
|
||||
closeTerminal();
|
||||
delete _room_mailbox;
|
||||
if (_mux) vSemaphoreDelete(_mux);
|
||||
@@ -653,6 +654,14 @@ bool WebConfigServer::formatWiFiStatus(
|
||||
appendOtaSeederStatus(reply, reply_len);
|
||||
return true;
|
||||
}
|
||||
if (mesh::wifi::networkPower().backgroundSuspended()
|
||||
&& !mesh::wifi::networkPower().foregroundActive()) {
|
||||
snprintf(reply, reply_len,
|
||||
"> suspended; recovery every 30 minutes, SSID: %s",
|
||||
configured ? ssid : "(not configured)");
|
||||
appendOtaSeederStatus(reply, reply_len);
|
||||
return true;
|
||||
}
|
||||
if (active && active->_mode == MODE_CONNECTING) {
|
||||
snprintf(reply, reply_len, "> connecting, SSID: %s",
|
||||
configured ? ssid : "(not configured)");
|
||||
@@ -754,6 +763,35 @@ bool WebConfigServer::getSetupInfo(char* ssid, size_t ssid_len, char* ip, size_t
|
||||
return true;
|
||||
}
|
||||
|
||||
void WebConfigServer::noteNetworkActivity() {
|
||||
// This is separate from _last_activity, which also tracks boot and captive
|
||||
// portal events. Those events must not renew an idle LAN listener's lease.
|
||||
_network_activity_until = WebConfigBatch::scheduleAt(millis(), 120000UL);
|
||||
mesh::wifi::networkPower().setHold(mesh::wifi::NetworkPowerHold::WebConfig, true);
|
||||
}
|
||||
|
||||
void WebConfigServer::requestNetworkAccess() {
|
||||
noteNetworkActivity();
|
||||
mesh::wifi::networkPower().requestProbe();
|
||||
}
|
||||
|
||||
bool WebConfigServer::isNetworkForegroundActive(uint32_t now) const {
|
||||
if (_mode == MODE_OFF && !_stopping) return false;
|
||||
if (_mode == MODE_SETUP || _stopping || handlerRefCount() != 0) return true;
|
||||
WCLock lock(_mux);
|
||||
if (_batch_state == BATCH_PENDING || _setup_wifi_handoff_pending) return true;
|
||||
if (_terminal && (_terminal->running || _terminal->queue.pending)) return true;
|
||||
if (_room_mailbox && (_room_mailbox->state() == mesh::RoomWebMailbox::State::Pending
|
||||
|| _room_mailbox->state() == mesh::RoomWebMailbox::State::Running)) return true;
|
||||
return _network_activity_until
|
||||
&& !WebConfigBatch::deadlineReached(now, _network_activity_until);
|
||||
}
|
||||
|
||||
void WebConfigServer::refreshNetworkPowerHold(uint32_t now) {
|
||||
mesh::wifi::networkPower().setHold(mesh::wifi::NetworkPowerHold::WebConfig,
|
||||
isNetworkForegroundActive(now));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Lifecycle
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -817,6 +855,9 @@ bool WebConfigServer::startSetupMode(char reply[]) {
|
||||
strcpy(reply, "Err: webconfig busy");
|
||||
return false;
|
||||
}
|
||||
// Publish the foreground owner before changing interfaces. The background
|
||||
// worker must not power down the station underneath this AP startup.
|
||||
requestNetworkAccess();
|
||||
_retry_saved_wifi_in_setup = false;
|
||||
_setup_reconnect_in_progress = false;
|
||||
_setup_reconnect_deadline = 0;
|
||||
@@ -888,6 +929,7 @@ bool WebConfigServer::startSetupMode(char reply[]) {
|
||||
}
|
||||
if (!ap_ok) {
|
||||
if (!promote_lan) stopOwnedWiFiRadio();
|
||||
refreshNetworkPowerHold(millis());
|
||||
strcpy(reply, "Err: failed to start AP");
|
||||
return false;
|
||||
}
|
||||
@@ -905,6 +947,7 @@ bool WebConfigServer::startSetupMode(char reply[]) {
|
||||
_initial_setup = _wifi_ssid[0] == 0 && node.admin_password[0] != 0;
|
||||
_setup_started_at = millis();
|
||||
_last_activity = _setup_started_at;
|
||||
refreshNetworkPowerHold(_setup_started_at);
|
||||
// Keep the pre-AP scan results for the picker. Only an explicit browser
|
||||
// rescan needs to leave the AP's home channel after clients have joined.
|
||||
|
||||
@@ -942,6 +985,8 @@ bool WebConfigServer::startLanMode(char reply[]) {
|
||||
}
|
||||
|
||||
bool WebConfigServer::beginSavedStation(uint32_t now) {
|
||||
if (mesh::wifi::networkPower().backgroundSuspended()
|
||||
&& !isNetworkForegroundActive(now)) return false;
|
||||
WiFi.mode(WIFI_STA);
|
||||
if (mesh::wifi::applyProtocolMask(WIFI_IF_STA) != ESP_OK) {
|
||||
return false;
|
||||
@@ -1020,6 +1065,7 @@ void WebConfigServer::requestStop() {
|
||||
_stopping = true;
|
||||
_stop_warn_at = WebConfigBatch::scheduleAt(millis(), STOP_WARN_MS);
|
||||
_stop_warned = false;
|
||||
refreshNetworkPowerHold(millis());
|
||||
}
|
||||
|
||||
bool WebConfigServer::stopForOTA(char reply[]) {
|
||||
@@ -1095,6 +1141,8 @@ void WebConfigServer::finalizeTeardown() {
|
||||
_stats_json[0] = 0;
|
||||
_board_cmds = 0;
|
||||
_board_cmds_probed = false;
|
||||
_network_activity_until = 0;
|
||||
refreshNetworkPowerHold(millis());
|
||||
if (_cb) _cb->onWebConfigStopped();
|
||||
}
|
||||
|
||||
@@ -1113,6 +1161,7 @@ void WebConfigServer::probeBoardCommands() {
|
||||
}
|
||||
|
||||
void WebConfigServer::tick(uint32_t now) {
|
||||
refreshNetworkPowerHold(now);
|
||||
if (_stopping) {
|
||||
uint32_t refs = handlerRefCount();
|
||||
switch (WebConfigBatch::stopStep(refs, _stop_warned, _stop_warn_at, now)) {
|
||||
@@ -1137,6 +1186,12 @@ void WebConfigServer::tick(uint32_t now) {
|
||||
serviceTerminal(now);
|
||||
serviceRoom(now);
|
||||
|
||||
// The MQTT/NTP owner has stopped its transports before publishing this
|
||||
// state. An idle portal must not start an independent reconnect loop while
|
||||
// those consumers are in their shared thirty-minute recovery cooldown.
|
||||
if (mesh::wifi::networkPower().backgroundSuspended()
|
||||
&& !isNetworkForegroundActive(now)) return;
|
||||
|
||||
// A primary ESP-NOW radio and its WiFi station cannot remain on different
|
||||
// channels. Reject a router-driven channel move (for example a CSA) and put
|
||||
// the mesh radio back on its boot channel before any reconnect work runs.
|
||||
@@ -1614,6 +1669,8 @@ void WebConfigServer::dispatchRequest(AsyncWebServerRequest* req,
|
||||
return;
|
||||
}
|
||||
|
||||
mesh::wifi::networkPower().setHold(mesh::wifi::NetworkPowerHold::WebConfig, true);
|
||||
|
||||
(target->*handler)(req);
|
||||
|
||||
portENTER_CRITICAL(&s_wc_route_mux);
|
||||
@@ -1729,6 +1786,7 @@ static bool roomRequestIdentity(AsyncWebServerRequest* req, uint8_t (&token)[32]
|
||||
void WebConfigServer::handleRoomPage(AsyncWebServerRequest* req) {
|
||||
if (_mode == MODE_OFF || !_cb || !_cb->supportsRoomService()) { req->send(404); return; }
|
||||
_last_activity = millis();
|
||||
noteNetworkActivity();
|
||||
auto* response = new (std::nothrow) WebConfigPacedProgmemResponse(
|
||||
"text/html; charset=utf-8", reinterpret_cast<const uint8_t*>(ROOM_WEB_HTML), sizeof(ROOM_WEB_HTML) - 1);
|
||||
if (!response) { req->send(503); return; }
|
||||
@@ -1765,6 +1823,7 @@ void WebConfigServer::handleRoomPost(AsyncWebServerRequest* req) {
|
||||
}
|
||||
if (result == mesh::RoomWebMailbox::Result::Accepted) {
|
||||
_last_activity = millis();
|
||||
noteNetworkActivity();
|
||||
req->send(202, "application/json", "{\"accepted\":true}");
|
||||
} else if (result == mesh::RoomWebMailbox::Result::Busy) {
|
||||
req->send(429, "application/json", "{\"error\":\"room service busy\"}");
|
||||
@@ -1814,7 +1873,7 @@ bool WebConfigServer::checkAuth(AsyncWebServerRequest* req) {
|
||||
// saved WiFi network must not grant that same password-reset privilege.
|
||||
if (!req || !req->client()
|
||||
|| req->client()->localIP() != WiFi.softAPIP()) return false;
|
||||
if (_initial_setup || _wifi_ssid[0] == 0) return true;
|
||||
if (_initial_setup || _wifi_ssid[0] == 0) { noteNetworkActivity(); return true; }
|
||||
} else if (_mode != MODE_LAN) {
|
||||
return false;
|
||||
}
|
||||
@@ -1823,7 +1882,7 @@ bool WebConfigServer::checkAuth(AsyncWebServerRequest* req) {
|
||||
WCLock lock(_mux);
|
||||
_cb->getNodeSnapshot(node);
|
||||
}
|
||||
if (node.admin_password[0] == 0) return true;
|
||||
if (node.admin_password[0] == 0) { noteNetworkActivity(); return true; }
|
||||
if (_session_token[0] == 0) return false;
|
||||
if (!req->hasHeader("Cookie")) return false;
|
||||
const String& cookies = req->getHeader("Cookie")->value();
|
||||
@@ -1834,6 +1893,7 @@ bool WebConfigServer::checkAuth(AsyncWebServerRequest* req) {
|
||||
if ((uint32_t)(now - _session_last_seen) > WEBCONFIG_SESSION_TTL_MS) return false;
|
||||
if (!fixedTimeEquals(token.c_str(), _session_token, 32)) return false;
|
||||
_session_last_seen = now; // sliding expiry
|
||||
noteNetworkActivity();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1857,6 +1917,7 @@ static void webConfigRejectEncoding(AsyncWebServerRequest* req) {
|
||||
void WebConfigServer::handleRoot(AsyncWebServerRequest* req) {
|
||||
if (_mode == MODE_OFF) { req->send(503); return; }
|
||||
_last_activity = millis();
|
||||
noteNetworkActivity();
|
||||
if (!webConfigClientAcceptsGzip(req)) { webConfigRejectEncoding(req); return; }
|
||||
if (req->hasHeader("If-None-Match") &&
|
||||
req->getHeader("If-None-Match")->value() == WEBCONFIG_HTML_ETAG) {
|
||||
@@ -1876,6 +1937,7 @@ void WebConfigServer::handleRoot(AsyncWebServerRequest* req) {
|
||||
void WebConfigServer::handleUi(AsyncWebServerRequest* req) {
|
||||
if (_mode == MODE_OFF) { req->send(503); return; }
|
||||
_last_activity = millis();
|
||||
noteNetworkActivity();
|
||||
if (!req->hasParam("v") ||
|
||||
req->getParam("v")->value() != WEBCONFIG_HTML_VERSION) {
|
||||
// Part URLs are immutable. Never serve a new layout under an old loader's
|
||||
@@ -1988,6 +2050,7 @@ void WebConfigServer::handleLogin(AsyncWebServerRequest* req) {
|
||||
return;
|
||||
}
|
||||
if (_initial_setup || _wifi_ssid[0] == 0) {
|
||||
noteNetworkActivity();
|
||||
req->send(200, "application/json", "{\"ok\":true}");
|
||||
return;
|
||||
}
|
||||
@@ -1998,6 +2061,7 @@ void WebConfigServer::handleLogin(AsyncWebServerRequest* req) {
|
||||
_cb->getNodeSnapshot(node);
|
||||
}
|
||||
if (node.admin_password[0] == 0) {
|
||||
noteNetworkActivity();
|
||||
req->send(200, "application/json", "{\"ok\":true}");
|
||||
return;
|
||||
}
|
||||
@@ -2026,6 +2090,7 @@ void WebConfigServer::handleLogin(AsyncWebServerRequest* req) {
|
||||
_login_lock_until = 0;
|
||||
for (int i = 0; i < 4; i++) sprintf(&_session_token[i * 8], "%08lx", (unsigned long)esp_random());
|
||||
_session_last_seen = now;
|
||||
noteNetworkActivity();
|
||||
|
||||
AsyncWebServerResponse* res = req->beginResponse(200, "application/json", "{\"ok\":true}");
|
||||
char cookie[80];
|
||||
@@ -2951,6 +3016,7 @@ void WebConfigServer::handleScan(AsyncWebServerRequest* req) {
|
||||
void WebConfigServer::handlePresets(AsyncWebServerRequest* req) {
|
||||
if (_mode == MODE_OFF) { req->send(503); return; }
|
||||
_last_activity = millis();
|
||||
noteNetworkActivity();
|
||||
#ifdef WITH_MQTT_BRIDGE
|
||||
if (_mqtt_prefs == NULL) {
|
||||
req->send(200, "application/json", "{\"presets\":[]}");
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <helpers/RoomWebMailbox.h>
|
||||
#include <helpers/WiFiPowerSave.h>
|
||||
#include <helpers/WiFiReconnectPolicy.h>
|
||||
#include <helpers/WiFiNetworkPowerPolicy.h>
|
||||
#include <helpers/ui/DisplayBuildFlags.h>
|
||||
|
||||
class AsyncWebServer;
|
||||
@@ -252,6 +253,12 @@ public:
|
||||
bool stopForOTA(char reply[]);
|
||||
void tick(uint32_t now); // call every loop iteration
|
||||
|
||||
// A listening LAN portal is not itself a reason to keep a failed background
|
||||
// network awake. Explicit starts and real browser activity get a bounded
|
||||
// window; AP setup and in-flight work retain the radio until they complete.
|
||||
void requestNetworkAccess();
|
||||
bool isNetworkForegroundActive(uint32_t now) const;
|
||||
|
||||
Mode mode() const { return _mode; }
|
||||
bool isRunning() const { return _mode != MODE_OFF; }
|
||||
bool isStopping() const { return _stopping; }
|
||||
@@ -367,6 +374,7 @@ private:
|
||||
uint32_t _diag_last = 0;
|
||||
|
||||
volatile uint32_t _last_activity = 0;
|
||||
volatile uint32_t _network_activity_until = 0;
|
||||
uint32_t _reboot_at = 0; // 0 = none scheduled
|
||||
uint32_t _stop_warn_at = 0;
|
||||
bool _stop_warned = false;
|
||||
@@ -378,6 +386,8 @@ private:
|
||||
bool _board_cmds_probed = false;
|
||||
|
||||
void createServer();
|
||||
void noteNetworkActivity();
|
||||
void refreshNetworkPowerHold(uint32_t now);
|
||||
bool beginSavedStation(uint32_t now);
|
||||
void registerRoutes();
|
||||
typedef void (WebConfigServer::*RequestHandler)(AsyncWebServerRequest*);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <WiFi.h>
|
||||
|
||||
#include <helpers/WiFiOtaSeederPolicy.h>
|
||||
#include <helpers/WiFiNetworkPowerPolicy.h>
|
||||
#include <helpers/WiFiOtaSeederStatus.h>
|
||||
#include <helpers/UsbLogging.h>
|
||||
#include <helpers/ota/FolderMotaStore.h>
|
||||
@@ -54,6 +55,7 @@ void detachTcpFolder(bool disconnected) {
|
||||
void stopClient(bool disconnected = false) {
|
||||
detachTcpFolder(disconnected);
|
||||
if (seeder_client) seeder_client.stop();
|
||||
mesh::wifi::networkPower().setHold(mesh::wifi::NetworkPowerHold::OtaSeeder, false);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -89,6 +91,7 @@ void WiFiOtaSeeder::loop() {
|
||||
// A different host transport may already own the replacement context.
|
||||
if (active && !active->folder_active) active->clear_folder_dest();
|
||||
tcp_folder_attached = false;
|
||||
mesh::wifi::networkPower().setHold(mesh::wifi::NetworkPowerHold::OtaSeeder, false);
|
||||
}
|
||||
if (seeder_client && seeder_client.connected()) return;
|
||||
|
||||
@@ -125,6 +128,7 @@ void WiFiOtaSeeder::loop() {
|
||||
}
|
||||
|
||||
tcp_folder_attached = true;
|
||||
mesh::wifi::networkPower().setHold(mesh::wifi::NetworkPowerHold::OtaSeeder, true);
|
||||
char link_info[24];
|
||||
snprintf(link_info, sizeof(link_info), "tcp %s",
|
||||
seeder_client.remoteIP().toString().c_str());
|
||||
|
||||
Reference in new issue
Block a user