Skip to content

Commit 1f13deb

Browse files
committed
Replace packet diagrams with an accurate SVG; drop stale packet PNG
The old Mermaid packet-beta blocks and OpenView-packet.png both labelled fields 'MSB to LSB', but every decoder reads little-endian; the PNG also described a 0x02 payload that no longer matches decodeHealthypiPkt2. - Add docs/images/packet-format.svg: frame envelope + the 0x03 and 0x04 payloads, with byte offsets taken from the decoders - Document the legacy 0x02 packet and the BLE per-characteristic layout - Remove the unused OpenView-packet.png (623 KB)
1 parent 3a55bad commit 1f13deb

3 files changed

Lines changed: 161 additions & 58 deletions

File tree

README.md

Lines changed: 42 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -128,68 +128,52 @@ See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the full data path
128128

129129
## Wire format
130130

131-
Any device that can push bytes over UART/USB/BLE can talk to OpenView. The frame is:
131+
Any device that can push bytes over UART/USB/BLE can talk to OpenView. Every board uses
132+
the same frame; only the payload differs per packet type.
132133

133-
| Position | Value |
134-
|---|---|
135-
| 0 | `0x0A` (start) |
136-
| 1 | `0xFA` (type indicator) |
137-
| 2 | Payload length LSB |
138-
| 3 | Payload length MSB |
139-
| 4 | Packet type |
140-
| 5 … n | Payload |
141-
| last | `0x0B` (stop) |
134+
![OpenView packet format](docs/images/packet-format.svg)
135+
136+
> **All multi-byte fields are little-endian.** Unknown packet types are surfaced rather
137+
> than dropped — the Console screen hex-dumps them, which is the fastest way to bring up
138+
> new firmware.
142139
143140
<details>
144-
<summary><b>HealthyPi 5 packet layouts</b> (firmware ≥ 1.0.0 sends ECG/BioZ and PPG as separate packets)</summary>
145-
146-
```mermaid
147-
packet-beta
148-
title OpenView ECG & BioZ packet
149-
0-7: "0x0A (START)"
150-
8-15: "0xFA (Type Indicator)"
151-
16-23: "Payload Length LSB"
152-
24-31: "Payload Length MSB"
153-
32-39: "0x03 (Type - Data)"
154-
40-71: "ECG (32-bit MSB to LSB)"
155-
72-103: "ECG (32-bit MSB to LSB)"
156-
104-135: "ECG (32-bit MSB to LSB)"
157-
136-167: "ECG (32-bit MSB to LSB)"
158-
168-199: "ECG (32-bit MSB to LSB)"
159-
200-231: "ECG (32-bit MSB to LSB)"
160-
232-263: "ECG (32-bit MSB to LSB)"
161-
264-295: "ECG (32-bit MSB to LSB)"
162-
296-327: "Resp (32-bit MSB to LSB )"
163-
328-359: "Resp (32-bit MSB to LSB )"
164-
360-391: "Resp (32-bit MSB to LSB )"
165-
392-423: "Resp (32-bit MSB to LSB )"
166-
424-431: "Heart Rate"
167-
432-439: "Resp Rate"
168-
440-447: "0x00"
169-
448-455: "0x0B (STOP)"
170-
```
141+
<summary><b>Legacy packet <code>0x02</code></b> — HealthyPi 5 firmware &lt; 1.0.0 (single combined sample)</summary>
171142

172-
```mermaid
173-
packet-beta
174-
title OpenView PPG packet
175-
0-7: "0x0A (START)"
176-
8-15: "0xFA (Type Indicator)"
177-
16-23: "Payload Length LSB"
178-
24-31: "Payload Length MSB"
179-
32-39: "0x04 (Type - Data)"
180-
40-55: "PPG - Red (16-bit MSB to LSB)"
181-
56-71: "PPG - Red (16-bit MSB to LSB)"
182-
72-87: "PPG - Red (16-bit MSB to LSB)"
183-
88-103: "PPG - Red (16-bit MSB to LSB)"
184-
104-119: "PPG - Red (16-bit MSB to LSB)"
185-
120-135: "PPG - Red (16-bit MSB to LSB)"
186-
136-151: "PPG - Red (16-bit MSB to LSB)"
187-
152-167: "PPG - Red (16-bit MSB to LSB)"
188-
168-183: "Temperature (16-bit)"
189-
184-191: "SpO2"
190-
192-199: "0x00"
191-
200-207: "0x0B (STOP)"
192-
```
143+
Before firmware 1.0.0, HealthyPi 5 sent one sample of every signal in a single 22-byte
144+
payload instead of the batched `0x03` / `0x04` packets. Still decoded for compatibility
145+
(`decodeHealthypiPkt2`):
146+
147+
| Offset | Field | Type |
148+
|---|---|---|
149+
| `0–3` | ECG | int32 LE (sign-extended 24-bit ADC) |
150+
| `4–7` | BioZ / respiration | int32 LE |
151+
| `8` | BioZ skip flag | uint8 — `1` = discard this BioZ sample |
152+
| `9–12` | PPG red | int32 LE |
153+
| `13–16` | PPG IR | int32 LE |
154+
| `17–18` | Temperature | int16 LE (°C × 100) |
155+
| `19` | SpO₂ | uint8 (%) |
156+
| `20` | Heart rate | uint8 (bpm) |
157+
| `21` | Respiration rate | uint8 (breaths/min) |
158+
159+
</details>
160+
161+
<details>
162+
<summary><b>HealthyPi 5 over BLE</b> — one characteristic per signal</summary>
163+
164+
Over BLE the board does not batch signals: each GATT characteristic streams a single
165+
signal, so OpenView routes each characteristic to its own synthetic packet type. Values
166+
are little-endian, matching the USB stream.
167+
168+
| Signal | Characteristic | Payload |
169+
|---|---|---|
170+
| ECG | `ECG_CHAR` | N × int32 LE |
171+
| Respiration | `RESP_CHAR` | N × int32 LE |
172+
| PPG | `HIST_CHAR` | N × int16 LE |
173+
| Heart rate | `2a37` | uint8 |
174+
| SpO₂ | `2a5e` | uint8 |
175+
| Temperature | `2a6e` | int16 LE (× 0.01) |
176+
| Respiration rate | `HRV_CHAR` | uint8 |
193177

194178
</details>
195179

docs/images/OpenView-packet.png

-623 KB
Binary file not shown.

docs/images/packet-format.svg

Lines changed: 119 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)