mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-21 15:17:34 +08:00
fix(rc): check write return value in BindCRSF, guard Spektrum bind against invalid sub-type
This commit is contained in:
@@ -564,7 +564,7 @@ bool CrsfRc::BindCRSF()
|
||||
0xE8, // packet CRC8
|
||||
};
|
||||
|
||||
return _uart->write((void *)bind_frame, sizeof(bind_frame));
|
||||
return _uart->write((void *)bind_frame, sizeof(bind_frame)) == sizeof(bind_frame);
|
||||
}
|
||||
|
||||
int CrsfRc::print_status()
|
||||
|
||||
@@ -182,9 +182,9 @@ void DsmRc::Run()
|
||||
dsm_bind_pulses = DSMX8_BIND_PULSES;
|
||||
}
|
||||
|
||||
bind_spektrum(dsm_bind_pulses);
|
||||
|
||||
cmd_ret = vehicle_command_ack_s::VEHICLE_CMD_RESULT_ACCEPTED;
|
||||
if (dsm_bind_pulses > 0 && bind_spektrum(dsm_bind_pulses)) {
|
||||
cmd_ret = vehicle_command_ack_s::VEHICLE_CMD_RESULT_ACCEPTED;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -404,9 +404,9 @@ void RCInput::Run()
|
||||
dsm_bind_pulses = DSMX8_BIND_PULSES;
|
||||
}
|
||||
|
||||
bind_spektrum(dsm_bind_pulses);
|
||||
|
||||
cmd_ret = vehicle_command_ack_s::VEHICLE_CMD_RESULT_ACCEPTED;
|
||||
if (dsm_bind_pulses > 0 && bind_spektrum(dsm_bind_pulses)) {
|
||||
cmd_ret = vehicle_command_ack_s::VEHICLE_CMD_RESULT_ACCEPTED;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user