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
+6
View File
@@ -33,6 +33,12 @@ PB_BIND(alox_EspNowAccelSample, alox_EspNowAccelSample, AUTO)
PB_BIND(alox_EspNowBatteryQuery, alox_EspNowBatteryQuery, AUTO)
PB_BIND(alox_EspNowTapNotify, alox_EspNowTapNotify, AUTO)
PB_BIND(alox_EspNowTapEvent, alox_EspNowTapEvent, AUTO)
PB_BIND(alox_EspNowBatteryReport, alox_EspNowBatteryReport, AUTO)
+61 -4
View File
@@ -27,7 +27,9 @@ typedef enum _alox_EspNowMessageType {
alox_EspNowMessageType_ESPNOW_SET_ACCEL_STREAM = 13,
alox_EspNowMessageType_ESPNOW_LED_RING = 14,
alox_EspNowMessageType_ESPNOW_BATTERY_QUERY = 15,
alox_EspNowMessageType_ESPNOW_BATTERY_REPORT = 16
alox_EspNowMessageType_ESPNOW_BATTERY_REPORT = 16,
alox_EspNowMessageType_ESPNOW_SET_TAP_NOTIFY = 17,
alox_EspNowMessageType_ESPNOW_TAP_EVENT = 18
} alox_EspNowMessageType;
/* Struct definitions */
@@ -83,6 +85,21 @@ typedef struct _alox_EspNowBatteryQuery {
uint32_t client_id;
} alox_EspNowBatteryQuery;
/* * Master → slave: which tap kinds should be reported via ESP-NOW. */
typedef struct _alox_EspNowTapNotify {
uint32_t client_id;
bool single;
bool double_tap;
bool triple;
} alox_EspNowTapNotify;
/* * Slave → master: tap detected on BMA456 (event, not periodic). */
typedef struct _alox_EspNowTapEvent {
uint32_t slave_id;
/* * 1=single, 2=double, 3=triple */
uint32_t kind;
} alox_EspNowTapEvent;
/* * Slave → master: LiPo voltages (periodic ~30 s and on query). */
typedef struct _alox_EspNowBatteryReport {
uint32_t client_id;
@@ -150,6 +167,8 @@ typedef struct _alox_EspNowMessage {
alox_EspNowLedRing led_ring;
alox_EspNowBatteryQuery battery_query;
alox_EspNowBatteryReport battery_report;
alox_EspNowTapNotify tap_notify;
alox_EspNowTapEvent tap_event;
} payload;
} alox_EspNowMessage;
@@ -160,8 +179,10 @@ extern "C" {
/* Helper constants for enums */
#define _alox_EspNowMessageType_MIN alox_EspNowMessageType_ESPNOW_UNKNOWN
#define _alox_EspNowMessageType_MAX alox_EspNowMessageType_ESPNOW_BATTERY_REPORT
#define _alox_EspNowMessageType_ARRAYSIZE ((alox_EspNowMessageType)(alox_EspNowMessageType_ESPNOW_BATTERY_REPORT+1))
#define _alox_EspNowMessageType_MAX alox_EspNowMessageType_ESPNOW_TAP_EVENT
#define _alox_EspNowMessageType_ARRAYSIZE ((alox_EspNowMessageType)(alox_EspNowMessageType_ESPNOW_TAP_EVENT+1))
@@ -191,6 +212,8 @@ extern "C" {
#define alox_EspNowAccelStream_init_default {0, 0}
#define alox_EspNowAccelSample_init_default {0, 0, 0, 0}
#define alox_EspNowBatteryQuery_init_default {0}
#define alox_EspNowTapNotify_init_default {0, 0, 0, 0}
#define alox_EspNowTapEvent_init_default {0, 0}
#define alox_EspNowBatteryReport_init_default {0, 0, 0, 0, 0}
#define alox_EspNowLedRing_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define alox_EspNowOtaStart_init_default {0}
@@ -207,6 +230,8 @@ extern "C" {
#define alox_EspNowAccelStream_init_zero {0, 0}
#define alox_EspNowAccelSample_init_zero {0, 0, 0, 0}
#define alox_EspNowBatteryQuery_init_zero {0}
#define alox_EspNowTapNotify_init_zero {0, 0, 0, 0}
#define alox_EspNowTapEvent_init_zero {0, 0}
#define alox_EspNowBatteryReport_init_zero {0, 0, 0, 0, 0}
#define alox_EspNowLedRing_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define alox_EspNowOtaStart_init_zero {0}
@@ -235,6 +260,12 @@ extern "C" {
#define alox_EspNowAccelSample_y_tag 3
#define alox_EspNowAccelSample_z_tag 4
#define alox_EspNowBatteryQuery_client_id_tag 1
#define alox_EspNowTapNotify_client_id_tag 1
#define alox_EspNowTapNotify_single_tag 2
#define alox_EspNowTapNotify_double_tap_tag 3
#define alox_EspNowTapNotify_triple_tag 4
#define alox_EspNowTapEvent_slave_id_tag 1
#define alox_EspNowTapEvent_kind_tag 2
#define alox_EspNowBatteryReport_client_id_tag 1
#define alox_EspNowBatteryReport_lipo1_valid_tag 2
#define alox_EspNowBatteryReport_lipo2_valid_tag 3
@@ -273,6 +304,8 @@ extern "C" {
#define alox_EspNowMessage_led_ring_tag 15
#define alox_EspNowMessage_battery_query_tag 16
#define alox_EspNowMessage_battery_report_tag 17
#define alox_EspNowMessage_tap_notify_tag 18
#define alox_EspNowMessage_tap_event_tag 19
/* Struct field encoding specification for nanopb */
#define alox_EspNowUnicastTest_FIELDLIST(X, a) \
@@ -330,6 +363,20 @@ X(a, STATIC, SINGULAR, UINT32, client_id, 1)
#define alox_EspNowBatteryQuery_CALLBACK NULL
#define alox_EspNowBatteryQuery_DEFAULT NULL
#define alox_EspNowTapNotify_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, client_id, 1) \
X(a, STATIC, SINGULAR, BOOL, single, 2) \
X(a, STATIC, SINGULAR, BOOL, double_tap, 3) \
X(a, STATIC, SINGULAR, BOOL, triple, 4)
#define alox_EspNowTapNotify_CALLBACK NULL
#define alox_EspNowTapNotify_DEFAULT NULL
#define alox_EspNowTapEvent_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, slave_id, 1) \
X(a, STATIC, SINGULAR, UINT32, kind, 2)
#define alox_EspNowTapEvent_CALLBACK NULL
#define alox_EspNowTapEvent_DEFAULT NULL
#define alox_EspNowBatteryReport_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, client_id, 1) \
X(a, STATIC, SINGULAR, BOOL, lipo1_valid, 2) \
@@ -393,7 +440,9 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,accel_sample,payload.accel_sample),
X(a, STATIC, ONEOF, MESSAGE, (payload,accel_stream,payload.accel_stream), 14) \
X(a, STATIC, ONEOF, MESSAGE, (payload,led_ring,payload.led_ring), 15) \
X(a, STATIC, ONEOF, MESSAGE, (payload,battery_query,payload.battery_query), 16) \
X(a, STATIC, ONEOF, MESSAGE, (payload,battery_report,payload.battery_report), 17)
X(a, STATIC, ONEOF, MESSAGE, (payload,battery_report,payload.battery_report), 17) \
X(a, STATIC, ONEOF, MESSAGE, (payload,tap_notify,payload.tap_notify), 18) \
X(a, STATIC, ONEOF, MESSAGE, (payload,tap_event,payload.tap_event), 19)
#define alox_EspNowMessage_CALLBACK NULL
#define alox_EspNowMessage_DEFAULT NULL
#define alox_EspNowMessage_payload_discover_MSGTYPE alox_EspNowDiscover
@@ -412,6 +461,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,battery_report,payload.battery_repor
#define alox_EspNowMessage_payload_led_ring_MSGTYPE alox_EspNowLedRing
#define alox_EspNowMessage_payload_battery_query_MSGTYPE alox_EspNowBatteryQuery
#define alox_EspNowMessage_payload_battery_report_MSGTYPE alox_EspNowBatteryReport
#define alox_EspNowMessage_payload_tap_notify_MSGTYPE alox_EspNowTapNotify
#define alox_EspNowMessage_payload_tap_event_MSGTYPE alox_EspNowTapEvent
extern const pb_msgdesc_t alox_EspNowUnicastTest_msg;
extern const pb_msgdesc_t alox_EspNowFindMe_msg;
@@ -422,6 +473,8 @@ extern const pb_msgdesc_t alox_EspNowAccelDeadzone_msg;
extern const pb_msgdesc_t alox_EspNowAccelStream_msg;
extern const pb_msgdesc_t alox_EspNowAccelSample_msg;
extern const pb_msgdesc_t alox_EspNowBatteryQuery_msg;
extern const pb_msgdesc_t alox_EspNowTapNotify_msg;
extern const pb_msgdesc_t alox_EspNowTapEvent_msg;
extern const pb_msgdesc_t alox_EspNowBatteryReport_msg;
extern const pb_msgdesc_t alox_EspNowLedRing_msg;
extern const pb_msgdesc_t alox_EspNowOtaStart_msg;
@@ -440,6 +493,8 @@ extern const pb_msgdesc_t alox_EspNowMessage_msg;
#define alox_EspNowAccelStream_fields &alox_EspNowAccelStream_msg
#define alox_EspNowAccelSample_fields &alox_EspNowAccelSample_msg
#define alox_EspNowBatteryQuery_fields &alox_EspNowBatteryQuery_msg
#define alox_EspNowTapNotify_fields &alox_EspNowTapNotify_msg
#define alox_EspNowTapEvent_fields &alox_EspNowTapEvent_msg
#define alox_EspNowBatteryReport_fields &alox_EspNowBatteryReport_msg
#define alox_EspNowLedRing_fields &alox_EspNowLedRing_msg
#define alox_EspNowOtaStart_fields &alox_EspNowOtaStart_msg
@@ -465,6 +520,8 @@ extern const pb_msgdesc_t alox_EspNowMessage_msg;
#define alox_EspNowOtaStart_size 6
#define alox_EspNowOtaStatus_size 18
#define alox_EspNowRestart_size 6
#define alox_EspNowTapEvent_size 12
#define alox_EspNowTapNotify_size 12
#define alox_EspNowUnicastTest_size 6
#ifdef __cplusplus
+19
View File
@@ -22,6 +22,8 @@ enum EspNowMessageType {
ESPNOW_LED_RING = 14;
ESPNOW_BATTERY_QUERY = 15;
ESPNOW_BATTERY_REPORT = 16;
ESPNOW_SET_TAP_NOTIFY = 17;
ESPNOW_TAP_EVENT = 18;
}
message EspNowUnicastTest {
@@ -76,6 +78,21 @@ message EspNowBatteryQuery {
uint32 client_id = 1;
}
/** Master → slave: which tap kinds should be reported via ESP-NOW. */
message EspNowTapNotify {
uint32 client_id = 1;
bool single = 2;
bool double_tap = 3;
bool triple = 4;
}
/** Slave → master: tap detected on BMA456 (event, not periodic). */
message EspNowTapEvent {
uint32 slave_id = 1;
/** 1=single, 2=double, 3=triple */
uint32 kind = 2;
}
/** Slave → master: LiPo voltages (periodic ~30 s and on query). */
message EspNowBatteryReport {
uint32 client_id = 1;
@@ -139,5 +156,7 @@ message EspNowMessage {
EspNowLedRing led_ring = 15;
EspNowBatteryQuery battery_query = 16;
EspNowBatteryReport battery_report = 17;
EspNowTapNotify tap_notify = 18;
EspNowTapEvent tap_event = 19;
}
}
+17
View File
@@ -63,6 +63,21 @@ PB_BIND(alox_AccelSample, alox_AccelSample, AUTO)
PB_BIND(alox_AccelSnapshotResponse, alox_AccelSnapshotResponse, 2)
PB_BIND(alox_TapNotifyRequest, alox_TapNotifyRequest, AUTO)
PB_BIND(alox_TapNotifyResponse, alox_TapNotifyResponse, AUTO)
PB_BIND(alox_TapSnapshotRequest, alox_TapSnapshotRequest, AUTO)
PB_BIND(alox_TapEvent, alox_TapEvent, AUTO)
PB_BIND(alox_TapSnapshotResponse, alox_TapSnapshotResponse, 2)
PB_BIND(alox_EspNowUnicastTestRequest, alox_EspNowUnicastTestRequest, AUTO)
@@ -111,3 +126,5 @@ PB_BIND(alox_OtaSlaveProgressResponse, alox_OtaSlaveProgressResponse, 2)
+170 -7
View File
@@ -30,9 +30,18 @@ typedef enum _alox_MessageType {
alox_MessageType_RESTART = 23,
alox_MessageType_ACCEL_SNAPSHOT = 24,
alox_MessageType_ACCEL_STREAM = 25,
alox_MessageType_BATTERY_STATUS = 26
alox_MessageType_BATTERY_STATUS = 26,
alox_MessageType_TAP_NOTIFY = 27,
alox_MessageType_TAP_SNAPSHOT = 28
} alox_MessageType;
typedef enum _alox_TapKind {
alox_TapKind_TAP_NONE = 0,
alox_TapKind_TAP_SINGLE = 1,
alox_TapKind_TAP_DOUBLE = 2,
alox_TapKind_TAP_TRIPLE = 3
} alox_TapKind;
/* Struct definitions */
typedef struct _alox_Ack {
char dummy_field;
@@ -59,6 +68,10 @@ typedef struct _alox_ClientInfo {
uint32_t version;
/* * Master: ESP-NOW accel stream enabled for this slave. */
bool accel_stream_enabled;
/* * Master: ESP-NOW tap notify flags for this slave. */
bool tap_notify_single;
bool tap_notify_double;
bool tap_notify_triple;
} alox_ClientInfo;
typedef struct _alox_ClientInfoResponse {
@@ -160,6 +173,42 @@ typedef struct _alox_AccelSnapshotResponse {
alox_AccelSample samples[16];
} alox_AccelSnapshotResponse;
/* * Host → master: enable/disable tap ESP-NOW notify per slave (single/double/triple). */
typedef struct _alox_TapNotifyRequest {
bool write;
uint32_t client_id;
bool all_clients;
bool single;
bool double_tap;
bool triple;
} alox_TapNotifyRequest;
typedef struct _alox_TapNotifyResponse {
uint32_t client_id;
bool success;
uint32_t slaves_updated;
bool single;
bool double_tap;
bool triple;
} alox_TapNotifyResponse;
/* * Host → master: read cached tap events (discarded after reply or when age > 16 ms). */
typedef struct _alox_TapSnapshotRequest {
uint32_t client_id;
} alox_TapSnapshotRequest;
typedef struct _alox_TapEvent {
uint32_t client_id;
bool valid;
alox_TapKind kind;
uint32_t age_ms;
} alox_TapEvent;
typedef struct _alox_TapSnapshotResponse {
pb_size_t events_count;
alox_TapEvent events[16];
} alox_TapSnapshotResponse;
typedef struct _alox_EspNowUnicastTestRequest {
uint32_t client_id;
uint32_t seq;
@@ -304,6 +353,10 @@ typedef struct _alox_UartMessage {
alox_AccelStreamResponse accel_stream_response;
alox_BatteryStatusRequest battery_status_request;
alox_BatteryStatusResponse battery_status_response;
alox_TapNotifyRequest tap_notify_request;
alox_TapNotifyResponse tap_notify_response;
alox_TapSnapshotRequest tap_snapshot_request;
alox_TapSnapshotResponse tap_snapshot_response;
} payload;
} alox_UartMessage;
@@ -314,8 +367,12 @@ extern "C" {
/* Helper constants for enums */
#define _alox_MessageType_MIN alox_MessageType_UNKNOWN
#define _alox_MessageType_MAX alox_MessageType_BATTERY_STATUS
#define _alox_MessageType_ARRAYSIZE ((alox_MessageType)(alox_MessageType_BATTERY_STATUS+1))
#define _alox_MessageType_MAX alox_MessageType_TAP_SNAPSHOT
#define _alox_MessageType_ARRAYSIZE ((alox_MessageType)(alox_MessageType_TAP_SNAPSHOT+1))
#define _alox_TapKind_MIN alox_TapKind_TAP_NONE
#define _alox_TapKind_MAX alox_TapKind_TAP_TRIPLE
#define _alox_TapKind_ARRAYSIZE ((alox_TapKind)(alox_TapKind_TAP_TRIPLE+1))
#define alox_UartMessage_type_ENUMTYPE alox_MessageType
@@ -338,6 +395,12 @@ extern "C" {
#define alox_TapEvent_kind_ENUMTYPE alox_TapKind
@@ -358,7 +421,7 @@ extern "C" {
#define alox_Ack_init_default {0}
#define alox_EchoPayload_init_default {{{NULL}, NULL}}
#define alox_VersionResponse_init_default {0, {{NULL}, NULL}, {{NULL}, NULL}}
#define alox_ClientInfo_init_default {0, 0, 0, {{NULL}, NULL}, 0, 0, 0, 0}
#define alox_ClientInfo_init_default {0, 0, 0, {{NULL}, NULL}, 0, 0, 0, 0, 0, 0, 0}
#define alox_ClientInfoResponse_init_default {{{NULL}, NULL}}
#define alox_ClientInput_init_default {0, 0, 0, 0}
#define alox_ClientInputResponse_init_default {{{NULL}, NULL}}
@@ -373,6 +436,11 @@ extern "C" {
#define alox_AccelSnapshotRequest_init_default {0}
#define alox_AccelSample_init_default {0, 0, 0, 0, 0, 0}
#define alox_AccelSnapshotResponse_init_default {0, {alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default}}
#define alox_TapNotifyRequest_init_default {0, 0, 0, 0, 0, 0}
#define alox_TapNotifyResponse_init_default {0, 0, 0, 0, 0, 0}
#define alox_TapSnapshotRequest_init_default {0}
#define alox_TapEvent_init_default {0, 0, _alox_TapKind_MIN, 0}
#define alox_TapSnapshotResponse_init_default {0, {alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default}}
#define alox_EspNowUnicastTestRequest_init_default {0, 0}
#define alox_EspNowUnicastTestResponse_init_default {0, 0}
#define alox_LedRingProgressRequest_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
@@ -392,7 +460,7 @@ extern "C" {
#define alox_Ack_init_zero {0}
#define alox_EchoPayload_init_zero {{{NULL}, NULL}}
#define alox_VersionResponse_init_zero {0, {{NULL}, NULL}, {{NULL}, NULL}}
#define alox_ClientInfo_init_zero {0, 0, 0, {{NULL}, NULL}, 0, 0, 0, 0}
#define alox_ClientInfo_init_zero {0, 0, 0, {{NULL}, NULL}, 0, 0, 0, 0, 0, 0, 0}
#define alox_ClientInfoResponse_init_zero {{{NULL}, NULL}}
#define alox_ClientInput_init_zero {0, 0, 0, 0}
#define alox_ClientInputResponse_init_zero {{{NULL}, NULL}}
@@ -407,6 +475,11 @@ extern "C" {
#define alox_AccelSnapshotRequest_init_zero {0}
#define alox_AccelSample_init_zero {0, 0, 0, 0, 0, 0}
#define alox_AccelSnapshotResponse_init_zero {0, {alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero}}
#define alox_TapNotifyRequest_init_zero {0, 0, 0, 0, 0, 0}
#define alox_TapNotifyResponse_init_zero {0, 0, 0, 0, 0, 0}
#define alox_TapSnapshotRequest_init_zero {0}
#define alox_TapEvent_init_zero {0, 0, _alox_TapKind_MIN, 0}
#define alox_TapSnapshotResponse_init_zero {0, {alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero}}
#define alox_EspNowUnicastTestRequest_init_zero {0, 0}
#define alox_EspNowUnicastTestResponse_init_zero {0, 0}
#define alox_LedRingProgressRequest_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
@@ -436,6 +509,9 @@ extern "C" {
#define alox_ClientInfo_last_success_ping_tag 6
#define alox_ClientInfo_version_tag 7
#define alox_ClientInfo_accel_stream_enabled_tag 8
#define alox_ClientInfo_tap_notify_single_tag 9
#define alox_ClientInfo_tap_notify_double_tag 10
#define alox_ClientInfo_tap_notify_triple_tag 11
#define alox_ClientInfoResponse_clients_tag 1
#define alox_ClientInput_id_tag 1
#define alox_ClientInput_lage_x_tag 2
@@ -476,6 +552,24 @@ extern "C" {
#define alox_AccelSample_z_tag 5
#define alox_AccelSample_age_ms_tag 6
#define alox_AccelSnapshotResponse_samples_tag 1
#define alox_TapNotifyRequest_write_tag 1
#define alox_TapNotifyRequest_client_id_tag 2
#define alox_TapNotifyRequest_all_clients_tag 3
#define alox_TapNotifyRequest_single_tag 4
#define alox_TapNotifyRequest_double_tap_tag 5
#define alox_TapNotifyRequest_triple_tag 6
#define alox_TapNotifyResponse_client_id_tag 1
#define alox_TapNotifyResponse_success_tag 2
#define alox_TapNotifyResponse_slaves_updated_tag 3
#define alox_TapNotifyResponse_single_tag 4
#define alox_TapNotifyResponse_double_tap_tag 5
#define alox_TapNotifyResponse_triple_tag 6
#define alox_TapSnapshotRequest_client_id_tag 1
#define alox_TapEvent_client_id_tag 1
#define alox_TapEvent_valid_tag 2
#define alox_TapEvent_kind_tag 3
#define alox_TapEvent_age_ms_tag 4
#define alox_TapSnapshotResponse_events_tag 1
#define alox_EspNowUnicastTestRequest_client_id_tag 1
#define alox_EspNowUnicastTestRequest_seq_tag 2
#define alox_EspNowUnicastTestResponse_success_tag 1
@@ -550,6 +644,10 @@ extern "C" {
#define alox_UartMessage_accel_stream_response_tag 26
#define alox_UartMessage_battery_status_request_tag 27
#define alox_UartMessage_battery_status_response_tag 28
#define alox_UartMessage_tap_notify_request_tag 29
#define alox_UartMessage_tap_notify_response_tag 30
#define alox_UartMessage_tap_snapshot_request_tag 31
#define alox_UartMessage_tap_snapshot_response_tag 32
/* Struct field encoding specification for nanopb */
#define alox_UartMessage_FIELDLIST(X, a) \
@@ -580,7 +678,11 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,accel_snapshot_response,payload.acce
X(a, STATIC, ONEOF, MESSAGE, (payload,accel_stream_request,payload.accel_stream_request), 25) \
X(a, STATIC, ONEOF, MESSAGE, (payload,accel_stream_response,payload.accel_stream_response), 26) \
X(a, STATIC, ONEOF, MESSAGE, (payload,battery_status_request,payload.battery_status_request), 27) \
X(a, STATIC, ONEOF, MESSAGE, (payload,battery_status_response,payload.battery_status_response), 28)
X(a, STATIC, ONEOF, MESSAGE, (payload,battery_status_response,payload.battery_status_response), 28) \
X(a, STATIC, ONEOF, MESSAGE, (payload,tap_notify_request,payload.tap_notify_request), 29) \
X(a, STATIC, ONEOF, MESSAGE, (payload,tap_notify_response,payload.tap_notify_response), 30) \
X(a, STATIC, ONEOF, MESSAGE, (payload,tap_snapshot_request,payload.tap_snapshot_request), 31) \
X(a, STATIC, ONEOF, MESSAGE, (payload,tap_snapshot_response,payload.tap_snapshot_response), 32)
#define alox_UartMessage_CALLBACK NULL
#define alox_UartMessage_DEFAULT NULL
#define alox_UartMessage_payload_ack_payload_MSGTYPE alox_Ack
@@ -610,6 +712,10 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,battery_status_response,payload.batt
#define alox_UartMessage_payload_accel_stream_response_MSGTYPE alox_AccelStreamResponse
#define alox_UartMessage_payload_battery_status_request_MSGTYPE alox_BatteryStatusRequest
#define alox_UartMessage_payload_battery_status_response_MSGTYPE alox_BatteryStatusResponse
#define alox_UartMessage_payload_tap_notify_request_MSGTYPE alox_TapNotifyRequest
#define alox_UartMessage_payload_tap_notify_response_MSGTYPE alox_TapNotifyResponse
#define alox_UartMessage_payload_tap_snapshot_request_MSGTYPE alox_TapSnapshotRequest
#define alox_UartMessage_payload_tap_snapshot_response_MSGTYPE alox_TapSnapshotResponse
#define alox_Ack_FIELDLIST(X, a) \
@@ -636,7 +742,10 @@ X(a, CALLBACK, SINGULAR, BYTES, mac, 4) \
X(a, STATIC, SINGULAR, UINT32, last_ping, 5) \
X(a, STATIC, SINGULAR, UINT32, last_success_ping, 6) \
X(a, STATIC, SINGULAR, UINT32, version, 7) \
X(a, STATIC, SINGULAR, BOOL, accel_stream_enabled, 8)
X(a, STATIC, SINGULAR, BOOL, accel_stream_enabled, 8) \
X(a, STATIC, SINGULAR, BOOL, tap_notify_single, 9) \
X(a, STATIC, SINGULAR, BOOL, tap_notify_double, 10) \
X(a, STATIC, SINGULAR, BOOL, tap_notify_triple, 11)
#define alox_ClientInfo_CALLBACK pb_default_field_callback
#define alox_ClientInfo_DEFAULT NULL
@@ -742,6 +851,45 @@ X(a, STATIC, REPEATED, MESSAGE, samples, 1)
#define alox_AccelSnapshotResponse_DEFAULT NULL
#define alox_AccelSnapshotResponse_samples_MSGTYPE alox_AccelSample
#define alox_TapNotifyRequest_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, BOOL, write, 1) \
X(a, STATIC, SINGULAR, UINT32, client_id, 2) \
X(a, STATIC, SINGULAR, BOOL, all_clients, 3) \
X(a, STATIC, SINGULAR, BOOL, single, 4) \
X(a, STATIC, SINGULAR, BOOL, double_tap, 5) \
X(a, STATIC, SINGULAR, BOOL, triple, 6)
#define alox_TapNotifyRequest_CALLBACK NULL
#define alox_TapNotifyRequest_DEFAULT NULL
#define alox_TapNotifyResponse_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, client_id, 1) \
X(a, STATIC, SINGULAR, BOOL, success, 2) \
X(a, STATIC, SINGULAR, UINT32, slaves_updated, 3) \
X(a, STATIC, SINGULAR, BOOL, single, 4) \
X(a, STATIC, SINGULAR, BOOL, double_tap, 5) \
X(a, STATIC, SINGULAR, BOOL, triple, 6)
#define alox_TapNotifyResponse_CALLBACK NULL
#define alox_TapNotifyResponse_DEFAULT NULL
#define alox_TapSnapshotRequest_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, client_id, 1)
#define alox_TapSnapshotRequest_CALLBACK NULL
#define alox_TapSnapshotRequest_DEFAULT NULL
#define alox_TapEvent_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, client_id, 1) \
X(a, STATIC, SINGULAR, BOOL, valid, 2) \
X(a, STATIC, SINGULAR, UENUM, kind, 3) \
X(a, STATIC, SINGULAR, UINT32, age_ms, 4)
#define alox_TapEvent_CALLBACK NULL
#define alox_TapEvent_DEFAULT NULL
#define alox_TapSnapshotResponse_FIELDLIST(X, a) \
X(a, STATIC, REPEATED, MESSAGE, events, 1)
#define alox_TapSnapshotResponse_CALLBACK NULL
#define alox_TapSnapshotResponse_DEFAULT NULL
#define alox_TapSnapshotResponse_events_MSGTYPE alox_TapEvent
#define alox_EspNowUnicastTestRequest_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, client_id, 1) \
X(a, STATIC, SINGULAR, UINT32, seq, 2)
@@ -869,6 +1017,11 @@ extern const pb_msgdesc_t alox_BatteryStatusResponse_msg;
extern const pb_msgdesc_t alox_AccelSnapshotRequest_msg;
extern const pb_msgdesc_t alox_AccelSample_msg;
extern const pb_msgdesc_t alox_AccelSnapshotResponse_msg;
extern const pb_msgdesc_t alox_TapNotifyRequest_msg;
extern const pb_msgdesc_t alox_TapNotifyResponse_msg;
extern const pb_msgdesc_t alox_TapSnapshotRequest_msg;
extern const pb_msgdesc_t alox_TapEvent_msg;
extern const pb_msgdesc_t alox_TapSnapshotResponse_msg;
extern const pb_msgdesc_t alox_EspNowUnicastTestRequest_msg;
extern const pb_msgdesc_t alox_EspNowUnicastTestResponse_msg;
extern const pb_msgdesc_t alox_LedRingProgressRequest_msg;
@@ -905,6 +1058,11 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
#define alox_AccelSnapshotRequest_fields &alox_AccelSnapshotRequest_msg
#define alox_AccelSample_fields &alox_AccelSample_msg
#define alox_AccelSnapshotResponse_fields &alox_AccelSnapshotResponse_msg
#define alox_TapNotifyRequest_fields &alox_TapNotifyRequest_msg
#define alox_TapNotifyResponse_fields &alox_TapNotifyResponse_msg
#define alox_TapSnapshotRequest_fields &alox_TapSnapshotRequest_msg
#define alox_TapEvent_fields &alox_TapEvent_msg
#define alox_TapSnapshotResponse_fields &alox_TapSnapshotResponse_msg
#define alox_EspNowUnicastTestRequest_fields &alox_EspNowUnicastTestRequest_msg
#define alox_EspNowUnicastTestResponse_fields &alox_EspNowUnicastTestResponse_msg
#define alox_LedRingProgressRequest_fields &alox_LedRingProgressRequest_msg
@@ -957,6 +1115,11 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
#define alox_OtaStatusPayload_size 24
#define alox_RestartRequest_size 6
#define alox_RestartResponse_size 8
#define alox_TapEvent_size 16
#define alox_TapNotifyRequest_size 16
#define alox_TapNotifyResponse_size 20
#define alox_TapSnapshotRequest_size 6
#define alox_TapSnapshotResponse_size 288
#ifdef __cplusplus
} /* extern "C" */
+52
View File
@@ -25,6 +25,8 @@ enum MessageType {
ACCEL_SNAPSHOT = 24;
ACCEL_STREAM = 25;
BATTERY_STATUS = 26;
TAP_NOTIFY = 27;
TAP_SNAPSHOT = 28;
}
message UartMessage {
@@ -57,6 +59,10 @@ message UartMessage {
AccelStreamResponse accel_stream_response = 26;
BatteryStatusRequest battery_status_request = 27;
BatteryStatusResponse battery_status_response = 28;
TapNotifyRequest tap_notify_request = 29;
TapNotifyResponse tap_notify_response = 30;
TapSnapshotRequest tap_snapshot_request = 31;
TapSnapshotResponse tap_snapshot_response = 32;
}
}
@@ -83,6 +89,10 @@ message ClientInfo {
uint32 version = 7;
/** Master: ESP-NOW accel stream enabled for this slave. */
bool accel_stream_enabled = 8;
/** Master: ESP-NOW tap notify flags for this slave. */
bool tap_notify_single = 9;
bool tap_notify_double = 10;
bool tap_notify_triple = 11;
}
message ClientInfoResponse {
@@ -180,6 +190,48 @@ message AccelSnapshotResponse {
repeated AccelSample samples = 1 [(nanopb).max_count = 16];
}
/** Host → master: enable/disable tap ESP-NOW notify per slave (single/double/triple). */
message TapNotifyRequest {
bool write = 1;
uint32 client_id = 2;
bool all_clients = 3;
bool single = 4;
bool double_tap = 5;
bool triple = 6;
}
message TapNotifyResponse {
uint32 client_id = 1;
bool success = 2;
uint32 slaves_updated = 3;
bool single = 4;
bool double_tap = 5;
bool triple = 6;
}
enum TapKind {
TAP_NONE = 0;
TAP_SINGLE = 1;
TAP_DOUBLE = 2;
TAP_TRIPLE = 3;
}
/** Host → master: read cached tap events (discarded after reply or when age > 16 ms). */
message TapSnapshotRequest {
uint32 client_id = 1;
}
message TapEvent {
uint32 client_id = 1;
bool valid = 2;
TapKind kind = 3;
uint32 age_ms = 4;
}
message TapSnapshotResponse {
repeated TapEvent events = 1 [(nanopb).max_count = 16];
}
message EspNowUnicastTestRequest {
uint32 client_id = 1;
uint32 seq = 2;