mirror of
https://github.com/liberatedsystems/RNode_Firmware_CE.git
synced 2024-10-01 03:15:40 -04:00
Persist display intensity to EEPROM
This commit is contained in:
parent
7e86873ead
commit
7274a6cc70
@ -134,6 +134,8 @@ bool display_init() {
|
||||
disp_area.cp437(true);
|
||||
display.cp437(true);
|
||||
|
||||
display_intensity = EEPROM.read(eeprom_addr(ADDR_CONF_DINT));
|
||||
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
|
@ -117,6 +117,10 @@ void setup() {
|
||||
#endif
|
||||
|
||||
#if HAS_DISPLAY
|
||||
if (EEPROM.read(eeprom_addr(ADDR_CONF_DSET)) != CONF_OK_BYTE) {
|
||||
eeprom_update(eeprom_addr(ADDR_CONF_DSET), CONF_OK_BYTE);
|
||||
eeprom_update(eeprom_addr(ADDR_CONF_DINT), 0xFF);
|
||||
}
|
||||
disp_ready = display_init();
|
||||
update_display();
|
||||
#endif
|
||||
@ -798,6 +802,7 @@ void serialCallback(uint8_t sbyte) {
|
||||
ESCAPE = false;
|
||||
}
|
||||
display_intensity = sbyte;
|
||||
di_conf_save(display_intensity);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
2
ROM.h
2
ROM.h
@ -58,6 +58,8 @@
|
||||
#define ADDR_CONF_OK 0xA7
|
||||
|
||||
#define ADDR_CONF_BT 0xB0
|
||||
#define ADDR_CONF_DSET 0xB1
|
||||
#define ADDR_CONF_DINT 0xB2
|
||||
|
||||
#define INFO_LOCK_BYTE 0x73
|
||||
#define CONF_OK_BYTE 0x73
|
||||
|
@ -1096,6 +1096,10 @@ void bt_conf_save(bool is_enabled) {
|
||||
}
|
||||
}
|
||||
|
||||
void di_conf_save(uint8_t dint) {
|
||||
eeprom_update(eeprom_addr(ADDR_CONF_DINT), dint);
|
||||
}
|
||||
|
||||
bool eeprom_have_conf() {
|
||||
if (EEPROM.read(eeprom_addr(ADDR_CONF_OK)) == CONF_OK_BYTE) {
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user