fix: Härtungen aus dem Plan-2-Review

- wm_internal_fls.c: TLS_DBGPRT_ERR ist in diesem Build wegkompiliert, daher
  printf() für die fehlgeschlagene s_fls2_lock-Anlage; PATCHES.md korrigiert.
- nl_wifi_w600.c: der SoftAP-Backstop (Zerstören eines unerwarteten SDK-Softap)
  lief bisher innerhalb von lock()/unlock() - tls_wifi_softap_destroy() und
  clear_softap_param() greifen aber auf SDK-Zustand zu, nicht auf s_sm/die
  Credential-Puffer, die s_lock eigentlich schützt. Jetzt wird im Lock nur noch
  ein lokales Flag gesetzt, die SDK-Aufrufe laufen danach.
- clear_softap_param() liest TLS_PARAM_ID_WPROTOCOL jetzt aus SRAM (FALSE)
  statt Flash (TRUE) - das Schreiben bleibt weiterhin geflasht.
- app_main.c füttert den Watchdog erst, wenn Licht-, Netz- und HTTP-Task
  jeweils seit dem letzten Feed einen Fortschritt gemeldet haben. Dafür
  bekommen nl_wifi_w600.c (nl_net_beat) und nl_http_server.c (nl_http_beat)
  je einen volatile Heartbeat-Zähler; der HTTP-Listen-Socket bekommt ein
  SO_RCVTIMEO von 2 s auf accept(), damit er auch ohne Anfragen tickt.
This commit is contained in:
Michael Sauer
2026-09-12 00:59:40 +02:00
parent e5145626b0
commit 8805aa764d
7 changed files with 65 additions and 15 deletions
+22 -4
View File
@@ -148,8 +148,9 @@ static void app_task(void *arg)
nl_engine_cfg_t cfg;
nl_light_state_t last, initial, pending;
bool have_last, counter_cleared = false;
bool light_alive = false, net_alive = false, http_alive = false;
uint8_t boots;
uint32_t boot_ms, beat_seen;
uint32_t boot_ms, light_seen, net_seen, http_seen;
(void)arg;
nl_flash_init();
@@ -200,7 +201,9 @@ static void app_task(void *arg)
nl_http_server_start(nl_app_api_ctx());
boot_ms = nl_app_now_ms();
beat_seen = s_light_beat;
light_seen = s_light_beat;
net_seen = nl_net_beat;
http_seen = nl_http_beat;
for (;;) {
uint32_t now;
bool due;
@@ -232,8 +235,23 @@ static void app_task(void *arg)
}
}
if (s_light_beat != beat_seen) {
beat_seen = s_light_beat;
/* Feed the watchdog only once the light, network and HTTP tasks have each made
* progress since the last feed - a single stuck task (e.g. nl_app_lock() held
* forever) must still starve the watchdog, not just the light task. */
if (s_light_beat != light_seen) {
light_seen = s_light_beat;
light_alive = true;
}
if (nl_net_beat != net_seen) {
net_seen = nl_net_beat;
net_alive = true;
}
if (nl_http_beat != http_seen) {
http_seen = nl_http_beat;
http_alive = true;
}
if (light_alive && net_alive && http_alive) {
light_alive = net_alive = http_alive = false;
tls_watchdog_clr();
}
}