Add runtime BMA456 tap config with NVS persistence and goTool UI.

Expose multitap parameters over UART/ESP-NOW (like deadzone), store per node in NVS, and allow get/set from CLI, REST, and the dashboard without poll-overwrite while editing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
simon
2026-09-26 13:07:13 +02:00
co-authored by Cursor
parent f006f8b912
commit d7441cb85f
32 changed files with 1859 additions and 150 deletions
+40
View File
@@ -45,6 +45,24 @@ static esp_err_t send_accel_deadzone(const uint8_t *dest_mac, uint32_t client_id
return esp_now_core_send(dest_mac, &msg);
}
static esp_err_t send_tap_config(const uint8_t *dest_mac, uint32_t client_id,
const bma456_tap_config_t *cfg) {
alox_EspNowMessage msg = alox_EspNowMessage_init_zero;
msg.type = alox_EspNowMessageType_ESPNOW_SET_TAP_CONFIG;
msg.which_payload = alox_EspNowMessage_tap_config_tag;
msg.payload.tap_config.client_id = client_id;
msg.payload.tap_config.tap_sens_thres = cfg->tap_sens_thres;
msg.payload.tap_config.max_gest_dur = cfg->max_gest_dur;
msg.payload.tap_config.tap_shock_dur = cfg->tap_shock_dur;
msg.payload.tap_config.quite_time_after_gest = cfg->quite_time_after_gest;
msg.payload.tap_config.wait_for_timeout = cfg->wait_for_timeout;
msg.payload.tap_config.axis_sel = cfg->axis_sel;
msg.payload.tap_config.enable_single = cfg->enable_single;
msg.payload.tap_config.enable_double = cfg->enable_double;
msg.payload.tap_config.enable_triple = cfg->enable_triple;
return esp_now_core_send(dest_mac, &msg);
}
static esp_err_t send_unicast_test(const uint8_t *dest_mac, uint32_t seq) {
alox_EspNowMessage msg = alox_EspNowMessage_init_zero;
msg.type = alox_EspNowMessageType_ESPNOW_UNICAST_TEST;
@@ -387,6 +405,28 @@ esp_err_t esp_now_comm_send_accel_deadzone(const uint8_t mac[CLIENT_MAC_LEN],
return err;
}
esp_err_t esp_now_comm_send_tap_config(const uint8_t mac[CLIENT_MAC_LEN],
uint32_t client_id,
const bma456_tap_config_t *cfg) {
if (mac == NULL || cfg == NULL || !esp_now_core_is_master()) {
return ESP_ERR_INVALID_STATE;
}
char mac_str[18];
esp_now_core_mac_to_str(mac, mac_str, sizeof(mac_str));
esp_err_t err = send_tap_config(mac, client_id, cfg);
if (err == ESP_OK) {
ESP_LOGI(TAG,
"unicast SET_TAP_CONFIG to %s: sens=%u client_id=%lu "
"(S=%d D=%d T=%d)",
mac_str, (unsigned)cfg->tap_sens_thres, (unsigned long)client_id,
cfg->enable_single, cfg->enable_double, cfg->enable_triple);
} else {
ESP_LOGW(TAG, "unicast SET_TAP_CONFIG to %s failed: %s", mac_str,
esp_err_to_name(err));
}
return err;
}
static void handle_accel_sample(const uint8_t mac[CLIENT_MAC_LEN],
const alox_EspNowAccelSample *sample) {
if (sample == NULL) {