Add configuration slider for double tapping

This commit is contained in:
2026-03-01 20:45:23 +01:00
parent ef97d8f32a
commit f155d16399
8 changed files with 248 additions and 52 deletions
+21 -3
View File
@@ -60,6 +60,16 @@ enum CurveType : uint8_t { CURVE_LINEAR=0, CURVE_SQUARE=1, CURVE_SQRT=2 };
enum ChargeMode : uint8_t { CHARGE_OFF=0, CHARGE_SLOW=1, CHARGE_FAST=2 };
enum ChargeStatus: uint8_t { CHGSTAT_DISCHARGING=0, CHGSTAT_CHARGING=1, CHGSTAT_FULL=2 };
// ─── Tap action types ─────────────────────────────────────────────────────────
// TAP_ACTION_KEY: fires a raw HID keycode (tapKey) with optional modifier (tapMod).
// Modifier byte: bit0=Ctrl, bit1=Shift, bit2=Alt, bit3=GUI (same as HID modifier byte).
enum TapAction : uint8_t {
TAP_ACTION_LEFT = 0,
TAP_ACTION_RIGHT = 1,
TAP_ACTION_MIDDLE = 2,
TAP_ACTION_KEY = 3,
};
// ─── Config (stored in flash) ─────────────────────────────────────────────────
struct Config {
uint32_t magic;
@@ -69,11 +79,15 @@ struct Config {
CurveType curve;
uint8_t axisFlip;
ChargeMode chargeMode;
uint8_t tapThreshold; // 131 → REG_TAP_THS_6D bits[4:0]; 1 LSB = 62.5 mg at ±2g
TapAction tapAction; // what a double-tap does
uint8_t tapKey; // HID keycode (used when tapAction == TAP_ACTION_KEY)
uint8_t tapMod; // HID modifier byte (used when tapAction == TAP_ACTION_KEY)
};
extern Config cfg;
extern const Config CFG_DEFAULTS;
// ─── ConfigBlob (over BLE, 16 bytes) ─────────────────────────────────────────
// ─── ConfigBlob (over BLE, 20 bytes) ─────────────────────────────────────────
struct __attribute__((packed)) ConfigBlob {
float sensitivity; // [0]
float deadZone; // [4]
@@ -81,9 +95,13 @@ struct __attribute__((packed)) ConfigBlob {
uint8_t curve; // [12]
uint8_t axisFlip; // [13]
uint8_t chargeMode; // [14]
uint8_t _pad; // [15]
uint8_t tapThreshold; // [15] 131
uint8_t tapAction; // [16] TapAction enum
uint8_t tapKey; // [17] HID keycode
uint8_t tapMod; // [18] HID modifier
uint8_t _pad; // [19]
};
static_assert(sizeof(ConfigBlob) == 16, "ConfigBlob must be 16 bytes");
static_assert(sizeof(ConfigBlob) == 20, "ConfigBlob must be 20 bytes");
// ─── TelemetryPacket (24 bytes) ───────────────────────────────────────────────
#ifdef FEATURE_TELEMETRY