diff --git a/.gitignore b/.gitignore index 4e7bf47..7361770 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ build/ .cache +alox.protogen +.vscode/ diff --git a/Makefile b/Makefile index 21899ac..ec1d45b 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,16 @@ all: export: 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: idf.py build diff --git a/main/.gitignore b/main/.gitignore new file mode 100644 index 0000000..d3baa75 --- /dev/null +++ b/main/.gitignore @@ -0,0 +1,2 @@ +uart_prot.c +uart_prot.h diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 3b5ef82..9d84066 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -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 ".") diff --git a/prot.json b/prot.json new file mode 100644 index 0000000..f2e1136 --- /dev/null +++ b/prot.json @@ -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 } + ] + } + ] +} diff --git a/readme.md b/readme.md index 11a4485..17256a7 100644 --- a/readme.md +++ b/readme.md @@ -23,6 +23,27 @@ - **Checksum** (`uint8_t`): 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