-
• #2
That's odd. Does it work better if you do
reset()
andsave()
as two separate commands? I think it says in the documentation, butreset()
will reset the chip without actually saving anything.There isn't a way to 'mute' save I'm afraid, but using
save()
to save data that changes all the time isn't a good idea anyway - it rewrites all of flash each time, so it can wear out the flash memory inside Espruino relatively quickly.Have you seen the Flash EEPROM Library - that will allow you to save data to flash memory, but it does so using a simple 'journalling' system which means that all of the flash memory gets used up before it is erased.
-
• #3
Hi Gordon,
looks like the setSleepIndicator() is not affected by the save() for whatever reason.
I just had a setSleepIndicator("") and the dump() doesn't show the code any more after the save.
Strange.thanks for the link to Flash EEPROM Library, I will have a look.
For codingnights, I just create a sequence of experiments with the 'bare' PICO
so even newbies can create great effects with just a little bit of javascript in 2hrs time.
Just a handful of simple statements and try to make creative use of a button and 2 LEDs.
"Single Button Combination Lock" is a great example what can be achieved. -
• #4
Hi Gordon,
it looks like there is a little bug with the setSleepIndicator(LED1) which is not cleard with reset():
I set the Indicator and run a save(); but after a reset() and a following save(), the dump() still showed the setSleepIndicator(B2).
After calling setSleepIndicator() with undefined argument the dump is empty. So looks like this resists the reset() processing:>dump() setSleepIndicator(B2); digitalWrite(B2,1); =undefined >reset(); =undefined _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v84 Copyright 2015 G.Williams >save(); =undefined Erasing Flash..... Writing... Compressed 81600 bytes to 854 Checking... Done! >dump() setSleepIndicator(B2); =undefined >setSleepIndicator() =undefined >dump() =undefined
-
• #5
Ahh, thanks! I just fixed this, so it'll be in the next version
I experiment with some standalone datalogger which issues save() internally for data persistency.
When I use reset(), the code is still in the flash memory and can be used with load(). That's OK.
But what is the correct way to reset the flash memory to a neutral state?
For the moment in time I use "reset();save()"
But when the PICO is connected to a USB I get a constant green LED and the dump() says:
1st question:
So is there a way to clear the flash so there is no "setSleepIndicator(B12); digitalWrite(B12,1);" ?
2nd question:
Is there a way for a 'mute' save().
save() generates a lot of output to the console; in standalone this may overflow the buffers.
Greetings from Frankfurt/Germany, Uli