Chat freely about anything...

User avatar
By Barnabybear
#45654 @martinayotte, thanks I used a 1K on the only deep sleep test I did but had not thought about manualy waking an ESP to re-flash it. I my have misread the spec (if so I'm sorry) but I read it as to be able to clear exsisting stored WiFi infomation by detecting a long button press (this my not be needed). Unless the ESP is going to need to be manualy reset on frequent occations (which could be done by power cycling) the reset pin is not needed. As we can detect the difference between a reboot due to waking from sleep and a reboot from grounding reset pin, the code could check for the reason for rebooting and clear the settings or skip that continue as normal. This would save a GPIO.
So:
Power up with GPIO 0 low - boots into flash mode.
Power up - boots - runs normal code.
Wake from sleep - boots - runs normal code.
Reset grounded - boots - runs erase WiFi data code.

Edit: links to other posts for checking reboot / reset reason.
viewtopic.php?f=32&t=4819&start=5
viewtopic.php?p=26862
https://github.com/devicehive/esp8266-f ... nterface.h
Last edited by Barnabybear on Mon Apr 18, 2016 1:31 am, edited 1 time in total.
User avatar
By mattrix
#45659 Thanks so much for the responses.

I forgot about the reset reason (I had used it before).
I might just do that, if reset via the pin being grounded (user pressing button), then do 'full reset'.

There isn't really any other reason for the user to reset, unless they wanted to force a poll of data which seems unlikely.
User avatar
By mattrix
#45673 Actually, looks like Reset reason won't work

Using:
Serial.println(ESP.getResetReason());

If I hit reset button while program running:
"External System"

However, if it's gone into deep sleep and then I reset:
"Deep-Sleep Wake"