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);
|
disp_area.cp437(true);
|
||||||
display.cp437(true);
|
display.cp437(true);
|
||||||
|
|
||||||
|
display_intensity = EEPROM.read(eeprom_addr(ADDR_CONF_DINT));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -117,6 +117,10 @@ void setup() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_DISPLAY
|
#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();
|
disp_ready = display_init();
|
||||||
update_display();
|
update_display();
|
||||||
#endif
|
#endif
|
||||||
@ -798,6 +802,7 @@ void serialCallback(uint8_t sbyte) {
|
|||||||
ESCAPE = false;
|
ESCAPE = false;
|
||||||
}
|
}
|
||||||
display_intensity = sbyte;
|
display_intensity = sbyte;
|
||||||
|
di_conf_save(display_intensity);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
2
ROM.h
2
ROM.h
@ -58,6 +58,8 @@
|
|||||||
#define ADDR_CONF_OK 0xA7
|
#define ADDR_CONF_OK 0xA7
|
||||||
|
|
||||||
#define ADDR_CONF_BT 0xB0
|
#define ADDR_CONF_BT 0xB0
|
||||||
|
#define ADDR_CONF_DSET 0xB1
|
||||||
|
#define ADDR_CONF_DINT 0xB2
|
||||||
|
|
||||||
#define INFO_LOCK_BYTE 0x73
|
#define INFO_LOCK_BYTE 0x73
|
||||||
#define CONF_OK_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() {
|
bool eeprom_have_conf() {
|
||||||
if (EEPROM.read(eeprom_addr(ADDR_CONF_OK)) == CONF_OK_BYTE) {
|
if (EEPROM.read(eeprom_addr(ADDR_CONF_OK)) == CONF_OK_BYTE) {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user