Browse Source

AP_KDECAN: map ESC id to servo channel and passthrough pwm

Co-authored-by: Siddharth Purohit <siddharthbharatpurohit@gmail.com>
zr-v5.1
Randy Mackay 4 years ago committed by Andrew Tridgell
parent
commit
d2b8fce25a
  1. 11
      libraries/AP_KDECAN/AP_KDECAN.cpp
  2. 2
      libraries/AP_KDECAN/AP_KDECAN.h

11
libraries/AP_KDECAN/AP_KDECAN.cpp

@ -570,17 +570,10 @@ void AP_KDECAN::update() @@ -570,17 +570,10 @@ void AP_KDECAN::update()
if (_rc_out_sem.take(1)) {
for (uint8_t i = 0; i < KDECAN_MAX_NUM_ESCS; i++) {
if ((_esc_present_bitmask & (1 << i)) == 0) {
continue;
}
SRV_Channel::Aux_servo_function_t motor_function = SRV_Channels::get_motor_function(i);
if (SRV_Channels::function_assigned(motor_function)) {
float norm_output = SRV_Channels::get_output_norm(motor_function);
_scaled_output[i] = uint16_t((norm_output + 1.0f) / 2.0f * 2000.0f);
} else {
_scaled_output[i] = 0;
continue;
}
_scaled_output[i] = SRV_Channels::srv_channel(i)->get_output_pwm();
}
_rc_out_sem.give();

2
libraries/AP_KDECAN/AP_KDECAN.h

@ -104,7 +104,7 @@ private: @@ -104,7 +104,7 @@ private:
union frame_id_t {
struct {
struct PACKED {
uint8_t object_address;
uint8_t destination_id;
uint8_t source_id;

Loading…
Cancel
Save