Make tap freezing configurable, add toggles to other functions, minor UI changes
This commit is contained in:
+27
-16
@@ -53,7 +53,15 @@
|
||||
|
||||
// ─── Persistence ──────────────────────────────────────────────────────────────
|
||||
#define CONFIG_FILENAME "/imu_mouse_cfg.bin"
|
||||
#define CONFIG_MAGIC 0xDEAD123AUL
|
||||
#define CONFIG_MAGIC 0xDEAD123CUL
|
||||
|
||||
// ─── Runtime feature-override flags (cfg.featureFlags bitmask) ───────────────
|
||||
// These mirror the compile-time FEATURE_* defines but can be toggled at runtime
|
||||
// via the web UI and persisted in flash. Bits not listed here are reserved = 0.
|
||||
#define FLAG_TAP_ENABLED 0x01 // Tap detection active (requires restart)
|
||||
#define FLAG_TEMP_COMP_ENABLED 0x02 // Temperature gyro-drift compensation
|
||||
#define FLAG_AUTO_RECAL_ENABLED 0x04 // Auto-recalibrate after long idle
|
||||
#define FLAG_ALL_DEFAULT (FLAG_TAP_ENABLED | FLAG_TEMP_COMP_ENABLED | FLAG_AUTO_RECAL_ENABLED)
|
||||
|
||||
// ─── Enums ────────────────────────────────────────────────────────────────────
|
||||
enum CurveType : uint8_t { CURVE_LINEAR=0, CURVE_SQUARE=1, CURVE_SQRT=2 };
|
||||
@@ -83,27 +91,30 @@ struct Config {
|
||||
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)
|
||||
float jerkThreshold; // jerk² threshold for tap-freeze detection
|
||||
float jerkThreshold; // jerk² threshold for tap-freeze detection
|
||||
uint8_t tapFreezeEnabled; // 1 = enable jerk-based cursor freeze during taps
|
||||
uint8_t featureFlags; // bitmask of FLAG_* — runtime feature overrides
|
||||
};
|
||||
extern Config cfg;
|
||||
extern const Config CFG_DEFAULTS;
|
||||
|
||||
// ─── ConfigBlob (over BLE, 20 bytes) ─────────────────────────────────────────
|
||||
// ─── ConfigBlob (over BLE, 25 bytes) ─────────────────────────────────────────
|
||||
struct __attribute__((packed)) ConfigBlob {
|
||||
float sensitivity; // [0]
|
||||
float deadZone; // [4]
|
||||
float accelStrength; // [8]
|
||||
uint8_t curve; // [12]
|
||||
uint8_t axisFlip; // [13]
|
||||
uint8_t chargeMode; // [14]
|
||||
uint8_t tapThreshold; // [15] 1–31
|
||||
uint8_t tapAction; // [16] TapAction enum
|
||||
uint8_t tapKey; // [17] HID keycode
|
||||
uint8_t tapMod; // [18] HID modifier
|
||||
uint8_t _pad; // [19]
|
||||
float jerkThreshold; // [20] jerk² tap-freeze threshold
|
||||
float sensitivity; // [0]
|
||||
float deadZone; // [4]
|
||||
float accelStrength; // [8]
|
||||
uint8_t curve; // [12]
|
||||
uint8_t axisFlip; // [13]
|
||||
uint8_t chargeMode; // [14]
|
||||
uint8_t tapThreshold; // [15] 1–31
|
||||
uint8_t tapAction; // [16] TapAction enum
|
||||
uint8_t tapKey; // [17] HID keycode
|
||||
uint8_t tapMod; // [18] HID modifier
|
||||
uint8_t tapFreezeEnabled; // [19] 1 = enable jerk-based cursor freeze during taps
|
||||
float jerkThreshold; // [20] jerk² tap-freeze threshold
|
||||
uint8_t featureFlags; // [24] FLAG_* bitmask — runtime feature overrides
|
||||
};
|
||||
static_assert(sizeof(ConfigBlob) == 24, "ConfigBlob must be 24 bytes");
|
||||
static_assert(sizeof(ConfigBlob) == 25, "ConfigBlob must be 25 bytes");
|
||||
|
||||
// ─── TelemetryPacket (24 bytes) ───────────────────────────────────────────────
|
||||
#ifdef FEATURE_TELEMETRY
|
||||
|
||||
Reference in New Issue
Block a user