mirror of https://github.com/ArduPilot/ardupilot
AP_Notify: scale NCP5623 for for data range
we were overflowing the RGB max of 0x1f, leading to LED being off at high power
This commit is contained in:
parent
0fd335af33
commit
5a7e870cfb
|
@ -45,6 +45,8 @@ NCP5623::NCP5623(uint8_t bus)
|
|||
bool NCP5623::write(uint8_t reg, uint8_t data)
|
||||
{
|
||||
uint8_t msg[1] = { 0x00 };
|
||||
// scale to 0 to 0x1F
|
||||
data = (data * 255U) / 0x1FU;
|
||||
msg[0] = ((reg & 0xe0) | (data & 0x1f));
|
||||
bool ret = _dev->transfer(msg, 1, nullptr, 0);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue