Added Code Generated Proto

This commit is contained in:
simon 2025-05-19 21:58:26 +02:00
parent 72486619f2
commit a3a2c35fed
6 changed files with 97 additions and 1 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
build/ build/
.cache .cache
alox.protogen
.vscode/

View File

@ -4,6 +4,16 @@ all:
export: export:
source ~/esp/esp-idf/export.fish && fish source ~/esp/esp-idf/export.fish && fish
get_code_gen:
wget git.aloxdrim.de/skruecken/protgen/actions/runs/latest/artifacts/alox.protogen -O alox.protogen.zip
unzip -o alox.protogen.zip
rm alox.protogen.zip
chmod +x alox.protogen
gen_prot:
./alox.protogen -i prot.json -o main/uart
buildIdf: buildIdf:
idf.py build idf.py build

2
main/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
uart_prot.c
uart_prot.h

View File

@ -1,3 +1,3 @@
idf_component_register(SRCS "main.c" "uart_handler.c" "communication_handler.c" idf_component_register(SRCS "main.c" "uart_handler.c" "communication_handler.c" "uart_prot.c"
INCLUDE_DIRS ".") INCLUDE_DIRS ".")

61
prot.json Normal file
View File

@ -0,0 +1,61 @@
{
"protocol": {
"start_byte": "0xAA",
"message_length": 0,
"max_payload": 255,
"checksum": "xor"
},
"messages_esp_to_pc": [
{
"name": "Clients",
"id": "0xE1",
"payload": [
{ "name": "clientCount", "type": "uint8_t" },
{ "name": "clientAvaiableBitMask", "type": "uint32_t" }
]
},
{
"name": "Status",
"id": "0xE2",
"payload": [
{ "name": "clientId", "type": "uint8_t" },
{ "name": "mac", "type": "uint8_t", "array": 6 }
]
},
{
"name": "Pong",
"id": "0xD1",
"payload": [
{ "name": "clientId", "type": "uint8_t" },
{ "name": "ping", "type": "uint32_t" }
]
}
],
"messages_pc_to_esp": [
{
"name": "RequestPing",
"id": "0xE1",
"payload": [
{ "name": "clientId", "type": "uint8_t" }
]
},
{
"name": "RequestStatus",
"id": "0xE2",
"payload": [
{ "name": "clientId", "type": "uint8_t" }
]
},
{
"name": "PrepareFirmwareUpdate",
"id": "0xF1"
},
{
"name": "FirmwareUpdateLine",
"id": "0xF2",
"payload": [
{ "name": "data", "type": "uint8_t", "array": 240 }
]
}
]
}

View File

@ -23,6 +23,27 @@
- **Checksum** (`uint8_t`): - **Checksum** (`uint8_t`):
XOR über alle Bytes ab `Length` bis einschließlich `Payload`. XOR über alle Bytes ab `Length` bis einschließlich `Payload`.
### Nachrichten von PC zu ESP:
clientid: 0x00 für master, 0xFF für broadcast, ansonsten 0xA0-0xB3 // 19 Clients
### RequestPing 0xE1
Payload: byte: clientid
### RequestInfo 0xE2
Payload: byte: clientid
### RequestRestart 0xE3
Payload: byte: clientid
### PrepareFirmwareUpdate 0xF1
Payload: none
### FirmwareUpdateLine 0xF2
Payload: firmware line 240Bytes MAX
### ExecuteFirmwareUpdate 0xF3
Payload: none
### Nachrichten von ESP zu PC:
--- ---
# Roadmap # Roadmap