Fix missing data store persistence updates - font style, scope name and corresponding scope key - now sticks across reboots. Revised tdpro home ui offset to original settings. Fixed tpro hibernate icon positioning.

This commit is contained in:
pelgraine
2026-05-07 17:57:19 +10:00
parent 6de664ea37
commit 3596ad558d
3 changed files with 21 additions and 8 deletions
+13
View File
@@ -280,12 +280,22 @@ void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& no
if (file.read((uint8_t *)&_prefs.rx_fail_reboot_threshold, sizeof(_prefs.rx_fail_reboot_threshold)) != sizeof(_prefs.rx_fail_reboot_threshold)) {
_prefs.rx_fail_reboot_threshold = 3; // default: 3
}
if (file.read((uint8_t *)&_prefs.ui_font_style, sizeof(_prefs.ui_font_style)) != sizeof(_prefs.ui_font_style)) {
_prefs.ui_font_style = 0; // default: Classic (FreeSans)
}
if (file.read((uint8_t *)_prefs.default_scope_name, sizeof(_prefs.default_scope_name)) != sizeof(_prefs.default_scope_name)) {
memset(_prefs.default_scope_name, 0, sizeof(_prefs.default_scope_name));
}
if (file.read((uint8_t *)_prefs.default_scope_key, sizeof(_prefs.default_scope_key)) != sizeof(_prefs.default_scope_key)) {
memset(_prefs.default_scope_key, 0, sizeof(_prefs.default_scope_key));
}
// Clamp to valid ranges
if (_prefs.dark_mode > 1) _prefs.dark_mode = 0;
if (_prefs.portrait_mode > 1) _prefs.portrait_mode = 0;
if (_prefs.hint_shown > 1) _prefs.hint_shown = 0;
if (_prefs.large_font > 1) _prefs.large_font = 0;
if (_prefs.ui_font_style > 2) _prefs.ui_font_style = 0;
if (_prefs.tx_fail_reset_threshold > 10) _prefs.tx_fail_reset_threshold = 3;
if (_prefs.rx_fail_reboot_threshold > 10) _prefs.rx_fail_reboot_threshold = 3;
// auto_lock_minutes: only accept known options (0, 2, 5, 10, 15, 30)
@@ -344,6 +354,9 @@ void DataStore::savePrefs(const NodePrefs& _prefs, double node_lat, double node_
file.write((uint8_t *)&_prefs.large_font, sizeof(_prefs.large_font)); // 102
file.write((uint8_t *)&_prefs.tx_fail_reset_threshold, sizeof(_prefs.tx_fail_reset_threshold)); // 103
file.write((uint8_t *)&_prefs.rx_fail_reboot_threshold, sizeof(_prefs.rx_fail_reboot_threshold)); // 104
file.write((uint8_t *)&_prefs.ui_font_style, sizeof(_prefs.ui_font_style)); // 105
file.write((uint8_t *)_prefs.default_scope_name, sizeof(_prefs.default_scope_name)); // 106
file.write((uint8_t *)_prefs.default_scope_key, sizeof(_prefs.default_scope_key)); // 137
file.close();
}
+6 -6
View File
@@ -1039,15 +1039,15 @@ public:
#if defined(LilyGo_T5S3_EPaper_Pro)
display.drawXbm((display.width() - 32) / 2, 28, power_icon, 32, 32);
#else
display.drawXbm((display.width() - 32) / 2, 10, power_icon, 32, 32);
display.drawXbm((display.width() - 32) / 2, 20, power_icon, 32, 32);
#endif
#if defined(LilyGo_T5S3_EPaper_Pro)
display.drawTextCentered(display.width() / 2, 64, "power off device?");
display.drawTextCentered(display.width() / 2, 76, "usb-c to wake");
#else
display.drawTextCentered(display.width() / 2, 50, "power off device?");
display.drawTextCentered(display.width() / 2, 60, "usb-c to wake");
display.drawTextCentered(display.width() / 2, 76, "Enter:yes q:no");
display.drawTextCentered(display.width() / 2, 56, "power off device?");
display.drawTextCentered(display.width() / 2, 66, "usb-c to wake");
display.drawTextCentered(display.width() / 2, 82, "Enter:yes q:no");
#endif
} else {
// Menu: hibernate / power off
@@ -1055,8 +1055,8 @@ public:
display.drawXbm((display.width() - 32) / 2, 20, power_icon, 32, 32);
const int y1 = 58, y2 = 70;
#else
display.drawXbm((display.width() - 32) / 2, 10, power_icon, 32, 32);
const int y1 = 50, y2 = 62;
display.drawXbm((display.width() - 32) / 2, 20, power_icon, 32, 32);
const int y1 = 56, y2 = 68;
#endif
char line1[48], line2[48];
#if defined(LilyGo_TDeck_Pro)
+2 -2
View File
@@ -72,8 +72,8 @@ build_flags =
-D EINK_ROTATION=0
-D EINK_SCALE_X=1.875f
-D EINK_SCALE_Y=2.5f
-D EINK_X_OFFSET=2
-D EINK_Y_OFFSET=4
-D EINK_X_OFFSET=0
-D EINK_Y_OFFSET=5
-D PIN_DISPLAY_CS=34
-D PIN_DISPLAY_DC=35
-D PIN_DISPLAY_RST=16