Add BMA456 tap detection with ESP-NOW notify and host snapshot API.

Slaves forward configured tap kinds to the master; goTool exposes CLI, dashboard, REST, and WebSocket with separate notify vs receive and 2s display cache.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-29 20:42:57 +02:00
co-authored by Cursor
parent 3cb0b5bbe9
commit a8d4d42920
34 changed files with 3138 additions and 241 deletions
+16
View File
@@ -36,6 +36,8 @@ static bool s_have_last_sample;
static volatile bool s_int_pending;
static SemaphoreHandle_t s_accel_mutex;
static bma456_tap_handler_t s_tap_handler;
static void *s_tap_handler_ctx;
static esp_err_t check_bma4(const char *api_name, int8_t rslt);
@@ -123,6 +125,11 @@ void bma456_set_accel_deadzone(uint32_t deadzone_lsb) {
uint32_t bma456_get_accel_deadzone(void) { return s_accel_deadzone; }
void bma456_set_tap_handler(bma456_tap_handler_t handler, void *ctx) {
s_tap_handler = handler;
s_tap_handler_ctx = ctx;
}
esp_err_t bma456_read_accel(int16_t *x, int16_t *y, int16_t *z) {
if (!s_bma456_ready || x == NULL || y == NULL || z == NULL) {
return ESP_ERR_INVALID_STATE;
@@ -183,10 +190,19 @@ static void handle_tap_interrupt(void) {
if (tap_out.single_tap) {
ESP_LOGI(TAG, "tap: single");
if (s_tap_handler != NULL) {
s_tap_handler(BMA456_TAP_SINGLE, s_tap_handler_ctx);
}
} else if (tap_out.double_tap) {
ESP_LOGI(TAG, "tap: double");
if (s_tap_handler != NULL) {
s_tap_handler(BMA456_TAP_DOUBLE, s_tap_handler_ctx);
}
} else if (tap_out.triple_tap) {
ESP_LOGI(TAG, "tap: triple");
if (s_tap_handler != NULL) {
s_tap_handler(BMA456_TAP_TRIPLE, s_tap_handler_ctx);
}
}
}