AP_DroneCAN: register handle_actuator_status_Volz callback and fix logging

This commit is contained in:
Iampete1 2024-08-22 21:01:54 +01:00 committed by Andrew Tridgell
parent 46db6c12c1
commit 5453f3a0cc
2 changed files with 10 additions and 5 deletions

View File

@ -80,10 +80,6 @@ extern const AP_HAL::HAL& hal;
#define DRONECAN_STACK_SIZE 4096
#endif
#ifndef AP_DRONECAN_VOLZ_FEEDBACK_ENABLED
#define AP_DRONECAN_VOLZ_FEEDBACK_ENABLED 0
#endif
#ifndef AP_DRONECAN_DEFAULT_NODE
#define AP_DRONECAN_DEFAULT_NODE 10
#endif
@ -1424,7 +1420,7 @@ void AP_DroneCAN::handle_actuator_status_Volz(const CanardRxTransfer& transfer,
ToDeg(msg.actual_position),
msg.current * 0.025f,
msg.voltage * 0.2f,
msg.motor_pwm * (100.0/255.0),
uint8_t(msg.motor_pwm * (100.0/255.0)),
int16_t(msg.motor_temperature) - 50);
#endif
}

View File

@ -64,6 +64,10 @@
#define AP_DRONECAN_SERIAL_ENABLED AP_SERIALMANAGER_REGISTER_ENABLED && (BOARD_FLASH_SIZE>1024)
#endif
#ifndef AP_DRONECAN_VOLZ_FEEDBACK_ENABLED
#define AP_DRONECAN_VOLZ_FEEDBACK_ENABLED 0
#endif
#if AP_DRONECAN_SERIAL_ENABLED
#include "AP_DroneCAN_serial.h"
#endif
@ -334,6 +338,11 @@ private:
Canard::ObjCallback<AP_DroneCAN, uavcan_protocol_debug_LogMessage> debug_cb{this, &AP_DroneCAN::handle_debug};
Canard::Subscriber<uavcan_protocol_debug_LogMessage> debug_listener{debug_cb, _driver_index};
#if AP_DRONECAN_VOLZ_FEEDBACK_ENABLED
Canard::ObjCallback<AP_DroneCAN, com_volz_servo_ActuatorStatus> volz_servo_ActuatorStatus_cb{this, &AP_DroneCAN::handle_actuator_status_Volz};
Canard::Subscriber<com_volz_servo_ActuatorStatus> volz_servo_ActuatorStatus_listener{volz_servo_ActuatorStatus_cb, _driver_index};
#endif
// param client
Canard::ObjCallback<AP_DroneCAN, uavcan_protocol_param_GetSetResponse> param_get_set_res_cb{this, &AP_DroneCAN::handle_param_get_set_response};
Canard::Client<uavcan_protocol_param_GetSetResponse> param_get_set_client{canard_iface, param_get_set_res_cb};