I recall the documentation is wrong but I think it should work ... 'modmachine.c'I'm not sure reset_cause returns the right result on rp2, making it pretty useless as a "here's how you recover from deepsleep" mechanism.
Code:
static mp_int_t mp_machine_reset_cause(void) { int reset_cause; if (watchdog_caused_reboot()) { reset_cause = RP2_RESET_WDT; } else { reset_cause = RP2_RESET_PWRON; } return reset_cause;}
I implemented my own more refined 'reset_cause' and could differentiate restarts following -
Code:
POWER_CYCLED_RESETRESET_BUTTON_PUSHEDDEBUGGER_RESET PROGRAM_UPLOADWATCHDOG_TIMED_OUT
I can also confirm that 'print' output gets lost if 'lightsleep' or 'deepsleep' is executed before it's had a chance to empty the transmit buffer.
Statistics: Posted by hippy — Wed May 15, 2024 7:46 pm