Add boot logo bypass feature

Pressing the RIGHT button while the boot logo is scrolling down will
abort the sequence, to start running the actual sketch faster.
This commit is contained in:
Scott Allen 2017-02-06 14:37:45 -05:00
parent 2fede9cb86
commit de17257029
3 changed files with 23 additions and 1 deletions

View File

@ -54,6 +54,8 @@ A user settable *unit name* of up to 6 characters can be saved in system EEPROM
Once the logo display sequence completes, the sketch continues.
For developers who wish to quickly begin testing, or impatient users who want to go strait to playing their game, the boot logo sequence can be bypassed by holding the *RIGHT* button while powering up, and then releasing it. Alternatively, the *RIGHT* button can be pressed while the logo is scrolling down.
### "Flashlight" mode
If the *UP* button is pressed and held when the Arduboy is powered on, it enters *flashlight* mode. This turns the RGB LED fully on, and all the pixels of the screen are lit, resulting in a bright white light suitable as a small flashlight. (For an incorrect RGB LED, only the screen will light). To exit *flashlight* mode, press the *DOWN* button to continue with the sketch.
@ -193,6 +195,11 @@ void Arduboy2Base::begin()
audio.begin();
bootLogo();
// wait for all buttons to be released
do {
delay(50);
} while (buttonsState());
}
```

View File

@ -45,6 +45,11 @@ void Arduboy2Base::begin()
audio.begin();
bootLogo();
// wait for all buttons to be released
do {
delay(50);
} while (buttonsState());
}
void Arduboy2Base::flashlight()
@ -93,6 +98,11 @@ void Arduboy2Base::bootLogo()
digitalWrite(RED_LED, RGB_ON);
for (int8_t y = -18; y <= 24; y++) {
if (pressed(RIGHT_BUTTON)) {
digitalWriteRGB(RGB_OFF, RGB_OFF, RGB_OFF); // all LEDs off
return;
}
if (y == -4) {
digitalWriteRGB(RGB_OFF, RGB_ON, RGB_OFF); // green LED on
}

View File

@ -236,6 +236,11 @@ class Arduboy2Base : public Arduboy2Core
* The Arduboy logo scrolls down from the top of the screen to the center
* while the RGB LEDs light in sequence.
*
* If the RIGHT button is pressed while the logo is scrolling down,
* the boot logo sequence will be aborted. This can be useful for
* developers who wish to quickly start testing, or anyone else who is
* impatient and wants to go straight to the actual sketch.
*
* This function calls `bootLogoExtra()` after the logo stops scrolling down,
* which derived classes can implement to add additional information to the
* logo screen. The `Arduboy2` class uses this to display the unit name.