mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2026-04-27 14:30:33 +00:00
Add home button: short-press BOOT returns to watch face
GPIO 0 (BOOT button) now serves as the home/wake button: - Short press when blanked: wake display - Short press when on sub-screen: animate back to watch face - Long press (2s): screenshot to SD (unchanged) Addresses spurious navigation from USB disconnect noise on the capacitive touch panel.
This commit is contained in:
parent
1e83e6afcd
commit
d3416a8dfe
1 changed files with 14 additions and 4 deletions
|
|
@ -2048,17 +2048,27 @@ void loop() {
|
|||
#if HAS_SD && HAS_DISPLAY
|
||||
{
|
||||
static uint32_t btn_down_since = 0;
|
||||
static bool btn_screenshot_taken = false;
|
||||
static bool btn_action_taken = false;
|
||||
if (digitalRead(0) == LOW) {
|
||||
if (btn_down_since == 0) btn_down_since = millis();
|
||||
if (!btn_screenshot_taken && millis() - btn_down_since > 2000) {
|
||||
btn_screenshot_taken = true;
|
||||
// Long press (2s): screenshot to SD
|
||||
if (!btn_action_taken && millis() - btn_down_since > 2000) {
|
||||
btn_action_taken = true;
|
||||
if (drv2605_ready) drv2605_play(HAPTIC_DOUBLE_CLICK);
|
||||
gui_screenshot_sd();
|
||||
}
|
||||
} else {
|
||||
// Short press: navigate home
|
||||
if (btn_down_since > 0 && !btn_action_taken && millis() - btn_down_since > 50) {
|
||||
if (display_blanked) {
|
||||
display_unblank();
|
||||
} else {
|
||||
lv_tileview_set_tile(gui_tileview, gui_tile_watch, LV_ANIM_ON);
|
||||
if (drv2605_ready) drv2605_play(HAPTIC_LIGHT_CLICK);
|
||||
}
|
||||
}
|
||||
btn_down_since = 0;
|
||||
btn_screenshot_taken = false;
|
||||
btn_action_taken = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue