From 93adf709b91d2c5486e416fcbee15e5f4658ff53 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Tue, 1 Oct 2024 15:47:11 -0500 Subject: [PATCH] add a hotkey to force a save of the config --- proto/enums.proto | 1 + src/gamepad.cpp | 3 +++ www/src/Locales/en/SettingsPage.jsx | 1 + www/src/Pages/SettingsPage.jsx | 1 + 4 files changed, 6 insertions(+) diff --git a/proto/enums.proto b/proto/enums.proto index db76de54b..7fa979950 100644 --- a/proto/enums.proto +++ b/proto/enums.proto @@ -300,6 +300,7 @@ enum GamepadHotkey HOTKEY_DPAD_LEFT = 40; HOTKEY_DPAD_RIGHT = 41; HOTKEY_PREVIOUS_PROFILE = 42; + HOTKEY_SAVE_CONFIG = 43; } // This has to be kept in sync with LEDFormat in NeoPico.hpp diff --git a/src/gamepad.cpp b/src/gamepad.cpp index 16ee3268e..c98b8b586 100644 --- a/src/gamepad.cpp +++ b/src/gamepad.cpp @@ -495,6 +495,9 @@ void Gamepad::processHotkeyAction(GamepadHotkey action) { case HOTKEY_REBOOT_DEFAULT: System::reboot(System::BootMode::DEFAULT); break; + case HOTKEY_SAVE_CONFIG: + Storage::getInstance().save(true); + break; case HOTKEY_CAPTURE_BUTTON: state.buttons |= GAMEPAD_MASK_A2; break; diff --git a/www/src/Locales/en/SettingsPage.jsx b/www/src/Locales/en/SettingsPage.jsx index 1a5955902..6c6a0cf9c 100644 --- a/www/src/Locales/en/SettingsPage.jsx +++ b/www/src/Locales/en/SettingsPage.jsx @@ -127,6 +127,7 @@ export default { 'load-profile-3': 'Load Profile #3', 'load-profile-4': 'Load Profile #4', 'reboot-default': 'Reboot GP2040-CE', + 'save-config': 'Save Config', 'next-profile': 'Next Profile', 'previous-profile': 'Previous Profile', }, diff --git a/www/src/Pages/SettingsPage.jsx b/www/src/Pages/SettingsPage.jsx index 443f01eca..5fffdea7d 100644 --- a/www/src/Pages/SettingsPage.jsx +++ b/www/src/Pages/SettingsPage.jsx @@ -266,6 +266,7 @@ const HOTKEY_ACTIONS = [ { labelKey: 'hotkey-actions.r3-button', value: 20 }, { labelKey: 'hotkey-actions.touchpad-button', value: 21 }, { labelKey: 'hotkey-actions.reboot-default', value: 22 }, + { labelKey: 'hotkey-actions.save-config', value: 43 }, { labelKey: 'hotkey-actions.b1-button', value: 23 }, { labelKey: 'hotkey-actions.b2-button', value: 24 }, { labelKey: 'hotkey-actions.b3-button', value: 25 },