Compare commits

..

2 Commits

Author SHA1 Message Date
2e88358c53 Add feature development guide and fix ESP-NOW proto generation.
Document UART-to-ESP-NOW flow using Find me; align proto_generate_espnow with uart (python3, -I .).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 22:09:24 +02:00
efd6260201 Add find-me LED locate on master and slaves via ESP-NOW.
UART FIND_ME (client_id 0 = local ring, >0 = unicast), ESPNOW_FIND_ME payload, CLI/dashboard buttons per slave.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 22:04:07 +02:00
27 changed files with 1026 additions and 91 deletions

View File

@ -19,8 +19,8 @@ default:
@echo "Set PORT=$(PORT) (current) for goTool targets." @echo "Set PORT=$(PORT) (current) for goTool targets."
proto_generate_espnow: proto_generate_espnow:
cd main/proto && python ../../libs/nanopb/generator/nanopb_generator.py \ cd main/proto && python3 ../../libs/nanopb/generator/nanopb_generator.py \
-I ../../libs/nanopb/generator/proto esp_now_messages.proto -I . -I ../../libs/nanopb/generator/proto esp_now_messages.proto
proto_generate: proto_generate_uart proto_generate_espnow proto_generate: proto_generate_uart proto_generate_espnow

351
docs/adding-a-feature.md Normal file
View File

@ -0,0 +1,351 @@
# Feature hinzufügen — von UART bis ESP-NOW
Dieser Guide beschreibt die **komplette Kette** am Beispiel **Find me** (Commit `efd6260`): Host sendet ein UART-Kommando an den Master, der die Aktion lokal ausführt oder per ESP-NOW an einen Slave weiterleitet.
## Architektur (Überblick)
```mermaid
sequenceDiagram
participant Host as Host (goTool / Dashboard)
participant Master as Master (UART + ESP-NOW)
participant Slave as Slave (ESP-NOW)
Host->>Master: UART-Frame [cmd_id + UartMessage protobuf]
Master->>Master: cmd_* Handler (Queue)
alt client_id == 0
Master->>Master: z.B. led_ring_find_me()
else client_id > 0
Master->>Slave: ESP-NOW EspNowMessage (unicast)
Slave->>Slave: esp_now_recv_cb → Handler
end
Master->>Host: UART-Response (UartMessage)
```
| Schicht | Dateien | Rolle |
|---------|---------|--------|
| Schema UART | `main/proto/uart_messages.proto` | `MessageType`, Request/Response für Host ↔ Master |
| Schema ESP-NOW | `main/proto/esp_now_messages.proto` | Master ↔ Slave (ohne UART) |
| Transport UART | `main/uart.c`, `goTool/uart/` | Rahmen `0xAA … 0xCC`, Byte 0 = Command-ID |
| Dispatch | `main/cmd_handler.c`, `main/uart_cmd.c` | Queue + `uart_cmd_register()` |
| Master-Logik | `main/cmd_*.c` | Decode, Registry, ESP-NOW senden |
| ESP-NOW | `main/esp_now_comm.c` | Encode/Decode, Send, Slave-`recv_cb` |
| Geräte-Funktion | z.B. `main/led_ring.c` | Wiederverwendbare Aktion (Master + Slave) |
| Host | `goTool/cmd_*.go`, `api_serve.go`, `webui/` | CLI, HTTP, UI |
**Wichtig:** UART-Befehle laufen auf dem **Master** (nur wenn `app_config.master`). Slaves haben keinen UART-Command-Handler; sie reagieren auf **ESP-NOW**. Die eigentliche Wirkung (LED, Sensor, …) liegt in gemeinsamen Modulen (`led_ring`, `bosch456`, …).
---
## Wann braucht man was?
| Ziel | UART (`uart_messages.proto`) | ESP-NOW (`esp_now_messages.proto`) |
|------|------------------------------|-------------------------------------|
| Nur Master (angeschlossener Pod) | Ja | Nein |
| Einen registrierten Slave ansteuern | Ja (Master leitet weiter) | Ja |
| Slave → Master Rückmeldung | Optional (UART-Status) | Ja, wenn Slave antworten soll |
**Find me:** UART `FIND_ME` mit `client_id`; `0` = Master-Ring, `>0` = Unicast `ESPNOW_FIND_ME` an die Slave-MAC aus der Registry.
Referenz für **nur ESP-NOW-Weiterleitung ohne lokale Wirkung:** `cmd_espnow_unicast_test.c`
Referenz für **Master lokal + Slave + `client_id`:** `cmd_espnow_find_me.c`, `cmd_accel_deadzone.c`
---
## Schritt 1 — Protobuf (UART)
Datei: `main/proto/uart_messages.proto`
1. **Neue ID** in `enum MessageType` (freie Nummer wählen, z.B. `22`):
```protobuf
FIND_ME = 22;
```
2. **Request/Response** definieren und im `UartMessage`-`oneof` eintragen (neue Feldnummern, nicht wiederverwenden):
```protobuf
message EspNowFindMeRequest {
uint32 client_id = 1;
}
message EspNowFindMeResponse {
bool success = 1;
uint32 client_id = 2;
}
// in message UartMessage { oneof payload { …
EspNowFindMeRequest espnow_find_me_request = 19;
EspNowFindMeResponse espnow_find_me_response = 20;
}
```
3. **Generieren:**
```bash
make proto_generate_uart
make gotool-proto
```
Erzeugt u.a. `main/proto/uart_messages.pb.h`, `.pb.c` und `goTool/pb/uart_messages.pb.go`.
---
## Schritt 2 — Protobuf (ESP-NOW), falls Slaves betroffen
Datei: `main/proto/esp_now_messages.proto`
1. Neuer Wert in `enum EspNowMessageType`:
```protobuf
ESPNOW_FIND_ME = 10;
```
2. Payload-Nachricht + Eintrag im `EspNowMessage`-`oneof`:
```protobuf
message EspNowFindMe {
uint32 client_id = 1; // 0 = alle; sonst nur passende slave_id
}
// EspNowMessage.oneof:
EspNowFindMe find_me = 11;
```
3. **Generieren:**
```bash
make proto_generate_espnow
# oder: make proto_generate
```
**Hinweis:** Master und alle Slaves müssen dieselbe ESP-NOW-Proto-Version flashen, sobald sich `esp_now_messages.proto` ändert.
---
## Schritt 3 — Geräte-Logik (gemeinsam)
Funktion, die auf **Master und Slave** gleich wirken soll, gehört **nicht** in den UART-Handler, sondern in ein Modul (z.B. `led_ring`).
Find me:
- `led_ring_find_me()` in `led_ring.c` — sequenz `LED_CMD_FIND_ME` (3× rot/grün/blau, volle Helligkeit)
- Optional separater UART-Pfad nur für Ring-Steuerung: `LED_RING` mode `4` in `cmd_led_ring.c` (ohne ESP-NOW)
---
## Schritt 4 — UART-Command-Handler (nur Master)
Neue Dateien: `main/cmd_espnow_find_me.c`, `main/cmd_espnow_find_me.h`
Muster (gekürzt):
```c
static void reply(bool success, uint32_t client_id) {
alox_UartMessage response;
uart_cmd_init_response(&response, alox_MessageType_FIND_ME,
alox_UartMessage_espnow_find_me_response_tag);
response.payload.espnow_find_me_response.success = success;
response.payload.espnow_find_me_response.client_id = client_id;
uart_cmd_send(&response, TAG);
}
static void handle_find_me(const uint8_t *data, size_t len) {
alox_UartMessage uart_msg;
if (uart_cmd_decode(data, len, &uart_msg) != ESP_OK) { … }
const alox_EspNowFindMeRequest *req = UART_CMD_REQ(
&uart_msg, alox_UartMessage_espnow_find_me_request_tag,
espnow_find_me_request);
if (req == NULL) { … }
if (req->client_id == 0) {
led_ring_find_me(); // lokal
reply(true, 0);
return;
}
const client_info_t *client = client_registry_find_by_id(req->client_id);
if (client == NULL) { reply(false, req->client_id); return; }
esp_err_t err = esp_now_comm_send_find_me(client->mac, req->client_id);
reply(err == ESP_OK, req->client_id);
}
void cmd_espnow_find_me_register(void) {
uart_cmd_register(alox_MessageType_FIND_ME, handle_find_me);
}
```
Hilfs-APIs (`uart_cmd.h`):
| API | Zweck |
|-----|--------|
| `uart_cmd_decode()` | Protobuf-Body (ohne führendes Command-Byte) dekodieren |
| `UART_CMD_REQ()` | Sicheres Lesen des `oneof`-Zweigs |
| `uart_cmd_init_response()` | Response-Typ + `which_payload` setzen |
| `uart_cmd_send()` | Antwort UART raus |
**Registrierung** in `main/powerpod.c` (nur im `if (app_config.master)`-Block):
```c
cmd_espnow_find_me_register();
```
**Build:** `main/CMakeLists.txt``"cmd_espnow_find_me.c"`
**Logging-Namen:** `main/cmd_handler.c``case alox_MessageType_FIND_ME: return "FIND_ME";`
### Ablauf UART intern
1. `uart_read_task` liest Frame, legt `msg_id = payload[0]` und Rest in Queue.
2. `vCmdDispatcherTask` ruft den registrierten Handler mit `data` = Bytes **nach** der ID auf.
3. Handler antwortet synchron über `uart_cmd_send` (die LED-Animation läuft danach im `led_task` weiter).
---
## Schritt 5 — ESP-NOW senden (Master)
In `main/esp_now_comm.c`:
1. **Statische Sendefunktion** (wie `send_unicast_test`):
```c
static esp_err_t send_find_me(const uint8_t *dest_mac, uint32_t client_id) {
alox_EspNowMessage msg = alox_EspNowMessage_init_zero;
msg.type = alox_EspNowMessageType_ESPNOW_FIND_ME;
msg.which_payload = alox_EspNowMessage_find_me_tag;
msg.payload.find_me.client_id = client_id;
return send_message(dest_mac, &msg);
}
```
2. **Öffentliche API** in `esp_now_comm.h` / `.c`:
```c
esp_err_t esp_now_comm_send_find_me(const uint8_t mac[CLIENT_MAC_LEN],
uint32_t client_id);
```
Prüfungen: `mac != NULL`, `s_config.master`, Peer per `ensure_peer()` (passiert in `send_message`).
---
## Schritt 6 — ESP-NOW empfangen (Slave)
Im Slave-Zweig von `espnow_recv_cb` (`!s_config.master`):
1. Handler-Funktion, typisch mit **Master-MAC-Check** und **`client_id`-Filter** (wie Deadzone):
```c
static void handle_slave_find_me(const uint8_t *master_mac,
const alox_EspNowFindMe *req) {
uint32_t my_id = s_own_mac[5];
if (req->client_id != 0 && req->client_id != my_id) return;
if (s_slave_joined && !mac_equal(master_mac, s_master_mac)) return;
led_ring_find_me();
}
```
2. Im `switch (msg.which_payload)`:
```c
case alox_EspNowMessage_find_me_tag:
if (!s_slave_joined || !mac_equal(info->src_addr, s_master_mac)) break;
handle_slave_find_me(info->src_addr, &msg.payload.find_me);
break;
```
Slaves führen `led_ring_init()` in `powerpod.c` ebenfalls aus — Ring-Hardware ist auf beiden Rollen vorhanden.
---
## Schritt 7 — Host (goTool)
### CLI
`goTool/cmd_find_me.go`:
- `UartMessage` mit `Type: MessageType_FIND_ME` und `EspnowFindMeRequest`
- Payload = `[byte(MessageType_FIND_ME)] + proto.Marshal(msg)`
- `exchangePayload` → Response dekodieren
`main.go`: Command `find-me` registrieren, `-port` Pflicht.
```bash
go run . -port /dev/ttyUSB0 find-me
go run . -port /dev/ttyUSB0 find-me -client 16
```
### Dashboard / HTTP
1. `managedSerial.FindMe(clientID)` in `client_api.go` (UART-Serial mutex wie andere Befehle).
2. `POST /api/find-me` mit `{"client_id": 0}` in `api_serve.go`.
3. Button in `goTool/webui/index.html` (Master + pro Slave-Zeile).
### Serial-Format (Host)
Entspricht `main/README.md`:
| Byte | Inhalt |
|------|--------|
| Frame | `0xAA`, Länge, Payload, XOR-Checksum, `0xCC` |
| Payload[0] | `MessageType` (z.B. `22` = FIND_ME) |
| Payload[1…] | Nanopb-`UartMessage` |
---
## Schritt 8 — Dokumentation & Test
1. **`main/README.md`:** Zeile in UART-Tabelle, ggf. ESP-NOW-Tabelle, eigener Abschnitt mit Beispiel-`go run`.
2. **`goTool/README.md`:** Command-Tabelle + HTTP-API.
3. **Build:**
```bash
make proto_generate
cd goTool && go build .
idf.py build
```
4. **Manuell testen:**
| Test | Erwartung |
|------|-----------|
| `find-me` (client 0) | Master-Ring blinkt RGB |
| `find-me -client <id>` | Nur dieser Slave blinkt; Log Master: `unicast FIND_ME` |
| Slave offline / unbekannte ID | `success=false` in UART-Response |
| Dashboard-Buttons | Gleiches Verhalten wie CLI |
---
## Checkliste (Kurz)
- [ ] `uart_messages.proto`: `MessageType`, Request, Response, `oneof`
- [ ] `esp_now_messages.proto` (falls Slave): `EspNowMessageType`, Message, `oneof`
- [ ] `make proto_generate` + `make gotool-proto`
- [ ] Geräte-Modul (z.B. `led_ring_*`)
- [ ] `cmd_*.c` + `uart_cmd_register`
- [ ] `esp_now_comm`: `send_*` + Slave-`recv` case
- [ ] `CMakeLists.txt`, `powerpod.c`, `cmd_handler.c` Name
- [ ] goTool: CLI, `client_api`, optional `api_serve` + WebUI
- [ ] README aktualisieren
- [ ] Master + Slave flashen bei ESP-NOW-Proto-Änderung
---
## Referenz-Dateien (Find me)
| Bereich | Datei |
|---------|--------|
| UART Proto | `main/proto/uart_messages.proto` |
| ESP-NOW Proto | `main/proto/esp_now_messages.proto` |
| UART Handler | `main/cmd_espnow_find_me.c` |
| ESP-NOW | `main/esp_now_comm.c`, `main/esp_now_comm.h` |
| LED | `main/led_ring.c`, `main/led_ring.h` |
| Host CLI | `goTool/cmd_find_me.go` |
| HTTP/UI | `goTool/api_serve.go`, `goTool/webui/index.html` |
Ähnliche Features zum Abgucken:
- **Nur Master, kein ESP-NOW:** `cmd_version.c`, `cmd_led_ring.c`
- **Nur Slave per ESP-NOW (Master leitet nur durch):** `cmd_espnow_unicast_test.c`
- **Master + alle Slaves / Filter:** `cmd_accel_deadzone.c`
- **Großer ESP-NOW-Fluss mit Status:** `ota_espnow.c`, `cmd_ota.c`

