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:
simon 2026-05-19 21:18:18 +02:00
parent a0f4a81a55
commit 508b684fdf
16 changed files with 649 additions and 66 deletions

View File

@ -29,6 +29,7 @@ go run . -port /dev/ttyUSB0 clients
| `serve` | — | Web dashboard at `http://localhost:8080` (WebSocket live updates) | | `serve` | — | Web dashboard at `http://localhost:8080` (WebSocket live updates) |
| `ota` | 1619 | UART firmware upload to master; firmware then pushes to slaves via ESP-NOW | | `ota` | 1619 | UART firmware upload to master; firmware then pushes to slaves via ESP-NOW |
| `ota-progress` | 21 | Query per-slave ESP-NOW OTA progress on the master (`-client N`, default all) | | `ota-progress` | 21 | Query per-slave ESP-NOW OTA progress on the master (`-client N`, default all) |
| `led-ring` | 8 | LED ring: `-mode clear\|progress\|digit`, `-progress`, `-digit`, RGB, `-intensity` |
`clients` requires slaves to have responded to master discover broadcasts first. `clients` requires slaves to have responded to master discover broadcasts first.

View File

@ -172,6 +172,33 @@ func (s *serialPort) espnowUnicastTest(clientID, seq uint32) (*pb.EspNowUnicastT
return r, nil return r, nil
} }
func (s *serialPort) ledRingProgress(req *pb.LedRingProgressRequest) (*pb.LedRingProgressResponse, error) {
msg := &pb.UartMessage{
Type: pb.MessageType_LED_RING,
Payload: &pb.UartMessage_LedRingProgressRequest{
LedRingProgressRequest: req,
},
}
body, err := proto.Marshal(msg)
if err != nil {
return nil, fmt.Errorf("encode: %w", err)
}
payload := append([]byte{byte(pb.MessageType_LED_RING)}, body...)
respPayload, err := s.exchangePayload(payload, "LED_RING")
if err != nil {
return nil, err
}
var respMsg pb.UartMessage
if err := proto.Unmarshal(respPayload[1:], &respMsg); err != nil {
return nil, fmt.Errorf("decode: %w", err)
}
r := respMsg.GetLedRingProgressResponse()
if r == nil {
return nil, fmt.Errorf("missing led_ring_progress_response")
}
return r, nil
}
func (s *serialPort) GetVersion() (*pb.VersionResponse, error) { return s.getVersion() } func (s *serialPort) GetVersion() (*pb.VersionResponse, error) { return s.getVersion() }
func (s *serialPort) ListClients() ([]*pb.ClientInfo, error) { return s.listClients() } func (s *serialPort) ListClients() ([]*pb.ClientInfo, error) { return s.listClients() }

56
goTool/cmd_led_ring.go Normal file
View File

@ -0,0 +1,56 @@
package main
import (
"flag"
"fmt"
"powerpod/gotool/pb"
)
const (
ledRingModeClear = 0
ledRingModeProgress = 1
ledRingModeDigit = 2
)
func runLedRing(sp *serialPort, args []string) error {
fs := flag.NewFlagSet("led-ring", flag.ExitOnError)
mode := fs.String("mode", "progress", "clear, progress, or digit")
progress := fs.Uint("progress", 0, "fill level 0100 (mode=progress)")
digit := fs.Uint("digit", 0, "digit 010 (mode=digit)")
r := fs.Uint("r", 0, "red 0255")
g := fs.Uint("g", 255, "green 0255")
b := fs.Uint("b", 0, "blue 0255")
intensity := fs.Uint("intensity", 255, "brightness 0255")
if err := fs.Parse(args); err != nil {
return err
}
var modeVal uint32
switch *mode {
case "clear":
modeVal = ledRingModeClear
case "progress":
modeVal = ledRingModeProgress
case "digit":
modeVal = ledRingModeDigit
default:
return fmt.Errorf("unknown -mode %q (clear, progress, digit)", *mode)
}
resp, err := sp.ledRingProgress(&pb.LedRingProgressRequest{
Mode: modeVal,
Progress: uint32(*progress),
Digit: uint32(*digit),
R: uint32(*r),
G: uint32(*g),
B: uint32(*b),
Intensity: uint32(*intensity),
})
if err != nil {
return err
}
fmt.Printf("success=%v mode=%d progress=%d digit=%d\n",
resp.GetSuccess(), resp.GetMode(), resp.GetProgress(), resp.GetDigit())
return nil
}

View File

