powerpods/main/proto/esp_now_messages.proto
simon a8d4d42920 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>
2026-05-29 20:42:57 +02:00

163 lines
3.9 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "proto3";
import "nanopb.proto";
package alox;
enum EspNowMessageType {
ESPNOW_UNKNOWN = 0;
ESPNOW_DISCOVER = 1;
ESPNOW_SLAVE_INFO = 2;
ESPNOW_HEARTBEAT = 3;
ESPNOW_SET_ACCEL_DEADZONE = 4;
ESPNOW_UNICAST_TEST = 5;
ESPNOW_OTA_START = 6;
ESPNOW_OTA_PAYLOAD = 7;
ESPNOW_OTA_END = 8;
ESPNOW_OTA_STATUS = 9;
ESPNOW_FIND_ME = 10;
ESPNOW_RESTART = 11;
ESPNOW_ACCEL_SAMPLE = 12;
ESPNOW_SET_ACCEL_STREAM = 13;
ESPNOW_LED_RING = 14;
ESPNOW_BATTERY_QUERY = 15;
ESPNOW_BATTERY_REPORT = 16;
ESPNOW_SET_TAP_NOTIFY = 17;
ESPNOW_TAP_EVENT = 18;
}
message EspNowUnicastTest {
uint32 seq = 1;
}
/** Master → slave: locate pod (LED ring R/G/B ×3 @ full brightness). */
message EspNowFindMe {
/** 0 = any slave; otherwise only slave_id must match */
uint32 client_id = 1;
}
/** Master → slave: reboot after short delay. */
message EspNowRestart {
uint32 client_id = 1;
}
message EspNowDiscover {
uint32 network = 1;
}
message EspNowSlavePresence {
uint32 network = 1;
bytes mac = 2;
uint32 version = 3;
uint32 slave_id = 4;
bool available = 5;
bool used = 6;
}
message EspNowAccelDeadzone {
uint32 deadzone = 1;
uint32 client_id = 2; // 0 = all slaves; otherwise only matching slave_id applies
}
/** Master → slave: enable/disable periodic accel ESP-NOW stream (~16 ms). */
message EspNowAccelStream {
bool enable = 1;
uint32 client_id = 2;
}
/** Slave → master: latest BMA456 sample (sent ~every 16 ms). */
message EspNowAccelSample {
uint32 slave_id = 1;
sint32 x = 2;
sint32 y = 3;
sint32 z = 4;
}
/** Master → slave: on-demand LiPo read (optional; slaves also push every ~30 s). */
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;
bool lipo1_valid = 2;
bool lipo2_valid = 3;
uint32 lipo1_mv = 4;
uint32 lipo2_mv = 5;
}
/** Master → slave: LED ring command (same modes as UART LedRingProgressRequest). */
message EspNowLedRing {
uint32 client_id = 1;
uint32 mode = 2;
uint32 progress = 3;
uint32 digit = 4;
uint32 r = 5;
uint32 g = 6;
uint32 b = 7;
uint32 intensity = 8;
uint32 blink_ms = 9;
uint32 blink_count = 10;
}
// Master → slave: begin OTA (erase inactive slot; slave replies ESPNOW_OTA_STATUS).
message EspNowOtaStart {
uint32 total_size = 1;
}
// Master → slave: firmware chunk (up to 200 bytes); slave buffers 4 KiB before flash write.
message EspNowOtaPayload {
uint32 seq = 1;
bytes data = 2 [(nanopb).max_size = 200];
}
// Master → slave: finalize OTA (flush, esp_ota_end, set boot partition).
message EspNowOtaEnd {}
// Slave → master: status / block ACK (same status codes as UART OtaStatusPayload).
message EspNowOtaStatus {
uint32 status = 1;
uint32 bytes_written = 2;
uint32 error = 3;
}
message EspNowMessage {
EspNowMessageType type = 1;
oneof payload {
EspNowDiscover discover = 2;
EspNowSlavePresence slave_info = 3;
EspNowSlavePresence heartbeat = 4;
EspNowAccelDeadzone accel_deadzone = 5;
EspNowUnicastTest unicast_test = 6;
EspNowOtaStart ota_start = 7;
EspNowOtaPayload ota_payload = 8;
EspNowOtaEnd ota_end = 9;
EspNowOtaStatus ota_status = 10;
EspNowFindMe find_me = 11;
EspNowRestart restart = 12;
EspNowAccelSample accel_sample = 13;
EspNowAccelStream accel_stream = 14;
EspNowLedRing led_ring = 15;
EspNowBatteryQuery battery_query = 16;
EspNowBatteryReport battery_report = 17;
EspNowTapNotify tap_notify = 18;
EspNowTapEvent tap_event = 19;
}
}