diff --git a/src/Arduboy2.cpp b/src/Arduboy2.cpp index c59c5c1..7d750a7 100644 --- a/src/Arduboy2.cpp +++ b/src/Arduboy2.cpp @@ -33,10 +33,7 @@ void Arduboy2Base::begin() blank(); // blank the display - // utils - if(pressed(UP_BUTTON)) { - flashlight(); - } + flashlight(); // light the RGB LED and screen if UP button is being held. // check for and handle buttons held during start up for system control systemButtons(); @@ -48,12 +45,19 @@ void Arduboy2Base::begin() void Arduboy2Base::flashlight() { - // sendLCDCommand(OLED_ALL_PIXELS_ON); // smaller than allPixelsOn() + if(!pressed(UP_BUTTON)) { + return; + } + + sendLCDCommand(OLED_ALL_PIXELS_ON); // smaller than allPixelsOn() digitalWriteRGB(RGB_ON, RGB_ON, RGB_ON); + while(!pressed(DOWN_BUTTON)) { idle(); } + digitalWriteRGB(RGB_OFF, RGB_OFF, RGB_OFF); + sendLCDCommand(OLED_PIXELS_FROM_RAM); } void Arduboy2Base::systemButtons() { diff --git a/src/Arduboy2.h b/src/Arduboy2.h index 747e1cc..cc34837 100644 --- a/src/Arduboy2.h +++ b/src/Arduboy2.h @@ -74,10 +74,11 @@ public: /// Flashlight mode /** - * Hold up key when booting to enable, press down key to exit - * or simply turn off your Arduboy. Your sketches can also - * call this at any time. It goes into a tight loop until the - * down buttn is pressed. + * Turn the RGB LED and screen fully on. Called in the begin() function. + * + * Hold the UP button when booting to enable. Press the DOWN button to exit + * or simply turn off your Arduboy. It goes into a tight loop until the + * DOWN button is pressed. */ void flashlight();