Skip to content

Commit

Permalink
hot fix of bug with node.description (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
AsiiaPine authored Oct 14, 2024
1 parent a4690ec commit 8922ff0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Src/modules/dronecan/core/dronecan_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ DronecanModule::DronecanModule() : Module(0, Protocol::DRONECAN) {

void DronecanModule::init() {
auto node_name_param_idx = static_cast<ParamIndex_t>(IntParamsIndexes::INTEGER_PARAMS_AMOUNT);
const auto& [board_name, name_length] = CircuitPeriphery::get_board_name();
paramsSetStringValue(node_name_param_idx, name_length, (const uint8_t*)board_name);
uavcanSetNodeName(board_name);
const auto current_node_name = (const char*)paramsGetStringValue(node_name_param_idx);
if(strlen(current_node_name) == 0) {
const auto& [board_name, name_length] = CircuitPeriphery::get_board_name();
paramsSetStringValue(node_name_param_idx, name_length, (const uint8_t*)board_name);
}
uavcanSetNodeName((const char*)paramsGetStringValue(node_name_param_idx));

int param_node_id_value = paramsGetIntegerValue(IntParamsIndexes::PARAM_UAVCAN_NODE_ID);
auto node_id = std::clamp(param_node_id_value, 1, 126);
Expand Down

0 comments on commit 8922ff0

Please # to comment.