You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
uint16_t vendor_status_code; // Vendor-specific status word
258
+
uint32_t last_seen_ms; // FC millis() timestamp of last NodeStatus
259
+
uint8_t name_len; // Length of name (0 until GetNodeInfo implemented)
260
+
char name[32]; // Node name, zero-padded
261
+
} dronecanNodeInfo_t;
262
+
```
263
+
264
+
The table holds up to `DRONECAN_MAX_NODES` (32) entries, indexed by arrival order. Entries are never removed at runtime; the table persists from boot until power-off.
265
+
266
+
#### Accessor Functions
267
+
268
+
| Function | Returns |
269
+
|----------|---------|
270
+
|`dronecanGetNodeCount()`| Number of unique nodes seen (`uint8_t`) |
271
+
|`dronecanGetNode(uint8_t index)`| Pointer to `dronecanNodeInfo_t` for entry `index`, or `NULL` if out of range |
272
+
|`dronecanGetState()`| Current bus state (`dronecanState_e`) |
273
+
|`dronecanGetBitrateKbps()`| Configured bitrate as a plain integer (e.g. 1000) |
274
+
275
+
---
276
+
245
277
### Configuration
246
278
247
279
#### Settings
@@ -305,8 +337,8 @@ The driver includes 7 built-in message handlers. Each handler decodes a message
305
337
306
338
#### `handle_NodeStatus()`
307
339
**Receives:**`uavcan_protocol_NodeStatus` (from other nodes)
308
-
**Processing:** Decodes and logs node health (OK/WARNING/ERROR/CRITICAL) and mode (OPERATIONAL/INITIALIZATION/MAINTENANCE/SOFTWARE_UPDATE/OFFLINE)
309
-
**Status:**Logs health and mode status
340
+
**Processing:** Decodes the message and upserts into the node table (`nodeTable[]`). If the source node ID is already in the table, health, mode, uptime, vendor status, and `last_seen_ms` are updated. If it is a new node and the table is not full, a new entry is appended and `activeNodeCount` is incremented. Node names are not available from NodeStatus broadcasts; they remain empty until `GetNodeInfo` service requests are implemented.
341
+
**Status:**Node count accessible via `dronecanGetNodeCount()`; per-node detail via `dronecanGetNode()`
310
342
311
343
### Service Handlers
312
344
@@ -477,6 +509,46 @@ if (uavcan_equipment_gnss_Fix_decode(transfer, &gnssFix) == 0) {
477
509
478
510
---
479
511
512
+
## MSP Commands
513
+
514
+
Two MSP2 commands expose the node table to external tools (configurator, GCS, test scripts):
515
+
516
+
### `MSP2_INAV_DRONECAN_NODES` (0x2042)
517
+
518
+
**Direction:** Request (no payload) → Reply
519
+
**Handler location:**`mspFcProcessOutCommand()` in `fc_msp.c`
520
+
**Guard:**`#ifdef USE_DRONECAN`
521
+
522
+
**Reply layout:**
523
+
524
+
| Offset | Size | Field |
525
+
|--------|------|-------|
526
+
| 0 | 1 |`nodeCount`|
527
+
| 1 + N×30 | 1 |`nodeID`|
528
+
| 2 + N×30 | 1 |`health`|
529
+
| 3 + N×30 | 1 |`mode`|
530
+
| 4 + N×30 | 4 |`uptime_sec` (little-endian) |
531
+
| 8 + N×30 | 2 |`vendor_status_code`|
532
+
| 10 + N×30 | 4 |`last_seen_ms`|
533
+
| 14 + N×30 | 1 |`name_len`|
534
+
| 15 + N×30 | 16 |`name` (zero-padded) |
535
+
536
+
Total: 1 + nodeCount × 30 bytes.
537
+
538
+
---
539
+
540
+
### `MSP2_INAV_DRONECAN_NODE_INFO` (0x2043)
541
+
542
+
**Direction:** Request (1 byte node ID) → Reply
543
+
**Handler location:**`mspFCProcessInOutCommand()` in `fc_msp.c`
544
+
**Guard:**`#ifdef USE_DRONECAN`
545
+
546
+
**Request:** 1 byte — target `nodeID`
547
+
548
+
**Reply layout:** same fields as above but with a 32-byte `name` field (46 bytes total). Returns an empty response if the requested node ID is not in the table.
|`nodes`| Number of unique nodes seen since boot |
337
+
338
+
### MSP Commands
339
+
340
+
Two MSP2 commands are available for querying detected DroneCAN nodes programmatically (e.g. from a GCS or configurator):
341
+
342
+
| Command | Code | Description |
343
+
|---------|------|-------------|
344
+
|`MSP2_INAV_DRONECAN_NODES`|`0x2042`| Returns count and status of all detected nodes |
345
+
|`MSP2_INAV_DRONECAN_NODE_INFO`|`0x2043`| Returns full detail for a single node by ID |
346
+
347
+
**`MSP2_INAV_DRONECAN_NODES` response:** one byte node count followed by 7-byte records — nodeID(1), health(1), mode(1), last\_seen\_ms(4). Maximum payload is 1 + 32×7 = 225 bytes, well within the 512-byte MSP output buffer.
348
+
349
+
**`MSP2_INAV_DRONECAN_NODE_INFO` request/response:** send a single-byte node ID; receive full node detail — nodeID, health, mode, uptime\_sec, vendor\_status\_code, last\_seen\_ms, name\_len, and name (32 bytes). Returns `MSP_RESULT_ERROR` if the node ID is not in the table.
350
+
351
+
See `docs/development/msp/README.md` for the full MSP field layout.
**Description:** Returns the list of all detected DroneCAN nodes with their current status.
4164
+
4165
+
**Request Payload:****None**
4166
+
4167
+
**Reply Payload:**
4168
+
|Field|C Type|Size (Bytes)|Description|
4169
+
|---|---|---|---|
4170
+
|`nodeCount`|`uint8_t`| 1 | Number of detected DroneCAN nodes |
4171
+
|`nodeData`|`dronecanNodeStatus_t[]`| array | Array of per-node status records, one per detected node. Each record: nodeID(1)+health(1)+mode(1)+last_seen_ms(4) = 7 bytes. Full detail available via MSP2_INAV_DRONECAN_NODE_INFO. |
4172
+
4173
+
**Notes:** Requires `USE_DRONECAN`. Response is `nodeCount` followed by `nodeCount` records of 7 bytes each: nodeID(1)+health(1)+mode(1)+last_seen_ms(4). Maximum payload 1 + (DRONECAN_MAX_NODES * 7) = 225 bytes. Full node detail including uptime, vendor status, and name is available via MSP2_INAV_DRONECAN_NODE_INFO.
**Description:** Retrieves the full configuration for each LED on the strip using the `ledConfig_t` structure. Supersedes `MSP_LED_STRIP_CONFIG`.
4161
4199
@@ -4710,6 +4748,19 @@ When the MSP JSON specification changes, bump `msp_messages.json` version:
4710
4748
4711
4749
**Notes:** Returns error if the aircraft is not armed or `NAV_COURSE_HOLD_MODE` is not active. On success, sets both `posControl.cruise.course` and `posControl.cruise.previousCourse` to the normalised value, preventing spurious heading adjustments from `getCruiseHeadingAdjustment()` on the next control cycle.
**Description:** Bandwidth-efficient auxiliary RC channel update. Sets CH13-CH32 with configurable resolution (2/4/8/16-bit) without affecting primary flight controls. Designed for extending channel count beyond native RC link capacity via MSP passthrough.
4753
+
4754
+
**Request Payload:**
4755
+
|Field|C Type|Size (Bytes)|Units|Description|
4756
+
|---|---|---|---|---|
4757
+
|`definitionByte`|`uint8_t`| 1 | - | Packed start channel and resolution. Bits 7-3: start channel index (valid range 12-31 for CH13-CH32; 0-11 rejected as error). Bits 2-0: resolution mode (0=2-bit, 1=4-bit, 2=8-bit, 3=16-bit; 4-7 reserved/error). |
4758
+
|`channelData`|`uint8_t[]`| array | PWM (encoded) | Packed channel values, sequential from start channel. Number of channels is derived from data size and resolution. Value 0 means skip (no update). Sub-byte modes (2-bit, 4-bit) are packed MSB-first. 2-bit values 1-3 map to 1000/1500/2000us. 4-bit values 1-15 map to 1000 + (val-1)*1000/14 us. 8-bit values 1-255 map to 1000 + (val-1)*1000/254 us. 16-bit values are direct PWM, clamped to 750-2250us. |
4759
+
4760
+
**Reply Payload:****None**
4761
+
4762
+
**Notes:** CH1-CH12 (index 0-11) are protected and will return `MSP_RESULT_ERROR`. Payload size must be 2-49 bytes. Constraint: `startChannel + channelCount <= 32`. Values persist until overwritten; no timeout. Applied as a post-RX overlay in `calculateRxChannelsAndUpdateFailsafe()` after MSP RC Override but before failsafe. Does not require `USE_RX_MSP` or MSP-RC-OVERRIDE flight mode. Does not affect failsafe detection. When MSP is the primary RX provider, channels covered by `MSP_SET_RAW_RC` are automatically skipped. Channels in the `mspOverrideChannels` bitmask are skipped when MSP RC Override mode is active. Recommended to send with `MSP_FLAG_DONT_REPLY` (flags=0x01) to save bandwidth on telemetry passthrough links. 16-bit mode requires even number of data bytes and values are clamped to 750-2250us.
Copy file name to clipboardExpand all lines: docs/development/msp/msp_messages.json
+94Lines changed: 94 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9817,6 +9817,100 @@
9817
9817
"notes": "Requires `USE_ESC_SENSOR`. See `escSensorData_t` in `sensors/esc_sensor.h` for the exact structure fields.",
9818
9818
"description": "Retrieves the full telemetry data structure reported by each ESC."
9819
9819
},
9820
+
"MSP2_INAV_DRONECAN_NODES": {
9821
+
"code": 8258,
9822
+
"mspv": 2,
9823
+
"request": null,
9824
+
"reply": {
9825
+
"payload": [
9826
+
{
9827
+
"name": "nodeCount",
9828
+
"ctype": "uint8_t",
9829
+
"desc": "Number of detected DroneCAN nodes",
9830
+
"units": ""
9831
+
},
9832
+
{
9833
+
"name": "nodeData",
9834
+
"desc": "Array of per-node status records, one per detected node. Each record: nodeID(1)+health(1)+mode(1)+last_seen_ms(4) = 7 bytes. Full detail available via MSP2_INAV_DRONECAN_NODE_INFO.",
9835
+
"ctype": "dronecanNodeStatus_t",
9836
+
"array": true,
9837
+
"array_size": 0,
9838
+
"units": ""
9839
+
}
9840
+
]
9841
+
},
9842
+
"variable_len": true,
9843
+
"notes": "Requires `USE_DRONECAN`. Response is `nodeCount` followed by `nodeCount` records of 7 bytes each: nodeID(1)+health(1)+mode(1)+last_seen_ms(4). Maximum payload 1 + (DRONECAN_MAX_NODES * 7) = 225 bytes. Full node detail including uptime, vendor status, and name is available via MSP2_INAV_DRONECAN_NODE_INFO.",
9844
+
"description": "Returns the list of all detected DroneCAN nodes with their current status."
0 commit comments