invert voltage led ring and fix long start button press not working

This commit is contained in:
interfisch 2023-05-23 22:17:25 +02:00
parent a775b5e0fa
commit a5dcb39295
2 changed files with 8 additions and 4 deletions

View File

@ -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);
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...
uint8_t pp=i%strip.numPixels()+8; //Offset
if (i<position) {
uint8_t pp=strip.numPixels()- ((i+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)

View File

@ -601,8 +601,7 @@ void readButtons() {
button_start_state=true; //pressed
button_start_lastchange=loopmillis; //save time for debouncing
}else if (!digitalRead(PIN_START) && button_start_state) { //released an was pressed before
button_start_state=false; // not pressed
button_start_wait_release_flag=false;
button_start_state=false; // not pressed
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) {
armed=false; //disarm
writeLogComment(loopmillis, "Disarmed by button");