mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 16:51:16 +08:00
fix rgbled On and Powersave value in read mode
fix rgbled On and Powersave value in read mode. In read mode, the ENABLE and SHDN is in bit 4 and bit5, so we may need a 4bit left shift to get a correct value.
This commit is contained in:
1 parent
bbc104ad4c
commit
563200fee6
1 file changed
+2
-2
@@ -388,8 +388,8 @@ RGBLED::get(bool &on, bool &powersave, uint8_t &r, uint8_t &g, uint8_t &b)
|
||||
ret = transfer(nullptr, 0, &result[0], 2);
|
||||
|
||||
if (ret == OK) {
|
||||
on = result[0] & SETTING_ENABLE;
|
||||
powersave = !(result[0] & SETTING_NOT_POWERSAVE);
|
||||
on = ((result[0] >> 4) & SETTING_ENABLE);
|
||||
powersave = !((result[0] >> 4) & SETTING_NOT_POWERSAVE);
|
||||
/* XXX check, looks wrong */
|
||||
r = (result[0] & 0x0f) << 4;
|
||||
g = (result[1] & 0xf0);
|
||||
|
||||
Reference in new issue
Block a user