Skip to content

Bootloop detection and failsafe mode#48

Closed
Kupferfox wants to merge 123 commits into
mgerhard74:mainfrom
Kupferfox:bootloop_failsafe
Closed

Bootloop detection and failsafe mode#48
Kupferfox wants to merge 123 commits into
mgerhard74:mainfrom
Kupferfox:bootloop_failsafe

Conversation

@Kupferfox

Copy link
Copy Markdown
Collaborator

Es gibt nun einen Failsafe-Mode, in dem eine Firmware aufgeladen werden kann.

Folgende Logik:

  • wenn innerhalb von 90 Sekunden die MCU öfter als 5 Mal rebootet startet der Failsafe-Mode
  • dann kommt ein AccessPoint hoch (SSID=AMIS_FAILSAFE, IP=192.168.4.1)
  • diese liefert eine HTTP für einen Firmware Upload / Reset
  • passiert nichts, versucht die MCU nach 5 Minuten einen normalen Start
  • klappt dieser wieder 5x nicht, fängt das Spiel von vorne an

Die Implementierung ist komplett abgekapselt von allen Funktionen. Also ein wirkliches Failsafe.

In Setup und Loop jeweils nur 1 Call der bei Normalbetrieb ins leere Läuft. Quasi zero overhead (3x if-check).

@Kupferfox Kupferfox self-assigned this Feb 11, 2026
Karl Kupferfuchs and others added 27 commits February 15, 2026 11:33
StefanOberhumer and others added 21 commits February 15, 2026 11:33
…wn module.

The device is mostly located in the fuse box without any connected
computer.
The serial of the device is used to communicate with the electric meter
and dealing with baudrates of 300 or 9600 which disturbs the serial
exception dump.
Also working with low baudrates can trigger the hardware watchdog while
dumping the stack trace.

So: We capture exception information in our own module and write them to
the filesystem.

Wrapping the __wrap_system_restart_local() function using
'-Wl,--wrap=__wrap_system_restart_local' is not possible as the
system_restart_local() function is already wrapped within the original
framework.

We replace the original core_esp8266_postmortem.cpp while compiling this
project using
'pre:pio-scripts/replace_freamwork_core_esp8266_postmortem.py'
StefanOberhumer added a commit that referenced this pull request Mar 14, 2026
…loop_failsafe

Cherrypick kupferfox bootloop failsafe (original PR: #48)
@StefanOberhumer

StefanOberhumer commented Apr 4, 2026

Copy link
Copy Markdown
Collaborator

Merged via 66c4df0 and #58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants