diff --git a/bootloader/bootloader.c b/bootloader/bootloader.c index 85baf84333..2497b13856 100644 --- a/bootloader/bootloader.c +++ b/bootloader/bootloader.c @@ -119,11 +119,9 @@ int main(void) mpu_config_bootloader(); #ifndef APPVER - // at least one button is unpressed - uint16_t state = gpio_port_read(BTN_PORT); - int unpressed = ((state & BTN_PIN_YES) == BTN_PIN_YES || (state & BTN_PIN_NO) == BTN_PIN_NO); + bool left_pressed = (buttonRead() & BTN_PIN_NO) == 0; - if (firmware_present_new() && unpressed) { + if (firmware_present_new() && !left_pressed) { oledClear(); oledDrawBitmap(40, 0, &bmp_logo64_empty); diff --git a/buttons.c b/buttons.c index a6e64b5ad6..f416736c38 100644 --- a/buttons.c +++ b/buttons.c @@ -29,10 +29,9 @@ uint16_t buttonRead(void) { void buttonUpdate() { - uint16_t state; static uint16_t last_state = BTN_PIN_YES | BTN_PIN_NO; - state = buttonRead(); + uint16_t state = buttonRead(); if ((state & BTN_PIN_YES) == 0) { // Yes button is down if ((last_state & BTN_PIN_YES) == 0) { // last Yes was down