Add UART LED_RING command for progress bar, digits, and clear.
Stop the main-loop digit demo so host-driven display persists; expose clear/progress/digit modes with RGB and intensity via protobuf and goTool. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -42,6 +42,12 @@ PB_BIND(alox_EspNowUnicastTestRequest, alox_EspNowUnicastTestRequest, AUTO)
|
||||
PB_BIND(alox_EspNowUnicastTestResponse, alox_EspNowUnicastTestResponse, AUTO)
|
||||
|
||||
|
||||
PB_BIND(alox_LedRingProgressRequest, alox_LedRingProgressRequest, AUTO)
|
||||
|
||||
|
||||
PB_BIND(alox_LedRingProgressResponse, alox_LedRingProgressResponse, AUTO)
|
||||
|
||||
|
||||
PB_BIND(alox_OtaStartPayload, alox_OtaStartPayload, AUTO)
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ typedef enum _alox_MessageType {
|
||||
alox_MessageType_CLIENT_INPUT = 5,
|
||||
alox_MessageType_ACCEL_DEADZONE = 6,
|
||||
alox_MessageType_ESPNOW_UNICAST_TEST = 7,
|
||||
alox_MessageType_LED_RING = 8,
|
||||
alox_MessageType_OTA_START = 16,
|
||||
alox_MessageType_OTA_PAYLOAD = 17,
|
||||
alox_MessageType_OTA_END = 18,
|
||||
@@ -95,6 +96,28 @@ typedef struct _alox_EspNowUnicastTestResponse {
|
||||
uint32_t seq;
|
||||
} alox_EspNowUnicastTestResponse;
|
||||
|
||||
/* Host → device: LED ring display (progress bar, digit, or clear).
|
||||
mode: 0=clear, 1=progress (0–100 %), 2=digit (0–10, same layout as firmware digit maps). */
|
||||
typedef struct _alox_LedRingProgressRequest {
|
||||
uint32_t mode;
|
||||
/* * 0–100: fraction of ring LEDs to light (mode=progress) */
|
||||
uint32_t progress;
|
||||
/* * 0–10 (mode=digit) */
|
||||
uint32_t digit;
|
||||
uint32_t r;
|
||||
uint32_t g;
|
||||
uint32_t b;
|
||||
/* * 0–255 brightness scale applied to r/g/b */
|
||||
uint32_t intensity;
|
||||
} alox_LedRingProgressRequest;
|
||||
|
||||
typedef struct _alox_LedRingProgressResponse {
|
||||
bool success;
|
||||
uint32_t mode;
|
||||
uint32_t progress;
|
||||
uint32_t digit;
|
||||
} alox_LedRingProgressResponse;
|
||||
|
||||
/* Host → device: begin UART OTA (erase inactive OTA slot; device replies OTA_STATUS). */
|
||||
typedef struct _alox_OtaStartPayload {
|
||||
uint32_t total_size;
|
||||
@@ -163,6 +186,8 @@ typedef struct _alox_UartMessage {
|
||||
alox_EspNowUnicastTestResponse espnow_unicast_test_response;
|
||||
alox_OtaSlaveProgressRequest ota_slave_progress_request;
|
||||
alox_OtaSlaveProgressResponse ota_slave_progress_response;
|
||||
alox_LedRingProgressRequest led_ring_progress_request;
|
||||
alox_LedRingProgressResponse led_ring_progress_response;
|
||||
} payload;
|
||||
} alox_UartMessage;
|
||||
|
||||
@@ -195,6 +220,8 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Initializer values for message structs */
|
||||
@@ -210,6 +237,8 @@ extern "C" {
|
||||
#define alox_AccelDeadzoneResponse_init_default {0, 0, 0, 0}
|
||||
#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}
|
||||
#define alox_LedRingProgressResponse_init_default {0, 0, 0, 0}
|
||||
#define alox_OtaStartPayload_init_default {0}
|
||||
#define alox_OtaPayload_init_default {0, {0, {0}}}
|
||||
#define alox_OtaEndPayload_init_default {0}
|
||||
@@ -229,6 +258,8 @@ extern "C" {
|
||||
#define alox_AccelDeadzoneResponse_init_zero {0, 0, 0, 0}
|
||||
#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}
|
||||
#define alox_LedRingProgressResponse_init_zero {0, 0, 0, 0}
|
||||
#define alox_OtaStartPayload_init_zero {0}
|
||||
#define alox_OtaPayload_init_zero {0, {0, {0}}}
|
||||
#define alox_OtaEndPayload_init_zero {0}
|
||||
@@ -267,6 +298,17 @@ extern "C" {
|
||||
#define alox_EspNowUnicastTestRequest_seq_tag 2
|
||||
#define alox_EspNowUnicastTestResponse_success_tag 1
|
||||
#define alox_EspNowUnicastTestResponse_seq_tag 2
|
||||
#define alox_LedRingProgressRequest_mode_tag 1
|
||||
#define alox_LedRingProgressRequest_progress_tag 2
|
||||
#define alox_LedRingProgressRequest_digit_tag 3
|
||||
#define alox_LedRingProgressRequest_r_tag 4
|
||||
#define alox_LedRingProgressRequest_g_tag 5
|
||||
#define alox_LedRingProgressRequest_b_tag 6
|
||||
#define alox_LedRingProgressRequest_intensity_tag 7
|
||||
#define alox_LedRingProgressResponse_success_tag 1
|
||||
#define alox_LedRingProgressResponse_mode_tag 2
|
||||
#define alox_LedRingProgressResponse_progress_tag 3
|
||||
#define alox_LedRingProgressResponse_digit_tag 4
|
||||
#define alox_OtaStartPayload_total_size_tag 1
|
||||
#define alox_OtaPayload_seq_tag 1
|
||||
#define alox_OtaPayload_data_tag 2
|
||||
@@ -301,6 +343,8 @@ extern "C" {
|
||||
#define alox_UartMessage_espnow_unicast_test_response_tag 14
|
||||
#define alox_UartMessage_ota_slave_progress_request_tag 15
|
||||
#define alox_UartMessage_ota_slave_progress_response_tag 16
|
||||
#define alox_UartMessage_led_ring_progress_request_tag 17
|
||||
#define alox_UartMessage_led_ring_progress_response_tag 18
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define alox_UartMessage_FIELDLIST(X, a) \
|
||||
@@ -319,7 +363,9 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,accel_deadzone_response,payload.acce
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,espnow_unicast_test_request,payload.espnow_unicast_test_request), 13) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,espnow_unicast_test_response,payload.espnow_unicast_test_response), 14) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,ota_slave_progress_request,payload.ota_slave_progress_request), 15) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,ota_slave_progress_response,payload.ota_slave_progress_response), 16)
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,ota_slave_progress_response,payload.ota_slave_progress_response), 16) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,led_ring_progress_request,payload.led_ring_progress_request), 17) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,led_ring_progress_response,payload.led_ring_progress_response), 18)
|
||||
#define alox_UartMessage_CALLBACK NULL
|
||||
#define alox_UartMessage_DEFAULT NULL
|
||||
#define alox_UartMessage_payload_ack_payload_MSGTYPE alox_Ack
|
||||
@@ -337,6 +383,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,ota_slave_progress_response,payload.
|
||||
#define alox_UartMessage_payload_espnow_unicast_test_response_MSGTYPE alox_EspNowUnicastTestResponse
|
||||
#define alox_UartMessage_payload_ota_slave_progress_request_MSGTYPE alox_OtaSlaveProgressRequest
|
||||
#define alox_UartMessage_payload_ota_slave_progress_response_MSGTYPE alox_OtaSlaveProgressResponse
|
||||
#define alox_UartMessage_payload_led_ring_progress_request_MSGTYPE alox_LedRingProgressRequest
|
||||
#define alox_UartMessage_payload_led_ring_progress_response_MSGTYPE alox_LedRingProgressResponse
|
||||
|
||||
#define alox_Ack_FIELDLIST(X, a) \
|
||||
|
||||
@@ -414,6 +462,25 @@ X(a, STATIC, SINGULAR, UINT32, seq, 2)
|
||||
#define alox_EspNowUnicastTestResponse_CALLBACK NULL
|
||||
#define alox_EspNowUnicastTestResponse_DEFAULT NULL
|
||||
|
||||
#define alox_LedRingProgressRequest_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, mode, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, progress, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, digit, 3) \
|
||||
X(a, STATIC, SINGULAR, UINT32, r, 4) \
|
||||
X(a, STATIC, SINGULAR, UINT32, g, 5) \
|
||||
X(a, STATIC, SINGULAR, UINT32, b, 6) \
|
||||
X(a, STATIC, SINGULAR, UINT32, intensity, 7)
|
||||
#define alox_LedRingProgressRequest_CALLBACK NULL
|
||||
#define alox_LedRingProgressRequest_DEFAULT NULL
|
||||
|
||||
#define alox_LedRingProgressResponse_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, success, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, mode, 2) \
|
||||
X(a, STATIC, SINGULAR, UINT32, progress, 3) \
|
||||
X(a, STATIC, SINGULAR, UINT32, digit, 4)
|
||||
#define alox_LedRingProgressResponse_CALLBACK NULL
|
||||
#define alox_LedRingProgressResponse_DEFAULT NULL
|
||||
|
||||
#define alox_OtaStartPayload_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, total_size, 1)
|
||||
#define alox_OtaStartPayload_CALLBACK NULL
|
||||
@@ -474,6 +541,8 @@ extern const pb_msgdesc_t alox_AccelDeadzoneRequest_msg;
|
||||
extern const pb_msgdesc_t alox_AccelDeadzoneResponse_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;
|
||||
extern const pb_msgdesc_t alox_LedRingProgressResponse_msg;
|
||||
extern const pb_msgdesc_t alox_OtaStartPayload_msg;
|
||||
extern const pb_msgdesc_t alox_OtaPayload_msg;
|
||||
extern const pb_msgdesc_t alox_OtaEndPayload_msg;
|
||||
@@ -495,6 +564,8 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
|
||||
#define alox_AccelDeadzoneResponse_fields &alox_AccelDeadzoneResponse_msg
|
||||
#define alox_EspNowUnicastTestRequest_fields &alox_EspNowUnicastTestRequest_msg
|
||||
#define alox_EspNowUnicastTestResponse_fields &alox_EspNowUnicastTestResponse_msg
|
||||
#define alox_LedRingProgressRequest_fields &alox_LedRingProgressRequest_msg
|
||||
#define alox_LedRingProgressResponse_fields &alox_LedRingProgressResponse_msg
|
||||
#define alox_OtaStartPayload_fields &alox_OtaStartPayload_msg
|
||||
#define alox_OtaPayload_fields &alox_OtaPayload_msg
|
||||
#define alox_OtaEndPayload_fields &alox_OtaEndPayload_msg
|
||||
@@ -517,6 +588,8 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
|
||||
#define alox_ClientInput_size 22
|
||||
#define alox_EspNowUnicastTestRequest_size 12
|
||||
#define alox_EspNowUnicastTestResponse_size 8
|
||||
#define alox_LedRingProgressRequest_size 42
|
||||
#define alox_LedRingProgressResponse_size 20
|
||||
#define alox_OtaEndPayload_size 0
|
||||
#define alox_OtaPayload_size 209
|
||||
#define alox_OtaSlaveProgressEntry_size 30
|
||||
|
||||
@@ -13,6 +13,7 @@ enum MessageType {
|
||||
CLIENT_INPUT = 5;
|
||||
ACCEL_DEADZONE = 6;
|
||||
ESPNOW_UNICAST_TEST = 7;
|
||||
LED_RING = 8;
|
||||
OTA_START = 16;
|
||||
OTA_PAYLOAD = 17;
|
||||
OTA_END = 18;
|
||||
@@ -39,6 +40,8 @@ message UartMessage {
|
||||
EspNowUnicastTestResponse espnow_unicast_test_response = 14;
|
||||
OtaSlaveProgressRequest ota_slave_progress_request = 15;
|
||||
OtaSlaveProgressResponse ota_slave_progress_response = 16;
|
||||
LedRingProgressRequest led_ring_progress_request = 17;
|
||||
LedRingProgressResponse led_ring_progress_response = 18;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,6 +110,28 @@ message EspNowUnicastTestResponse {
|
||||
uint32 seq = 2;
|
||||
}
|
||||
|
||||
// Host → device: LED ring display (progress bar, digit, or clear).
|
||||
// mode: 0=clear, 1=progress (0–100 %), 2=digit (0–10, same layout as firmware digit maps).
|
||||
message LedRingProgressRequest {
|
||||
uint32 mode = 1;
|
||||
/** 0–100: fraction of ring LEDs to light (mode=progress) */
|
||||
uint32 progress = 2;
|
||||
/** 0–10 (mode=digit) */
|
||||
uint32 digit = 3;
|
||||
uint32 r = 4;
|
||||
uint32 g = 5;
|
||||
uint32 b = 6;
|
||||
/** 0–255 brightness scale applied to r/g/b */
|
||||
uint32 intensity = 7;
|
||||
}
|
||||
|
||||
message LedRingProgressResponse {
|
||||
bool success = 1;
|
||||
uint32 mode = 2;
|
||||
uint32 progress = 3;
|
||||
uint32 digit = 4;
|
||||
}
|
||||
|
||||
// Host → device: begin UART OTA (erase inactive OTA slot; device replies OTA_STATUS).
|
||||
message OtaStartPayload {
|
||||
uint32 total_size = 1;
|
||||
|
||||
Reference in New Issue
Block a user