Use both buttons to toggle driver & testing view

This commit is contained in:
Jasper Blanckenburg 2022-03-13 20:01:46 +01:00
parent 3cf68cd3cb
commit 14b5f6988d
1 changed files with 16 additions and 4 deletions

View File

@ -214,8 +214,12 @@ void update_display(){
}
uint32_t now = millis();
if(Stw_data.button1_rises > 0){
Stw_data.button1_rises--;
// Both buttons have to be pressed at the same time, but we also use the
// debounced rises to ensure we don't keep toggling between the pages
if (Stw_data.buttonState1 && Stw_data.buttonState4 &&
(Stw_data.button1_rises > 0|| Stw_data.button4_rises > 0)){
Stw_data.button1_rises = 0;
Stw_data.button4_rises = 0;
page = (DisplayPage) ((page + 1) % DISPLAY_PAGES);
tft.clear();
last_cleared = now;
@ -306,6 +310,14 @@ void update_page_driver() {
left_box_value = (Value) (left_box_value + 1);
}
left_box.update_label(get_label(left_box_value));
if (Stw_data.button1_rises > 0) {
Stw_data.button1_rises--;
if (left_box_value == VAL_FIRST_LEFT_BOX) {
left_box_value = VAL_LAST;
} else {
left_box_value = (Value) (left_box_value - 1);
}
left_box.update_label(get_label(left_box_value));
}
gear_box.update_value(get_value(VAL_GEAR));
@ -318,10 +330,10 @@ void update_page_driver() {
}
void redraw_page_testing() {
}
void update_page_testing() {}
void update_page_testing() {}
DataBox::DataBox(int x1, int y1, int x2, int y2, int text_x, int text_y, int font,
int size_x, int size_y, uint8_t justification)