Saving variable value in Flash Memory
Moderators: grovkillen, Stuntteam, TD-er
Saving variable value in Flash Memory
Hi guys
I am using the espeasy and I need to save the value of my variable Temperature in the flash memory of ESP 8266.
I cant lost the value of variable when the esp 8266 is restarted (power off -> power on)
Is it possible ? How can I do this ?
Thanks
I am using the espeasy and I need to save the value of my variable Temperature in the flash memory of ESP 8266.
I cant lost the value of variable when the esp 8266 is restarted (power off -> power on)
Is it possible ? How can I do this ?
Thanks
Re: Saving variable value in Flash Memory
theoretically possible, but it would wear out the flash memory on the long run, so not a good idea...
Re: Saving variable value in Flash Memory
Do you know how ?
Re: Saving variable value in Flash Memory
Technically speaking, you could use the SPIFFS file system to write each time you have a reading to a file, which effectively becomes the "last read value" from your temperature sensor.
The issue is that your ESP8266 flash will wear out very quickly, as it's not designed to be used that way. And once you wear it out, you will need to change the flash IC in your design, or the whole ESP8266 board in the worst case.
The better way to do this would be to store the last read value in a different database, typically the one where your ESP8266 board sends its data. Hopefully that database will always be available, and will also be able to tell what time it was when the last received temperature was effectively received.
Moreover, why would you care to keep the last temperature reading anyway if your sensor crashes or the battery dies? As soon as it starts up again you will get a new reading, and it does not matter what the old reading was about, really... it would be more interesting to know WHEN was the last reading taken, but that information again can only be taken from the database where you are sending the temperature data to.
Hope this helps.
Bye, Luca
The issue is that your ESP8266 flash will wear out very quickly, as it's not designed to be used that way. And once you wear it out, you will need to change the flash IC in your design, or the whole ESP8266 board in the worst case.
The better way to do this would be to store the last read value in a different database, typically the one where your ESP8266 board sends its data. Hopefully that database will always be available, and will also be able to tell what time it was when the last received temperature was effectively received.
Moreover, why would you care to keep the last temperature reading anyway if your sensor crashes or the battery dies? As soon as it starts up again you will get a new reading, and it does not matter what the old reading was about, really... it would be more interesting to know WHEN was the last reading taken, but that information again can only be taken from the database where you are sending the temperature data to.
Hope this helps.
Bye, Luca
Re: Saving variable value in Flash Memory
I think this is about something like here:
https://www.letscontrolit.com/forum/vie ... rol#p14559
And this is about Value Name 1: Temperature at Device4. Isn't it?
So first we set temperature in the variable but what to do when ESP restart?
https://www.letscontrolit.com/forum/vie ... rol#p14559
And this is about Value Name 1: Temperature at Device4. Isn't it?
So first we set temperature in the variable but what to do when ESP restart?
-
- New user
- Posts: 5
- Joined: 31 Mar 2017, 05:42
Re: Saving variable value in Flash Memory
the database where you are sending the temperature data to
คาสิโนออนไลน์
คาสิโนออนไลน์
Re: Saving variable value in Flash Memory
Hi all,
I have a thermostat and I need to store the last preset value which is entered by the user permanently.
How can I do that?
I have a thermostat and I need to store the last preset value which is entered by the user permanently.
How can I do that?
Re: Saving variable value in Flash Memory
In my thermostat/timer plugin I write the set point & times to flash:
case PLUGIN_WEBFORM_SAVE:
{
//example to save the temp set point
tmpStr = WebServer.arg("plugin_121_SetTemp");
Settings.TaskDevicePluginConfigFloat[event->TaskIndex][0] = tmpStr.toFloat ();
SaveTaskSettings(event->TaskIndex);
success = true;
break;
}
case PLUGIN_WEBFORM_SAVE:
{
//example to save the temp set point
tmpStr = WebServer.arg("plugin_121_SetTemp");
Settings.TaskDevicePluginConfigFloat[event->TaskIndex][0] = tmpStr.toFloat ();
SaveTaskSettings(event->TaskIndex);
success = true;
break;
}
Who is online
Users browsing this forum: No registered users and 16 guests