-
• #2
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 isfalse
we should probably disconnect from WiFi (you can put it to sleep I think?). - Close any sockets opened by the JS code (does this)
-
• #3
... I think the
ESP8266.reboot()
is overkill. To be honest we should probably make thatE.reboot()
orE.hardReset()
and expose it as a function injshardware.c
. It'd be really useful for STM32s as well.
I'm looking at what we really need to do for a reset() call on the esp8266. This is the documentation for reset():
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.