Description
u8_store_bootloader_settings()
writes the modifies bootloader settings into the protected flash memory area. The bootloader will operate with the new settings at the next reboot. This function compares the values to be written with the once that are currently in flash before it erases and flashes the new settings. This reduces the write cycles in the flash memory, which the user should also pay attention to in order not to exceed the maximum number of erase/write cycles (typ. < 100k).
Syntax
u8_store_bootloader_settings();
Parameters
none
Returns
uint8_t –
0: settings are successfully written to flash
Example Code
This example shows how to read, set and store the ‘device name’ variable of the bootloader settings.
void setup()
{
Serial.begin();
while (!Serial)
{
yield(); // wait for PC CAN2SER-monitor to open
}
String s_device_name = BOOTLOADER_SETTING.s_get_device_name();
Serial.println("Current bootloader settings:");
Serial.println(" - device name: " + s_device_name);
delay(2000);
Serial.println("Modify the settings");
BOOTLOADER_SETTING.u8_set_device_name("myDICE");
delay(2000);
Serial.println("Store the settings in flash");
BOOTLOADER_SETTING.u8_store_bootloader_settings();
Serial.println("DONE");
}
void loop ()
{
}
Notes and Warnings
As mentioned it has to be made sure that the number of erase/write cycles to the flash memory will not be exceeded. So please refrain from changing and storing the settings in any regular manner.
See also
Chapter ‘Memory’ in the users manual