← index #5779Issue #5764
Related · high · value 4.008
QUERY · ISSUE

machine.soft_reset() behaves curiously on esp8266

openby nazsoltiopened 2020-03-20updated 2020-03-23
port-esp8266

Hi!

This is related to https://github.com/micropython/micropython/issues/5764
Thanks a lot for implementing it by the way! 😄

If I invoke it from the REPL, everything works as expected, but if it's invoked from a running code, it will drop to REPL (and with no MPY: soft reboot message). Here's an example:

try:
    trixie.run()

 except KeyboardInterrupt:
    trixie.runner.stop()

except trixie.ResetError:
    # land here on reset
    print('SOFT RESET')
    machine.soft_reset()

except trixie.RebootError:
    # land here on reboot
    print('HARD RESET')
    machine.reset()

except Exception as exc:
    # we should never end up here
    print('EXCEPTION')
    trixie.runner.stop()

trixie.run() raises trixie.SoftReset on soft reset intent, after which 'SOFT RESET' is printed, but then it drops to REPL instead.

I saw it in another issue, that it's by design that main.py won't be called on soft-reset, so I tested the snippet above in _boot.py and boot.py also, but it produces the same behavior. Not having 'MPY: soft reset' printed is suspicious. I'm confused if this is indeed a bug, or I'm doing something wrong.

Thanks a lot for looking into this!

CANDIDATE · ISSUE

machine.soft_reset not available for esp8266

closedby nazsoltiopened 2020-03-16updated 2020-03-20
port-esp8266

Hi all,

This is related to https://github.com/micropython/micropython/issues/2508
Is there a limitation because of which soft_reset isn't implemented for the esp8266? I'd like to have the same behaviour from code, that Ctrl+D does.

Thanks for any info!

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied