diff --git a/src/main.cpp b/src/main.cpp index 65920f44..dd375b90 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -178,7 +178,6 @@ void loop() { tft.fillRect(0,0,WIDTH,HEIGHT,BGCOLOR); while(1){ handleSerialCommands(); - // TODO: screenSleep(); // turn off screen with a timer -> wake up on any button press if(returnToMenu) { returnToMenu = false; @@ -186,8 +185,9 @@ void loop() { redraw=true; } + if(checkAnyKeyPress()) reset_screensaver_timer(); + if (redraw) { - reset_screensaver_timer(); drawMainMenu(index); redraw = false; delay(200); diff --git a/src/mykeyboard.cpp b/src/mykeyboard.cpp index 49efda8d..9d1cffb4 100644 --- a/src/mykeyboard.cpp +++ b/src/mykeyboard.cpp @@ -59,8 +59,23 @@ bool checkEscPress(){ else { return false; } } +bool checkAnyKeyPress() { +#if defined (CARDPUTER) // If any key is pressed, it'll jump the boot screen + Keyboard.update(); + if(Keyboard.isPressed()) + #else + if(digitalRead(SEL_BTN)==LOW) // If M5 key is pressed, it'll jump the boot screen + #endif + return true; + // else + return false; + +} + + #include "TV-B-Gone.h" #include "rf.h" +#include "bad_usb.h" #include "webInterface.h" void checkShortcutPress(){ @@ -69,6 +84,7 @@ void checkShortcutPress(){ Keyboard.update(); if(Keyboard.isKeyPressed('i')) otherIRcodes(); if(Keyboard.isKeyPressed('r') || Keyboard.isKeyPressed('s')) otherRFcodes(); + if(Keyboard.isKeyPressed('b')) usb_setup(); // badusb if(Keyboard.isKeyPressed('w')) loopOptionsWebUi(); // TODO: other boards // TODO: user-configurable diff --git a/src/mykeyboard.h b/src/mykeyboard.h index 4de25106..abec1dd1 100644 --- a/src/mykeyboard.h +++ b/src/mykeyboard.h @@ -13,3 +13,5 @@ bool checkSelPress(); bool checkEscPress(); void checkShortcutPress(); + +bool checkAnyKeyPress(); \ No newline at end of file