mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
mavlink: Fix ESC_STATUS sending for batches > 1
The indexing was wrong for esc_status sending for ESCs 4-> Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
parent
ca47f6f016
commit
f67eb6989d
@ -75,10 +75,11 @@ private:
|
||||
for (int batch_number = 0; batch_number < _number_of_batches; batch_number++) {
|
||||
msg.index = batch_number * batch_size;
|
||||
|
||||
for (int esc_index = 0; esc_index < batch_size ; esc_index++) {
|
||||
msg.rpm[esc_index] = esc_status.esc[esc_index].esc_rpm;
|
||||
msg.voltage[esc_index] = esc_status.esc[esc_index].esc_voltage;
|
||||
msg.current[esc_index] = esc_status.esc[esc_index].esc_current;
|
||||
for (int esc_index = 0; esc_index < batch_size
|
||||
&& msg.index + esc_index < esc_status_s::CONNECTED_ESC_MAX; esc_index++) {
|
||||
msg.rpm[esc_index] = esc_status.esc[msg.index + esc_index].esc_rpm;
|
||||
msg.voltage[esc_index] = esc_status.esc[msg.index + esc_index].esc_voltage;
|
||||
msg.current[esc_index] = esc_status.esc[msg.index + esc_index].esc_current;
|
||||
}
|
||||
|
||||
mavlink_msg_esc_status_send_struct(_mavlink->get_channel(), &msg);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user