no custom settings for confirm & back single clicks

This commit is contained in:
jpirnay
2026-04-27 14:47:28 +02:00
parent ea99b764ce
commit 4ee96309d4
2 changed files with 17 additions and 8 deletions
+14 -5
View File
@@ -58,6 +58,11 @@ void applyLegacyFrontButtonLayout(CrossPointSettings& settings) {
} }
} }
void enforceFixedShortActions(CrossPointSettings& settings) {
settings.btnShortBack = static_cast<uint8_t>(CrossPointSettings::BUTTON_ACTION::BTN_DEFAULT);
settings.btnShortConfirm = static_cast<uint8_t>(CrossPointSettings::BUTTON_ACTION::BTN_DEFAULT);
}
} // namespace } // namespace
void CrossPointSettings::validateFrontButtonMapping(CrossPointSettings& settings) { void CrossPointSettings::validateFrontButtonMapping(CrossPointSettings& settings) {
@@ -88,11 +93,14 @@ bool CrossPointSettings::loadFromFile() {
if (!json.isEmpty()) { if (!json.isEmpty()) {
bool resave = false; bool resave = false;
bool result = JsonSettingsIO::loadSettings(*this, json.c_str(), &resave); bool result = JsonSettingsIO::loadSettings(*this, json.c_str(), &resave);
if (result && resave) { if (result) {
if (saveToFile()) { enforceFixedShortActions(*this);
LOG_DBG("CPS", "Resaved settings to update format"); if (resave) {
} else { if (saveToFile()) {
LOG_ERR("CPS", "Failed to resave settings after format update"); LOG_DBG("CPS", "Resaved settings to update format");
} else {
LOG_ERR("CPS", "Failed to resave settings after format update");
}
} }
} }
return result; return result;
@@ -102,6 +110,7 @@ bool CrossPointSettings::loadFromFile() {
// Fall back to binary migration // Fall back to binary migration
if (Storage.exists(SETTINGS_FILE_BIN)) { if (Storage.exists(SETTINGS_FILE_BIN)) {
if (loadFromBinaryFile()) { if (loadFromBinaryFile()) {
enforceFixedShortActions(*this);
if (saveToFile()) { if (saveToFile()) {
Storage.rename(SETTINGS_FILE_BIN, SETTINGS_FILE_BAK); Storage.rename(SETTINGS_FILE_BIN, SETTINGS_FILE_BAK);
LOG_DBG("CPS", "Migrated settings.bin to settings.json"); LOG_DBG("CPS", "Migrated settings.bin to settings.json");
+3 -3
View File
@@ -144,8 +144,8 @@ inline const std::vector<SettingInfo> list = {
StrId::STR_BTN_ACT_KOREADER_SYNC StrId::STR_BTN_ACT_KOREADER_SYNC
// Back button: short=exit reader, double=ignore, long=go home // Back button: short=exit reader, double=ignore, long=go home
SettingInfo::Enum(StrId::STR_BTN_SHORT_PRESS, &CrossPointSettings::btnShortBack, SettingInfo::Enum(StrId::STR_BTN_SHORT_PRESS, &CrossPointSettings::btnShortBack, {StrId::STR_BTN_DEF_EXIT_READER},
{StrId::STR_BTN_DEF_EXIT_READER, BTN_ACT_OPTIONS}, "btnShortBack", StrId::STR_CAT_CONTROLS) "btnShortBack", StrId::STR_CAT_CONTROLS)
.withSubcategory(StrId::STR_MENU_BTN_ACTIONS) .withSubcategory(StrId::STR_MENU_BTN_ACTIONS)
.withSubmenu(StrId::STR_BTN_BACK), .withSubmenu(StrId::STR_BTN_BACK),
SettingInfo::Enum(StrId::STR_BTN_DOUBLE_PRESS, &CrossPointSettings::btnDoubleBack, SettingInfo::Enum(StrId::STR_BTN_DOUBLE_PRESS, &CrossPointSettings::btnDoubleBack,
@@ -156,7 +156,7 @@ inline const std::vector<SettingInfo> list = {
.withSubmenu(StrId::STR_BTN_BACK), .withSubmenu(StrId::STR_BTN_BACK),
// Confirm button: short=reader menu, double=ignore, long=KOReader sync // Confirm button: short=reader menu, double=ignore, long=KOReader sync
SettingInfo::Enum(StrId::STR_BTN_SHORT_PRESS, &CrossPointSettings::btnShortConfirm, SettingInfo::Enum(StrId::STR_BTN_SHORT_PRESS, &CrossPointSettings::btnShortConfirm,
{StrId::STR_BTN_DEF_READER_MENU, BTN_ACT_OPTIONS}, "btnShortConfirm", StrId::STR_CAT_CONTROLS) {StrId::STR_BTN_DEF_READER_MENU}, "btnShortConfirm", StrId::STR_CAT_CONTROLS)
.withSubmenu(StrId::STR_BTN_CONFIRM), .withSubmenu(StrId::STR_BTN_CONFIRM),
SettingInfo::Enum(StrId::STR_BTN_DOUBLE_PRESS, &CrossPointSettings::btnDoubleConfirm, SettingInfo::Enum(StrId::STR_BTN_DOUBLE_PRESS, &CrossPointSettings::btnDoubleConfirm,
{StrId::STR_BTN_DEF_IGNORE, BTN_ACT_OPTIONS}, "btnDoubleConfirm", StrId::STR_CAT_CONTROLS) {StrId::STR_BTN_DEF_IGNORE, BTN_ACT_OPTIONS}, "btnDoubleConfirm", StrId::STR_CAT_CONTROLS)