Skip to content

Commit 9d203f1

Browse files
committed
reduce esp8266 net churn
1 parent f0a83d1 commit 9d203f1

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
- Added `ZeroNetProfileEsp8266`, a constrained MQTT-first preset for Wemos / ESP8266.
1212
- Added optional offline queue gating in `ZeroHttpPump` and `ZeroMqttPump` so constrained boards can refuse backlog when link or transport is down.
13+
- Reduced scheduler contention in the ESP8266 preset by staggering network task start offsets and lowering idle network task cadence.
1314
- Added generic compare workloads for `EnvMonitor`, `TelemetryGateway`, and `IndustrialLoop`.
1415
- Added repeatable ESP32 compare runners plus a cross-target workload compile matrix.
1516
- Improved telemetry gateway tuning so module throughput rises without queue buildup.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Current target maturity:
117117
Recommended board-specific path:
118118

119119
- **ESP32:** use the default network module configs first, then validate against your real endpoint.
120-
- **ESP8266 / Wemos:** start with `ZeroNetProfileEsp8266`. It is a BETA, MQTT-first constrained preset that disables periodic HTTP dispatch by default and prevents offline queue buildup so constrained boards do not need heavy manual tuning just to stay responsive.
120+
- **ESP8266 / Wemos:** start with `ZeroNetProfileEsp8266`. It is a BETA, MQTT-first constrained preset that disables periodic HTTP dispatch by default, prevents offline queue buildup, and staggers slower network task cadence so constrained boards do not need heavy manual tuning just to stay responsive.
121121

122122
Current best module tradeoff reference (ESP32, `LEAN_NET`, manual pattern vs module pattern):
123123

examples/LiveNetworkNode/LiveNetworkNode.ino

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,14 @@ void setup() {
441441

442442
#if defined(ARDUINO_ARCH_ESP8266)
443443
ZeroKernel.addTask("Sample", sampleTask, ZeroNetProfileEsp8266::kSampleTaskIntervalMs, 0);
444-
ZeroKernel.addTask("WiFiMaint", wifiMaintainerTask, ZeroNetProfileEsp8266::kWiFiTaskIntervalMs, 0);
445-
ZeroKernel.addTask("HttpPump", httpPumpTask, ZeroNetProfileEsp8266::kHttpTaskIntervalMs, 0);
446-
ZeroKernel.addTask("MqttPump", mqttPumpTask, ZeroNetProfileEsp8266::kMqttTaskIntervalMs, 0);
447-
ZeroKernel.addTask("Dispatch", dispatchTask, ZeroNetProfileEsp8266::kDispatchTaskIntervalMs, 0);
444+
ZeroKernel.addTask("WiFiMaint", wifiMaintainerTask, ZeroNetProfileEsp8266::kWiFiTaskIntervalMs,
445+
ZeroNetProfileEsp8266::kWiFiTaskStartDelayMs);
446+
ZeroKernel.addTask("HttpPump", httpPumpTask, ZeroNetProfileEsp8266::kHttpTaskIntervalMs,
447+
ZeroNetProfileEsp8266::kHttpTaskStartDelayMs);
448+
ZeroKernel.addTask("MqttPump", mqttPumpTask, ZeroNetProfileEsp8266::kMqttTaskIntervalMs,
449+
ZeroNetProfileEsp8266::kMqttTaskStartDelayMs);
450+
ZeroKernel.addTask("Dispatch", dispatchTask, ZeroNetProfileEsp8266::kDispatchTaskIntervalMs,
451+
ZeroNetProfileEsp8266::kDispatchTaskStartDelayMs);
448452
#else
449453
ZeroKernel.addTask("Sample", sampleTask, kSampleTaskIntervalMs, 0);
450454
ZeroKernel.addTask("WiFiMaint", wifiMaintainerTask, 100, kWiFiMaintStartDelayMs);

src/modules/net/ZeroNetProfileEsp8266.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,27 @@ namespace net {
1313
// This profile intentionally prefers MQTT cadence over aggressive HTTP churn.
1414
struct ZeroNetProfileEsp8266 {
1515
static const unsigned long kSampleTaskIntervalMs = 100UL;
16-
static const unsigned long kWiFiTaskIntervalMs = 100UL;
17-
static const unsigned long kHttpTaskIntervalMs = 100UL;
18-
static const unsigned long kMqttTaskIntervalMs = 100UL;
19-
static const unsigned long kDispatchTaskIntervalMs = 100UL;
16+
static const unsigned long kWiFiTaskIntervalMs = 250UL;
17+
static const unsigned long kHttpTaskIntervalMs = 250UL;
18+
static const unsigned long kMqttTaskIntervalMs = 500UL;
19+
static const unsigned long kDispatchTaskIntervalMs = 250UL;
2020
static const unsigned long kReportTaskIntervalMs = 250UL;
2121

22+
static const unsigned long kWiFiTaskStartDelayMs = 25UL;
23+
static const unsigned long kHttpTaskStartDelayMs = 75UL;
24+
static const unsigned long kMqttTaskStartDelayMs = 125UL;
25+
static const unsigned long kDispatchTaskStartDelayMs = 175UL;
26+
2227
static const unsigned long kHttpDispatchPeriodMs = 0UL;
2328
static const unsigned long kMqttDispatchPeriodMs = 1000UL;
2429
static const unsigned long kHttpIoTimeoutMs = 200UL;
2530

2631
static ZeroWiFiMaintainer::Config wifiConfig() {
2732
ZeroWiFiMaintainer::Config config;
2833
config.pollIntervalMs = 1000UL;
29-
config.retryBaseMs = 10000UL;
30-
config.retryMaxMs = 30000UL;
31-
config.retryJitterMs = 500UL;
34+
config.retryBaseMs = 4000UL;
35+
config.retryMaxMs = 12000UL;
36+
config.retryJitterMs = 350UL;
3237
config.stablePollMultiplier = 4;
3338
config.stableThreshold = 6;
3439
return config;

0 commit comments

Comments
 (0)