diff --git a/libraries/AP_DroneCAN/AP_DroneCAN.cpp b/libraries/AP_DroneCAN/AP_DroneCAN.cpp index ee2dfe2eba..5e5637fee1 100644 --- a/libraries/AP_DroneCAN/AP_DroneCAN.cpp +++ b/libraries/AP_DroneCAN/AP_DroneCAN.cpp @@ -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 } diff --git a/libraries/AP_DroneCAN/AP_DroneCAN.h b/libraries/AP_DroneCAN/AP_DroneCAN.h index b5527fb594..e1b713d33f 100644 --- a/libraries/AP_DroneCAN/AP_DroneCAN.h +++ b/libraries/AP_DroneCAN/AP_DroneCAN.h @@ -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 debug_cb{this, &AP_DroneCAN::handle_debug}; Canard::Subscriber debug_listener{debug_cb, _driver_index}; +#if AP_DRONECAN_VOLZ_FEEDBACK_ENABLED + Canard::ObjCallback volz_servo_ActuatorStatus_cb{this, &AP_DroneCAN::handle_actuator_status_Volz}; + Canard::Subscriber volz_servo_ActuatorStatus_listener{volz_servo_ActuatorStatus_cb, _driver_index}; +#endif + // param client Canard::ObjCallback param_get_set_res_cb{this, &AP_DroneCAN::handle_param_get_set_response}; Canard::Client param_get_set_client{canard_iface, param_get_set_res_cb};