Question about reset()

Posted on
  • I'm looking at what we really need to do for a reset() call on the esp8266. This is the documentation for reset():

    Reset the interpreter - clear program memory, and do not load a saved program from flash. This does NOT reset the underlying hardware (which allows you to reset the device without it disconnecting from USB).

    From that I gather that wifi really shouldn't be touched because (looking a little bit ahead) the user is probably connected via wifi to the interpreter. The docs would then say "which allows you to reset the device without it disconnecting from USB or Wifi".

    The alternative would be to try and put the wifi into the power-on state (which can have a default connection set) but there is an ESP8266.reboot() which does a hardware reboot for situations where the user really wants the power-up clean slate.

  • Hmm - actually that documentation isn't too clear... It should (IMO):

    • Close any sockets opened by the JS code (does this)
    • Clear the program/intervals/etc and not load saved code (does this)
    • Reset the pin states to power-on states (jshReset)

    Ideally it should be as close to power-on as possible, but as you say we ought to think that maybe someone will be programming it via a network connection in the future.

    So yes, I think probably leave WiFi as-is. There is the default argument when connecting to an AP or making one, and I wonder whether if that is false we should probably disconnect from WiFi (you can put it to sleep I think?).

  • ... I think the ESP8266.reboot() is overkill. To be honest we should probably make that E.reboot() or E.hardReset() and expose it as a function in jshardware.c. It'd be really useful for STM32s as well.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Question about reset()

Posted by Avatar for tve @tve

Actions