View File

@ -29,10 +29,13 @@ 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\|blink`, `-progress`, `-digit`, RGB, `-intensity` (0 = ~5 %), `-blink-ms`, `-blink-count` | | `led-ring` | 8 | LED ring: `-mode clear\|progress\|digit\|blink\|find-me`, … |
| `find-me` | 22 | Locate pod (`-client 0` master, `>0` slave via ESP-NOW) |
`clients` requires slaves to have responded to master discover broadcasts first. `clients` requires slaves to have responded to master discover broadcasts first.
For adding commands end-to-end (UART, ESP-NOW, CLI, dashboard), see **[docs/adding-a-feature.md](../docs/adding-a-feature.md)** (Find me example).
### Automated tests ### Automated tests
Bench **configs** (`testdata/configs/`) list network, MACs, and serial ports (`uart.master` for commands, `*_console` for esptool reset). **Scenarios** run UART commands plus optional `reset` steps. Bench **configs** (`testdata/configs/`) list network, MACs, and serial ports (`uart.master` for commands, `*_console` for esptool reset). **Scenarios** run UART commands plus optional `reset` steps.
@ -70,7 +73,7 @@ The dashboard can configure nodes using the same UART commands as the CLI:
| Alle Slaves | per-slave ESP-NOW (Master bleibt unverändert; CLI `-all` setzt auch den Master) | | Alle Slaves | per-slave ESP-NOW (Master bleibt unverändert; CLI `-all` setzt auch den Master) |
| Unicast test | `unicast-test -client ID` | | Unicast test | `unicast-test -client ID` |
HTTP API (used by the web UI): `GET/POST /api/deadzone`, `POST /api/unicast-test`, `POST /api/ota` (multipart field `firmware`, max 2 MiB). HTTP API (used by the web UI): `GET/POST /api/deadzone`, `POST /api/unicast-test`, `POST /api/find-me`, `POST /api/ota` (multipart field `firmware`, max 2 MiB).
| UI / API | Behaviour | | UI / API | Behaviour |
|----------|-----------| |----------|-----------|

View File

@ -40,6 +40,16 @@ type unicastAPIResponse struct {
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
type findMeAPIRequest struct {
ClientID uint32 `json:"client_id"`
}
type findMeAPIResponse struct {
Success bool `json:"success"`
ClientID uint32 `json:"client_id,omitempty"`
Error string `json:"error,omitempty"`
}
type otaAPIResponse struct { type otaAPIResponse struct {
Success bool `json:"success"` Success bool `json:"success"`
BytesWritten uint32 `json:"bytes_written,omitempty"` BytesWritten uint32 `json:"bytes_written,omitempty"`
@ -65,6 +75,13 @@ func mountServeAPI(mux *http.ServeMux, link *managedSerial, hub *wsHub) {
} }
serveUnicastTest(w, r, link) serveUnicastTest(w, r, link)
}) })
mux.HandleFunc("/api/find-me", func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
return
}
serveFindMe(w, r, link)
})
mux.HandleFunc("/api/ota", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/api/ota", func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost { if r.Method != http.MethodPost {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed) http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
@ -216,6 +233,22 @@ func applyDeadzoneToSlaves(link *managedSerial, deadzone uint32) (uint32, error)
return updated, nil return updated, nil
} }
func serveFindMe(w http.ResponseWriter, r *http.Request, link *managedSerial) {
var body findMeAPIRequest
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
writeJSON(w, http.StatusBadRequest, findMeAPIResponse{Error: "invalid JSON"})
return
}
if err := link.FindMe(body.ClientID); err != nil {
writeJSON(w, http.StatusServiceUnavailable, findMeAPIResponse{
ClientID: body.ClientID,
Error: err.Error(),
})
return
}
writeJSON(w, http.StatusOK, findMeAPIResponse{Success: true, ClientID: body.ClientID})
}
func serveUnicastTest(w http.ResponseWriter, r *http.Request, link *managedSerial) { func serveUnicastTest(w http.ResponseWriter, r *http.Request, link *managedSerial) {
var body unicastAPIRequest var body unicastAPIRequest
if err := json.NewDecoder(r.Body).Decode(&body); err != nil { if err := json.NewDecoder(r.Body).Decode(&body); err != nil {

View File

@ -172,6 +172,12 @@ func (s *serialPort) espnowUnicastTest(clientID, seq uint32) (*pb.EspNowUnicastT
return r, nil return r, nil
} }
func (m *managedSerial) FindMe(clientID uint32) error {
return m.withPort(func(sp *serialPort) error {
return runFindMeClient(sp, clientID)
})
}
func (s *serialPort) ledRingProgress(req *pb.LedRingProgressRequest) (*pb.LedRingProgressResponse, error) { func (s *serialPort) ledRingProgress(req *pb.LedRingProgressRequest) (*pb.LedRingProgressResponse, error) {
msg := &pb.UartMessage{ msg := &pb.UartMessage{
Type: pb.MessageType_LED_RING, Type: pb.MessageType_LED_RING,

61
goTool/cmd_find_me.go Normal file
View File

@ -0,0 +1,61 @@
package main
import (
"flag"
"fmt"
"google.golang.org/protobuf/proto"
"powerpod/gotool/pb"
)
func runFindMe(sp *serialPort, args []string) error {
fs := flag.NewFlagSet("find-me", flag.ExitOnError)
clientID := fs.Uint("client", 0, "0=master LED ring, >0=ESP-NOW unicast to slave id")
if err := fs.Parse(args); err != nil {
return err
}
return runFindMeClient(sp, uint32(*clientID))
}
func runFindMeClient(sp *serialPort, clientID uint32) error {
resp, err := sp.espnowFindMe(clientID)
if err != nil {
return err
}
if !resp.GetSuccess() {
return fmt.Errorf("find-me rejected (client_id=%d)", resp.GetClientId())
}
if clientID == 0 {
fmt.Println("find-me started on master")
} else {
fmt.Printf("find-me sent to slave %d\n", clientID)
}
return nil
}
func (s *serialPort) espnowFindMe(clientID uint32) (*pb.EspNowFindMeResponse, error) {
msg := &pb.UartMessage{
Type: pb.MessageType_FIND_ME,
Payload: &pb.UartMessage_EspnowFindMeRequest{
EspnowFindMeRequest: &pb.EspNowFindMeRequest{ClientId: clientID},
},
}
body, err := proto.Marshal(msg)
if err != nil {
return nil, fmt.Errorf("encode: %w", err)
}
payload := append([]byte{byte(pb.MessageType_FIND_ME)}, body...)
respPayload, err := s.exchangePayload(payload, "FIND_ME")
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.GetEspnowFindMeResponse()
if r == nil {
return nil, fmt.Errorf("missing espnow_find_me_response")
}
return r, nil
}

View File

@ -12,11 +12,12 @@ const (
ledRingModeProgress = 1 ledRingModeProgress = 1
ledRingModeDigit = 2 ledRingModeDigit = 2
ledRingModeBlink = 3 ledRingModeBlink = 3
ledRingModeFindMe = 4
) )
func runLedRing(sp *serialPort, args []string) error { func runLedRing(sp *serialPort, args []string) error {
fs := flag.NewFlagSet("led-ring", flag.ExitOnError) fs := flag.NewFlagSet("led-ring", flag.ExitOnError)
mode := fs.String("mode", "progress", "clear, progress, digit, or blink") mode := fs.String("mode", "progress", "clear, progress, digit, blink, or find-me")
progress := fs.Uint("progress", 0, "fill level 0100 (mode=progress)") progress := fs.Uint("progress", 0, "fill level 0100 (mode=progress)")
digit := fs.Uint("digit", 0, "digit 010 (mode=digit)") digit := fs.Uint("digit", 0, "digit 010 (mode=digit)")
r := fs.Uint("r", 0, "red 0255") r := fs.Uint("r", 0, "red 0255")
@ -39,8 +40,10 @@ func runLedRing(sp *serialPort, args []string) error {
modeVal = ledRingModeDigit modeVal = ledRingModeDigit
case "blink": case "blink":
modeVal = ledRingModeBlink modeVal = ledRingModeBlink
case "find-me", "find_me", "findme":
modeVal = ledRingModeFindMe
default: default:
return fmt.Errorf("unknown -mode %q (clear, progress, digit, blink)", *mode) return fmt.Errorf("unknown -mode %q (clear, progress, digit, blink, find-me)", *mode)
} }
resp, err := sp.ledRingProgress(&pb.LedRingProgressRequest{ resp, err := sp.ledRingProgress(&pb.LedRingProgressRequest{

View File

@ -21,7 +21,8 @@ func usage() {
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") 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") fmt.Fprintf(os.Stderr, " led-ring set LED ring progress bar (0100%%, rgb, intensity)\n")
fmt.Fprintf(os.Stderr, " find-me blink LED ring red/green/blue (3× each, full brightness)\n\n")
flag.PrintDefaults() flag.PrintDefaults()
} }
@ -48,7 +49,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", "led-ring", "led_ring", "ota", "ota-progress", "ota_progress": case "version", "clients", "client-info", "deadzone", "accel-deadzone", "unicast-test", "unicast_test", "led-ring", "led_ring", "find-me", "find_me", "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()
@ -70,6 +71,8 @@ func main() {
runErr = runUnicastTest(sp, flag.Args()[1:]) runErr = runUnicastTest(sp, flag.Args()[1:])
case "led-ring", "led_ring": case "led-ring", "led_ring":
runErr = runLedRing(sp, flag.Args()[1:]) runErr = runLedRing(sp, flag.Args()[1:])
case "find-me", "find_me":
runErr = runFindMe(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

@ -39,6 +39,7 @@ const (
MessageType_OTA_STATUS MessageType = 19 MessageType_OTA_STATUS MessageType = 19
MessageType_OTA_START_ESPNOW MessageType = 20 MessageType_OTA_START_ESPNOW MessageType = 20
MessageType_OTA_SLAVE_PROGRESS MessageType = 21 MessageType_OTA_SLAVE_PROGRESS MessageType = 21
MessageType_FIND_ME MessageType = 22
) )
// Enum value maps for MessageType. // Enum value maps for MessageType.
@ -59,6 +60,7 @@ var (
19: "OTA_STATUS", 19: "OTA_STATUS",
20: "OTA_START_ESPNOW", 20: "OTA_START_ESPNOW",
21: "OTA_SLAVE_PROGRESS", 21: "OTA_SLAVE_PROGRESS",
22: "FIND_ME",
} }
MessageType_value = map[string]int32{ MessageType_value = map[string]int32{
"UNKNOWN": 0, "UNKNOWN": 0,
@ -76,6 +78,7 @@ var (
"OTA_STATUS": 19, "OTA_STATUS": 19,
"OTA_START_ESPNOW": 20, "OTA_START_ESPNOW": 20,
"OTA_SLAVE_PROGRESS": 21, "OTA_SLAVE_PROGRESS": 21,
"FIND_ME": 22,
} }
) )
@ -128,6 +131,8 @@ type UartMessage struct {
// *UartMessage_OtaSlaveProgressResponse // *UartMessage_OtaSlaveProgressResponse
// *UartMessage_LedRingProgressRequest // *UartMessage_LedRingProgressRequest
// *UartMessage_LedRingProgressResponse // *UartMessage_LedRingProgressResponse
// *UartMessage_EspnowFindMeRequest
// *UartMessage_EspnowFindMeResponse
Payload isUartMessage_Payload `protobuf_oneof:"payload"` Payload isUartMessage_Payload `protobuf_oneof:"payload"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -330,6 +335,24 @@ func (x *UartMessage) GetLedRingProgressResponse() *LedRingProgressResponse {
return nil return nil
} }
func (x *UartMessage) GetEspnowFindMeRequest() *EspNowFindMeRequest {
if x != nil {
if x, ok := x.Payload.(*UartMessage_EspnowFindMeRequest); ok {
return x.EspnowFindMeRequest
}
}
return nil
}
func (x *UartMessage) GetEspnowFindMeResponse() *EspNowFindMeResponse {
if x != nil {
if x, ok := x.Payload.(*UartMessage_EspnowFindMeResponse); ok {
return x.EspnowFindMeResponse
}
}
return nil
}
type isUartMessage_Payload interface { type isUartMessage_Payload interface {
isUartMessage_Payload() isUartMessage_Payload()
} }
@ -402,6 +425,14 @@ type UartMessage_LedRingProgressResponse struct {
LedRingProgressResponse *LedRingProgressResponse `protobuf:"bytes,18,opt,name=led_ring_progress_response,json=ledRingProgressResponse,proto3,oneof"` LedRingProgressResponse *LedRingProgressResponse `protobuf:"bytes,18,opt,name=led_ring_progress_response,json=ledRingProgressResponse,proto3,oneof"`
} }
type UartMessage_EspnowFindMeRequest struct {
EspnowFindMeRequest *EspNowFindMeRequest `protobuf:"bytes,19,opt,name=espnow_find_me_request,json=espnowFindMeRequest,proto3,oneof"`
}
type UartMessage_EspnowFindMeResponse struct {
EspnowFindMeResponse *EspNowFindMeResponse `protobuf:"bytes,20,opt,name=espnow_find_me_response,json=espnowFindMeResponse,proto3,oneof"`
}
func (*UartMessage_AckPayload) isUartMessage_Payload() {} func (*UartMessage_AckPayload) isUartMessage_Payload() {}
func (*UartMessage_EchoPayload) isUartMessage_Payload() {} func (*UartMessage_EchoPayload) isUartMessage_Payload() {}
@ -436,6 +467,10 @@ func (*UartMessage_LedRingProgressRequest) isUartMessage_Payload() {}
func (*UartMessage_LedRingProgressResponse) isUartMessage_Payload() {} func (*UartMessage_LedRingProgressResponse) isUartMessage_Payload() {}
func (*UartMessage_EspnowFindMeRequest) isUartMessage_Payload() {}
func (*UartMessage_EspnowFindMeResponse) 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
@ -1068,8 +1103,8 @@ func (x *EspNowUnicastTestResponse) GetSeq() uint32 {
return 0 return 0
} }
// Host → device: LED ring display (progress bar, digit, clear, or blink). // Host → device: LED ring display (progress bar, digit, clear, blink, or find-me).
// mode: 0=clear, 1=progress (0100 %), 2=digit (010), 3=blink full ring. // mode: 0=clear, 1=progress (0100 %), 2=digit (010), 3=blink full ring, 4=find-me (R/G/B ×3 @ full brightness).
type LedRingProgressRequest struct { type LedRingProgressRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Mode uint32 `protobuf:"varint,1,opt,name=mode,proto3" json:"mode,omitempty"` Mode uint32 `protobuf:"varint,1,opt,name=mode,proto3" json:"mode,omitempty"`
@ -1251,6 +1286,103 @@ func (x *LedRingProgressResponse) GetDigit() uint32 {
return 0 return 0
} }
// * Host → master: find-me on local ring (client_id=0) or ESP-NOW unicast to one slave.
type EspNowFindMeRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
ClientId uint32 `protobuf:"varint,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *EspNowFindMeRequest) Reset() {
*x = EspNowFindMeRequest{}
mi := &file_uart_messages_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *EspNowFindMeRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EspNowFindMeRequest) ProtoMessage() {}
func (x *EspNowFindMeRequest) ProtoReflect() protoreflect.Message {
mi := &file_uart_messages_proto_msgTypes[14]
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 EspNowFindMeRequest.ProtoReflect.Descriptor instead.
func (*EspNowFindMeRequest) Descriptor() ([]byte, []int) {
return file_uart_messages_proto_rawDescGZIP(), []int{14}
}
func (x *EspNowFindMeRequest) GetClientId() uint32 {
if x != nil {
return x.ClientId
}
return 0
}
type EspNowFindMeResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
ClientId uint32 `protobuf:"varint,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *EspNowFindMeResponse) Reset() {
*x = EspNowFindMeResponse{}
mi := &file_uart_messages_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *EspNowFindMeResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EspNowFindMeResponse) ProtoMessage() {}
func (x *EspNowFindMeResponse) ProtoReflect() protoreflect.Message {
mi := &file_uart_messages_proto_msgTypes[15]
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 EspNowFindMeResponse.ProtoReflect.Descriptor instead.
func (*EspNowFindMeResponse) Descriptor() ([]byte, []int) {
return file_uart_messages_proto_rawDescGZIP(), []int{15}
}
func (x *EspNowFindMeResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *EspNowFindMeResponse) GetClientId() uint32 {
if x != nil {
return x.ClientId
}
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"`
@ -1261,7 +1393,7 @@ type OtaStartPayload struct {
func (x *OtaStartPayload) Reset() { func (x *OtaStartPayload) Reset() {
*x = OtaStartPayload{} *x = OtaStartPayload{}
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)
} }
@ -1273,7 +1405,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[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 {
@ -1286,7 +1418,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{14} return file_uart_messages_proto_rawDescGZIP(), []int{16}
} }
func (x *OtaStartPayload) GetTotalSize() uint32 { func (x *OtaStartPayload) GetTotalSize() uint32 {
@ -1307,7 +1439,7 @@ type OtaPayload struct {
func (x *OtaPayload) Reset() { func (x *OtaPayload) Reset() {
*x = OtaPayload{} *x = OtaPayload{}
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)
} }
@ -1319,7 +1451,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[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 {
@ -1332,7 +1464,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{15} return file_uart_messages_proto_rawDescGZIP(), []int{17}
} }
func (x *OtaPayload) GetSeq() uint32 { func (x *OtaPayload) GetSeq() uint32 {
@ -1358,7 +1490,7 @@ type OtaEndPayload struct {
func (x *OtaEndPayload) Reset() { func (x *OtaEndPayload) Reset() {
*x = OtaEndPayload{} *x = OtaEndPayload{}
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)
} }
@ -1370,7 +1502,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[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 {
@ -1383,7 +1515,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{16} return file_uart_messages_proto_rawDescGZIP(), []int{18}
} }
// Device → host status (also used as ACK after each 4 KiB written). // Device → host status (also used as ACK after each 4 KiB written).
@ -1400,7 +1532,7 @@ type OtaStatusPayload struct {
func (x *OtaStatusPayload) Reset() { func (x *OtaStatusPayload) Reset() {
*x = OtaStatusPayload{} *x = OtaStatusPayload{}
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)
} }
@ -1412,7 +1544,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[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 {
@ -1425,7 +1557,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{17} return file_uart_messages_proto_rawDescGZIP(), []int{19}
} }
func (x *OtaStatusPayload) GetStatus() uint32 { func (x *OtaStatusPayload) GetStatus() uint32 {
@ -1466,7 +1598,7 @@ type OtaSlaveProgressRequest struct {
func (x *OtaSlaveProgressRequest) Reset() { func (x *OtaSlaveProgressRequest) Reset() {
*x = OtaSlaveProgressRequest{} *x = OtaSlaveProgressRequest{}
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)
} }
@ -1478,7 +1610,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[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 {
@ -1491,7 +1623,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{18} return file_uart_messages_proto_rawDescGZIP(), []int{20}
} }
func (x *OtaSlaveProgressRequest) GetClientId() uint32 { func (x *OtaSlaveProgressRequest) GetClientId() uint32 {
@ -1515,7 +1647,7 @@ type OtaSlaveProgressEntry struct {
func (x *OtaSlaveProgressEntry) Reset() { func (x *OtaSlaveProgressEntry) Reset() {
*x = OtaSlaveProgressEntry{} *x = OtaSlaveProgressEntry{}
mi := &file_uart_messages_proto_msgTypes[19] mi := &file_uart_messages_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1527,7 +1659,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[19] mi := &file_uart_messages_proto_msgTypes[21]
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 {
@ -1540,7 +1672,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{19} return file_uart_messages_proto_rawDescGZIP(), []int{21}
} }
func (x *OtaSlaveProgressEntry) GetClientId() uint32 { func (x *OtaSlaveProgressEntry) GetClientId() uint32 {
@ -1591,7 +1723,7 @@ type OtaSlaveProgressResponse struct {
func (x *OtaSlaveProgressResponse) Reset() { func (x *OtaSlaveProgressResponse) Reset() {
*x = OtaSlaveProgressResponse{} *x = OtaSlaveProgressResponse{}
mi := &file_uart_messages_proto_msgTypes[20] mi := &file_uart_messages_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1603,7 +1735,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[20] mi := &file_uart_messages_proto_msgTypes[22]
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 {
@ -1616,7 +1748,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{20} return file_uart_messages_proto_rawDescGZIP(), []int{22}
} }
func (x *OtaSlaveProgressResponse) GetActive() bool { func (x *OtaSlaveProgressResponse) GetActive() bool {
@ -1658,8 +1790,7 @@ 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\"\xc4\n" + "\x13uart_messages.proto\x12\x04alox\x1a\fnanopb.proto\"\xeb\v\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" +
@ -1682,7 +1813,9 @@ const file_uart_messages_proto_rawDesc = "" +
"\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\x18otaSlaveProgressResponse\x12Y\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" + "\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" + "\x1aled_ring_progress_response\x18\x12 \x01(\v2\x1d.alox.LedRingProgressResponseH\x00R\x17ledRingProgressResponse\x12P\n" +
"\x16espnow_find_me_request\x18\x13 \x01(\v2\x19.alox.EspNowFindMeRequestH\x00R\x13espnowFindMeRequest\x12S\n" +
"\x17espnow_find_me_response\x18\x14 \x01(\v2\x1a.alox.EspNowFindMeResponseH\x00R\x14espnowFindMeResponseB\t\n" +
"\apayload\"\x05\n" + "\apayload\"\x05\n" +
"\x03Ack\"!\n" + "\x03Ack\"!\n" +
"\vEchoPayload\x12\x12\n" + "\vEchoPayload\x12\x12\n" +
@ -1741,7 +1874,12 @@ const file_uart_messages_proto_rawDesc = "" +
"\asuccess\x18\x01 \x01(\bR\asuccess\x12\x12\n" + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x12\n" +
"\x04mode\x18\x02 \x01(\rR\x04mode\x12\x1a\n" + "\x04mode\x18\x02 \x01(\rR\x04mode\x12\x1a\n" +
"\bprogress\x18\x03 \x01(\rR\bprogress\x12\x14\n" + "\bprogress\x18\x03 \x01(\rR\bprogress\x12\x14\n" +
"\x05digit\x18\x04 \x01(\rR\x05digit\"0\n" + "\x05digit\x18\x04 \x01(\rR\x05digit\"2\n" +
"\x13EspNowFindMeRequest\x12\x1b\n" +
"\tclient_id\x18\x01 \x01(\rR\bclientId\"M\n" +
"\x14EspNowFindMeResponse\x12\x18\n" +
"\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1b\n" +
"\tclient_id\x18\x02 \x01(\rR\bclientId\"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" +
@ -1772,7 +1910,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*\x83\x02\n" + "\x06slaves\x18\x05 \x03(\v2\x1b.alox.OtaSlaveProgressEntryB\x05\x92?\x02\x10\x10R\x06slaves*\x90\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" +
@ -1789,7 +1927,8 @@ const file_uart_messages_proto_rawDesc = "" +
"\n" + "\n" +
"OTA_STATUS\x10\x13\x12\x14\n" + "OTA_STATUS\x10\x13\x12\x14\n" +
"\x10OTA_START_ESPNOW\x10\x14\x12\x16\n" + "\x10OTA_START_ESPNOW\x10\x14\x12\x16\n" +
"\x12OTA_SLAVE_PROGRESS\x10\x15b\x06proto3" "\x12OTA_SLAVE_PROGRESS\x10\x15\x12\v\n" +
"\aFIND_ME\x10\x16b\x06proto3"
var ( var (
file_uart_messages_proto_rawDescOnce sync.Once file_uart_messages_proto_rawDescOnce sync.Once
@ -1804,7 +1943,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, 21) var file_uart_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 23)
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
@ -1821,13 +1960,15 @@ var file_uart_messages_proto_goTypes = []any{
(*EspNowUnicastTestResponse)(nil), // 12: alox.EspNowUnicastTestResponse (*EspNowUnicastTestResponse)(nil), // 12: alox.EspNowUnicastTestResponse
(*LedRingProgressRequest)(nil), // 13: alox.LedRingProgressRequest (*LedRingProgressRequest)(nil), // 13: alox.LedRingProgressRequest
(*LedRingProgressResponse)(nil), // 14: alox.LedRingProgressResponse (*LedRingProgressResponse)(nil), // 14: alox.LedRingProgressResponse
(*OtaStartPayload)(nil), // 15: alox.OtaStartPayload (*EspNowFindMeRequest)(nil), // 15: alox.EspNowFindMeRequest
(*OtaPayload)(nil), // 16: alox.OtaPayload (*EspNowFindMeResponse)(nil), // 16: alox.EspNowFindMeResponse
(*OtaEndPayload)(nil), // 17: alox.OtaEndPayload (*OtaStartPayload)(nil), // 17: alox.OtaStartPayload
(*OtaStatusPayload)(nil), // 18: alox.OtaStatusPayload (*OtaPayload)(nil), // 18: alox.OtaPayload
(*OtaSlaveProgressRequest)(nil), // 19: alox.OtaSlaveProgressRequest (*OtaEndPayload)(nil), // 19: alox.OtaEndPayload
(*OtaSlaveProgressEntry)(nil), // 20: alox.OtaSlaveProgressEntry (*OtaStatusPayload)(nil), // 20: alox.OtaStatusPayload
(*OtaSlaveProgressResponse)(nil), // 21: alox.OtaSlaveProgressResponse (*OtaSlaveProgressRequest)(nil), // 21: alox.OtaSlaveProgressRequest
(*OtaSlaveProgressEntry)(nil), // 22: alox.OtaSlaveProgressEntry
(*OtaSlaveProgressResponse)(nil), // 23: 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
@ -1836,26 +1977,28 @@ 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
15, // 6: alox.UartMessage.ota_start:type_name -> alox.OtaStartPayload 17, // 6: alox.UartMessage.ota_start:type_name -> alox.OtaStartPayload
16, // 7: alox.UartMessage.ota_payload:type_name -> alox.OtaPayload 18, // 7: alox.UartMessage.ota_payload:type_name -> alox.OtaPayload
17, // 8: alox.UartMessage.ota_end:type_name -> alox.OtaEndPayload 19, // 8: alox.UartMessage.ota_end:type_name -> alox.OtaEndPayload
18, // 9: alox.UartMessage.ota_status:type_name -> alox.OtaStatusPayload 20, // 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
19, // 14: alox.UartMessage.ota_slave_progress_request:type_name -> alox.OtaSlaveProgressRequest 21, // 14: alox.UartMessage.ota_slave_progress_request:type_name -> alox.OtaSlaveProgressRequest
21, // 15: alox.UartMessage.ota_slave_progress_response:type_name -> alox.OtaSlaveProgressResponse 23, // 15: alox.UartMessage.ota_slave_progress_response:type_name -> alox.OtaSlaveProgressResponse
13, // 16: alox.UartMessage.led_ring_progress_request:type_name -> alox.LedRingProgressRequest 13, // 16: alox.UartMessage.led_ring_progress_request:type_name -> alox.LedRingProgressRequest
14, // 17: alox.UartMessage.led_ring_progress_response:type_name -> alox.LedRingProgressResponse 14, // 17: alox.UartMessage.led_ring_progress_response:type_name -> alox.LedRingProgressResponse
5, // 18: alox.ClientInfoResponse.clients:type_name -> alox.ClientInfo 15, // 18: alox.UartMessage.espnow_find_me_request:type_name -> alox.EspNowFindMeRequest
7, // 19: alox.ClientInputResponse.clients:type_name -> alox.ClientInput 16, // 19: alox.UartMessage.espnow_find_me_response:type_name -> alox.EspNowFindMeResponse
20, // 20: alox.OtaSlaveProgressResponse.slaves:type_name -> alox.OtaSlaveProgressEntry 5, // 20: alox.ClientInfoResponse.clients:type_name -> alox.ClientInfo
21, // [21:21] is the sub-list for method output_type 7, // 21: alox.ClientInputResponse.clients:type_name -> alox.ClientInput
21, // [21:21] is the sub-list for method input_type 22, // 22: alox.OtaSlaveProgressResponse.slaves:type_name -> alox.OtaSlaveProgressEntry
21, // [21:21] is the sub-list for extension type_name 23, // [23:23] is the sub-list for method output_type
21, // [21:21] is the sub-list for extension extendee 23, // [23:23] is the sub-list for method input_type
0, // [0:21] is the sub-list for field type_name 23, // [23:23] is the sub-list for extension type_name
23, // [23:23] is the sub-list for extension extendee
0, // [0:23] is the sub-list for field type_name
} }
func init() { file_uart_messages_proto_init() } func init() { file_uart_messages_proto_init() }
@ -1881,6 +2024,8 @@ func file_uart_messages_proto_init() {
(*UartMessage_OtaSlaveProgressResponse)(nil), (*UartMessage_OtaSlaveProgressResponse)(nil),
(*UartMessage_LedRingProgressRequest)(nil), (*UartMessage_LedRingProgressRequest)(nil),
(*UartMessage_LedRingProgressResponse)(nil), (*UartMessage_LedRingProgressResponse)(nil),
(*UartMessage_EspnowFindMeRequest)(nil),
(*UartMessage_EspnowFindMeResponse)(nil),
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
@ -1888,7 +2033,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: 21, NumMessages: 23,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -227,6 +227,12 @@
:disabled="busy || !state.uart_connected"> :disabled="busy || !state.uart_connected">
Setzen Setzen
</button> </button>
<button type="button" class="btn btn-outline-warning btn-sm"
@click="findMe()"
:disabled="busy || !state.uart_connected"
title="LED-Ring: Rot/Grün/Blau je 3×">
Find me
</button>
</div> </div>
<p class="text-muted small mt-2 mb-0" x-show="!state.uart_connected"> <p class="text-muted small mt-2 mb-0" x-show="!state.uart_connected">
UART nicht verbunden — Eingabe gesperrt. UART nicht verbunden — Eingabe gesperrt.
@ -300,6 +306,12 @@
title="ESP-NOW Unicast-Test"> title="ESP-NOW Unicast-Test">
Test Test
</button> </button>
<button type="button" class="btn btn-outline-warning btn-sm"
@click="findMe(c.id)"
:disabled="busy || !state.uart_connected || !c.available"
title="LED-Ring Find me (ESP-NOW)">
Find me
</button>
</div> </div>
</td> </td>
</tr> </tr>
@ -726,6 +738,27 @@
} finally { } finally {
this.busy = false; this.busy = false;
} }
},
async findMe(clientId = 0) {
this.busy = true;
try {
const r = await fetch('/api/find-me', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ client_id: clientId })
});
const data = await r.json();
if (!r.ok || !data.success) {
this.flash(data.error || 'Find me fehlgeschlagen', false);
return;
}
const label = clientId === 0 ? 'Master' : `Slave ${clientId}`;
this.flash(`Find me gestartet (${label})`, true);
} catch (e) {
this.flash(String(e), false);
} finally {
this.busy = false;
}
} }
}; };
} }

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_espnow_find_me.c"
"cmd_led_ring.c" "cmd_led_ring.c"
"cmd_ota.c" "cmd_ota.c"
"cmd_ota_slave_progress.c" "cmd_ota_slave_progress.c"

View File

@ -110,6 +110,8 @@ Schema: `proto/esp_now_messages.proto`. Encode/decode: `esp_now_proto.c`. The ES
| `ESPNOW_SLAVE_INFO` | Slave → master | `EspNowSlavePresence` | | `ESPNOW_SLAVE_INFO` | Slave → master | `EspNowSlavePresence` |
| `ESPNOW_HEARTBEAT` | Slave → master | `EspNowSlavePresence` (same fields) | | `ESPNOW_HEARTBEAT` | Slave → master | `EspNowSlavePresence` (same fields) |
| `ESPNOW_SET_ACCEL_DEADZONE` | Master → slave | `EspNowAccelDeadzone` (`deadzone` LSB) | | `ESPNOW_SET_ACCEL_DEADZONE` | Master → slave | `EspNowAccelDeadzone` (`deadzone` LSB) |
| `ESPNOW_UNICAST_TEST` | Master → slave | `EspNowUnicastTest` (`seq`) |
| `ESPNOW_FIND_ME` | Master → slave | `EspNowFindMe` (`client_id` filter) — LED locate sequence |
| `ESPNOW_OTA_START` | Master → slave (unicast) | `EspNowOtaStart` (`total_size`) | | `ESPNOW_OTA_START` | Master → slave (unicast) | `EspNowOtaStart` (`total_size`) |
| `ESPNOW_OTA_PAYLOAD` | Master → slave | `EspNowOtaPayload` (`seq`, up to 200 B `data`) | | `ESPNOW_OTA_PAYLOAD` | Master → slave | `EspNowOtaPayload` (`seq`, up to 200 B `data`) |
| `ESPNOW_OTA_END` | Master → slave | `EspNowOtaEnd` | | `ESPNOW_OTA_END` | Master → slave | `EspNowOtaEnd` |
@ -210,6 +212,7 @@ Host and master speak nanopb-encoded `UartMessage` inside UART frames (byte 0 =
| 19 | `OTA_STATUS` | Device → host (prepare/ready/block ACK/success/failed) | | 19 | `OTA_STATUS` | Device → host (prepare/ready/block ACK/success/failed) |
| 20 | `OTA_START_ESPNOW` | Implemented — re-distribute staged image to slaves only | | 20 | `OTA_START_ESPNOW` | Implemented — re-distribute staged image to slaves only |
| 21 | `OTA_SLAVE_PROGRESS` | Implemented (`cmd_ota_slave_progress.c`) — query per-slave ESP-NOW OTA progress | | 21 | `OTA_SLAVE_PROGRESS` | Implemented (`cmd_ota_slave_progress.c`) — query per-slave ESP-NOW OTA progress |
| 22 | `FIND_ME` | Implemented (`cmd_espnow_find_me.c`) — `client_id=0` local ring, `>0` ESP-NOW to slave |
Regenerate C code: Regenerate C code:
@ -313,6 +316,19 @@ 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`.
### FIND_ME command
Locate a pod: the LED ring blinks **3× red, 3× green, 3× blue** at full brightness.
**Request:** framed `22` + `espnow_find_me_request` (`client_id`: `0` = master only, `>0` = ESP-NOW unicast to that slave).
**Response:** `espnow_find_me_response` (`success`, `client_id`).
```bash
go run . -port /dev/ttyUSB0 find-me
go run . -port /dev/ttyUSB0 find-me -client 16
```
### LED_RING command ### LED_RING command
Control the 95-LED ring from the host. The firmware **does not** animate digits locally; only UART updates the display. Control the 95-LED ring from the host. The firmware **does not** animate digits locally; only UART updates the display.
@ -321,7 +337,7 @@ Control the 95-LED ring from the host. The firmware **does not** animate digits
| Field | Meaning | | Field | Meaning |
|-------|---------| |-------|---------|
| `mode` | `0` = clear, `1` = progress bar, `2` = digit, `3` = blink full ring | | `mode` | `0` = clear, `1` = progress bar, `2` = digit, `3` = blink full ring, `4` = find-me (R/G/B ×3 @ full brightness) |
| `progress` | 0100 (% of ring lit, mode `1`) | | `progress` | 0100 (% of ring lit, mode `1`) |
| `digit` | 010 (mode `2`, same segment maps as built-in digits) | | `digit` | 010 (mode `2`, same segment maps as built-in digits) |
| `r`, `g`, `b` | Color 0255 | | `r`, `g`, `b` | Color 0255 |
@ -335,6 +351,9 @@ 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 digit -digit 7 -r 255 -g 200
go run . -port /dev/ttyUSB0 led-ring -mode clear go run . -port /dev/ttyUSB0 led-ring -mode clear
go run . -port /dev/ttyUSB0 led-ring -mode blink -g 255 -blink-count 2 go run . -port /dev/ttyUSB0 led-ring -mode blink -g 255 -blink-count 2
go run . -port /dev/ttyUSB0 find-me
go run . -port /dev/ttyUSB0 find-me -client 16
go run . -port /dev/ttyUSB0 led-ring -mode find-me
``` ```
### CLIENT_INFO command ### CLIENT_INFO command
@ -429,11 +448,18 @@ Target: ESP32-S3. Close serial monitor on the UART adapter port before running `
| `proto/*.pb.c/h` | Generated nanopb | | `proto/*.pb.c/h` | Generated nanopb |
| `CMakeLists.txt` | Sources, `esp_wifi`, drivers, git hash | | `CMakeLists.txt` | Sources, `esp_wifi`, drivers, git hash |
## Adding a new UART command ## Adding a new feature (UART → ESP-NOW)
1. Add or extend messages in `uart_messages.proto` and regenerate nanopb. End-to-end walkthrough (protobuf, master handler, ESP-NOW unicast to slaves, goTool, dashboard) with **Find me** as the worked example:
2. Create `cmd_*.c` with a handler; register with `uart_cmd_register(MessageType_…, handler)`.
3. Decode with `uart_cmd_decode()` / `UART_CMD_REQ()`; reply with `uart_cmd_init_response()` + `uart_cmd_send()`. **[docs/adding-a-feature.md](../docs/adding-a-feature.md)**
4. Extend `goTool` or another host client to send the matching frame.
Short checklist:
1. Add or extend messages in `uart_messages.proto` (and `esp_now_messages.proto` if slaves are involved); run `make proto_generate` and `make gotool-proto`.
2. Implement device logic in a shared module (e.g. `led_ring.c`), not only in the UART handler.
3. Create `cmd_*.c`, register with `uart_cmd_register()`; decode with `uart_cmd_decode()` / `UART_CMD_REQ()`; reply with `uart_cmd_init_response()` + `uart_cmd_send()`.
4. Master → slave: `esp_now_comm_send_*()` + slave branch in `espnow_recv_cb`.
5. Extend `goTool` (CLI, optional `/api/…` and web UI).
For ESP-NOW-driven PC updates later: map slave state to `ClientInfo` and send `CLIENT_INFO` over UART from the master. For ESP-NOW-driven PC updates later: map slave state to `ClientInfo` and send `CLIENT_INFO` over UART from the master.

64
main/cmd_espnow_find_me.c Normal file
View File

@ -0,0 +1,64 @@
#include "client_registry.h"
#include "cmd_espnow_find_me.h"
#include "esp_log.h"
#include "esp_now_comm.h"
#include "led_ring.h"
#include "uart_cmd.h"
static const char *TAG = "[FIND_ME]";
static void reply(bool success, uint32_t client_id) {
alox_UartMessage response;
uart_cmd_init_response(&response, alox_MessageType_FIND_ME,
alox_UartMessage_espnow_find_me_response_tag);
response.payload.espnow_find_me_response.success = success;
response.payload.espnow_find_me_response.client_id = client_id;
uart_cmd_send(&response, TAG);
}
static void handle_find_me(const uint8_t *data, size_t len) {
alox_UartMessage uart_msg;
if (uart_cmd_decode(data, len, &uart_msg) != ESP_OK) {
ESP_LOGW(TAG, "decode failed");
reply(false, 0);
return;
}
const alox_EspNowFindMeRequest *req = UART_CMD_REQ(
&uart_msg, alox_UartMessage_espnow_find_me_request_tag,
espnow_find_me_request);
if (req == NULL) {
ESP_LOGW(TAG, "missing find_me request");
reply(false, 0);
return;
}
if (req->client_id == 0) {
led_ring_find_me();
ESP_LOGI(TAG, "find-me on master");
reply(true, 0);
return;
}
const client_info_t *client = client_registry_find_by_id(req->client_id);
if (client == NULL) {
ESP_LOGW(TAG, "client id %lu not in registry",
(unsigned long)req->client_id);
reply(false, req->client_id);
return;
}
esp_err_t err = esp_now_comm_send_find_me(client->mac, req->client_id);
if (err == ESP_OK) {
ESP_LOGI(TAG, "find-me sent to slave %lu", (unsigned long)req->client_id);
} else {
ESP_LOGW(TAG, "find-me to slave %lu failed: %s",
(unsigned long)req->client_id, esp_err_to_name(err));
}
reply(err == ESP_OK, req->client_id);
}
void cmd_espnow_find_me_register(void) {
uart_cmd_register(alox_MessageType_FIND_ME, handle_find_me);
}

View File

@ -0,0 +1,6 @@
#ifndef CMD_ESPNOW_FIND_ME_H
#define CMD_ESPNOW_FIND_ME_H
void cmd_espnow_find_me_register(void);
#endif

View File

@ -44,6 +44,8 @@ static const char *message_type_name(uint16_t id) {
return "OTA_START_ESPNOW"; return "OTA_START_ESPNOW";
case alox_MessageType_OTA_SLAVE_PROGRESS: case alox_MessageType_OTA_SLAVE_PROGRESS:
return "OTA_SLAVE_PROGRESS"; return "OTA_SLAVE_PROGRESS";
case alox_MessageType_FIND_ME:
return "FIND_ME";
default: default:
return "UNKNOWN"; return "UNKNOWN";
} }

View File

@ -9,6 +9,7 @@ static const char *TAG = "[LED_RING_CMD]";
#define LED_RING_MODE_PROGRESS 1 #define LED_RING_MODE_PROGRESS 1
#define LED_RING_MODE_DIGIT 2 #define LED_RING_MODE_DIGIT 2
#define LED_RING_MODE_BLINK 3 #define LED_RING_MODE_BLINK 3
#define LED_RING_MODE_FIND_ME 4
static uint8_t clamp_u8(uint32_t v) { static uint8_t clamp_u8(uint32_t v) {
if (v > 255) { if (v > 255) {
@ -109,6 +110,12 @@ static void handle_led_ring(const uint8_t *data, size_t len) {
return; return;
} }
case LED_RING_MODE_FIND_ME:
led_ring_find_me();
ESP_LOGI(TAG, "find-me");
reply(true, mode, 0, 0);
return;
case LED_RING_MODE_BLINK: { case LED_RING_MODE_BLINK: {
cmd.mode = LED_CMD_BLINK; cmd.mode = LED_CMD_BLINK;
cmd.r = r; cmd.r = r;

View File

@ -1,6 +1,7 @@
#include "bosch456.h" #include "bosch456.h"
#include "client_registry.h" #include "client_registry.h"
#include "esp_now_comm.h" #include "esp_now_comm.h"
#include "led_ring.h"
#include "ota_espnow.h" #include "ota_espnow.h"
#include "esp_now_proto.h" #include "esp_now_proto.h"
#include "esp_err.h" #include "esp_err.h"
@ -171,6 +172,16 @@ static esp_err_t send_unicast_test(const uint8_t *dest_mac, uint32_t seq) {
return send_message(dest_mac, &msg); return send_message(dest_mac, &msg);
} }
static esp_err_t send_find_me(const uint8_t *dest_mac, uint32_t client_id) {
alox_EspNowMessage msg = alox_EspNowMessage_init_zero;
msg.type = alox_EspNowMessageType_ESPNOW_FIND_ME;
msg.which_payload = alox_EspNowMessage_find_me_tag;
msg.payload.find_me.client_id = client_id;
return send_message(dest_mac, &msg);
}
static esp_err_t send_ota_start(const uint8_t *dest_mac, uint32_t total_size) { static esp_err_t send_ota_start(const uint8_t *dest_mac, uint32_t total_size) {
alox_EspNowMessage msg = alox_EspNowMessage_init_zero; alox_EspNowMessage msg = alox_EspNowMessage_init_zero;
@ -261,6 +272,25 @@ bool esp_now_comm_get_master_mac(uint8_t mac_out[CLIENT_MAC_LEN]) {
return true; return true;
} }
esp_err_t esp_now_comm_send_find_me(const uint8_t mac[CLIENT_MAC_LEN],
uint32_t client_id) {
if (mac == NULL || !s_config.master) {
return ESP_ERR_INVALID_STATE;
}
char mac_str[18];
mac_to_str(mac, mac_str, sizeof(mac_str));
esp_err_t err = send_find_me(mac, client_id);
if (err == ESP_OK) {
ESP_LOGI(TAG, "unicast FIND_ME to %s client_id=%lu", mac_str,
(unsigned long)client_id);
} else {
ESP_LOGW(TAG, "unicast FIND_ME to %s failed: %s", mac_str,
esp_err_to_name(err));
}
return err;
}
esp_err_t esp_now_comm_send_unicast_test(const uint8_t mac[CLIENT_MAC_LEN], esp_err_t esp_now_comm_send_unicast_test(const uint8_t mac[CLIENT_MAC_LEN],
uint32_t seq) { uint32_t seq) {
if (mac == NULL || !s_config.master) { if (mac == NULL || !s_config.master) {
@ -330,6 +360,24 @@ static void handle_slave_unicast_test(const uint8_t *master_mac,
mac_str, (unsigned long)test->seq, (int)s_slave_joined); mac_str, (unsigned long)test->seq, (int)s_slave_joined);
} }
static void handle_slave_find_me(const uint8_t *master_mac,
const alox_EspNowFindMe *req) {
uint32_t my_id = s_own_mac[5];
if (req->client_id != 0 && req->client_id != my_id) {
return;
}
if (s_slave_joined && !mac_equal(master_mac, s_master_mac)) {
return;
}
char mac_str[18];
mac_to_str(master_mac, mac_str, sizeof(mac_str));
ESP_LOGI(TAG, "FIND_ME from master %s (id=%lu)", mac_str, (unsigned long)my_id);
led_ring_find_me();
}
static void handle_slave_accel_deadzone(const uint8_t *master_mac, static void handle_slave_accel_deadzone(const uint8_t *master_mac,
const alox_EspNowAccelDeadzone *cfg) { const alox_EspNowAccelDeadzone *cfg) {
uint32_t my_id = s_own_mac[5]; uint32_t my_id = s_own_mac[5];
@ -492,6 +540,12 @@ static void espnow_recv_cb(const esp_now_recv_info_t *info, const uint8_t *data,
case alox_EspNowMessage_accel_deadzone_tag: case alox_EspNowMessage_accel_deadzone_tag:
handle_slave_accel_deadzone(info->src_addr, &msg.payload.accel_deadzone); handle_slave_accel_deadzone(info->src_addr, &msg.payload.accel_deadzone);
break; break;
case alox_EspNowMessage_find_me_tag:
if (!s_slave_joined || !mac_equal(info->src_addr, s_master_mac)) {
break;
}
handle_slave_find_me(info->src_addr, &msg.payload.find_me);
break;
case alox_EspNowMessage_ota_start_tag: case alox_EspNowMessage_ota_start_tag:
case alox_EspNowMessage_ota_payload_tag: case alox_EspNowMessage_ota_payload_tag:
case alox_EspNowMessage_ota_end_tag: case alox_EspNowMessage_ota_end_tag:

View File

@ -15,6 +15,10 @@ esp_err_t esp_now_comm_send_accel_deadzone(const uint8_t mac[CLIENT_MAC_LEN],
esp_err_t esp_now_comm_send_unicast_test(const uint8_t mac[CLIENT_MAC_LEN], esp_err_t esp_now_comm_send_unicast_test(const uint8_t mac[CLIENT_MAC_LEN],
uint32_t seq); uint32_t seq);
/** Master: trigger find-me LED sequence on one slave. */
esp_err_t esp_now_comm_send_find_me(const uint8_t mac[CLIENT_MAC_LEN],
uint32_t client_id);
/** Master → slave OTA (unicast). */ /** Master → slave OTA (unicast). */
esp_err_t esp_now_comm_send_ota_start(const uint8_t mac[CLIENT_MAC_LEN], esp_err_t esp_now_comm_send_ota_start(const uint8_t mac[CLIENT_MAC_LEN],
uint32_t total_size); uint32_t total_size);

View File

@ -20,6 +20,9 @@ static led_strip_handle_t led_ring;
#define LED_RING_PIN 7 #define LED_RING_PIN 7
#define LED_RING_BLINK_ON_MS 350 #define LED_RING_BLINK_ON_MS 350
#define LED_RING_BLINK_OFF_MS 150 #define LED_RING_BLINK_OFF_MS 150
#define LED_RING_FIND_ME_ON_MS 300
#define LED_RING_FIND_ME_OFF_MS 150
#define LED_RING_FIND_ME_BLINKS_PER_COLOR 3
static QueueHandle_t led_queue; static QueueHandle_t led_queue;
@ -67,6 +70,21 @@ static void ring_fill_color(uint8_t r, uint8_t g, uint8_t b) {
} }
} }
static void ring_blink_scaled(uint8_t r, uint8_t g, uint8_t b, uint8_t intensity,
uint8_t count, uint16_t on_ms, uint16_t off_ms) {
led_ring_scale_rgb(&r, &g, &b, intensity);
for (uint8_t n = 0; n < count; n++) {
ring_fill_color(r, g, b);
led_strip_refresh(led_ring);
vTaskDelay(pdMS_TO_TICKS(on_ms));
led_strip_clear(led_ring);
led_strip_refresh(led_ring);
if (n + 1 < count) {
vTaskDelay(pdMS_TO_TICKS(off_ms));
}
}
}
void vTaskLedRing(void *pvParameters) { void vTaskLedRing(void *pvParameters) {
led_strip_config_t ring_config = { led_strip_config_t ring_config = {
.strip_gpio_num = LED_RING_PIN, .strip_gpio_num = LED_RING_PIN,
@ -109,15 +127,19 @@ void vTaskLedRing(void *pvParameters) {
} else if (cmd.mode == LED_CMD_BLINK) { } else if (cmd.mode == LED_CMD_BLINK) {
uint16_t on_ms = cmd.blink_ms > 0 ? cmd.blink_ms : LED_RING_BLINK_ON_MS; uint16_t on_ms = cmd.blink_ms > 0 ? cmd.blink_ms : LED_RING_BLINK_ON_MS;
uint8_t count = cmd.blink_count > 0 ? cmd.blink_count : 1; uint8_t count = cmd.blink_count > 0 ? cmd.blink_count : 1;
ring_blink_scaled(cmd.r, cmd.g, cmd.b, cmd.intensity, count, on_ms,
for (uint8_t n = 0; n < count; n++) { LED_RING_BLINK_OFF_MS);
ring_fill_color(r, g, b); continue;
led_strip_refresh(led_ring); } else if (cmd.mode == LED_CMD_FIND_ME) {
vTaskDelay(pdMS_TO_TICKS(on_ms)); static const struct {
led_strip_clear(led_ring); uint8_t r, g, b;
led_strip_refresh(led_ring); } colors[] = {{255, 0, 0}, {0, 255, 0}, {0, 0, 255}};
if (n + 1 < count) { for (size_t c = 0; c < sizeof(colors) / sizeof(colors[0]); c++) {
vTaskDelay(pdMS_TO_TICKS(LED_RING_BLINK_OFF_MS)); ring_blink_scaled(colors[c].r, colors[c].g, colors[c].b,
LED_RING_FULL_INTENSITY, LED_RING_FIND_ME_BLINKS_PER_COLOR,
LED_RING_FIND_ME_ON_MS, LED_RING_FIND_ME_OFF_MS);
if (c + 1 < sizeof(colors) / sizeof(colors[0])) {
vTaskDelay(pdMS_TO_TICKS(LED_RING_FIND_ME_OFF_MS));
} }
} }
continue; continue;
@ -195,3 +217,8 @@ void led_ring_blink_once(uint8_t r, uint8_t g, uint8_t b) {
void led_ring_ota_success(void) { led_ring_blink_once(0, 255, 0); } void led_ring_ota_success(void) { led_ring_blink_once(0, 255, 0); }
void led_ring_ota_failed(void) { led_ring_blink_once(255, 0, 0); } void led_ring_ota_failed(void) { led_ring_blink_once(255, 0, 0); }
void led_ring_find_me(void) {
led_command_t cmd = {.mode = LED_CMD_FIND_ME};
led_ring_send_command(&cmd);
}

View File

@ -5,13 +5,16 @@
/** Default RGB scale (~5 % of full brightness). */ /** Default RGB scale (~5 % of full brightness). */
#define LED_RING_DEFAULT_INTENSITY 13 #define LED_RING_DEFAULT_INTENSITY 13
/** Full brightness for find-me and similar alerts. */
#define LED_RING_FULL_INTENSITY 255
typedef enum { typedef enum {
LED_CMD_CLEAR, LED_CMD_CLEAR,
LED_CMD_SET_DIGIT, LED_CMD_SET_DIGIT,
LED_CMD_SET_COLOR, LED_CMD_SET_COLOR,
LED_CMD_PROGRESS, LED_CMD_PROGRESS,
LED_CMD_BLINK LED_CMD_BLINK,
LED_CMD_FIND_ME
} led_mode_t; } led_mode_t;
typedef struct { typedef struct {
@ -39,4 +42,7 @@ void led_ring_blink_once(uint8_t r, uint8_t g, uint8_t b);
void led_ring_ota_success(void); void led_ring_ota_success(void);
void led_ring_ota_failed(void); void led_ring_ota_failed(void);
/** Red / green / blue: 3 blinks each at full intensity. */
void led_ring_find_me(void);
#endif #endif

View File

@ -2,6 +2,7 @@
#include "cmd_handler.h" #include "cmd_handler.h"
#include "cmd_accel_deadzone.h" #include "cmd_accel_deadzone.h"
#include "cmd_espnow_unicast_test.h" #include "cmd_espnow_unicast_test.h"
#include "cmd_espnow_find_me.h"
#include "cmd_client_info.h" #include "cmd_client_info.h"
#include "cmd_version.h" #include "cmd_version.h"
#include "cmd_ota.h" #include "cmd_ota.h"
@ -169,6 +170,7 @@ 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_espnow_find_me_register();
cmd_led_ring_register(); cmd_led_ring_register();
cmd_ota_register(); cmd_ota_register();
cmd_ota_slave_progress_register(); cmd_ota_slave_progress_register();

View File

@ -9,6 +9,9 @@
PB_BIND(alox_EspNowUnicastTest, alox_EspNowUnicastTest, AUTO) PB_BIND(alox_EspNowUnicastTest, alox_EspNowUnicastTest, AUTO)
PB_BIND(alox_EspNowFindMe, alox_EspNowFindMe, AUTO)
PB_BIND(alox_EspNowDiscover, alox_EspNowDiscover, AUTO) PB_BIND(alox_EspNowDiscover, alox_EspNowDiscover, AUTO)

View File

@ -1,8 +1,8 @@
/* Automatically generated nanopb header */ /* Automatically generated nanopb header */
/* Generated by nanopb-1.0.0-dev */ /* Generated by nanopb-1.0.0-dev */
#ifndef PB_ALOX_MAIN_PROTO_ESP_NOW_MESSAGES_PB_H_INCLUDED #ifndef PB_ALOX_ESP_NOW_MESSAGES_PB_H_INCLUDED
#define PB_ALOX_MAIN_PROTO_ESP_NOW_MESSAGES_PB_H_INCLUDED #define PB_ALOX_ESP_NOW_MESSAGES_PB_H_INCLUDED
#include <pb.h> #include <pb.h>
#if PB_PROTO_HEADER_VERSION != 40 #if PB_PROTO_HEADER_VERSION != 40
@ -20,7 +20,8 @@ typedef enum _alox_EspNowMessageType {
alox_EspNowMessageType_ESPNOW_OTA_START = 6, alox_EspNowMessageType_ESPNOW_OTA_START = 6,
alox_EspNowMessageType_ESPNOW_OTA_PAYLOAD = 7, alox_EspNowMessageType_ESPNOW_OTA_PAYLOAD = 7,
alox_EspNowMessageType_ESPNOW_OTA_END = 8, alox_EspNowMessageType_ESPNOW_OTA_END = 8,
alox_EspNowMessageType_ESPNOW_OTA_STATUS = 9 alox_EspNowMessageType_ESPNOW_OTA_STATUS = 9,
alox_EspNowMessageType_ESPNOW_FIND_ME = 10
} alox_EspNowMessageType; } alox_EspNowMessageType;
/* Struct definitions */ /* Struct definitions */
@ -28,6 +29,12 @@ typedef struct _alox_EspNowUnicastTest {
uint32_t seq; uint32_t seq;
} alox_EspNowUnicastTest; } alox_EspNowUnicastTest;
/* * Master → slave: locate pod (LED ring R/G/B ×3 @ full brightness). */
typedef struct _alox_EspNowFindMe {
/* * 0 = any slave; otherwise only slave_id must match */
uint32_t client_id;
} alox_EspNowFindMe;
typedef struct _alox_EspNowDiscover { typedef struct _alox_EspNowDiscover {
uint32_t network; uint32_t network;
} alox_EspNowDiscover; } alox_EspNowDiscover;
@ -83,6 +90,7 @@ typedef struct _alox_EspNowMessage {
alox_EspNowOtaPayload ota_payload; alox_EspNowOtaPayload ota_payload;
alox_EspNowOtaEnd ota_end; alox_EspNowOtaEnd ota_end;
alox_EspNowOtaStatus ota_status; alox_EspNowOtaStatus ota_status;
alox_EspNowFindMe find_me;
} payload; } payload;
} alox_EspNowMessage; } alox_EspNowMessage;
@ -93,8 +101,9 @@ extern "C" {
/* Helper constants for enums */ /* Helper constants for enums */
#define _alox_EspNowMessageType_MIN alox_EspNowMessageType_ESPNOW_UNKNOWN #define _alox_EspNowMessageType_MIN alox_EspNowMessageType_ESPNOW_UNKNOWN
#define _alox_EspNowMessageType_MAX alox_EspNowMessageType_ESPNOW_OTA_STATUS #define _alox_EspNowMessageType_MAX alox_EspNowMessageType_ESPNOW_FIND_ME
#define _alox_EspNowMessageType_ARRAYSIZE ((alox_EspNowMessageType)(alox_EspNowMessageType_ESPNOW_OTA_STATUS+1)) #define _alox_EspNowMessageType_ARRAYSIZE ((alox_EspNowMessageType)(alox_EspNowMessageType_ESPNOW_FIND_ME+1))
@ -109,6 +118,7 @@ extern "C" {
/* Initializer values for message structs */ /* Initializer values for message structs */
#define alox_EspNowUnicastTest_init_default {0} #define alox_EspNowUnicastTest_init_default {0}
#define alox_EspNowFindMe_init_default {0}
#define alox_EspNowDiscover_init_default {0} #define alox_EspNowDiscover_init_default {0}
#define alox_EspNowSlavePresence_init_default {0, {{NULL}, NULL}, 0, 0, 0, 0} #define alox_EspNowSlavePresence_init_default {0, {{NULL}, NULL}, 0, 0, 0, 0}
#define alox_EspNowAccelDeadzone_init_default {0, 0} #define alox_EspNowAccelDeadzone_init_default {0, 0}
@ -118,6 +128,7 @@ extern "C" {
#define alox_EspNowOtaStatus_init_default {0, 0, 0} #define alox_EspNowOtaStatus_init_default {0, 0, 0}
#define alox_EspNowMessage_init_default {_alox_EspNowMessageType_MIN, 0, {alox_EspNowDiscover_init_default}} #define alox_EspNowMessage_init_default {_alox_EspNowMessageType_MIN, 0, {alox_EspNowDiscover_init_default}}
#define alox_EspNowUnicastTest_init_zero {0} #define alox_EspNowUnicastTest_init_zero {0}
#define alox_EspNowFindMe_init_zero {0}
#define alox_EspNowDiscover_init_zero {0} #define alox_EspNowDiscover_init_zero {0}
#define alox_EspNowSlavePresence_init_zero {0, {{NULL}, NULL}, 0, 0, 0, 0} #define alox_EspNowSlavePresence_init_zero {0, {{NULL}, NULL}, 0, 0, 0, 0}
#define alox_EspNowAccelDeadzone_init_zero {0, 0} #define alox_EspNowAccelDeadzone_init_zero {0, 0}
@ -129,6 +140,7 @@ extern "C" {
/* Field tags (for use in manual encoding/decoding) */ /* Field tags (for use in manual encoding/decoding) */
#define alox_EspNowUnicastTest_seq_tag 1 #define alox_EspNowUnicastTest_seq_tag 1
#define alox_EspNowFindMe_client_id_tag 1
#define alox_EspNowDiscover_network_tag 1 #define alox_EspNowDiscover_network_tag 1
#define alox_EspNowSlavePresence_network_tag 1 #define alox_EspNowSlavePresence_network_tag 1
#define alox_EspNowSlavePresence_mac_tag 2 #define alox_EspNowSlavePresence_mac_tag 2
@ -154,6 +166,7 @@ extern "C" {
#define alox_EspNowMessage_ota_payload_tag 8 #define alox_EspNowMessage_ota_payload_tag 8
#define alox_EspNowMessage_ota_end_tag 9 #define alox_EspNowMessage_ota_end_tag 9
#define alox_EspNowMessage_ota_status_tag 10 #define alox_EspNowMessage_ota_status_tag 10
#define alox_EspNowMessage_find_me_tag 11
/* Struct field encoding specification for nanopb */ /* Struct field encoding specification for nanopb */
#define alox_EspNowUnicastTest_FIELDLIST(X, a) \ #define alox_EspNowUnicastTest_FIELDLIST(X, a) \
@ -161,6 +174,11 @@ X(a, STATIC, SINGULAR, UINT32, seq, 1)
#define alox_EspNowUnicastTest_CALLBACK NULL #define alox_EspNowUnicastTest_CALLBACK NULL
#define alox_EspNowUnicastTest_DEFAULT NULL #define alox_EspNowUnicastTest_DEFAULT NULL
#define alox_EspNowFindMe_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, client_id, 1)
#define alox_EspNowFindMe_CALLBACK NULL
#define alox_EspNowFindMe_DEFAULT NULL
#define alox_EspNowDiscover_FIELDLIST(X, a) \ #define alox_EspNowDiscover_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, network, 1) X(a, STATIC, SINGULAR, UINT32, network, 1)
#define alox_EspNowDiscover_CALLBACK NULL #define alox_EspNowDiscover_CALLBACK NULL
@ -215,7 +233,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,unicast_test,payload.unicast_test),
X(a, STATIC, ONEOF, MESSAGE, (payload,ota_start,payload.ota_start), 7) \ X(a, STATIC, ONEOF, MESSAGE, (payload,ota_start,payload.ota_start), 7) \
X(a, STATIC, ONEOF, MESSAGE, (payload,ota_payload,payload.ota_payload), 8) \ X(a, STATIC, ONEOF, MESSAGE, (payload,ota_payload,payload.ota_payload), 8) \
X(a, STATIC, ONEOF, MESSAGE, (payload,ota_end,payload.ota_end), 9) \ X(a, STATIC, ONEOF, MESSAGE, (payload,ota_end,payload.ota_end), 9) \
X(a, STATIC, ONEOF, MESSAGE, (payload,ota_status,payload.ota_status), 10) X(a, STATIC, ONEOF, MESSAGE, (payload,ota_status,payload.ota_status), 10) \
X(a, STATIC, ONEOF, MESSAGE, (payload,find_me,payload.find_me), 11)
#define alox_EspNowMessage_CALLBACK NULL #define alox_EspNowMessage_CALLBACK NULL
#define alox_EspNowMessage_DEFAULT NULL #define alox_EspNowMessage_DEFAULT NULL
#define alox_EspNowMessage_payload_discover_MSGTYPE alox_EspNowDiscover #define alox_EspNowMessage_payload_discover_MSGTYPE alox_EspNowDiscover
@ -227,8 +246,10 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,ota_status,payload.ota_status), 10)
#define alox_EspNowMessage_payload_ota_payload_MSGTYPE alox_EspNowOtaPayload #define alox_EspNowMessage_payload_ota_payload_MSGTYPE alox_EspNowOtaPayload
#define alox_EspNowMessage_payload_ota_end_MSGTYPE alox_EspNowOtaEnd #define alox_EspNowMessage_payload_ota_end_MSGTYPE alox_EspNowOtaEnd
#define alox_EspNowMessage_payload_ota_status_MSGTYPE alox_EspNowOtaStatus #define alox_EspNowMessage_payload_ota_status_MSGTYPE alox_EspNowOtaStatus
#define alox_EspNowMessage_payload_find_me_MSGTYPE alox_EspNowFindMe
extern const pb_msgdesc_t alox_EspNowUnicastTest_msg; extern const pb_msgdesc_t alox_EspNowUnicastTest_msg;
extern const pb_msgdesc_t alox_EspNowFindMe_msg;
extern const pb_msgdesc_t alox_EspNowDiscover_msg; extern const pb_msgdesc_t alox_EspNowDiscover_msg;
extern const pb_msgdesc_t alox_EspNowSlavePresence_msg; extern const pb_msgdesc_t alox_EspNowSlavePresence_msg;
extern const pb_msgdesc_t alox_EspNowAccelDeadzone_msg; extern const pb_msgdesc_t alox_EspNowAccelDeadzone_msg;
@ -240,6 +261,7 @@ extern const pb_msgdesc_t alox_EspNowMessage_msg;
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */ /* Defines for backwards compatibility with code written before nanopb-0.4.0 */
#define alox_EspNowUnicastTest_fields &alox_EspNowUnicastTest_msg #define alox_EspNowUnicastTest_fields &alox_EspNowUnicastTest_msg
#define alox_EspNowFindMe_fields &alox_EspNowFindMe_msg
#define alox_EspNowDiscover_fields &alox_EspNowDiscover_msg #define alox_EspNowDiscover_fields &alox_EspNowDiscover_msg
#define alox_EspNowSlavePresence_fields &alox_EspNowSlavePresence_msg #define alox_EspNowSlavePresence_fields &alox_EspNowSlavePresence_msg
#define alox_EspNowAccelDeadzone_fields &alox_EspNowAccelDeadzone_msg #define alox_EspNowAccelDeadzone_fields &alox_EspNowAccelDeadzone_msg
@ -252,9 +274,10 @@ extern const pb_msgdesc_t alox_EspNowMessage_msg;
/* Maximum encoded size of messages (where known) */ /* Maximum encoded size of messages (where known) */
/* alox_EspNowSlavePresence_size depends on runtime parameters */ /* alox_EspNowSlavePresence_size depends on runtime parameters */
/* alox_EspNowMessage_size depends on runtime parameters */ /* alox_EspNowMessage_size depends on runtime parameters */
#define ALOX_MAIN_PROTO_ESP_NOW_MESSAGES_PB_H_MAX_SIZE alox_EspNowOtaPayload_size #define ALOX_ESP_NOW_MESSAGES_PB_H_MAX_SIZE alox_EspNowOtaPayload_size
#define alox_EspNowAccelDeadzone_size 12 #define alox_EspNowAccelDeadzone_size 12
#define alox_EspNowDiscover_size 6 #define alox_EspNowDiscover_size 6
#define alox_EspNowFindMe_size 6
#define alox_EspNowOtaEnd_size 0 #define alox_EspNowOtaEnd_size 0
#define alox_EspNowOtaPayload_size 209 #define alox_EspNowOtaPayload_size 209
#define alox_EspNowOtaStart_size 6 #define alox_EspNowOtaStart_size 6

View File

@ -15,12 +15,19 @@ enum EspNowMessageType {
ESPNOW_OTA_PAYLOAD = 7; ESPNOW_OTA_PAYLOAD = 7;
ESPNOW_OTA_END = 8; ESPNOW_OTA_END = 8;
ESPNOW_OTA_STATUS = 9; ESPNOW_OTA_STATUS = 9;
ESPNOW_FIND_ME = 10;
} }
message EspNowUnicastTest { message EspNowUnicastTest {
uint32 seq = 1; 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;
}
message EspNowDiscover { message EspNowDiscover {
uint32 network = 1; uint32 network = 1;
} }
@ -72,5 +79,6 @@ message EspNowMessage {
EspNowOtaPayload ota_payload = 8; EspNowOtaPayload ota_payload = 8;
EspNowOtaEnd ota_end = 9; EspNowOtaEnd ota_end = 9;
EspNowOtaStatus ota_status = 10; EspNowOtaStatus ota_status = 10;
EspNowFindMe find_me = 11;
} }
} }

View File

@ -48,6 +48,12 @@ PB_BIND(alox_LedRingProgressRequest, alox_LedRingProgressRequest, AUTO)
PB_BIND(alox_LedRingProgressResponse, alox_LedRingProgressResponse, AUTO) PB_BIND(alox_LedRingProgressResponse, alox_LedRingProgressResponse, AUTO)
PB_BIND(alox_EspNowFindMeRequest, alox_EspNowFindMeRequest, AUTO)
PB_BIND(alox_EspNowFindMeResponse, alox_EspNowFindMeResponse, AUTO)
PB_BIND(alox_OtaStartPayload, alox_OtaStartPayload, AUTO) PB_BIND(alox_OtaStartPayload, alox_OtaStartPayload, AUTO)

View File

@ -25,7 +25,8 @@ typedef enum _alox_MessageType {
alox_MessageType_OTA_END = 18, alox_MessageType_OTA_END = 18,
alox_MessageType_OTA_STATUS = 19, alox_MessageType_OTA_STATUS = 19,
alox_MessageType_OTA_START_ESPNOW = 20, alox_MessageType_OTA_START_ESPNOW = 20,
alox_MessageType_OTA_SLAVE_PROGRESS = 21 alox_MessageType_OTA_SLAVE_PROGRESS = 21,
alox_MessageType_FIND_ME = 22
} alox_MessageType; } alox_MessageType;
/* Struct definitions */ /* Struct definitions */
@ -96,8 +97,8 @@ typedef struct _alox_EspNowUnicastTestResponse {
uint32_t seq; uint32_t seq;
} alox_EspNowUnicastTestResponse; } alox_EspNowUnicastTestResponse;
/* Host → device: LED ring display (progress bar, digit, clear, or blink). /* Host → device: LED ring display (progress bar, digit, clear, blink, or find-me).
mode: 0=clear, 1=progress (0100 %), 2=digit (010), 3=blink full ring. */ mode: 0=clear, 1=progress (0100 %), 2=digit (010), 3=blink full ring, 4=find-me (R/G/B ×3 @ full brightness). */
typedef struct _alox_LedRingProgressRequest { typedef struct _alox_LedRingProgressRequest {
uint32_t mode; uint32_t mode;
/* * 0100: fraction of ring LEDs to light (mode=progress) */ /* * 0100: fraction of ring LEDs to light (mode=progress) */
@ -122,6 +123,16 @@ typedef struct _alox_LedRingProgressResponse {
uint32_t digit; uint32_t digit;
} alox_LedRingProgressResponse; } alox_LedRingProgressResponse;
/* * Host → master: find-me on local ring (client_id=0) or ESP-NOW unicast to one slave. */
typedef struct _alox_EspNowFindMeRequest {
uint32_t client_id;
} alox_EspNowFindMeRequest;
typedef struct _alox_EspNowFindMeResponse {
bool success;
uint32_t client_id;
} alox_EspNowFindMeResponse;
/* 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;
@ -192,6 +203,8 @@ typedef struct _alox_UartMessage {
alox_OtaSlaveProgressResponse ota_slave_progress_response; alox_OtaSlaveProgressResponse ota_slave_progress_response;
alox_LedRingProgressRequest led_ring_progress_request; alox_LedRingProgressRequest led_ring_progress_request;
alox_LedRingProgressResponse led_ring_progress_response; alox_LedRingProgressResponse led_ring_progress_response;
alox_EspNowFindMeRequest espnow_find_me_request;
alox_EspNowFindMeResponse espnow_find_me_response;
} payload; } payload;
} alox_UartMessage; } alox_UartMessage;
@ -202,8 +215,8 @@ extern "C" {
/* Helper constants for enums */ /* Helper constants for enums */
#define _alox_MessageType_MIN alox_MessageType_UNKNOWN #define _alox_MessageType_MIN alox_MessageType_UNKNOWN
#define _alox_MessageType_MAX alox_MessageType_OTA_SLAVE_PROGRESS #define _alox_MessageType_MAX alox_MessageType_FIND_ME
#define _alox_MessageType_ARRAYSIZE ((alox_MessageType)(alox_MessageType_OTA_SLAVE_PROGRESS+1)) #define _alox_MessageType_ARRAYSIZE ((alox_MessageType)(alox_MessageType_FIND_ME+1))
#define alox_UartMessage_type_ENUMTYPE alox_MessageType #define alox_UartMessage_type_ENUMTYPE alox_MessageType
@ -225,6 +238,8 @@ extern "C" {
@ -243,6 +258,8 @@ extern "C" {
#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, 0, 0} #define alox_LedRingProgressRequest_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
#define alox_LedRingProgressResponse_init_default {0, 0, 0, 0} #define alox_LedRingProgressResponse_init_default {0, 0, 0, 0}
#define alox_EspNowFindMeRequest_init_default {0}
#define alox_EspNowFindMeResponse_init_default {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}
@ -264,6 +281,8 @@ extern "C" {
#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, 0, 0} #define alox_LedRingProgressRequest_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
#define alox_LedRingProgressResponse_init_zero {0, 0, 0, 0} #define alox_LedRingProgressResponse_init_zero {0, 0, 0, 0}
#define alox_EspNowFindMeRequest_init_zero {0}
#define alox_EspNowFindMeResponse_init_zero {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}
@ -315,6 +334,9 @@ extern "C" {
#define alox_LedRingProgressResponse_mode_tag 2 #define alox_LedRingProgressResponse_mode_tag 2
#define alox_LedRingProgressResponse_progress_tag 3 #define alox_LedRingProgressResponse_progress_tag 3
#define alox_LedRingProgressResponse_digit_tag 4 #define alox_LedRingProgressResponse_digit_tag 4
#define alox_EspNowFindMeRequest_client_id_tag 1
#define alox_EspNowFindMeResponse_success_tag 1
#define alox_EspNowFindMeResponse_client_id_tag 2
#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
@ -351,6 +373,8 @@ extern "C" {
#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_request_tag 17
#define alox_UartMessage_led_ring_progress_response_tag 18 #define alox_UartMessage_led_ring_progress_response_tag 18
#define alox_UartMessage_espnow_find_me_request_tag 19
#define alox_UartMessage_espnow_find_me_response_tag 20
/* Struct field encoding specification for nanopb */ /* Struct field encoding specification for nanopb */
#define alox_UartMessage_FIELDLIST(X, a) \ #define alox_UartMessage_FIELDLIST(X, a) \
@ -371,7 +395,9 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,espnow_unicast_test_response,payload
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_request,payload.led_ring_progress_request), 17) \
X(a, STATIC, ONEOF, MESSAGE, (payload,led_ring_progress_response,payload.led_ring_progress_response), 18) X(a, STATIC, ONEOF, MESSAGE, (payload,led_ring_progress_response,payload.led_ring_progress_response), 18) \
X(a, STATIC, ONEOF, MESSAGE, (payload,espnow_find_me_request,payload.espnow_find_me_request), 19) \
X(a, STATIC, ONEOF, MESSAGE, (payload,espnow_find_me_response,payload.espnow_find_me_response), 20)
#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
@ -391,6 +417,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,led_ring_progress_response,payload.l
#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_request_MSGTYPE alox_LedRingProgressRequest
#define alox_UartMessage_payload_led_ring_progress_response_MSGTYPE alox_LedRingProgressResponse #define alox_UartMessage_payload_led_ring_progress_response_MSGTYPE alox_LedRingProgressResponse
#define alox_UartMessage_payload_espnow_find_me_request_MSGTYPE alox_EspNowFindMeRequest
#define alox_UartMessage_payload_espnow_find_me_response_MSGTYPE alox_EspNowFindMeResponse
#define alox_Ack_FIELDLIST(X, a) \ #define alox_Ack_FIELDLIST(X, a) \
@ -489,6 +517,17 @@ X(a, STATIC, SINGULAR, UINT32, digit, 4)
#define alox_LedRingProgressResponse_CALLBACK NULL #define alox_LedRingProgressResponse_CALLBACK NULL
#define alox_LedRingProgressResponse_DEFAULT NULL #define alox_LedRingProgressResponse_DEFAULT NULL
#define alox_EspNowFindMeRequest_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, client_id, 1)
#define alox_EspNowFindMeRequest_CALLBACK NULL
#define alox_EspNowFindMeRequest_DEFAULT NULL
#define alox_EspNowFindMeResponse_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, BOOL, success, 1) \
X(a, STATIC, SINGULAR, UINT32, client_id, 2)
#define alox_EspNowFindMeResponse_CALLBACK NULL
#define alox_EspNowFindMeResponse_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
@ -551,6 +590,8 @@ 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_LedRingProgressRequest_msg;
extern const pb_msgdesc_t alox_LedRingProgressResponse_msg; extern const pb_msgdesc_t alox_LedRingProgressResponse_msg;
extern const pb_msgdesc_t alox_EspNowFindMeRequest_msg;
extern const pb_msgdesc_t alox_EspNowFindMeResponse_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;
@ -574,6 +615,8 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
#define alox_EspNowUnicastTestResponse_fields &alox_EspNowUnicastTestResponse_msg #define alox_EspNowUnicastTestResponse_fields &alox_EspNowUnicastTestResponse_msg
#define alox_LedRingProgressRequest_fields &alox_LedRingProgressRequest_msg #define alox_LedRingProgressRequest_fields &alox_LedRingProgressRequest_msg
#define alox_LedRingProgressResponse_fields &alox_LedRingProgressResponse_msg #define alox_LedRingProgressResponse_fields &alox_LedRingProgressResponse_msg
#define alox_EspNowFindMeRequest_fields &alox_EspNowFindMeRequest_msg
#define alox_EspNowFindMeResponse_fields &alox_EspNowFindMeResponse_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
@ -594,6 +637,8 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
#define alox_AccelDeadzoneResponse_size 20 #define alox_AccelDeadzoneResponse_size 20
#define alox_Ack_size 0 #define alox_Ack_size 0
#define alox_ClientInput_size 22 #define alox_ClientInput_size 22
#define alox_EspNowFindMeRequest_size 6
#define alox_EspNowFindMeResponse_size 8
#define alox_EspNowUnicastTestRequest_size 12 #define alox_EspNowUnicastTestRequest_size 12
#define alox_EspNowUnicastTestResponse_size 8 #define alox_EspNowUnicastTestResponse_size 8
#define alox_LedRingProgressRequest_size 54 #define alox_LedRingProgressRequest_size 54

View File

@ -20,6 +20,7 @@ enum MessageType {
OTA_STATUS = 19; OTA_STATUS = 19;
OTA_START_ESPNOW = 20; OTA_START_ESPNOW = 20;
OTA_SLAVE_PROGRESS = 21; OTA_SLAVE_PROGRESS = 21;
FIND_ME = 22;
} }
message UartMessage { message UartMessage {
@ -42,6 +43,8 @@ message UartMessage {
OtaSlaveProgressResponse ota_slave_progress_response = 16; OtaSlaveProgressResponse ota_slave_progress_response = 16;
LedRingProgressRequest led_ring_progress_request = 17; LedRingProgressRequest led_ring_progress_request = 17;
LedRingProgressResponse led_ring_progress_response = 18; LedRingProgressResponse led_ring_progress_response = 18;
EspNowFindMeRequest espnow_find_me_request = 19;
EspNowFindMeResponse espnow_find_me_response = 20;
} }
} }
@ -110,8 +113,8 @@ message EspNowUnicastTestResponse {
uint32 seq = 2; uint32 seq = 2;
} }
// Host device: LED ring display (progress bar, digit, clear, or blink). // Host device: LED ring display (progress bar, digit, clear, blink, or find-me).
// mode: 0=clear, 1=progress (0100 %), 2=digit (010), 3=blink full ring. // mode: 0=clear, 1=progress (0100 %), 2=digit (010), 3=blink full ring, 4=find-me (R/G/B ×3 @ full brightness).
message LedRingProgressRequest { message LedRingProgressRequest {
uint32 mode = 1; uint32 mode = 1;
/** 0100: fraction of ring LEDs to light (mode=progress) */ /** 0100: fraction of ring LEDs to light (mode=progress) */
@ -136,6 +139,16 @@ message LedRingProgressResponse {
uint32 digit = 4; uint32 digit = 4;
} }
/** Host → master: find-me on local ring (client_id=0) or ESP-NOW unicast to one slave. */
message EspNowFindMeRequest {
uint32 client_id = 1;
}
message EspNowFindMeResponse {
bool success = 1;
uint32 client_id = 2;
}
// 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;