mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-30 18:06:39 +08:00
MAVLink: Improve switch handling
This commit is contained in:
@@ -991,7 +991,7 @@ switch_pos_t
|
|||||||
MavlinkReceiver::decode_switch_pos(uint16_t buttons, unsigned sw)
|
MavlinkReceiver::decode_switch_pos(uint16_t buttons, unsigned sw)
|
||||||
{
|
{
|
||||||
// This 2-bit method should be used in the future: (buttons >> (sw * 2)) & 3;
|
// This 2-bit method should be used in the future: (buttons >> (sw * 2)) & 3;
|
||||||
return (buttons & (1 << sw));
|
return (buttons & (1 << sw)) ? manual_control_setpoint_s::SWITCH_POS_ON : manual_control_setpoint_s::SWITCH_POS_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
Reference in New Issue
Block a user