mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +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:
parent
bbc104ad4c
commit
563200fee6
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user