fix: Watchdog wirksam machen, Factory-Reset im App-Task, Resetzähler-Retry
- vApplicationIdleHook() füttert den Watchdog nicht mehr (sdk/Platform/Sys/wm_main.c, dokumentiert als Patch 4 in sdk/PATCHES.md). Bisher fütterte der Idle-Task den Watchdog bei jedem Leerlauf, auch wenn ein Task deadlockt (z.B. nl_app_lock() hält und nie freigibt) - der Watchdog konnte so nie greifen. - Neues Konsolenkommando `wdtest` (Parser in nl_console_cmd.c/.h, Ausführung in nl_console.c, Host-Test in test_console_cmd.c): hält nl_app_lock() für immer, damit light_task und app_task blockieren und nur der Watchdog-Reset den Chip retten kann. - nl_app_request_factory_reset() (nl_app.h) setzt nur ein volatile Flag; app_task prüft es in der Hauptschleife und ruft nl_app_factory_reset() selbst auf, da nur der App-Task die Flash-Stores besitzt. Das Konsolenkommando `factory` ruft jetzt diese Funktion statt nl_app_factory_reset() direkt aufzurufen, um die Race mit nl_state_log_append()/nl_resetcnt_clear() im App-Task zu vermeiden. Der Bootpfad (Bootzähler >= 5) ruft weiterhin direkt nl_app_factory_reset() auf. - nl_resetcnt_clear() wird nur noch als erledigt markiert, wenn es 0 zurückgibt, damit ein fehlgeschlagener Clear in der nächsten Schleifeniteration erneut versucht wird.
This commit is contained in:
@@ -12,4 +12,11 @@ nl_settings_t *nl_app_settings(void);
|
||||
int nl_app_save_settings(void);
|
||||
void nl_app_factory_reset(void);
|
||||
|
||||
/* Only sets a volatile flag; the app task (which owns the flash stores) checks it
|
||||
* once per loop iteration and calls nl_app_factory_reset() itself. This avoids the
|
||||
* race with the app task's own nl_state_log_append()/nl_resetcnt_clear() calls.
|
||||
* The console's `factory` command and, in a later plan, REST callers must use this
|
||||
* function instead of calling nl_app_factory_reset() directly from another task. */
|
||||
void nl_app_request_factory_reset(void);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user