@ -20,7 +20,8 @@ func usage() {
fmt.Fprintf(os.Stderr, " test run automated scenario (see testdata/)\n") fmt.Fprintf(os.Stderr, " test run automated scenario (see testdata/)\n")
fmt.Fprintf(os.Stderr, " serve web dashboard (Bootstrap + WebSocket)\n") fmt.Fprintf(os.Stderr, " serve web dashboard (Bootstrap + WebSocket)\n")
fmt.Fprintf(os.Stderr, " ota UART OTA upload (A/B partitions)\n") fmt.Fprintf(os.Stderr, " ota UART OTA upload (A/B partitions)\n")
fmt.Fprintf(os.Stderr, " ota-progress query per-slave ESP-NOW OTA progress on master\n\n") fmt.Fprintf(os.Stderr, " ota-progress query per-slave ESP-NOW OTA progress on master\n")
fmt.Fprintf(os.Stderr, " led-ring set LED ring progress bar (0100%%, rgb, intensity)\n\n")
flag.PrintDefaults() flag.PrintDefaults()
} }
@ -47,7 +48,7 @@ func main() {
os.Exit(2) os.Exit(2)
} }
runErr = runServe(*portName, *baud, flag.Args()[1:]) runErr = runServe(*portName, *baud, flag.Args()[1:])
case "version", "clients", "client-info", "deadzone", "accel-deadzone", "unicast-test", "unicast_test", "ota", "ota-progress", "ota_progress": case "version", "clients", "client-info", "deadzone", "accel-deadzone", "unicast-test", "unicast_test", "led-ring", "led_ring", "ota", "ota-progress", "ota_progress":
if *portName == "" { if *portName == "" {
fmt.Fprintf(os.Stderr, "command %q requires -port\n\n", cmd) fmt.Fprintf(os.Stderr, "command %q requires -port\n\n", cmd)
usage() usage()
@ -67,6 +68,8 @@ func main() {
runErr = runDeadzone(sp, flag.Args()[1:]) runErr = runDeadzone(sp, flag.Args()[1:])
case "unicast-test", "unicast_test": case "unicast-test", "unicast_test":
runErr = runUnicastTest(sp, flag.Args()[1:]) runErr = runUnicastTest(sp, flag.Args()[1:])
case "led-ring", "led_ring":
runErr = runLedRing(sp, flag.Args()[1:])
case "ota": case "ota":
runErr = runOTA(sp, flag.Args()[1:]) runErr = runOTA(sp, flag.Args()[1:])
case "ota-progress", "ota_progress": case "ota-progress", "ota_progress":

View File

@ -32,6 +32,7 @@ const (
MessageType_CLIENT_INPUT MessageType = 5 MessageType_CLIENT_INPUT MessageType = 5
MessageType_ACCEL_DEADZONE MessageType = 6 MessageType_ACCEL_DEADZONE MessageType = 6
MessageType_ESPNOW_UNICAST_TEST MessageType = 7 MessageType_ESPNOW_UNICAST_TEST MessageType = 7
MessageType_LED_RING MessageType = 8
MessageType_OTA_START MessageType = 16 MessageType_OTA_START MessageType = 16
MessageType_OTA_PAYLOAD MessageType = 17 MessageType_OTA_PAYLOAD MessageType = 17
MessageType_OTA_END MessageType = 18 MessageType_OTA_END MessageType = 18
@ -51,6 +52,7 @@ var (
5: "CLIENT_INPUT", 5: "CLIENT_INPUT",
6: "ACCEL_DEADZONE", 6: "ACCEL_DEADZONE",
7: "ESPNOW_UNICAST_TEST", 7: "ESPNOW_UNICAST_TEST",
8: "LED_RING",
16: "OTA_START", 16: "OTA_START",
17: "OTA_PAYLOAD", 17: "OTA_PAYLOAD",
18: "OTA_END", 18: "OTA_END",
@ -67,6 +69,7 @@ var (
"CLIENT_INPUT": 5, "CLIENT_INPUT": 5,
"ACCEL_DEADZONE": 6, "ACCEL_DEADZONE": 6,
"ESPNOW_UNICAST_TEST": 7, "ESPNOW_UNICAST_TEST": 7,
"LED_RING": 8,
"OTA_START": 16, "OTA_START": 16,
"OTA_PAYLOAD": 17, "OTA_PAYLOAD": 17,
"OTA_END": 18, "OTA_END": 18,
@ -123,6 +126,8 @@ type UartMessage struct {
// *UartMessage_EspnowUnicastTestResponse // *UartMessage_EspnowUnicastTestResponse
// *UartMessage_OtaSlaveProgressRequest // *UartMessage_OtaSlaveProgressRequest
// *UartMessage_OtaSlaveProgressResponse // *UartMessage_OtaSlaveProgressResponse
// *UartMessage_LedRingProgressRequest
// *UartMessage_LedRingProgressResponse
Payload isUartMessage_Payload `protobuf_oneof:"payload"` Payload isUartMessage_Payload `protobuf_oneof:"payload"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -307,6 +312,24 @@ func (x *UartMessage) GetOtaSlaveProgressResponse() *OtaSlaveProgressResponse {
return nil return nil
} }
func (x *UartMessage) GetLedRingProgressRequest() *LedRingProgressRequest {
if x != nil {
if x, ok := x.Payload.(*UartMessage_LedRingProgressRequest); ok {
return x.LedRingProgressRequest
}
}
return nil
}
func (x *UartMessage) GetLedRingProgressResponse() *LedRingProgressResponse {
if x != nil {
if x, ok := x.Payload.(*UartMessage_LedRingProgressResponse); ok {
return x.LedRingProgressResponse
}
}
return nil
}
type isUartMessage_Payload interface { type isUartMessage_Payload interface {
isUartMessage_Payload() isUartMessage_Payload()
} }
@ -371,6 +394,14 @@ type UartMessage_OtaSlaveProgressResponse struct {
OtaSlaveProgressResponse *OtaSlaveProgressResponse `protobuf:"bytes,16,opt,name=ota_slave_progress_response,json=otaSlaveProgressResponse,proto3,oneof"` OtaSlaveProgressResponse *OtaSlaveProgressResponse `protobuf:"bytes,16,opt,name=ota_slave_progress_response,json=otaSlaveProgressResponse,proto3,oneof"`
} }
type UartMessage_LedRingProgressRequest struct {
LedRingProgressRequest *LedRingProgressRequest `protobuf:"bytes,17,opt,name=led_ring_progress_request,json=ledRingProgressRequest,proto3,oneof"`
}
type UartMessage_LedRingProgressResponse struct {
LedRingProgressResponse *LedRingProgressResponse `protobuf:"bytes,18,opt,name=led_ring_progress_response,json=ledRingProgressResponse,proto3,oneof"`
}
func (*UartMessage_AckPayload) isUartMessage_Payload() {} func (*UartMessage_AckPayload) isUartMessage_Payload() {}
func (*UartMessage_EchoPayload) isUartMessage_Payload() {} func (*UartMessage_EchoPayload) isUartMessage_Payload() {}
@ -401,6 +432,10 @@ func (*UartMessage_OtaSlaveProgressRequest) isUartMessage_Payload() {}
func (*UartMessage_OtaSlaveProgressResponse) isUartMessage_Payload() {} func (*UartMessage_OtaSlaveProgressResponse) isUartMessage_Payload() {}
func (*UartMessage_LedRingProgressRequest) isUartMessage_Payload() {}
func (*UartMessage_LedRingProgressResponse) isUartMessage_Payload() {}
type Ack struct { type Ack struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
@ -1033,6 +1068,171 @@ func (x *EspNowUnicastTestResponse) GetSeq() uint32 {
return 0 return 0
} }
// Host → device: LED ring display (progress bar, digit, or clear).
// mode: 0=clear, 1=progress (0100 %), 2=digit (010, same layout as firmware digit maps).
type LedRingProgressRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Mode uint32 `protobuf:"varint,1,opt,name=mode,proto3" json:"mode,omitempty"`
// * 0100: fraction of ring LEDs to light (mode=progress)
Progress uint32 `protobuf:"varint,2,opt,name=progress,proto3" json:"progress,omitempty"`
// * 010 (mode=digit)
Digit uint32 `protobuf:"varint,3,opt,name=digit,proto3" json:"digit,omitempty"`
R uint32 `protobuf:"varint,4,opt,name=r,proto3" json:"r,omitempty"`
G uint32 `protobuf:"varint,5,opt,name=g,proto3" json:"g,omitempty"`
B uint32 `protobuf:"varint,6,opt,name=b,proto3" json:"b,omitempty"`
// * 0255 brightness scale applied to r/g/b
Intensity uint32 `protobuf:"varint,7,opt,name=intensity,proto3" json:"intensity,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *LedRingProgressRequest) Reset() {
*x = LedRingProgressRequest{}
mi := &file_uart_messages_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *LedRingProgressRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LedRingProgressRequest) ProtoMessage() {}
func (x *LedRingProgressRequest) ProtoReflect() protoreflect.Message {
mi := &file_uart_messages_proto_msgTypes[12]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LedRingProgressRequest.ProtoReflect.Descriptor instead.
func (*LedRingProgressRequest) Descriptor() ([]byte, []int) {
return file_uart_messages_proto_rawDescGZIP(), []int{12}
}
func (x *LedRingProgressRequest) GetMode() uint32 {
if x != nil {
return x.Mode
}
return 0
}
func (x *LedRingProgressRequest) GetProgress() uint32 {
if x != nil {
return x.Progress
}
return 0
}
func (x *LedRingProgressRequest) GetDigit() uint32 {
if x != nil {
return x.Digit
}
return 0
}
func (x *LedRingProgressRequest) GetR() uint32 {
if x != nil {
return x.R
}
return 0
}
func (x *LedRingProgressRequest) GetG() uint32 {
if x != nil {
return x.G
}
return 0
}
func (x *LedRingProgressRequest) GetB() uint32 {
if x != nil {
return x.B
}
return 0
}
func (x *LedRingProgressRequest) GetIntensity() uint32 {
if x != nil {
return x.Intensity
}
return 0
}
type LedRingProgressResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Mode uint32 `protobuf:"varint,2,opt,name=mode,proto3" json:"mode,omitempty"`
Progress uint32 `protobuf:"varint,3,opt,name=progress,proto3" json:"progress,omitempty"`
Digit uint32 `protobuf:"varint,4,opt,name=digit,proto3" json:"digit,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *LedRingProgressResponse) Reset() {
*x = LedRingProgressResponse{}
mi := &file_uart_messages_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *LedRingProgressResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LedRingProgressResponse) ProtoMessage() {}
func (x *LedRingProgressResponse) ProtoReflect() protoreflect.Message {
mi := &file_uart_messages_proto_msgTypes[13]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LedRingProgressResponse.ProtoReflect.Descriptor instead.
func (*LedRingProgressResponse) Descriptor() ([]byte, []int) {
return file_uart_messages_proto_rawDescGZIP(), []int{13}
}
func (x *LedRingProgressResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *LedRingProgressResponse) GetMode() uint32 {
if x != nil {
return x.Mode
}
return 0
}
func (x *LedRingProgressResponse) GetProgress() uint32 {
if x != nil {
return x.Progress
}
return 0
}
func (x *LedRingProgressResponse) GetDigit() uint32 {
if x != nil {
return x.Digit
}
return 0
}
// Host → device: begin UART OTA (erase inactive OTA slot; device replies OTA_STATUS). // Host → device: begin UART OTA (erase inactive OTA slot; device replies OTA_STATUS).
type OtaStartPayload struct { type OtaStartPayload struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
@ -1043,7 +1243,7 @@ type OtaStartPayload struct {
func (x *OtaStartPayload) Reset() { func (x *OtaStartPayload) Reset() {
*x = OtaStartPayload{} *x = OtaStartPayload{}
mi := &file_uart_messages_proto_msgTypes[12] mi := &file_uart_messages_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1055,7 +1255,7 @@ func (x *OtaStartPayload) String() string {
func (*OtaStartPayload) ProtoMessage() {} func (*OtaStartPayload) ProtoMessage() {}
func (x *OtaStartPayload) ProtoReflect() protoreflect.Message { func (x *OtaStartPayload) ProtoReflect() protoreflect.Message {
mi := &file_uart_messages_proto_msgTypes[12] mi := &file_uart_messages_proto_msgTypes[14]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1068,7 +1268,7 @@ func (x *OtaStartPayload) ProtoReflect() protoreflect.Message {
// Deprecated: Use OtaStartPayload.ProtoReflect.Descriptor instead. // Deprecated: Use OtaStartPayload.ProtoReflect.Descriptor instead.
func (*OtaStartPayload) Descriptor() ([]byte, []int) { func (*OtaStartPayload) Descriptor() ([]byte, []int) {
return file_uart_messages_proto_rawDescGZIP(), []int{12} return file_uart_messages_proto_rawDescGZIP(), []int{14}
} }
func (x *OtaStartPayload) GetTotalSize() uint32 { func (x *OtaStartPayload) GetTotalSize() uint32 {
@ -1089,7 +1289,7 @@ type OtaPayload struct {
func (x *OtaPayload) Reset() { func (x *OtaPayload) Reset() {
*x = OtaPayload{} *x = OtaPayload{}
mi := &file_uart_messages_proto_msgTypes[13] mi := &file_uart_messages_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1101,7 +1301,7 @@ func (x *OtaPayload) String() string {
func (*OtaPayload) ProtoMessage() {} func (*OtaPayload) ProtoMessage() {}
func (x *OtaPayload) ProtoReflect() protoreflect.Message { func (x *OtaPayload) ProtoReflect() protoreflect.Message {
mi := &file_uart_messages_proto_msgTypes[13] mi := &file_uart_messages_proto_msgTypes[15]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1114,7 +1314,7 @@ func (x *OtaPayload) ProtoReflect() protoreflect.Message {
// Deprecated: Use OtaPayload.ProtoReflect.Descriptor instead. // Deprecated: Use OtaPayload.ProtoReflect.Descriptor instead.
func (*OtaPayload) Descriptor() ([]byte, []int) { func (*OtaPayload) Descriptor() ([]byte, []int) {
return file_uart_messages_proto_rawDescGZIP(), []int{13} return file_uart_messages_proto_rawDescGZIP(), []int{15}
} }
func (x *OtaPayload) GetSeq() uint32 { func (x *OtaPayload) GetSeq() uint32 {
@ -1140,7 +1340,7 @@ type OtaEndPayload struct {
func (x *OtaEndPayload) Reset() { func (x *OtaEndPayload) Reset() {
*x = OtaEndPayload{} *x = OtaEndPayload{}
mi := &file_uart_messages_proto_msgTypes[14] mi := &file_uart_messages_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1152,7 +1352,7 @@ func (x *OtaEndPayload) String() string {
func (*OtaEndPayload) ProtoMessage() {} func (*OtaEndPayload) ProtoMessage() {}
func (x *OtaEndPayload) ProtoReflect() protoreflect.Message { func (x *OtaEndPayload) ProtoReflect() protoreflect.Message {
mi := &file_uart_messages_proto_msgTypes[14] mi := &file_uart_messages_proto_msgTypes[16]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1165,7 +1365,7 @@ func (x *OtaEndPayload) ProtoReflect() protoreflect.Message {
// Deprecated: Use OtaEndPayload.ProtoReflect.Descriptor instead. // Deprecated: Use OtaEndPayload.ProtoReflect.Descriptor instead.
func (*OtaEndPayload) Descriptor() ([]byte, []int) { func (*OtaEndPayload) Descriptor() ([]byte, []int) {
return file_uart_messages_proto_rawDescGZIP(), []int{14} return file_uart_messages_proto_rawDescGZIP(), []int{16}
} }
// Device → host status (also used as ACK after each 4 KiB written). // Device → host status (also used as ACK after each 4 KiB written).
@ -1182,7 +1382,7 @@ type OtaStatusPayload struct {
func (x *OtaStatusPayload) Reset() { func (x *OtaStatusPayload) Reset() {
*x = OtaStatusPayload{} *x = OtaStatusPayload{}
mi := &file_uart_messages_proto_msgTypes[15] mi := &file_uart_messages_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1194,7 +1394,7 @@ func (x *OtaStatusPayload) String() string {
func (*OtaStatusPayload) ProtoMessage() {} func (*OtaStatusPayload) ProtoMessage() {}
func (x *OtaStatusPayload) ProtoReflect() protoreflect.Message { func (x *OtaStatusPayload) ProtoReflect() protoreflect.Message {
mi := &file_uart_messages_proto_msgTypes[15] mi := &file_uart_messages_proto_msgTypes[17]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1207,7 +1407,7 @@ func (x *OtaStatusPayload) ProtoReflect() protoreflect.Message {
// Deprecated: Use OtaStatusPayload.ProtoReflect.Descriptor instead. // Deprecated: Use OtaStatusPayload.ProtoReflect.Descriptor instead.
func (*OtaStatusPayload) Descriptor() ([]byte, []int) { func (*OtaStatusPayload) Descriptor() ([]byte, []int) {
return file_uart_messages_proto_rawDescGZIP(), []int{15} return file_uart_messages_proto_rawDescGZIP(), []int{17}
} }
func (x *OtaStatusPayload) GetStatus() uint32 { func (x *OtaStatusPayload) GetStatus() uint32 {
@ -1248,7 +1448,7 @@ type OtaSlaveProgressRequest struct {
func (x *OtaSlaveProgressRequest) Reset() { func (x *OtaSlaveProgressRequest) Reset() {
*x = OtaSlaveProgressRequest{} *x = OtaSlaveProgressRequest{}
mi := &file_uart_messages_proto_msgTypes[16] mi := &file_uart_messages_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1260,7 +1460,7 @@ func (x *OtaSlaveProgressRequest) String() string {
func (*OtaSlaveProgressRequest) ProtoMessage() {} func (*OtaSlaveProgressRequest) ProtoMessage() {}
func (x *OtaSlaveProgressRequest) ProtoReflect() protoreflect.Message { func (x *OtaSlaveProgressRequest) ProtoReflect() protoreflect.Message {
mi := &file_uart_messages_proto_msgTypes[16] mi := &file_uart_messages_proto_msgTypes[18]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1273,7 +1473,7 @@ func (x *OtaSlaveProgressRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use OtaSlaveProgressRequest.ProtoReflect.Descriptor instead. // Deprecated: Use OtaSlaveProgressRequest.ProtoReflect.Descriptor instead.
func (*OtaSlaveProgressRequest) Descriptor() ([]byte, []int) { func (*OtaSlaveProgressRequest) Descriptor() ([]byte, []int) {
return file_uart_messages_proto_rawDescGZIP(), []int{16} return file_uart_messages_proto_rawDescGZIP(), []int{18}
} }
func (x *OtaSlaveProgressRequest) GetClientId() uint32 { func (x *OtaSlaveProgressRequest) GetClientId() uint32 {
@ -1297,7 +1497,7 @@ type OtaSlaveProgressEntry struct {
func (x *OtaSlaveProgressEntry) Reset() { func (x *OtaSlaveProgressEntry) Reset() {
*x = OtaSlaveProgressEntry{} *x = OtaSlaveProgressEntry{}
mi := &file_uart_messages_proto_msgTypes[17] mi := &file_uart_messages_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1309,7 +1509,7 @@ func (x *OtaSlaveProgressEntry) String() string {
func (*OtaSlaveProgressEntry) ProtoMessage() {} func (*OtaSlaveProgressEntry) ProtoMessage() {}
func (x *OtaSlaveProgressEntry) ProtoReflect() protoreflect.Message { func (x *OtaSlaveProgressEntry) ProtoReflect() protoreflect.Message {
mi := &file_uart_messages_proto_msgTypes[17] mi := &file_uart_messages_proto_msgTypes[19]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1322,7 +1522,7 @@ func (x *OtaSlaveProgressEntry) ProtoReflect() protoreflect.Message {
// Deprecated: Use OtaSlaveProgressEntry.ProtoReflect.Descriptor instead. // Deprecated: Use OtaSlaveProgressEntry.ProtoReflect.Descriptor instead.
func (*OtaSlaveProgressEntry) Descriptor() ([]byte, []int) { func (*OtaSlaveProgressEntry) Descriptor() ([]byte, []int) {
return file_uart_messages_proto_rawDescGZIP(), []int{17} return file_uart_messages_proto_rawDescGZIP(), []int{19}
} }
func (x *OtaSlaveProgressEntry) GetClientId() uint32 { func (x *OtaSlaveProgressEntry) GetClientId() uint32 {
@ -1373,7 +1573,7 @@ type OtaSlaveProgressResponse struct {
func (x *OtaSlaveProgressResponse) Reset() { func (x *OtaSlaveProgressResponse) Reset() {
*x = OtaSlaveProgressResponse{} *x = OtaSlaveProgressResponse{}
mi := &file_uart_messages_proto_msgTypes[18] mi := &file_uart_messages_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1385,7 +1585,7 @@ func (x *OtaSlaveProgressResponse) String() string {
func (*OtaSlaveProgressResponse) ProtoMessage() {} func (*OtaSlaveProgressResponse) ProtoMessage() {}
func (x *OtaSlaveProgressResponse) ProtoReflect() protoreflect.Message { func (x *OtaSlaveProgressResponse) ProtoReflect() protoreflect.Message {
mi := &file_uart_messages_proto_msgTypes[18] mi := &file_uart_messages_proto_msgTypes[20]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1398,7 +1598,7 @@ func (x *OtaSlaveProgressResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use OtaSlaveProgressResponse.ProtoReflect.Descriptor instead. // Deprecated: Use OtaSlaveProgressResponse.ProtoReflect.Descriptor instead.
func (*OtaSlaveProgressResponse) Descriptor() ([]byte, []int) { func (*OtaSlaveProgressResponse) Descriptor() ([]byte, []int) {
return file_uart_messages_proto_rawDescGZIP(), []int{18} return file_uart_messages_proto_rawDescGZIP(), []int{20}
} }
func (x *OtaSlaveProgressResponse) GetActive() bool { func (x *OtaSlaveProgressResponse) GetActive() bool {
@ -1440,7 +1640,8 @@ var File_uart_messages_proto protoreflect.FileDescriptor
const file_uart_messages_proto_rawDesc = "" + const file_uart_messages_proto_rawDesc = "" +
"\n" + "\n" +
"\x13uart_messages.proto\x12\x04alox\x1a\fnanopb.proto\"\x8b\t\n" + "\x13uart_messages.proto\x12\x04alox\x1a\fnanopb.proto\"\xc4\n" +
"\n" +
"\vUartMessage\x12%\n" + "\vUartMessage\x12%\n" +
"\x04type\x18\x01 \x01(\x0e2\x11.alox.MessageTypeR\x04type\x12,\n" + "\x04type\x18\x01 \x01(\x0e2\x11.alox.MessageTypeR\x04type\x12,\n" +
"\vack_payload\x18\x02 \x01(\v2\t.alox.AckH\x00R\n" + "\vack_payload\x18\x02 \x01(\v2\t.alox.AckH\x00R\n" +
@ -1461,7 +1662,9 @@ const file_uart_messages_proto_rawDesc = "" +
"\x1bespnow_unicast_test_request\x18\r \x01(\v2\x1e.alox.EspNowUnicastTestRequestH\x00R\x18espnowUnicastTestRequest\x12b\n" + "\x1bespnow_unicast_test_request\x18\r \x01(\v2\x1e.alox.EspNowUnicastTestRequestH\x00R\x18espnowUnicastTestRequest\x12b\n" +
"\x1cespnow_unicast_test_response\x18\x0e \x01(\v2\x1f.alox.EspNowUnicastTestResponseH\x00R\x19espnowUnicastTestResponse\x12\\\n" + "\x1cespnow_unicast_test_response\x18\x0e \x01(\v2\x1f.alox.EspNowUnicastTestResponseH\x00R\x19espnowUnicastTestResponse\x12\\\n" +
"\x1aota_slave_progress_request\x18\x0f \x01(\v2\x1d.alox.OtaSlaveProgressRequestH\x00R\x17otaSlaveProgressRequest\x12_\n" + "\x1aota_slave_progress_request\x18\x0f \x01(\v2\x1d.alox.OtaSlaveProgressRequestH\x00R\x17otaSlaveProgressRequest\x12_\n" +
"\x1bota_slave_progress_response\x18\x10 \x01(\v2\x1e.alox.OtaSlaveProgressResponseH\x00R\x18otaSlaveProgressResponseB\t\n" + "\x1bota_slave_progress_response\x18\x10 \x01(\v2\x1e.alox.OtaSlaveProgressResponseH\x00R\x18otaSlaveProgressResponse\x12Y\n" +
"\x19led_ring_progress_request\x18\x11 \x01(\v2\x1c.alox.LedRingProgressRequestH\x00R\x16ledRingProgressRequest\x12\\\n" +
"\x1aled_ring_progress_response\x18\x12 \x01(\v2\x1d.alox.LedRingProgressResponseH\x00R\x17ledRingProgressResponseB\t\n" +
"\apayload\"\x05\n" + "\apayload\"\x05\n" +
"\x03Ack\"!\n" + "\x03Ack\"!\n" +
"\vEchoPayload\x12\x12\n" + "\vEchoPayload\x12\x12\n" +
@ -1504,7 +1707,20 @@ const file_uart_messages_proto_rawDesc = "" +
"\x03seq\x18\x02 \x01(\rR\x03seq\"G\n" + "\x03seq\x18\x02 \x01(\rR\x03seq\"G\n" +
"\x19EspNowUnicastTestResponse\x12\x18\n" + "\x19EspNowUnicastTestResponse\x12\x18\n" +
"\asuccess\x18\x01 \x01(\bR\asuccess\x12\x10\n" + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x10\n" +
"\x03seq\x18\x02 \x01(\rR\x03seq\"0\n" + "\x03seq\x18\x02 \x01(\rR\x03seq\"\xa6\x01\n" +
"\x16LedRingProgressRequest\x12\x12\n" +
"\x04mode\x18\x01 \x01(\rR\x04mode\x12\x1a\n" +
"\bprogress\x18\x02 \x01(\rR\bprogress\x12\x14\n" +
"\x05digit\x18\x03 \x01(\rR\x05digit\x12\f\n" +
"\x01r\x18\x04 \x01(\rR\x01r\x12\f\n" +
"\x01g\x18\x05 \x01(\rR\x01g\x12\f\n" +
"\x01b\x18\x06 \x01(\rR\x01b\x12\x1c\n" +
"\tintensity\x18\a \x01(\rR\tintensity\"y\n" +
"\x17LedRingProgressResponse\x12\x18\n" +
"\asuccess\x18\x01 \x01(\bR\asuccess\x12\x12\n" +
"\x04mode\x18\x02 \x01(\rR\x04mode\x12\x1a\n" +
"\bprogress\x18\x03 \x01(\rR\bprogress\x12\x14\n" +
"\x05digit\x18\x04 \x01(\rR\x05digit\"0\n" +
"\x0fOtaStartPayload\x12\x1d\n" + "\x0fOtaStartPayload\x12\x1d\n" +
"\n" + "\n" +
"total_size\x18\x01 \x01(\rR\ttotalSize\":\n" + "total_size\x18\x01 \x01(\rR\ttotalSize\":\n" +
@ -1535,7 +1751,7 @@ const file_uart_messages_proto_rawDesc = "" +
"\x0faggregate_bytes\x18\x03 \x01(\rR\x0eaggregateBytes\x12\x1f\n" + "\x0faggregate_bytes\x18\x03 \x01(\rR\x0eaggregateBytes\x12\x1f\n" +
"\vslave_count\x18\x04 \x01(\rR\n" + "\vslave_count\x18\x04 \x01(\rR\n" +
"slaveCount\x12:\n" + "slaveCount\x12:\n" +
"\x06slaves\x18\x05 \x03(\v2\x1b.alox.OtaSlaveProgressEntryB\x05\x92?\x02\x10\x10R\x06slaves*\xf5\x01\n" + "\x06slaves\x18\x05 \x03(\v2\x1b.alox.OtaSlaveProgressEntryB\x05\x92?\x02\x10\x10R\x06slaves*\x83\x02\n" +
"\vMessageType\x12\v\n" + "\vMessageType\x12\v\n" +
"\aUNKNOWN\x10\x00\x12\a\n" + "\aUNKNOWN\x10\x00\x12\a\n" +
"\x03ACK\x10\x01\x12\b\n" + "\x03ACK\x10\x01\x12\b\n" +
@ -1544,7 +1760,8 @@ const file_uart_messages_proto_rawDesc = "" +
"\vCLIENT_INFO\x10\x04\x12\x10\n" + "\vCLIENT_INFO\x10\x04\x12\x10\n" +
"\fCLIENT_INPUT\x10\x05\x12\x12\n" + "\fCLIENT_INPUT\x10\x05\x12\x12\n" +
"\x0eACCEL_DEADZONE\x10\x06\x12\x17\n" + "\x0eACCEL_DEADZONE\x10\x06\x12\x17\n" +
"\x13ESPNOW_UNICAST_TEST\x10\a\x12\r\n" + "\x13ESPNOW_UNICAST_TEST\x10\a\x12\f\n" +
"\bLED_RING\x10\b\x12\r\n" +
"\tOTA_START\x10\x10\x12\x0f\n" + "\tOTA_START\x10\x10\x12\x0f\n" +
"\vOTA_PAYLOAD\x10\x11\x12\v\n" + "\vOTA_PAYLOAD\x10\x11\x12\v\n" +
"\aOTA_END\x10\x12\x12\x0e\n" + "\aOTA_END\x10\x12\x12\x0e\n" +
@ -1566,7 +1783,7 @@ func file_uart_messages_proto_rawDescGZIP() []byte {
} }
var file_uart_messages_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_uart_messages_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_uart_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 19) var file_uart_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 21)
var file_uart_messages_proto_goTypes = []any{ var file_uart_messages_proto_goTypes = []any{
(MessageType)(0), // 0: alox.MessageType (MessageType)(0), // 0: alox.MessageType
(*UartMessage)(nil), // 1: alox.UartMessage (*UartMessage)(nil), // 1: alox.UartMessage
@ -1581,13 +1798,15 @@ var file_uart_messages_proto_goTypes = []any{
(*AccelDeadzoneResponse)(nil), // 10: alox.AccelDeadzoneResponse (*AccelDeadzoneResponse)(nil), // 10: alox.AccelDeadzoneResponse
(*EspNowUnicastTestRequest)(nil), // 11: alox.EspNowUnicastTestRequest (*EspNowUnicastTestRequest)(nil), // 11: alox.EspNowUnicastTestRequest
(*EspNowUnicastTestResponse)(nil), // 12: alox.EspNowUnicastTestResponse (*EspNowUnicastTestResponse)(nil), // 12: alox.EspNowUnicastTestResponse
(*OtaStartPayload)(nil), // 13: alox.OtaStartPayload (*LedRingProgressRequest)(nil), // 13: alox.LedRingProgressRequest
(*OtaPayload)(nil), // 14: alox.OtaPayload (*LedRingProgressResponse)(nil), // 14: alox.LedRingProgressResponse
(*OtaEndPayload)(nil), // 15: alox.OtaEndPayload (*OtaStartPayload)(nil), // 15: alox.OtaStartPayload
(*OtaStatusPayload)(nil), // 16: alox.OtaStatusPayload (*OtaPayload)(nil), // 16: alox.OtaPayload
(*OtaSlaveProgressRequest)(nil), // 17: alox.OtaSlaveProgressRequest (*OtaEndPayload)(nil), // 17: alox.OtaEndPayload
(*OtaSlaveProgressEntry)(nil), // 18: alox.OtaSlaveProgressEntry (*OtaStatusPayload)(nil), // 18: alox.OtaStatusPayload
(*OtaSlaveProgressResponse)(nil), // 19: alox.OtaSlaveProgressResponse (*OtaSlaveProgressRequest)(nil), // 19: alox.OtaSlaveProgressRequest
(*OtaSlaveProgressEntry)(nil), // 20: alox.OtaSlaveProgressEntry
(*OtaSlaveProgressResponse)(nil), // 21: alox.OtaSlaveProgressResponse
} }
var file_uart_messages_proto_depIdxs = []int32{ var file_uart_messages_proto_depIdxs = []int32{
0, // 0: alox.UartMessage.type:type_name -> alox.MessageType 0, // 0: alox.UartMessage.type:type_name -> alox.MessageType
@ -1596,24 +1815,26 @@ var file_uart_messages_proto_depIdxs = []int32{
4, // 3: alox.UartMessage.version_response:type_name -> alox.VersionResponse 4, // 3: alox.UartMessage.version_response:type_name -> alox.VersionResponse
6, // 4: alox.UartMessage.client_info_response:type_name -> alox.ClientInfoResponse 6, // 4: alox.UartMessage.client_info_response:type_name -> alox.ClientInfoResponse
8, // 5: alox.UartMessage.client_input_response:type_name -> alox.ClientInputResponse 8, // 5: alox.UartMessage.client_input_response:type_name -> alox.ClientInputResponse
13, // 6: alox.UartMessage.ota_start:type_name -> alox.OtaStartPayload 15, // 6: alox.UartMessage.ota_start:type_name -> alox.OtaStartPayload
14, // 7: alox.UartMessage.ota_payload:type_name -> alox.OtaPayload 16, // 7: alox.UartMessage.ota_payload:type_name -> alox.OtaPayload
15, // 8: alox.UartMessage.ota_end:type_name -> alox.OtaEndPayload 17, // 8: alox.UartMessage.ota_end:type_name -> alox.OtaEndPayload
16, // 9: alox.UartMessage.ota_status:type_name -> alox.OtaStatusPayload 18, // 9: alox.UartMessage.ota_status:type_name -> alox.OtaStatusPayload
9, // 10: alox.UartMessage.accel_deadzone_request:type_name -> alox.AccelDeadzoneRequest 9, // 10: alox.UartMessage.accel_deadzone_request:type_name -> alox.AccelDeadzoneRequest
10, // 11: alox.UartMessage.accel_deadzone_response:type_name -> alox.AccelDeadzoneResponse 10, // 11: alox.UartMessage.accel_deadzone_response:type_name -> alox.AccelDeadzoneResponse
11, // 12: alox.UartMessage.espnow_unicast_test_request:type_name -> alox.EspNowUnicastTestRequest 11, // 12: alox.UartMessage.espnow_unicast_test_request:type_name -> alox.EspNowUnicastTestRequest
12, // 13: alox.UartMessage.espnow_unicast_test_response:type_name -> alox.EspNowUnicastTestResponse 12, // 13: alox.UartMessage.espnow_unicast_test_response:type_name -> alox.EspNowUnicastTestResponse
17, // 14: alox.UartMessage.ota_slave_progress_request:type_name -> alox.OtaSlaveProgressRequest 19, // 14: alox.UartMessage.ota_slave_progress_request:type_name -> alox.OtaSlaveProgressRequest
19, // 15: alox.UartMessage.ota_slave_progress_response:type_name -> alox.OtaSlaveProgressResponse 21, // 15: alox.UartMessage.ota_slave_progress_response:type_name -> alox.OtaSlaveProgressResponse
5, // 16: alox.ClientInfoResponse.clients:type_name -> alox.ClientInfo 13, // 16: alox.UartMessage.led_ring_progress_request:type_name -> alox.LedRingProgressRequest
7, // 17: alox.ClientInputResponse.clients:type_name -> alox.ClientInput 14, // 17: alox.UartMessage.led_ring_progress_response:type_name -> alox.LedRingProgressResponse
18, // 18: alox.OtaSlaveProgressResponse.slaves:type_name -> alox.OtaSlaveProgressEntry 5, // 18: alox.ClientInfoResponse.clients:type_name -> alox.ClientInfo
19, // [19:19] is the sub-list for method output_type 7, // 19: alox.ClientInputResponse.clients:type_name -> alox.ClientInput
19, // [19:19] is the sub-list for method input_type 20, // 20: alox.OtaSlaveProgressResponse.slaves:type_name -> alox.OtaSlaveProgressEntry
19, // [19:19] is the sub-list for extension type_name 21, // [21:21] is the sub-list for method output_type
19, // [19:19] is the sub-list for extension extendee 21, // [21:21] is the sub-list for method input_type
0, // [0:19] is the sub-list for field type_name 21, // [21:21] is the sub-list for extension type_name
21, // [21:21] is the sub-list for extension extendee
0, // [0:21] is the sub-list for field type_name
} }
func init() { file_uart_messages_proto_init() } func init() { file_uart_messages_proto_init() }
@ -1637,6 +1858,8 @@ func file_uart_messages_proto_init() {
(*UartMessage_EspnowUnicastTestResponse)(nil), (*UartMessage_EspnowUnicastTestResponse)(nil),
(*UartMessage_OtaSlaveProgressRequest)(nil), (*UartMessage_OtaSlaveProgressRequest)(nil),
(*UartMessage_OtaSlaveProgressResponse)(nil), (*UartMessage_OtaSlaveProgressResponse)(nil),
(*UartMessage_LedRingProgressRequest)(nil),
(*UartMessage_LedRingProgressResponse)(nil),
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
@ -1644,7 +1867,7 @@ func file_uart_messages_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_uart_messages_proto_rawDesc), len(file_uart_messages_proto_rawDesc)), RawDescriptor: unsafe.Slice(unsafe.StringData(file_uart_messages_proto_rawDesc), len(file_uart_messages_proto_rawDesc)),
NumEnums: 1, NumEnums: 1,
NumMessages: 19, NumMessages: 21,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -19,6 +19,7 @@ idf_component_register(
"cmd_client_info.c" "cmd_client_info.c"
"cmd_accel_deadzone.c" "cmd_accel_deadzone.c"
"cmd_espnow_unicast_test.c" "cmd_espnow_unicast_test.c"
"cmd_led_ring.c"
"cmd_ota.c" "cmd_ota.c"
"cmd_ota_slave_progress.c" "cmd_ota_slave_progress.c"
"ota_uart.c" "ota_uart.c"

View File

@ -202,6 +202,8 @@ Host and master speak nanopb-encoded `UartMessage` inside UART frames (byte 0 =
| 4 | `CLIENT_INFO` | Implemented (`cmd_client_info.c`) — slave list from registry | | 4 | `CLIENT_INFO` | Implemented (`cmd_client_info.c`) — slave list from registry |
| 5 | `CLIENT_INPUT` | Planned | | 5 | `CLIENT_INPUT` | Planned |
| 6 | `ACCEL_DEADZONE` | Implemented (`cmd_accel_deadzone.c`) — get/set accel filter LSB | | 6 | `ACCEL_DEADZONE` | Implemented (`cmd_accel_deadzone.c`) — get/set accel filter LSB |
| 7 | `ESPNOW_UNICAST_TEST` | Implemented (`cmd_espnow_unicast_test.c`) |
| 8 | `LED_RING` | Implemented (`cmd_led_ring.c`) — ring progress bar (0100 %, RGB, intensity) |
| 16 | `OTA_START` | Implemented (`cmd_ota.c`) — begin UART OTA on inactive slot | | 16 | `OTA_START` | Implemented (`cmd_ota.c`) — begin UART OTA on inactive slot |
| 17 | `OTA_PAYLOAD` | Implemented — up to 200 B per frame; device buffers 4 KiB | | 17 | `OTA_PAYLOAD` | Implemented — up to 200 B per frame; device buffers 4 KiB |
| 18 | `OTA_END` | Implemented — flush, `esp_ota_end`, push image to slaves via ESP-NOW, set boot | | 18 | `OTA_END` | Implemented — flush, `esp_ota_end`, push image to slaves via ESP-NOW, set boot |
@ -309,6 +311,28 @@ Minimal master→slave ESP-NOW unicast check (no BMA456). Use this before debugg
**Firmware logs:** master `unicast TEST to … seq=N`; slave `UNICAST TEST OK from master … seq=N`. **Firmware logs:** master `unicast TEST to … seq=N`; slave `UNICAST TEST OK from master … seq=N`.
### LED_RING command
Control the 95-LED ring from the host. The firmware **does not** animate digits locally; only UART updates the display.
**Request:** framed `08` + `led_ring_progress_request`:
| Field | Meaning |
|-------|---------|
| `mode` | `0` = clear, `1` = progress bar, `2` = digit |
| `progress` | 0100 (% of ring lit, mode `1`) |
| `digit` | 010 (mode `2`, same segment maps as built-in digits) |
| `r`, `g`, `b` | Color 0255 |
| `intensity` | Brightness 0255 (scaled into RGB; `0` → 255) |
**Response:** `led_ring_progress_response` (`success`, `mode`, `progress`, `digit`).
```bash
go run . -port /dev/ttyUSB0 led-ring -mode progress -progress 75 -g 80 -b 255
go run . -port /dev/ttyUSB0 led-ring -mode digit -digit 7 -r 255 -g 200
go run . -port /dev/ttyUSB0 led-ring -mode clear
```
### CLIENT_INFO command ### CLIENT_INFO command
**Request:** framed payload `04` only (`MessageType.CLIENT_INFO`). **Request:** framed payload `04` only (`MessageType.CLIENT_INFO`).
@ -393,7 +417,8 @@ Target: ESP32-S3. Close serial monitor on the UART adapter port before running `
| `client_registry.c/h` | Registered slave table | | `client_registry.c/h` | Registered slave table |
| `bosch456.c/h` | BMA456H I2C driver, accel poll, tap INT, deadzone filter | | `bosch456.c/h` | BMA456H I2C driver, accel poll, tap INT, deadzone filter |
| `board_input.c/h` | Taster GPIO12, LiPo ADC on GPIO1 / GPIO12 | | `board_input.c/h` | Taster GPIO12, LiPo ADC on GPIO1 / GPIO12 |
| `led_ring.c/h` | LED digit display | | `led_ring.c/h` | LED ring (digit display, progress bar) |
| `cmd_led_ring.c` | UART `LED_RING` progress command |
| `proto/uart_messages.proto` | UART protocol schema | | `proto/uart_messages.proto` | UART protocol schema |
| `proto/esp_now_messages.proto` | ESP-NOW protocol schema | | `proto/esp_now_messages.proto` | ESP-NOW protocol schema |
| `esp_now_proto.c/h` | Encode/decode `EspNowMessage` | | `esp_now_proto.c/h` | Encode/decode `EspNowMessage` |

View File

@ -30,6 +30,8 @@ static const char *message_type_name(uint16_t id) {
return "ACCEL_DEADZONE"; return "ACCEL_DEADZONE";
case alox_MessageType_ESPNOW_UNICAST_TEST: case alox_MessageType_ESPNOW_UNICAST_TEST:
return "ESPNOW_UNICAST_TEST"; return "ESPNOW_UNICAST_TEST";
case alox_MessageType_LED_RING:
return "LED_RING";
case alox_MessageType_OTA_START: case alox_MessageType_OTA_START:
return "OTA_START"; return "OTA_START";
case alox_MessageType_OTA_PAYLOAD: case alox_MessageType_OTA_PAYLOAD:

125
main/cmd_led_ring.c Normal file
View File

@ -0,0 +1,125 @@
#include "cmd_led_ring.h"
#include "esp_log.h"
#include "led_ring.h"
#include "uart_cmd.h"
static const char *TAG = "[LED_RING_CMD]";
#define LED_RING_MODE_CLEAR 0
#define LED_RING_MODE_PROGRESS 1
#define LED_RING_MODE_DIGIT 2
static uint8_t clamp_u8(uint32_t v) {
if (v > 255) {
return 255;
}
return (uint8_t)v;
}
static uint8_t clamp_progress(uint32_t v) {
if (v > 100) {
return 100;
}
return (uint8_t)v;
}
static void apply_intensity(uint8_t *r, uint8_t *g, uint8_t *b, uint8_t intensity) {
if (intensity == 0) {
return;
}
*r = (uint16_t)(*r) * intensity / 255;
*g = (uint16_t)(*g) * intensity / 255;
*b = (uint16_t)(*b) * intensity / 255;
}
static void reply(bool success, uint32_t mode, uint32_t progress, uint32_t digit) {
alox_UartMessage response;
uart_cmd_init_response(&response, alox_MessageType_LED_RING,
alox_UartMessage_led_ring_progress_response_tag);
response.payload.led_ring_progress_response.success = success;
response.payload.led_ring_progress_response.mode = mode;
response.payload.led_ring_progress_response.progress = progress;
response.payload.led_ring_progress_response.digit = digit;
uart_cmd_send(&response, TAG);
}
static void handle_led_ring(const uint8_t *data, size_t len) {
alox_UartMessage uart_msg;
alox_LedRingProgressRequest req = alox_LedRingProgressRequest_init_zero;
if (uart_cmd_decode(data, len, &uart_msg) != ESP_OK) {
ESP_LOGW(TAG, "decode failed");
reply(false, 0, 0, 0);
return;
}
const alox_LedRingProgressRequest *req_ptr = UART_CMD_REQ(
&uart_msg, alox_UartMessage_led_ring_progress_request_tag,
led_ring_progress_request);
if (req_ptr != NULL) {
req = *req_ptr;
}
uint32_t mode = req.mode;
uint8_t r = clamp_u8(req.r);
uint8_t g = clamp_u8(req.g);
uint8_t b = clamp_u8(req.b);
uint8_t intensity = clamp_u8(req.intensity);
if (intensity == 0) {
intensity = 255;
}
apply_intensity(&r, &g, &b, intensity);
led_command_t cmd = {0};
switch (mode) {
case LED_RING_MODE_CLEAR:
cmd.mode = LED_CMD_CLEAR;
led_ring_send_command(&cmd);
ESP_LOGI(TAG, "clear");
reply(true, mode, 0, 0);
return;
case LED_RING_MODE_PROGRESS: {
uint8_t progress = clamp_progress(req.progress);
cmd.mode = LED_CMD_PROGRESS;
cmd.progress = progress;
cmd.r = r;
cmd.g = g;
cmd.b = b;
cmd.intensity = intensity;
led_ring_send_command(&cmd);
ESP_LOGI(TAG, "progress %u%% rgb=%u,%u,%u", (unsigned)progress,
(unsigned)r, (unsigned)g, (unsigned)b);
reply(true, mode, progress, 0);
return;
}
case LED_RING_MODE_DIGIT: {
if (req.digit > 10) {
ESP_LOGW(TAG, "digit %lu out of range", (unsigned long)req.digit);
reply(false, mode, 0, req.digit);
return;
}
cmd.mode = LED_CMD_SET_DIGIT;
cmd.value = (uint8_t)req.digit;
cmd.r = r;
cmd.g = g;
cmd.b = b;
led_ring_send_command(&cmd);
ESP_LOGI(TAG, "digit %u rgb=%u,%u,%u", (unsigned)cmd.value, (unsigned)r,
(unsigned)g, (unsigned)b);
reply(true, mode, 0, req.digit);
return;
}
default:
ESP_LOGW(TAG, "unknown mode %lu", (unsigned long)mode);
reply(false, mode, 0, 0);
return;
}
}
void cmd_led_ring_register(void) {
uart_cmd_register(alox_MessageType_LED_RING, handle_led_ring);
}

6
main/cmd_led_ring.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef CMD_LED_RING_H
#define CMD_LED_RING_H
void cmd_led_ring_register(void);
#endif

View File

@ -67,10 +67,11 @@ void vTaskLedRing(void *pvParameters) {
led_command_t cmd; led_command_t cmd;
while (1) { while (1) {
if (xQueueReceive(led_queue, &cmd, portMAX_DELAY)) { if (xQueueReceive(led_queue, &cmd, portMAX_DELAY)) {
// Clear all LEDS
led_strip_clear(led_ring); led_strip_clear(led_ring);
if (cmd.mode == LED_CMD_SET_DIGIT && cmd.value <= 10) { if (cmd.mode == LED_CMD_CLEAR) {
/* ring already cleared */
} else if (cmd.mode == LED_CMD_SET_DIGIT && cmd.value <= 10) {
digit_definition_t digit = digit_lookup[cmd.value]; digit_definition_t digit = digit_lookup[cmd.value];
for (int i = 0; i < digit.count; i++) { for (int i = 0; i < digit.count; i++) {
@ -78,6 +79,14 @@ void vTaskLedRing(void *pvParameters) {
led_strip_set_pixel(led_ring, RING_LEDS - digit.leds[i], cmd.r, cmd.g, led_strip_set_pixel(led_ring, RING_LEDS - digit.leds[i], cmd.r, cmd.g,
cmd.b); cmd.b);
} }
} else if (cmd.mode == LED_CMD_PROGRESS) {
uint32_t lit = ((uint32_t)cmd.progress * RING_LEDS + 50) / 100;
if (lit > RING_LEDS) {
lit = RING_LEDS;
}
for (uint32_t i = 0; i < lit; i++) {
led_strip_set_pixel(led_ring, i, cmd.r, cmd.g, cmd.b);
}
} }
led_strip_refresh(led_ring); led_strip_refresh(led_ring);
} }

View File

@ -1,11 +1,18 @@
#include <stdint.h> #include <stdint.h>
typedef enum { LED_CMD_CLEAR, LED_CMD_SET_DIGIT, LED_CMD_SET_COLOR } led_mode_t; typedef enum {
LED_CMD_CLEAR,
LED_CMD_SET_DIGIT,
LED_CMD_SET_COLOR,
LED_CMD_PROGRESS
} led_mode_t;
typedef struct { typedef struct {
led_mode_t mode; led_mode_t mode;
uint8_t value; uint8_t value;
uint8_t r, g, b; uint8_t r, g, b;
uint8_t intensity;
uint8_t progress;
} led_command_t; } led_command_t;
void led_ring_send_command(led_command_t *cmd); void led_ring_send_command(led_command_t *cmd);

View File

@ -6,6 +6,7 @@
#include "cmd_version.h" #include "cmd_version.h"
#include "cmd_ota.h" #include "cmd_ota.h"
#include "cmd_ota_slave_progress.h" #include "cmd_ota_slave_progress.h"
#include "cmd_led_ring.h"
#include "esp_now_comm.h" #include "esp_now_comm.h"
#include "powerpod.h" #include "powerpod.h"
#include "driver/gpio.h" #include "driver/gpio.h"
@ -168,20 +169,13 @@ void app_main(void) {
cmd_client_info_register(); cmd_client_info_register();
cmd_accel_deadzone_register(); cmd_accel_deadzone_register();
cmd_espnow_unicast_test_register(); cmd_espnow_unicast_test_register();
cmd_led_ring_register();
cmd_ota_register(); cmd_ota_register();
cmd_ota_slave_progress_register(); cmd_ota_slave_progress_register();
} }
uint8_t current_digit = 10; ESP_LOGI(TAG, "LED ring: UART LED_RING commands only (no local demo loop)");
while (1) { while (1) {
led_command_t cmd = {.mode = LED_CMD_SET_DIGIT, vTaskDelay(portMAX_DELAY);
.value = current_digit,
.r = 5,
.g = 5,
.b = 0};
led_ring_send_command(&cmd);
current_digit = (current_digit + 1) % 11;
vTaskDelay(pdMS_TO_TICKS(500));
} }
} }

View File

@ -42,6 +42,12 @@ PB_BIND(alox_EspNowUnicastTestRequest, alox_EspNowUnicastTestRequest, AUTO)
PB_BIND(alox_EspNowUnicastTestResponse, alox_EspNowUnicastTestResponse, 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) PB_BIND(alox_OtaStartPayload, alox_OtaStartPayload, AUTO)

View File

@ -19,6 +19,7 @@ typedef enum _alox_MessageType {
alox_MessageType_CLIENT_INPUT = 5, alox_MessageType_CLIENT_INPUT = 5,
alox_MessageType_ACCEL_DEADZONE = 6, alox_MessageType_ACCEL_DEADZONE = 6,
alox_MessageType_ESPNOW_UNICAST_TEST = 7, alox_MessageType_ESPNOW_UNICAST_TEST = 7,
alox_MessageType_LED_RING = 8,
alox_MessageType_OTA_START = 16, alox_MessageType_OTA_START = 16,
alox_MessageType_OTA_PAYLOAD = 17, alox_MessageType_OTA_PAYLOAD = 17,
alox_MessageType_OTA_END = 18, alox_MessageType_OTA_END = 18,
@ -95,6 +96,28 @@ typedef struct _alox_EspNowUnicastTestResponse {
uint32_t seq; uint32_t seq;
} alox_EspNowUnicastTestResponse; } alox_EspNowUnicastTestResponse;
/* Host → device: LED ring display (progress bar, digit, or clear).
mode: 0=clear, 1=progress (0100 %), 2=digit (010, same layout as firmware digit maps). */
typedef struct _alox_LedRingProgressRequest {
uint32_t mode;
/* * 0100: fraction of ring LEDs to light (mode=progress) */
uint32_t progress;
/* * 010 (mode=digit) */
uint32_t digit;
uint32_t r;
uint32_t g;
uint32_t b;
/* * 0255 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). */ /* Host → device: begin UART OTA (erase inactive OTA slot; device replies OTA_STATUS). */
typedef struct _alox_OtaStartPayload { typedef struct _alox_OtaStartPayload {
uint32_t total_size; uint32_t total_size;
@ -163,6 +186,8 @@ typedef struct _alox_UartMessage {
alox_EspNowUnicastTestResponse espnow_unicast_test_response; alox_EspNowUnicastTestResponse espnow_unicast_test_response;
alox_OtaSlaveProgressRequest ota_slave_progress_request; alox_OtaSlaveProgressRequest ota_slave_progress_request;
alox_OtaSlaveProgressResponse ota_slave_progress_response; alox_OtaSlaveProgressResponse ota_slave_progress_response;
alox_LedRingProgressRequest led_ring_progress_request;
alox_LedRingProgressResponse led_ring_progress_response;
} payload; } payload;
} alox_UartMessage; } alox_UartMessage;
@ -195,6 +220,8 @@ extern "C" {
/* Initializer values for message structs */ /* Initializer values for message structs */
@ -210,6 +237,8 @@ extern "C" {
#define alox_AccelDeadzoneResponse_init_default {0, 0, 0, 0} #define alox_AccelDeadzoneResponse_init_default {0, 0, 0, 0}
#define alox_EspNowUnicastTestRequest_init_default {0, 0} #define alox_EspNowUnicastTestRequest_init_default {0, 0}
#define alox_EspNowUnicastTestResponse_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_OtaStartPayload_init_default {0}
#define alox_OtaPayload_init_default {0, {0, {0}}} #define alox_OtaPayload_init_default {0, {0, {0}}}
#define alox_OtaEndPayload_init_default {0} #define alox_OtaEndPayload_init_default {0}
@ -229,6 +258,8 @@ extern "C" {
#define alox_AccelDeadzoneResponse_init_zero {0, 0, 0, 0} #define alox_AccelDeadzoneResponse_init_zero {0, 0, 0, 0}
#define alox_EspNowUnicastTestRequest_init_zero {0, 0} #define alox_EspNowUnicastTestRequest_init_zero {0, 0}
#define alox_EspNowUnicastTestResponse_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_OtaStartPayload_init_zero {0}
#define alox_OtaPayload_init_zero {0, {0, {0}}} #define alox_OtaPayload_init_zero {0, {0, {0}}}
#define alox_OtaEndPayload_init_zero {0} #define alox_OtaEndPayload_init_zero {0}
@ -267,6 +298,17 @@ extern "C" {
#define alox_EspNowUnicastTestRequest_seq_tag 2 #define alox_EspNowUnicastTestRequest_seq_tag 2
#define alox_EspNowUnicastTestResponse_success_tag 1 #define alox_EspNowUnicastTestResponse_success_tag 1
#define alox_EspNowUnicastTestResponse_seq_tag 2 #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_OtaStartPayload_total_size_tag 1
#define alox_OtaPayload_seq_tag 1 #define alox_OtaPayload_seq_tag 1
#define alox_OtaPayload_data_tag 2 #define alox_OtaPayload_data_tag 2
@ -301,6 +343,8 @@ extern "C" {
#define alox_UartMessage_espnow_unicast_test_response_tag 14 #define alox_UartMessage_espnow_unicast_test_response_tag 14
#define alox_UartMessage_ota_slave_progress_request_tag 15 #define alox_UartMessage_ota_slave_progress_request_tag 15
#define alox_UartMessage_ota_slave_progress_response_tag 16 #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 */ /* Struct field encoding specification for nanopb */
#define alox_UartMessage_FIELDLIST(X, a) \ #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_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,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_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_CALLBACK NULL
#define alox_UartMessage_DEFAULT NULL #define alox_UartMessage_DEFAULT NULL
#define alox_UartMessage_payload_ack_payload_MSGTYPE alox_Ack #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_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_request_MSGTYPE alox_OtaSlaveProgressRequest
#define alox_UartMessage_payload_ota_slave_progress_response_MSGTYPE alox_OtaSlaveProgressResponse #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) \ #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_CALLBACK NULL
#define alox_EspNowUnicastTestResponse_DEFAULT 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) \ #define alox_OtaStartPayload_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, total_size, 1) X(a, STATIC, SINGULAR, UINT32, total_size, 1)
#define alox_OtaStartPayload_CALLBACK NULL #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_AccelDeadzoneResponse_msg;
extern const pb_msgdesc_t alox_EspNowUnicastTestRequest_msg; extern const pb_msgdesc_t alox_EspNowUnicastTestRequest_msg;
extern const pb_msgdesc_t alox_EspNowUnicastTestResponse_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_OtaStartPayload_msg;
extern const pb_msgdesc_t alox_OtaPayload_msg; extern const pb_msgdesc_t alox_OtaPayload_msg;
extern const pb_msgdesc_t alox_OtaEndPayload_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_AccelDeadzoneResponse_fields &alox_AccelDeadzoneResponse_msg
#define alox_EspNowUnicastTestRequest_fields &alox_EspNowUnicastTestRequest_msg #define alox_EspNowUnicastTestRequest_fields &alox_EspNowUnicastTestRequest_msg
#define alox_EspNowUnicastTestResponse_fields &alox_EspNowUnicastTestResponse_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_OtaStartPayload_fields &alox_OtaStartPayload_msg
#define alox_OtaPayload_fields &alox_OtaPayload_msg #define alox_OtaPayload_fields &alox_OtaPayload_msg
#define alox_OtaEndPayload_fields &alox_OtaEndPayload_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_ClientInput_size 22
#define alox_EspNowUnicastTestRequest_size 12 #define alox_EspNowUnicastTestRequest_size 12
#define alox_EspNowUnicastTestResponse_size 8 #define alox_EspNowUnicastTestResponse_size 8
#define alox_LedRingProgressRequest_size 42
#define alox_LedRingProgressResponse_size 20
#define alox_OtaEndPayload_size 0 #define alox_OtaEndPayload_size 0
#define alox_OtaPayload_size 209 #define alox_OtaPayload_size 209
#define alox_OtaSlaveProgressEntry_size 30 #define alox_OtaSlaveProgressEntry_size 30

View File

@ -13,6 +13,7 @@ enum MessageType {
CLIENT_INPUT = 5; CLIENT_INPUT = 5;
ACCEL_DEADZONE = 6; ACCEL_DEADZONE = 6;
ESPNOW_UNICAST_TEST = 7; ESPNOW_UNICAST_TEST = 7;
LED_RING = 8;
OTA_START = 16; OTA_START = 16;
OTA_PAYLOAD = 17; OTA_PAYLOAD = 17;
OTA_END = 18; OTA_END = 18;
@ -39,6 +40,8 @@ message UartMessage {
EspNowUnicastTestResponse espnow_unicast_test_response = 14; EspNowUnicastTestResponse espnow_unicast_test_response = 14;
OtaSlaveProgressRequest ota_slave_progress_request = 15; OtaSlaveProgressRequest ota_slave_progress_request = 15;
OtaSlaveProgressResponse ota_slave_progress_response = 16; 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; uint32 seq = 2;
} }
// Host device: LED ring display (progress bar, digit, or clear).
// mode: 0=clear, 1=progress (0100 %), 2=digit (010, same layout as firmware digit maps).
message LedRingProgressRequest {
uint32 mode = 1;
/** 0100: fraction of ring LEDs to light (mode=progress) */
uint32 progress = 2;
/** 010 (mode=digit) */
uint32 digit = 3;
uint32 r = 4;
uint32 g = 5;
uint32 b = 6;
/** 0255 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). // Host device: begin UART OTA (erase inactive OTA slot; device replies OTA_STATUS).
message OtaStartPayload { message OtaStartPayload {
uint32 total_size = 1; uint32 total_size = 1;