Skip to content

Commit

Permalink
firmware for Here4 updater
Browse files Browse the repository at this point in the history
  • Loading branch information
bugobliterator committed Jan 12, 2024
1 parent efac521 commit 69fbbe8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
34 changes: 17 additions & 17 deletions libraries/AP_DroneCAN/AP_DroneCAN_DNA_Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,23 @@ Unique IDs hash.
Returns 255 if no Node ID was detected */
uint8_t AP_DroneCAN_DNA_Server::getNodeIDForUniqueID(const uint8_t unique_id[], uint8_t size)
{
uint8_t node_id = 255;
NodeData node_data, cmp_node_data;
getHash(cmp_node_data, unique_id, size);

for (int i = MAX_NODE_ID; i >= 0; i--) {
if (!isNodeIDOccupied(i)) { // No point in checking NodeID that's not taken
continue;
}
if (!readNodeData(node_data, i)) {
break; //Storage module has failed, report that as no NodeID detected
}
if (memcmp(node_data.hwid_hash, cmp_node_data.hwid_hash, sizeof(NodeData::hwid_hash)) == 0) {
node_id = i;
break;
}
}
return node_id;
// uint8_t node_id = 255;
// NodeData node_data, cmp_node_data;
// getHash(cmp_node_data, unique_id, size);

// for (int i = MAX_NODE_ID; i >= 0; i--) {
// if (!isNodeIDOccupied(i)) { // No point in checking NodeID that's not taken
// continue;
// }
// if (!readNodeData(node_data, i)) {
// break; //Storage module has failed, report that as no NodeID detected
// }
// if (memcmp(node_data.hwid_hash, cmp_node_data.hwid_hash, sizeof(NodeData::hwid_hash)) == 0) {
// node_id = i;
// break;
// }
// }
return 125;
}

/* Hash the Unique ID and add it to the Server Record
Expand Down
2 changes: 2 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/CubeOrangePlus/defaults.parm
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ BATT2_VOLT_MULT 12.02
ADSB_TYPE 1
SERIAL5_BAUD 57
SERIAL5_PROTOCOL 1
CAN_P1_DRIVER 1
CAN_SLCAN_CPORT 1

0 comments on commit 69fbbe8

Please sign in to comment.