fix led voltage ring
This commit is contained in:
parent
a5dcb39295
commit
47b67b8086
|
@ -100,10 +100,11 @@ void led_update(unsigned long loopmillis,ESCSerialComm& escFront, ESCSerialComm&
|
|||
void led_voltage(unsigned long loopmillis,float vbat,float vbat_min,float vbat_max) {
|
||||
uint32_t colorBG=strip.Color(0, 255, 0, 0);
|
||||
uint32_t colorEmpty=strip.Color(255, 0, 0, 0);
|
||||
uint8_t position=map( max(min(vbat,vbat_max),vbat_min) ,vbat_min,vbat_max, 0,strip.numPixels());
|
||||
uint8_t position=map( max(min(vbat,vbat_max),vbat_min) ,vbat_min,vbat_max, 0,strip.numPixels()+1);
|
||||
for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
|
||||
uint8_t pp=strip.numPixels()- ((i+10)%strip.numPixels()) ; //Offset and invert
|
||||
if (i<=position) {
|
||||
uint8_t pp=(strip.numPixels()-i-1 + 10 )%strip.numPixels(); //Offset and invert
|
||||
|
||||
if (i<position) {
|
||||
strip.setPixelColor(pp, colorBG); // Set pixel's color (in RAM)
|
||||
}else{
|
||||
strip.setPixelColor(pp, colorEmpty); // Set pixel's color (in RAM)
|
||||
|
|
Loading…
Reference in New Issue