|
3 | 3 | #include "common/time.h" |
4 | 4 | #include "drivers/time.h" |
5 | 5 | #include <stdint.h> |
| 6 | +#include <stdlib.h> |
6 | 7 | #include "fc/settings.h" |
7 | 8 | #include "build/version.h" |
| 9 | +#include "sensors/diagnostics.h" |
| 10 | +#include "fc/runtime_config.h" |
8 | 11 | #if defined(USE_DRONECAN) |
9 | 12 |
|
10 | 13 | #include "io/gps.h" |
@@ -177,7 +180,7 @@ void handle_GetNodeInfo(CanardInstance *ins, CanardRxTransfer *transfer) { |
177 | 180 | pkt.software_version.major = FC_VERSION_MAJOR; |
178 | 181 | pkt.software_version.minor = FC_VERSION_MINOR; |
179 | 182 | pkt.software_version.optional_field_flags = FC_VERSION_PATCH_LEVEL; |
180 | | - pkt.software_version.vcs_commit = 0; // shortGitRevision; // need to convert string to integer put git hash in here |
| 183 | + pkt.software_version.vcs_commit = strtoul(shortGitRevision, NULL, 16); // need to convert string to integer put git hash in here |
181 | 184 |
|
182 | 185 | // should fill in hardware version |
183 | 186 | pkt.hardware_version.major = 1; |
@@ -213,12 +216,18 @@ void send_NodeStatus(void) { |
213 | 216 |
|
214 | 217 | // LOG_DEBUG(CAN, "Sending Node Status"); |
215 | 218 | node_status.uptime_sec = millis() / 1000UL; |
216 | | - node_status.health = UAVCAN_PROTOCOL_NODESTATUS_HEALTH_OK; |
217 | | - node_status.mode = UAVCAN_PROTOCOL_NODESTATUS_MODE_OPERATIONAL; |
218 | | - node_status.sub_mode = 0; |
| 219 | + if(isHardwareHealthy()){ |
| 220 | + node_status.health = UAVCAN_PROTOCOL_NODESTATUS_HEALTH_OK; |
| 221 | + } |
| 222 | + else { |
| 223 | + node_status.health = UAVCAN_PROTOCOL_NODESTATUS_HEALTH_CRITICAL; |
| 224 | + } |
| 225 | + |
| 226 | + node_status.mode = UAVCAN_PROTOCOL_NODESTATUS_MODE_OPERATIONAL; // Indicates that node is able to communicate over CAN, not that it is in flight. |
| 227 | + node_status.sub_mode = 0; // Not currently used in dronecan |
219 | 228 |
|
220 | 229 | // put whatever you like in here for display in GUI |
221 | | - node_status.vendor_specific_status_code = 1234; |
| 230 | + node_status.vendor_specific_status_code = armingFlags; |
222 | 231 |
|
223 | 232 | uint32_t len = uavcan_protocol_NodeStatus_encode(&node_status, buffer); |
224 | 233 |
|
|
0 commit comments