Skip to content

Commit

Permalink
Merge pull request #4912 from tonhuisman/feature/AdafruitGFXhelper-re…
Browse files Browse the repository at this point in the history
…duce-build-size

[AdaGFX_helper] Reduce build-size
  • Loading branch information
TD-er committed May 1, 2024
2 parents fb95d8c + 8bf6344 commit 2306cd6
Show file tree
Hide file tree
Showing 16 changed files with 2,996 additions and 1,169 deletions.
7 changes: 7 additions & 0 deletions docs/source/Plugin/AdaGFX_commands.repl
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
* *sevenseg24* A rather large 7-segment 21 * 48 font
* *sevenseg18* A somewhat less large 7-segment 16 * 34 font
* *freesans* A sans-serif 10 * 21 font
* *tomthumb* A small 3 * 5 font, for use on a 5x29 NeoPixel display. Not available in limited builds.

Usually disabled fonts: (can be enabled in a Custom build, default enabled in the MAX builds)

Expand All @@ -136,7 +137,11 @@
* *whiterabbit16pt* A modern 16 * 20 font
* *robotomono16pt* A modern 16 * 20 font
* *whiterabbit18pt* A modern 18 * 22 font
* *sevenseg18b* A better 18 * 22 font, where the 1 isn't proportionally spaced, but doesn't have much non-alphanumeric characters
* *lcd14cond18pt* A 14 segment, 18pt, LCD-like font
* *whiterabbit20pt* A modern 20 * 24 font
* *sevenseg24b* A better 24 * 34 font, where the 1 isn't proportionally spaced, but doesn't have much non-alphanumeric characters
* *lcd14cond24pt* A 14 segment, 24pt, LCD-like font

Standard disabled fonts (even on MAX builds), that can be enabled in a custom build:

Expand All @@ -148,6 +153,8 @@
* *robotocond16pt* A modern 16 * 20 font (Roboto Condensed, proportionally spaced)

NB: Roboto is used as the default Android font since Android 4.1, and very readable, even when using small fonts on a small display.

NB2: The 18pt fonts are included by default in the ESP32 builds, using this helper.
"
"
``<trigger>,l,<x1>,<y1>,<x2>,<y2>,<color>``
Expand Down
8 changes: 8 additions & 0 deletions docs/source/Plugin/P131.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,14 @@ Default setting is *Continue to next line*.

* **Maximum allowed brightness**: The brightness that is the maximum it can be set to, either from UI or via the ``brightness`` command, to optionally help protect both the eyes and the power-supply powering the display. Default is 255. Range: 1..255.

* **Default font**: Select from the currently available fonts, the font that will be active when the plugin is started.

Available fonts are depending on the build used, some builds don't show this option, as then only the ``default`` font is included:

.. image:: P131_DefaultFontOptions.png

The complete list of possible fonts is available at the ``font`` subcommand, below. (This screenshot is taken from a MAX build)

* **Font scaling** The scaling factor for the currently active font. Select a factor between 1 and 4.

* **Clear display on exit** When checked, will clear the display when the task is disabled, either from settings or via the ``TaskDisable`` command. This will fill the display with black pixels, turning all NeoPixels off.
Expand Down
Binary file added docs/source/Plugin/P131_DefaultFontOptions.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/Plugin/P131_DeviceConfiguration.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions lib/Adafruit_GFX_Library/Fonts/TomThumb.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const uint8_t TomThumbBitmaps[] PROGMEM = {
0x80, /* 0x2E period */
0x25, 0x48, /* 0x2F slash */
0x76, 0xDC, /* 0x30 zero */
0x75, 0x40, /* 0x31 one */
0x59, 0x2E, /* 0x31 one */
0xC5, 0x4E, /* 0x32 two */
0xC5, 0x1C, /* 0x33 three */
0xB7, 0x92, /* 0x34 four */
Expand Down Expand Up @@ -279,7 +279,7 @@ const GFXglyph TomThumbGlyphs[] PROGMEM = {
{22, 1, 1, 2, 0, -1}, /* 0x2E period */
{23, 3, 5, 4, 0, -5}, /* 0x2F slash */
{25, 3, 5, 4, 0, -5}, /* 0x30 zero */
{27, 2, 5, 3, 0, -5}, /* 0x31 one */
{27, 3, 5, 4, 0, -5}, /* 0x31 one */
{29, 3, 5, 4, 0, -5}, /* 0x32 two */
{31, 3, 5, 4, 0, -5}, /* 0x33 three */
{33, 3, 5, 4, 0, -5}, /* 0x34 four */
Expand Down
8 changes: 8 additions & 0 deletions platformio_esp32s3_envs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ build_flags = ${esp32s3_common.build_flags}
-DFEATURE_SD=1
-DPLUGIN_NEOPIXEL_COLLECTION

[env:neopixel_ESP32s3_4M316k_LittleFS_CDC]
extends = esp32s3_common_LittleFS
board = esp32s3cdc-qio_qspi
build_flags = ${esp32s3_common_LittleFS.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DFEATURE_SD=1
-DPLUGIN_NEOPIXEL_COLLECTION


[env:custom_ESP32s3_8M1M_LittleFS_CDC_ETH]
extends = esp32s3_common_LittleFS
Expand Down
7 changes: 6 additions & 1 deletion src/_P131_NeoPixelMatrix.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// #######################################################################################################

/** Changelog:
* 2024-04-17 tonhuisman: Add selection of a default font to use.
* 2023-10-03 tonhuisman: Optimizate alignment of settings struct, exclude some logging if BUILD_NO_DEBUG is defined
* 2023-02-27 tonhuisman: Implement support for getting config values, see AdafruitGFX_Helper.h changelog for details
* 2022-07-30 tonhuisman: Add commands to set scroll-options (settext, setscroll, setstep, setspeed, setempty, setright)
Expand Down Expand Up @@ -158,6 +159,8 @@ boolean Plugin_131(uint8_t function, struct EventStruct *event, String& string)
addFormNumericBox(F("Maximum allowed brightness"), F("maxbright"), P131_CONFIG_FLAG_GET_MAXBRIGHT, 1, 255);
addUnit(F("1..255"));

AdaGFXFormDefaultFont(F("deffont"), P131_CONFIG_DEFAULT_FONT);

AdaGFXFormFontScaling(F("fontscale"), P131_CONFIG_FLAG_GET_FONTSCALE, 4);

# ifdef P131_SHOW_SPLASH
Expand Down Expand Up @@ -288,6 +291,7 @@ boolean Plugin_131(uint8_t function, struct EventStruct *event, String& string)
P131_CONFIG_MATRIX_HEIGHT = getFormItemInt(F("mxheight"));
P131_CONFIG_TILE_WIDTH = getFormItemInt(F("tlwidth"));
P131_CONFIG_TILE_HEIGHT = getFormItemInt(F("tlheight"));
P131_CONFIG_DEFAULT_FONT = getFormItemInt(F("deffont"));

// Bits are already in the correct order/configuration to be passed on to the constructor
// Matrix bits
Expand Down Expand Up @@ -382,7 +386,8 @@ boolean Plugin_131(uint8_t function, struct EventStruct *event, String& string)
P131_CONFIG_FLAG_GET_BRIGHTNESS,
P131_CONFIG_FLAG_GET_MAXBRIGHT,
P131_CONFIG_GET_COLOR_FOREGROUND,
P131_CONFIG_GET_COLOR_BACKGROUND));
P131_CONFIG_GET_COLOR_BACKGROUND,
P131_CONFIG_DEFAULT_FONT));
P131_data_struct *P131_data = static_cast<P131_data_struct *>(getPluginTaskData(event->TaskIndex));

success = (nullptr != P131_data) && P131_data->plugin_init(event); // Start the display
Expand Down
6 changes: 6 additions & 0 deletions src/src/CustomBuild/define_plugin_sets.h
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,12 @@ To create/register a plugin, you have to :
#endif
#ifndef USES_P131
#define USES_P131 // NeoMatrix
#ifdef ESP32
#define TOMTHUMB_USE_EXTENDED 1
#endif
#endif
#if !defined(USES_P105) && defined(ESP32)
#define USES_P105 // AHT10/20/21 (used in TinyTronics Smart Home RGB LED Matrix)
#endif
#if !defined(USES_P137) && defined(ESP32)
#define USES_P137 // AXP192
Expand Down

0 comments on commit 2306cd6

Please sign in to comment.