Turn on all display pixels in "flashlight" mode

Mainly to give an indication that the device is in "flashlight" mode
for units that have the RGB LED installed reversed.

Also, the test for the UP button is moved to within flashlight() itself.
This commit is contained in:
Scott Allen 2016-06-15 13:25:57 -04:00
parent 3c4ebf59c2
commit f7915cd0a9
2 changed files with 14 additions and 9 deletions

View File

@ -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() {

View File

@ -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();