swap 2tap with 5tap

This commit is contained in:
liquidraver
2026-07-23 14:46:58 +02:00
parent af96039f19
commit a06e813ca1
14 changed files with 40 additions and 29 deletions
+3 -2
View File
@@ -760,9 +760,10 @@ Shutdown.
Single button; tap-count → key-code mapping comes from the board's devicetree `tap-codes` (up to 5). Typical mapping:
- 1 tap → Page next
- 2 taps → Flood advert
- 2 taps → LED heartbeat toggle
- 3 taps → Buzzer toggle
- 4 taps → GPS toggle (immediate, no delay)
- 4 taps → GPS toggle
- 5 taps → Flood advert (immediate, no delay)
### 8.4 Buzzer
+2 -2
View File
@@ -678,10 +678,10 @@
*
* /* Multi-tap action mapping (standard ZephCore assignment):
* * 1 tap (400ms wait) → KEY_1 = page next
* * 2 taps (400ms wait) → KEY_B = flood advert
* * 2 taps (400ms wait) → KEY_B = LED heartbeat toggle
* * 3 taps (400ms wait) → KEY_D = buzzer mute toggle
* * 4 taps (400ms wait) → KEY_C = GPS on/off
* * 5 taps (immediate) → KEY_E = LED heartbeat toggle */
* * 5 taps (immediate) → KEY_E = flood advert */
* user_btn_multitap {
* compatible = "zephcore,input-multi-tap";
* input-codes = <INPUT_KEY_A>;
@@ -70,8 +70,8 @@
* back button is a single GPIO whose tap-count/hold is decoded by the
* filters below same scheme as the Wio Tracker L1:
* 1 tap -> KEY_1 (back/cancel) long hold -> KEY_POWER
* 2 taps -> KEY_B (advert) 3 -> KEY_D (buzzer)
* 4 taps -> KEY_C (GPS) 5 -> KEY_E (LED)
* 2 taps -> KEY_B (LED) 3 -> KEY_D (buzzer)
* 4 taps -> KEY_C (GPS) 5 -> KEY_E (advert)
* (NFC pins P0.09/P0.10 are freed for GPIO by nfct-pins-as-gpios above.)
*/
buttons: buttons {
@@ -56,10 +56,10 @@
/* Input filter: user button multi-tap detection
* 1 tap (400ms wait) KEY_1 = page next on TFT
* 2 taps (400ms wait) KEY_B = flood advert
* 2 taps (400ms wait) KEY_B = LED heartbeat toggle
* 3 taps (400ms wait) KEY_D = buzzer mute toggle
* 4 taps (400ms wait) KEY_C = GPS on/off
* 5 taps (immediate) KEY_E = LED heartbeat toggle */
* 5 taps (immediate) KEY_E = flood advert */
user_btn_multitap {
compatible = "zephcore,input-multi-tap";
/* No 'input' phandle listen to ALL devices.
@@ -79,8 +79,8 @@ No QSPI external flash — contacts and channels live in internal flash.
- **Long-press = real power-off.** Hold the button ≥1 s: the buzzer plays the
shutdown melody, the radio and GNSS are parked, then the latch drops and the
board is genuinely off (not a ~1 µA System OFF doze). Press again to boot.
- **Multi-tap actions:** 2 taps = flood advert, 3 = buzzer mute toggle,
4 = GPS on/off, 5 = LED heartbeat toggle. A single tap maps to "page next",
- **Multi-tap actions:** 2 taps = LED heartbeat toggle, 3 = buzzer mute toggle,
4 = GPS on/off, 5 = flood advert. A single tap maps to "page next",
which is a no-op here since there is no display.
- **NFC pins** (P0.09/P0.10) are freed via `nfct-pins-as-gpios`; they are NC on
this board. Harmless, and consistent with the other RAK-based boards.
@@ -83,10 +83,10 @@
/* Input filter: multi-tap on the short-press output.
* 1 tap (400ms wait) KEY_1 = page next (no-op, board has no display)
* 2 taps (400ms wait) KEY_B = flood advert
* 2 taps (400ms wait) KEY_B = LED heartbeat toggle
* 3 taps (400ms wait) KEY_D = buzzer mute toggle
* 4 taps (400ms wait) KEY_C = GPS on/off
* 5 taps (immediate) KEY_E = LED heartbeat toggle */
* 5 taps (immediate) KEY_E = flood advert */
user_btn_multitap {
compatible = "zephcore,input-multi-tap";
/* No 'input' phandle listen to ALL devices.
@@ -93,10 +93,10 @@
/* Input filter: multi-tap
* 1 tap KEY_1 = (reserved / next page if display added)
* 2 taps KEY_B = flood advert
* 2 taps KEY_B = LED heartbeat toggle
* 3 taps KEY_D = buzzer mute toggle
* 4 taps KEY_C = GPS on/off
* 5 taps KEY_E = LED heartbeat toggle */
* 5 taps KEY_E = flood advert */
user_btn_multitap {
compatible = "zephcore,input-multi-tap";
input-codes = <INPUT_KEY_A>;
@@ -74,10 +74,10 @@
/* Input filter: user button multi-tap detection
* 1 tap (400ms wait) KEY_1 = page next (no-op without display)
* 2 taps (400ms wait) KEY_B = flood advert
* 2 taps (400ms wait) KEY_B = LED heartbeat toggle
* 3 taps (400ms wait) KEY_D = buzzer mute toggle
* 4 taps (400ms wait) KEY_C = GPS on/off
* 5 taps (immediate) KEY_E = LED heartbeat toggle */
* 5 taps (immediate) KEY_E = flood advert */
user_btn_multitap {
compatible = "zephcore,input-multi-tap";
/* No 'input' phandle listen to ALL devices.
@@ -80,10 +80,10 @@
/* Multi-tap detection
* 1 tap KEY_1 = page next
* 2 taps KEY_B = flood advert
* 2 taps KEY_B = LED heartbeat toggle
* 3 taps KEY_D = buzzer mute toggle
* 4 taps KEY_C = GPS on/off
* 5 taps KEY_E = LED heartbeat toggle */
* 5 taps KEY_E = flood advert */
user_btn_multitap {
compatible = "zephcore,input-multi-tap";
input-codes = <INPUT_KEY_A>;
@@ -79,10 +79,10 @@
/* Multi-tap detection
* 1 tap KEY_1 = page next
* 2 taps KEY_B = flood advert
* 2 taps KEY_B = LED heartbeat toggle
* 3 taps KEY_D = buzzer mute toggle
* 4 taps KEY_C = GPS on/off
* 5 taps KEY_E = LED heartbeat toggle */
* 5 taps KEY_E = flood advert */
user_btn_multitap {
compatible = "zephcore,input-multi-tap";
input-codes = <INPUT_KEY_A>;
@@ -101,10 +101,10 @@
/* Input filter: user button multi-tap detection
* 1 tap (400ms wait) KEY_1 = page next on OLED
* 2 taps (400ms wait) KEY_B = flood advert
* 2 taps (400ms wait) KEY_B = LED heartbeat toggle
* 3 taps (400ms wait) KEY_D = buzzer mute toggle
* 4 taps (400ms wait) KEY_C = GPS on/off
* 5 taps (immediate) KEY_E = LED heartbeat toggle */
* 5 taps (immediate) KEY_E = flood advert */
user_btn_multitap {
compatible = "zephcore,input-multi-tap";
/* No 'input' phandle listen to ALL devices.
+4 -4
View File
@@ -636,8 +636,8 @@ static void ui_input_cb(struct input_event *evt, void *user_data)
break;
case INPUT_KEY_B:
/* Double tap (400ms delayed): flood advert */
action_flood_advert();
/* Double tap (400ms delayed): toggle LED heartbeat */
action_leds_toggle();
break;
case INPUT_KEY_D:
@@ -651,8 +651,8 @@ static void ui_input_cb(struct input_event *evt, void *user_data)
break;
case INPUT_KEY_E:
/* Quintuple tap (immediate): toggle LED heartbeat */
action_leds_toggle();
/* Quintuple tap (immediate): flood advert */
action_flood_advert();
break;
/* ===== Longpress output ===== */
+2 -2
View File
@@ -55,10 +55,10 @@
/* Global action keys emitted by multi tap filter, handled in loop().
* Kept above 0xF0 so they stay clear of the printable range see the
* key-space contract above. */
#define KEY_FLOOD_ADVERT ((char)0xF5) /* INPUT_KEY_B: 2 taps → flood advert (unused) */
#define KEY_FLOOD_ADVERT ((char)0xF5) /* INPUT_KEY_E: 5 taps → flood advert */
#define KEY_BUZZ_TOGGLE ((char)0xF6) /* INPUT_KEY_D: 3 taps → buzzer mute toggle */
#define KEY_GPS_TOGGLE ((char)0xF7) /* INPUT_KEY_C: 4 taps → GPS on/off */
#define KEY_LED_TOGGLE ((char)0xF8) /* INPUT_KEY_E: 5 taps → LED heartbeat toggle */
#define KEY_LED_TOGGLE ((char)0xF8) /* INPUT_KEY_B: 2 taps → LED heartbeat toggle */
/* ===== Layout constants (calibrated for 128x64 OLED, 6x8 font) ===== */
/* All hard-coded offsets from old Arduino code are preserved here.
@@ -468,9 +468,10 @@ static void joystick_ui_input_cb(struct input_event *evt, void *user_data)
case INPUT_KEY_PAGEDOWN:key = KEY_NEXT; break;
case INPUT_KEY_F2: key = KEY_ENTER_LONG; break;
/* Multi tap outputs from input_multi_tap filter */
case INPUT_KEY_B: key = KEY_LED_TOGGLE; break; /* 2 taps */
case INPUT_KEY_D: key = KEY_BUZZ_TOGGLE; break; /* 3 taps */
case INPUT_KEY_C: key = KEY_GPS_TOGGLE; break; /* 4 taps */
case INPUT_KEY_E: key = KEY_LED_TOGGLE; break; /* 5 taps */
case INPUT_KEY_E: key = KEY_FLOOD_ADVERT; break; /* 5 taps */
default: break;
}
@@ -879,6 +880,15 @@ void JoystickUITask::loop()
} else if (key == KEY_LED_TOGGLE) {
toggleLeds();
consumed = true;
} else if (key == KEY_FLOOD_ADVERT) {
/* Canonical scoped path: honors prefs.path_hash_mode and the
* default transport scope (same as the Advert menu item). */
if (_mesh && _mesh->sendSelfAdvert(true)) {
showAlert("Advert flood sent", 1000);
} else {
showAlert("Advert failed", 1000);
}
consumed = true;
}
if (!consumed && _curr) {
_curr->handleInput(key);