My code shuts down the core at specific time, and if I understand the documentation correct after deep sleep the Core should be run exactly like I have pushed the reset button. Sadly my core resets and runs perfectly, expect the Digole OLED - the display stays black but I can see that the Core is running because I got the publish results on my website.
It must be a code problem because if I press reset or turn the Core off and back on the display initialize and works fine.
Docu: When the Core awakens from deep sleep, it will reset the Core and run
all user code from the beginning with no values being maintained in
memory from before the deep sleep.
Code snippet
int funcSleep() {
if (Time.hour() == sleepStart ) {
digole.setScreenOff();
Spark.sleep(SLEEP_MODE_DEEP,sleepTime);
}
}
Hmm, I think the ‘setup’ function doesn’t get run a second time when the core comes back from sleep, so you may need to reinitialize things after you come back in your loop?
did i misunderstood the documentation? Because it says “all user code from the beginning” Is setup() no user code? Maybe the Docu must be change to make it more clear.
Example (with problems):
if (coreRST == 1) digole.setScreenOn();
this will not work, because I cannot set a counter like coreRST while the Core starts with NO values in memory …
@Dave, @clyde, deep sleep mode on the Core retains nothing except the sleep timer and resets the Core upon timeout. So, based on my experience BOTH setup() and loop() get called.
@clyde, to understand why the digole does not work after sleep I would need to see your code and your hardware configuration (serial, I2C, SPI?). It IS possible to maintain inter-sleep values using the EEPROM emulation provided in the firmware.
So you could store a coreRST flag in EEPROM though I would discourage that if you expect to sleep/reset very often. The Digole is not “aware” of the Core sleep and turning off the display essentially just turns off the OLED pixel power. You could simply run digole.setScreenOn() in setup() regardless of its previous state. Again, I would need to see your code to give you the best advice.
interesting thought with simply set digole.setScreenOn(); I will try that as soon as i am back home.
I´ll send you the link to my code via PM.
But in case that I am not going to waste your time, let me first try your suggestion.
There are more important things out there that my lousy code
Ok another way - not really smooth but ok
Downloaded the firmware.bin file from CloudIDE and upload it to my raspberry. Now a spark flash --usb /…/firmware.bin is enough to get it running.
Then it restarts and after X of that tries it start with the program. Sometimes a bit earlier, sometimes a bit later… that is really crazy…fingers crossed…