This commit is contained in:
PacoX
2026-05-13 10:43:57 +02:00
parent 8296f44a4e
commit 94ed729985
2 changed files with 30 additions and 10 deletions
+6 -5
View File
@@ -15,7 +15,6 @@ The device capability determines the hash width (number of bytes per hop):
| 1 byte | 256 | Single-byte node IDs |
| 2 bytes | 65,536 | Medium meshes |
| 3 bytes | 16.7M | Large networks |
| 4 bytes | 4.3B | Gigantic deployments |
### Device Capability Detection
@@ -23,13 +22,15 @@ On device connection, the app reads the firmware capability to set `pathHashByte
```dart
// Read from device info response (offset 81)
final modeRaw = firmwareBytes.length >= 82
? (firmwareBytes[81] & 0x3F)
final modeRaw = firmwareBytes.length >= 82
? (firmwareBytes[81] & 0xFF)
: 0;
final mode = modeRaw.clamp(0, 3);
_pathHashByteWidth = mode + 1; // 1, 2, 3, or 4 bytes per hop
final mode = modeRaw.clamp(0, 2);
_pathHashByteWidth = mode + 1; // 1, 2, or 3 bytes per hop
```
The current implementation intentionally clamps to modes `0..2`, so the supported hop width is `1..3` bytes. Do not document 4-byte hops unless the connector implementation is widened first.
### Path Data Structure
Paths in messages and storage consist of: