mirror of https://github.com/MLXXXp/Arduboy2.git
Add bootLogoText() function
Displays the boot logo using text instead of a bitmap, as an option to reduce code size.
This commit is contained in:
parent
f294a045e0
commit
14d5877dae
|
@ -51,7 +51,7 @@ For developers who wish to quickly begin testing, or impatient users who want to
|
||||||
|
|
||||||
### "Flashlight" mode
|
### "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.
|
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 the Arduboy must be restarted.
|
||||||
|
|
||||||
*Flashlight* mode is also sometimes useful to allow uploading of new sketches, in case the sketch currently loaded uses a large amount of RAM which creates a bootloader problem.
|
*Flashlight* mode is also sometimes useful to allow uploading of new sketches, in case the sketch currently loaded uses a large amount of RAM which creates a bootloader problem.
|
||||||
|
|
||||||
|
@ -209,6 +209,11 @@ For example: Let's say a sketch has its own code to enable, disable and save the
|
||||||
|
|
||||||
This saves whatever code *blank()*, *systemButtons()* and *bootLogo()* would use.
|
This saves whatever code *blank()*, *systemButtons()* and *bootLogo()* would use.
|
||||||
|
|
||||||
|
There are a few functions provided that are roughly equivalent to the standard functions used by *begin()* but which use less code space.
|
||||||
|
|
||||||
|
- *bootLogoText()* can be used in place *bootLogo()* in the case where the sketch uses text functions. It renders the logo as text instead of as a bitmap (so doesn't look as good).
|
||||||
|
- *safeMode()* can be used in place of *flashlight()* for cases where it's needed to allow uploading a new sketch when the bootloader "magic key" problem is an issue. It only lights the red RGB LED, so you don't get the bright light that is the primary purpose of *flashlight()*.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
## What's different from Arduboy library V1.1
|
## What's different from Arduboy library V1.1
|
||||||
|
|
|
@ -19,6 +19,7 @@ begin KEYWORD2
|
||||||
blank KEYWORD2
|
blank KEYWORD2
|
||||||
boot KEYWORD2
|
boot KEYWORD2
|
||||||
bootLogo KEYWORD2
|
bootLogo KEYWORD2
|
||||||
|
bootLogoText KEYWORD2
|
||||||
buttonsState KEYWORD2
|
buttonsState KEYWORD2
|
||||||
clear KEYWORD2
|
clear KEYWORD2
|
||||||
collide KEYWORD2
|
collide KEYWORD2
|
||||||
|
|
|
@ -97,6 +97,8 @@ void Arduboy2Base::sysCtrlSound(uint8_t buttons, uint8_t led, uint8_t eeVal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bootLogoText() should be kept in sync with bootLogo()
|
||||||
|
// if changes are made to one, equivalent changes should be made to the other
|
||||||
void Arduboy2Base::bootLogo()
|
void Arduboy2Base::bootLogo()
|
||||||
{
|
{
|
||||||
digitalWriteRGB(RED_LED, RGB_ON);
|
digitalWriteRGB(RED_LED, RGB_ON);
|
||||||
|
@ -1003,6 +1005,50 @@ Arduboy2::Arduboy2()
|
||||||
textWrap = 0;
|
textWrap = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bootLogoText() should be kept in sync with bootLogo()
|
||||||
|
// if changes are made to one, equivalent changes should be made to the other
|
||||||
|
void Arduboy2::bootLogoText()
|
||||||
|
{
|
||||||
|
digitalWriteRGB(RED_LED, RGB_ON);
|
||||||
|
|
||||||
|
textSize = 2;
|
||||||
|
|
||||||
|
for (int8_t y = -18; y <= 24; y++) {
|
||||||
|
if (pressed(RIGHT_BUTTON)) {
|
||||||
|
digitalWriteRGB(RGB_OFF, RGB_OFF, RGB_OFF); // all LEDs off
|
||||||
|
textSize = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y == -4) {
|
||||||
|
digitalWriteRGB(RED_LED, RGB_OFF); // red LED off
|
||||||
|
digitalWriteRGB(GREEN_LED, RGB_ON); // green LED on
|
||||||
|
}
|
||||||
|
else if (y == 24) {
|
||||||
|
digitalWriteRGB(GREEN_LED, RGB_OFF); // green LED off
|
||||||
|
digitalWriteRGB(BLUE_LED, RGB_ON); // blue LED on
|
||||||
|
}
|
||||||
|
|
||||||
|
clear();
|
||||||
|
cursor_x = 23;
|
||||||
|
cursor_y = y;
|
||||||
|
print("ARDUBOY");
|
||||||
|
display();
|
||||||
|
delay(27);
|
||||||
|
// longer delay post boot, we put it inside the loop to
|
||||||
|
// save the flash calling clear/delay again outside the loop
|
||||||
|
if (y==-16) {
|
||||||
|
delay(250);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delay(750);
|
||||||
|
digitalWriteRGB(BLUE_LED, RGB_OFF);
|
||||||
|
textSize = 1;
|
||||||
|
|
||||||
|
bootLogoExtra();
|
||||||
|
}
|
||||||
|
|
||||||
void Arduboy2::bootLogoExtra()
|
void Arduboy2::bootLogoExtra()
|
||||||
{
|
{
|
||||||
uint8_t c = EEPROM.read(EEPROM_UNIT_NAME);
|
uint8_t c = EEPROM.read(EEPROM_UNIT_NAME);
|
||||||
|
|
|
@ -259,7 +259,7 @@ class Arduboy2Base : public Arduboy2Core
|
||||||
* which derived classes can implement to add additional information to the
|
* which derived classes can implement to add additional information to the
|
||||||
* logo screen. The `Arduboy2` class uses this to display the unit name.
|
* logo screen. The `Arduboy2` class uses this to display the unit name.
|
||||||
*
|
*
|
||||||
* \see begin() boot() Arduboy2::bootLogoExtra()
|
* \see begin() boot() Arduboy2::bootLogoExtra() Arduboy2::bootLogoText()
|
||||||
*/
|
*/
|
||||||
void bootLogo();
|
void bootLogo();
|
||||||
|
|
||||||
|
@ -1083,11 +1083,31 @@ class Arduboy2 : public Print, public Arduboy2Base
|
||||||
* \see Arduboy2::write()
|
* \see Arduboy2::write()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** \brief
|
||||||
|
* Display the boot logo sequence using printed text instead of a bitmap.
|
||||||
|
*
|
||||||
|
* \details
|
||||||
|
* This function can be called by a sketch after `boot()` as an alternative
|
||||||
|
* to `bootLogo()`.
|
||||||
|
*
|
||||||
|
* The Arduboy logo scrolls down from the top of the screen to the center
|
||||||
|
* while the RGB LEDs light in sequence.
|
||||||
|
*
|
||||||
|
* This function is the same as `bootLogo()` except the logo is printed as
|
||||||
|
* text instead of being rendered as a bitmap. It can be used to save some
|
||||||
|
* code space in a case where the sketch is using the Print class functions
|
||||||
|
* to display text. However, the logo will not look as good when printed as
|
||||||
|
* text as it does with the bitmap used by `bootLogo()`.
|
||||||
|
*
|
||||||
|
* \see bootLogo() boot() Arduboy2::bootLogoExtra()
|
||||||
|
*/
|
||||||
|
void bootLogoText();
|
||||||
|
|
||||||
/** \brief
|
/** \brief
|
||||||
* Show the unit name at the bottom of the boot logo screen.
|
* Show the unit name at the bottom of the boot logo screen.
|
||||||
*
|
*
|
||||||
* \details
|
* \details
|
||||||
* This function is called by the `bootLogo()` function.
|
* This function is called by `bootLogo()` and `bootlogoText()`.
|
||||||
*
|
*
|
||||||
* If a unit name has been saved in system EEPROM, it will be displayed at
|
* If a unit name has been saved in system EEPROM, it will be displayed at
|
||||||
* the bottom of the screen. This function pauses for a short time to allow
|
* the bottom of the screen. This function pauses for a short time to allow
|
||||||
|
@ -1097,7 +1117,7 @@ class Arduboy2 : public Print, public Arduboy2Base
|
||||||
* This function would not normally be called directly from within a sketch
|
* This function would not normally be called directly from within a sketch
|
||||||
* itself.
|
* itself.
|
||||||
*
|
*
|
||||||
* \see readUnitName() writeUnitName() bootLogo() begin()
|
* \see readUnitName() writeUnitName() bootLogo() bootLogoText() begin()
|
||||||
*/
|
*/
|
||||||
virtual void bootLogoExtra();
|
virtual void bootLogoExtra();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue