Skip to content

Commit 96bfc6f

Browse files
authored
Assignable Hotkey Actions for web-config and USB mode (#1628)
feat: hotkey actions for web-config and USB mode
1 parent 87fdf15 commit 96bfc6f

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

proto/enums.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,8 @@ enum GamepadHotkey
461461
HOTKEY_RS_DOWN = 83;
462462
HOTKEY_RS_LEFT = 84;
463463
HOTKEY_RS_RIGHT = 85;
464+
HOTKEY_REBOOT_WEBCONFIG = 86;
465+
HOTKEY_REBOOT_USB = 87;
464466
}
465467

466468
enum AnimationEffects

src/gamepad.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,16 @@ void Gamepad::processHotkeyAction(GamepadHotkey action) {
577577
System::reboot(System::BootMode::DEFAULT);
578578
}
579579
break;
580+
case HOTKEY_REBOOT_WEBCONFIG:
581+
if (action != lastAction) {
582+
System::reboot(System::BootMode::WEBCONFIG);
583+
}
584+
break;
585+
case HOTKEY_REBOOT_USB:
586+
if (action != lastAction) {
587+
System::reboot(System::BootMode::USB);
588+
}
589+
break;
580590
case HOTKEY_SAVE_CONFIG:
581591
if (action != lastAction) {
582592
Storage::getInstance().save(true);

www/src/Locales/en/SettingsPage.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ export default {
136136
'load-profile-5': 'Load Profile #5',
137137
'load-profile-6': 'Load Profile #6',
138138
'reboot-default': 'Reboot GP2040-CE',
139+
'reboot-webconfig': 'Reboot GP2040-CE into web-config mode',
140+
'reboot-usb': 'Reboot GP2040-CE into BOOTSEL/USB mode',
139141
'save-config': 'Save Config',
140142
'next-profile': 'Next Profile',
141143
'previous-profile': 'Previous Profile',

www/src/Pages/SettingsPage.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ const HOTKEY_ACTIONS = [
239239
{ labelKey: 'hotkey-actions.r3-button', value: 20 },
240240
{ labelKey: 'hotkey-actions.touchpad-button', value: 21 },
241241
{ labelKey: 'hotkey-actions.reboot-default', value: 22 },
242+
{ labelKey: 'hotkey-actions.reboot-webconfig', value: 86 },
243+
{ labelKey: 'hotkey-actions.reboot-usb', value: 87 },
242244
{ labelKey: 'hotkey-actions.save-config', value: 43 },
243245
{ labelKey: 'hotkey-actions.b1-button', value: 23 },
244246
{ labelKey: 'hotkey-actions.b2-button', value: 24 },

0 commit comments

Comments
 (0)