Compare commits
10 commits
e8d6f2eb33
...
ff46ef9411
Author | SHA1 | Date | |
---|---|---|---|
|
ff46ef9411 | ||
ce38e34051 | |||
ea3f815e3e | |||
12da5957b8 | |||
14846e5aa5 | |||
3adb5c576f | |||
4f84fc650f | |||
6b4c24783e | |||
740abd951d | |||
d285387f38 |
BIN
assets/dashboard.png
Normal file
After Width: | Height: | Size: 44 KiB |
|
@ -1,30 +1,42 @@
|
||||||
# Heliox communication protocol
|
# 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
|
## 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) |
|
| 0x0 | 0x1 | 0x2 | 0x3 | 0x4 | ... |
|
||||||
| :---------------: | :----------: | :---------------: | :-------------------: | :---------: |
|
| --- | --- | -------- | ------ | --------- | --------------- |
|
||||||
| Magic Number (HX) | Message Type | Parity Bit (even) | Data Length (x Bytes) | Data |
|
| H | X | _length_ | _mode_ | _submode_ | _optional data_ |
|
||||||
|
|
||||||
## Message Types
|
## Modes
|
||||||
|
|
||||||
| Code | Purpose |
|
### Mode selection
|
||||||
| ---- | -------------------- |
|
|
||||||
| 0 | Light Data |
|
|
||||||
| 1 | Control Signal |
|
|
||||||
| 2 | Status Messages |
|
|
||||||
| 3 | Confirmation Message |
|
|
||||||
| 4 | Debug Info |
|
|
||||||
|
|
||||||
### Light Data
|
The columns represent modes and the rows represent submodes:
|
||||||
|
|
||||||
- 1-Byte-block per lamp: 0-255
|
| | 0x0 | 0x1 | 0x2 | 0x3 |
|
||||||
- Index of lamp determinded by order
|
| :---: | :---------: | :---------------: | :---------------: | :-------------------------: |
|
||||||
|
| | **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** <sub>oggle</sub> | **i** <sub>ncrease</sub> | **d** <sub>decrease</sub> ]
|
Every submode can take any number of Bytes except the below-mentioned ones:
|
||||||
- on
|
|
||||||
- off
|
| **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.
|
||||||
|
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
@ -22,7 +22,7 @@ WebsocketCommunicator::WebsocketCommunicator(AsyncWebSocket &socket, AsyncWebSer
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
msgRead = false;
|
||||||
socket.onEvent(onEvent);
|
socket.onEvent(onEvent);
|
||||||
server.addHandler(&socket);
|
server.addHandler(&socket);
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,21 @@ void WebsocketCommunicator::sendMessage(const char message[])
|
||||||
|
|
||||||
char *WebsocketCommunicator::receiveMessage()
|
char *WebsocketCommunicator::receiveMessage()
|
||||||
{
|
{
|
||||||
|
msgRead = true;
|
||||||
return getBuffer();
|
return getBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebsocketCommunicator::clearBufferSafely()
|
||||||
|
{
|
||||||
|
if (msgRead)
|
||||||
|
{
|
||||||
|
clearBuffer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WebsocketCommunicator::handleMessage(void *arg, uint8_t *data, size_t len)
|
void WebsocketCommunicator::handleMessage(void *arg, uint8_t *data, size_t len)
|
||||||
{
|
{
|
||||||
Serial.println("data");
|
msgRead = false;
|
||||||
|
int effectiveLen = len < bufferSize ? len : bufferSize;
|
||||||
|
strncpy(messageBuffer, (char *)data, effectiveLen);
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@ class WebsocketCommunicator : public Communicator
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
void handleMessage(void *arg, uint8_t *data, size_t len);
|
void handleMessage(void *arg, uint8_t *data, size_t len);
|
||||||
|
bool msgRead;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AsyncWebSocket &socket;
|
AsyncWebSocket &socket;
|
||||||
|
@ -15,4 +16,5 @@ public:
|
||||||
void sendMessage(int *values, __SIZE_TYPE__ numberOfValues) override;
|
void sendMessage(int *values, __SIZE_TYPE__ numberOfValues) override;
|
||||||
void sendMessage(const char message[]) override;
|
void sendMessage(const char message[]) override;
|
||||||
char *receiveMessage() override;
|
char *receiveMessage() override;
|
||||||
|
void clearBufferSafely();
|
||||||
};
|
};
|
|
@ -20,7 +20,7 @@ AsyncWebSocket ws("/ws");
|
||||||
|
|
||||||
Communicator *computer;
|
Communicator *computer;
|
||||||
Communicator *phone;
|
Communicator *phone;
|
||||||
Communicator *websocket;
|
WebsocketCommunicator *websocket;
|
||||||
LightController *light;
|
LightController *light;
|
||||||
|
|
||||||
void websocketTask(void *parameter)
|
void websocketTask(void *parameter)
|
||||||
|
@ -28,14 +28,13 @@ void websocketTask(void *parameter)
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
websocket->sendMessage(light->getBjtState(), light->getBjtCount());
|
websocket->sendMessage(light->getBjtState(), light->getBjtCount());
|
||||||
websocket->clearBuffer();
|
|
||||||
|
|
||||||
vTaskDelay(90 / portTICK_PERIOD_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerTasks()
|
void registerWebSocketTask()
|
||||||
{
|
{
|
||||||
xTaskCreate(websocketTask, "websocketTask", 10000, NULL, 1, NULL);
|
xTaskCreate(websocketTask, "websocketTask", 10000, NULL, 1, NULL);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +77,7 @@ void setup()
|
||||||
|
|
||||||
connectWifi(WIFI_TIMEOUT);
|
connectWifi(WIFI_TIMEOUT);
|
||||||
server.begin();
|
server.begin();
|
||||||
registerTasks();
|
registerWebSocketTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
void computerCycle()
|
void computerCycle()
|
||||||
|
@ -95,9 +94,16 @@ void phoneCycle()
|
||||||
phone->clearBuffer();
|
phone->clearBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void websocketCycle()
|
||||||
|
{
|
||||||
|
light->updateState(websocket->receiveMessage(), STEPS);
|
||||||
|
websocket->clearBufferSafely();
|
||||||
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
computerCycle();
|
computerCycle();
|
||||||
phoneCycle();
|
phoneCycle();
|
||||||
|
websocketCycle();
|
||||||
ws.cleanupClients();
|
ws.cleanupClients();
|
||||||
}
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
EESchema-DOCLIB Version 2.0
|
||||||
|
#
|
||||||
|
$CMP M24C08-RMN6TP
|
||||||
|
D EEPROM 16Kbit 8Kbit 4Kbit 2Kb and 1Kb Serial
|
||||||
|
K
|
||||||
|
F https://www.st.com/resource/en/datasheet/m24c08-r.pdf
|
||||||
|
$ENDCMP
|
||||||
|
#
|
||||||
|
#End Doc Library
|
33
modules/control/Hardware/Circuit/Libraries/M24C08-RMN6TP.lib
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
EESchema-LIBRARY Version 2.3
|
||||||
|
#encoding utf-8
|
||||||
|
#SamacSys ECAD Model M24C08-RMN6TP
|
||||||
|
#/1141526/569181/2.49/8/3/Integrated Circuit
|
||||||
|
DEF M24C08-RMN6TP IC 0 30 Y Y 1 F N
|
||||||
|
F0 "IC" 950 300 50 H V L CNN
|
||||||
|
F1 "M24C08-RMN6TP" 950 200 50 H V L CNN
|
||||||
|
F2 "SOIC127P600X175-8N" 950 100 50 H I L CNN
|
||||||
|
F3 "https://www.st.com/resource/en/datasheet/m24c08-r.pdf" 950 0 50 H I L CNN
|
||||||
|
F4 "EEPROM 16Kbit 8Kbit 4Kbit 2Kb and 1Kb Serial" 950 -100 50 H I L CNN "Description"
|
||||||
|
F5 "1.75" 950 -200 50 H I L CNN "Height"
|
||||||
|
F6 "STMicroelectronics" 950 -300 50 H I L CNN "Manufacturer_Name"
|
||||||
|
F7 "M24C08-RMN6TP" 950 -400 50 H I L CNN "Manufacturer_Part_Number"
|
||||||
|
F8 "511-M24C08-RMN6TP" 950 -500 50 H I L CNN "Mouser Part Number"
|
||||||
|
F9 "https://www.mouser.co.uk/ProductDetail/STMicroelectronics/M24C08-RMN6TP?qs=%252B9pWl1iD4MWbThyGTUpSoQ%3D%3D" 950 -600 50 H I L CNN "Mouser Price/Stock"
|
||||||
|
F10 "M24C08-RMN6TP" 950 -700 50 H I L CNN "Arrow Part Number"
|
||||||
|
F11 "https://www.arrow.com/en/products/m24c08-rmn6tp/stmicroelectronics?region=nac" 950 -800 50 H I L CNN "Arrow Price/Stock"
|
||||||
|
F12 "" 950 -900 50 H I L CNN "Mouser Testing Part Number"
|
||||||
|
F13 "" 950 -1000 50 H I L CNN "Mouser Testing Price/Stock"
|
||||||
|
DRAW
|
||||||
|
X NC_1 1 0 0 200 R 50 50 0 0 P
|
||||||
|
X NC_2 2 0 -100 200 R 50 50 0 0 P
|
||||||
|
X E2 3 0 -200 200 R 50 50 0 0 P
|
||||||
|
X VSS 4 0 -300 200 R 50 50 0 0 P
|
||||||
|
X VCC 8 1100 0 200 L 50 50 0 0 P
|
||||||
|
X ~WC 7 1100 -100 200 L 50 50 0 0 P
|
||||||
|
X SCL 6 1100 -200 200 L 50 50 0 0 P
|
||||||
|
X SDA 5 1100 -300 200 L 50 50 0 0 P
|
||||||
|
P 5 0 1 6 200 100 900 100 900 -400 200 -400 200 100 N
|
||||||
|
ENDDRAW
|
||||||
|
ENDDEF
|
||||||
|
#
|
||||||
|
#End Library
|
|
@ -0,0 +1,41 @@
|
||||||
|
(module "SOIC127P600X175-8N" (layer F.Cu)
|
||||||
|
(descr "SO8N")
|
||||||
|
(tags "Integrated Circuit")
|
||||||
|
(attr smd)
|
||||||
|
(fp_text reference IC** (at 0 0) (layer F.SilkS)
|
||||||
|
(effects (font (size 1.27 1.27) (thickness 0.254)))
|
||||||
|
)
|
||||||
|
(fp_text user %R (at 0 0) (layer F.Fab)
|
||||||
|
(effects (font (size 1.27 1.27) (thickness 0.254)))
|
||||||
|
)
|
||||||
|
(fp_text value "SOIC127P600X175-8N" (at 0 0) (layer F.SilkS) hide
|
||||||
|
(effects (font (size 1.27 1.27) (thickness 0.254)))
|
||||||
|
)
|
||||||
|
(fp_line (start -3.725 -2.75) (end 3.725 -2.75) (layer F.CrtYd) (width 0.05))
|
||||||
|
(fp_line (start 3.725 -2.75) (end 3.725 2.75) (layer F.CrtYd) (width 0.05))
|
||||||
|
(fp_line (start 3.725 2.75) (end -3.725 2.75) (layer F.CrtYd) (width 0.05))
|
||||||
|
(fp_line (start -3.725 2.75) (end -3.725 -2.75) (layer F.CrtYd) (width 0.05))
|
||||||
|
(fp_line (start -1.95 -2.45) (end 1.95 -2.45) (layer F.Fab) (width 0.1))
|
||||||
|
(fp_line (start 1.95 -2.45) (end 1.95 2.45) (layer F.Fab) (width 0.1))
|
||||||
|
(fp_line (start 1.95 2.45) (end -1.95 2.45) (layer F.Fab) (width 0.1))
|
||||||
|
(fp_line (start -1.95 2.45) (end -1.95 -2.45) (layer F.Fab) (width 0.1))
|
||||||
|
(fp_line (start -1.95 -1.18) (end -0.68 -2.45) (layer F.Fab) (width 0.1))
|
||||||
|
(fp_line (start -1.6 -2.45) (end 1.6 -2.45) (layer F.SilkS) (width 0.2))
|
||||||
|
(fp_line (start 1.6 -2.45) (end 1.6 2.45) (layer F.SilkS) (width 0.2))
|
||||||
|
(fp_line (start 1.6 2.45) (end -1.6 2.45) (layer F.SilkS) (width 0.2))
|
||||||
|
(fp_line (start -1.6 2.45) (end -1.6 -2.45) (layer F.SilkS) (width 0.2))
|
||||||
|
(fp_line (start -3.475 -2.58) (end -1.95 -2.58) (layer F.SilkS) (width 0.2))
|
||||||
|
(pad 1 smd rect (at -2.712 -1.905 90) (size 0.65 1.525) (layers F.Cu F.Paste F.Mask))
|
||||||
|
(pad 2 smd rect (at -2.712 -0.635 90) (size 0.65 1.525) (layers F.Cu F.Paste F.Mask))
|
||||||
|
(pad 3 smd rect (at -2.712 0.635 90) (size 0.65 1.525) (layers F.Cu F.Paste F.Mask))
|
||||||
|
(pad 4 smd rect (at -2.712 1.905 90) (size 0.65 1.525) (layers F.Cu F.Paste F.Mask))
|
||||||
|
(pad 5 smd rect (at 2.712 1.905 90) (size 0.65 1.525) (layers F.Cu F.Paste F.Mask))
|
||||||
|
(pad 6 smd rect (at 2.712 0.635 90) (size 0.65 1.525) (layers F.Cu F.Paste F.Mask))
|
||||||
|
(pad 7 smd rect (at 2.712 -0.635 90) (size 0.65 1.525) (layers F.Cu F.Paste F.Mask))
|
||||||
|
(pad 8 smd rect (at 2.712 -1.905 90) (size 0.65 1.525) (layers F.Cu F.Paste F.Mask))
|
||||||
|
(model M24C08-RMN6TP.stp
|
||||||
|
(at (xyz 0 0 0))
|
||||||
|
(scale (xyz 1 1 1))
|
||||||
|
(rotate (xyz 0 0 0))
|
||||||
|
)
|
||||||
|
)
|
|
@ -7,4 +7,5 @@
|
||||||
(lib (name "CUI_TB006-508-04BE")(type "KiCad")(uri "${KIPRJMOD}/Libraries/CUI_TB006-508-04BE.pretty")(options "")(descr ""))
|
(lib (name "CUI_TB006-508-04BE")(type "KiCad")(uri "${KIPRJMOD}/Libraries/CUI_TB006-508-04BE.pretty")(options "")(descr ""))
|
||||||
(lib (name "TJ-S1615CY6TGLCCSRGB-A5")(type "KiCad")(uri "${KIPRJMOD}/Libraries/TJ-S1615CY6TGLCCSRGB-A5.pretty")(options "")(descr ""))
|
(lib (name "TJ-S1615CY6TGLCCSRGB-A5")(type "KiCad")(uri "${KIPRJMOD}/Libraries/TJ-S1615CY6TGLCCSRGB-A5.pretty")(options "")(descr ""))
|
||||||
(lib (name "logo")(type "KiCad")(uri "${KIPRJMOD}/Libraries/logo")(options "")(descr ""))
|
(lib (name "logo")(type "KiCad")(uri "${KIPRJMOD}/Libraries/logo")(options "")(descr ""))
|
||||||
|
(lib (name "M24C08-RMN6TP")(type "KiCad")(uri "${KIPRJMOD}/Libraries/M24C08-RMN6TP.pretty")(options "")(descr ""))
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
(lib (name "TYPE-C-31-M-12")(type "Legacy")(uri "${KIPRJMOD}/Libraries/TYPE-C-31-M-12.lib")(options "")(descr ""))
|
(lib (name "TYPE-C-31-M-12")(type "Legacy")(uri "${KIPRJMOD}/Libraries/TYPE-C-31-M-12.lib")(options "")(descr ""))
|
||||||
(lib (name "CD74HC4053PWR")(type "Legacy")(uri "${KIPRJMOD}/Libraries/CD74HC4053PWR.lib")(options "")(descr ""))
|
(lib (name "CD74HC4053PWR")(type "Legacy")(uri "${KIPRJMOD}/Libraries/CD74HC4053PWR.lib")(options "")(descr ""))
|
||||||
(lib (name "TS5V330PWR")(type "Legacy")(uri "${KIPRJMOD}/Libraries/TS5V330PWR.lib")(options "")(descr ""))
|
(lib (name "TS5V330PWR")(type "Legacy")(uri "${KIPRJMOD}/Libraries/TS5V330PWR.lib")(options "")(descr ""))
|
||||||
|
(lib (name "M24C08-RMN6TP")(type "Legacy")(uri "${KIPRJMOD}/Libraries/M24C08-RMN6TP.lib")(options "")(descr ""))
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
# Heliox - Dashboard
|
# Heliox - Dashboard
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<img src="../../assets/logo.png" alt="Logo" width="80" height="80">
|
||||||
|
</div>
|
||||||
|
|
||||||
[![Electron Build](https://github.com/GHOSCHT/light-control/actions/workflows/Electron.yml/badge.svg)](https://github.com/GHOSCHT/light-control/actions/workflows/Electron.yml)
|
[![Electron Build](https://github.com/GHOSCHT/light-control/actions/workflows/Electron.yml/badge.svg)](https://github.com/GHOSCHT/light-control/actions/workflows/Electron.yml)
|
||||||
[![CodeQL](https://github.com/GHOSCHT/light-control/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/GHOSCHT/light-control/actions/workflows/codeql-analysis.yml)
|
[![CodeQL](https://github.com/GHOSCHT/light-control/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/GHOSCHT/light-control/actions/workflows/codeql-analysis.yml)
|
||||||
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/bdb8a994396345efab8271307f1ea155)](https://www.codacy.com/gh/GHOSCHT/heliox/dashboard?utm_source=github.com&utm_medium=referral&utm_content=GHOSCHT/heliox&utm_campaign=Badge_Grade)
|
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/bdb8a994396345efab8271307f1ea155)](https://www.codacy.com/gh/GHOSCHT/heliox/dashboard?utm_source=github.com&utm_medium=referral&utm_content=GHOSCHT/heliox&utm_campaign=Badge_Grade)
|
||||||
|
@ -9,6 +13,10 @@
|
||||||
|
|
||||||
Uses: <https://github.com/GHOSCHT/simple-electron-react-boilerplate>
|
Uses: <https://github.com/GHOSCHT/simple-electron-react-boilerplate>
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<img src="../../assets/dashboard.png" alt="dashboard">
|
||||||
|
</div>
|
||||||
|
|
||||||
Dashboard: node-gyp fails on sqlite3 build -> set default pyhton version to python 2
|
Dashboard: node-gyp fails on sqlite3 build -> set default pyhton version to python 2
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|