invert voltage led ring and fix long start button press not working
This commit is contained in:
parent
a775b5e0fa
commit
a5dcb39295
|
@ -102,8 +102,8 @@ void led_voltage(unsigned long loopmillis,float vbat,float vbat_min,float vbat_m
|
||||||
uint32_t colorEmpty=strip.Color(255, 0, 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());
|
||||||
for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
|
for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
|
||||||
uint8_t pp=i%strip.numPixels()+8; //Offset
|
uint8_t pp=strip.numPixels()- ((i+10)%strip.numPixels()) ; //Offset and invert
|
||||||
if (i<position) {
|
if (i<=position) {
|
||||||
strip.setPixelColor(pp, colorBG); // Set pixel's color (in RAM)
|
strip.setPixelColor(pp, colorBG); // Set pixel's color (in RAM)
|
||||||
}else{
|
}else{
|
||||||
strip.setPixelColor(pp, colorEmpty); // Set pixel's color (in RAM)
|
strip.setPixelColor(pp, colorEmpty); // Set pixel's color (in RAM)
|
||||||
|
|
|
@ -601,8 +601,7 @@ void readButtons() {
|
||||||
button_start_state=true; //pressed
|
button_start_state=true; //pressed
|
||||||
button_start_lastchange=loopmillis; //save time for debouncing
|
button_start_lastchange=loopmillis; //save time for debouncing
|
||||||
}else if (!digitalRead(PIN_START) && button_start_state) { //released an was pressed before
|
}else if (!digitalRead(PIN_START) && button_start_state) { //released an was pressed before
|
||||||
button_start_state=false; // not pressed
|
button_start_state=false; // not pressed
|
||||||
button_start_wait_release_flag=false;
|
|
||||||
button_start_lastchange=loopmillis; //save time for debouncing
|
button_start_lastchange=loopmillis; //save time for debouncing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,6 +617,11 @@ void readButtons() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!button_start_state) { //release wait flag at end if button released
|
||||||
|
button_start_wait_release_flag=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (button_start_shortpress_flag) {
|
if (button_start_shortpress_flag) {
|
||||||
armed=false; //disarm
|
armed=false; //disarm
|
||||||
writeLogComment(loopmillis, "Disarmed by button");
|
writeLogComment(loopmillis, "Disarmed by button");
|
||||||
|
|
Loading…
Reference in New Issue