From 14846e5aa599a3bc72b8b425e5267be71b721c99 Mon Sep 17 00:00:00 2001
From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com>
Date: Tue, 20 Sep 2022 18:58:26 +0200
Subject: [PATCH] Restructure communication protocol
---
docs/communication.md | 50 +++++++++++++++++++++++++++----------------
1 file changed, 31 insertions(+), 19 deletions(-)
diff --git a/docs/communication.md b/docs/communication.md
index d09a869..b32a575 100644
--- a/docs/communication.md
+++ b/docs/communication.md
@@ -1,30 +1,42 @@
# Heliox communication protocol
+The following structure can be used to communicate with the Heliox control over several carrier protocols (UART, BL LE,...)
+
## Basic data structure
-The following table describes the bit pattern for a successful communication with heliox devices.
+The following table describes the bit pattern for a successful communication with and between Heliox devices.
-| 0-15 | 16-22 | 23 | 24-31 | 32-(32+8*x) |
-| :---------------: | :----------: | :---------------: | :-------------------: | :---------: |
-| Magic Number (HX) | Message Type | Parity Bit (even) | Data Length (x Bytes) | Data |
+| 0x0 | 0x1 | 0x2 | 0x3 | 0x4 | ... |
+| --- | --- | -------- | ------ | --------- | --------------- |
+| H | X | _length_ | _mode_ | _submode_ | _optional data_ |
-## Message Types
+## Modes
-| Code | Purpose |
-| ---- | -------------------- |
-| 0x0 | Light Data |
-| 0x1 | Control Signal |
-| 0x2 | Status Messages |
-| 0x3 | Confirmation Message |
-| 0x4 | Debug Info |
+### Mode selection
-### Light Data
+The columns represent modes and the rows represent submodes:
-- 1-Byte-block per lamp: 0-255
-- Index of lamp determinded by order
+| | 0x0 | 0x1 | 0x2 | 0x3 |
+| :---: | :---------: | :---------------: | :---------------: | :-------------------------: |
+| | **Message** | **Settings** | **Light control** | **Basic commands** |
+| 0x0 | light data | set baud rate | on | request light data |
+| 0x1 | info | set WIFI password | off | enter console flashing mode |
+| 0x2 | warning | set WIFI SSID | toggle | exit console flashing mode |
+| 0x3 | error | | increase | pair Bluetooth |
+| 0x4 | success | | decrease | help |
+| 0x5 | | | | version |
-### Control Signal
+### Optional data
-- Index Byte + [ **t** oggle | **i** ncrease | **d** decrease ]
-- on
-- off
+Every submode can take any number of Bytes except the below-mentioned ones:
+
+| **0 Bytes** | **1 Byte** |
+| :------------: | :--------: |
+| on | increase |
+| off | decrease |
+| flash console | toggle |
+| pair Bluetooth | |
+
+### Additional information
+
+The maximum length of a message ist 255 Bytes excluding the magic number "BM" and the length slot itself.