diff --git a/examples/esp/espCapTouchTft/ThemeCoolBlueModernBuilder.h b/examples/esp/espCapTouchTft/ThemeCoolBlueModernBuilder.h new file mode 100644 index 00000000..57f352b1 --- /dev/null +++ b/examples/esp/espCapTouchTft/ThemeCoolBlueModernBuilder.h @@ -0,0 +1,70 @@ +/** + * Cool blue modern theme by tcMenu organisation. This is part of the standard themes shipped with TcMenu. + * This file will not be updated by the designer, you can edit. + * See https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/themes/rendering-with-themes-icons-grids/ + */ + +#ifndef THEME_COOL_BLUE +#define THEME_COOL_BLUE + +#include + +const color_t coolBlueTitlePalette[] = {RGB(0,0,0), RGB(20,132,255), RGB(192,192,192), RGB(64, 64, 64)}; +const color_t coolBlueItemPalette[] = {RGB(255, 255, 255), RGB(0,64,135), RGB(20,133,255), RGB(31,100,178)}; +const color_t coolBlueActionPalette[] = {RGB(255, 255, 255), RGB(0,45,120), RGB(20,133,255), RGB(31,100,178)}; + +#define ACTION_BORDER_WIDTH 0 +#define USE_SLIDER_FOR_ANALOG true + +/** + * This is one of the stock themes, you can modify it to meet your requirements, and it will not be updated by tcMenu + * Designer unless you delete it. This sets up the fonts, spacing and padding for all items. + * @param gr the graphical renderer + * @param itemFont the font for items + * @param titleFont the font for titles + * @param needEditingIcons if editing icons are needed + */ +void installCoolBlueModernTheme(GraphicsDeviceRenderer& gr, const MenuFontDef& itemFont, const MenuFontDef& titleFont, + bool needEditingIcons, BaseGraphicalRenderer::TitleMode titleMode, bool useUnicode) { + + TcThemeBuilder themeBuilder(gr); + + themeBuilder.dimensionsFromRenderer() + .withSelectedColors(RGB(31, 88, 100), RGB(255, 255, 255)) + .withItemPadding(MenuPadding(4, 3, 4, 3)) + .withTitlePadding(MenuPadding(4, 3, 4, 3)) + .withRenderingSettings(titleMode, USE_SLIDER_FOR_ANALOG) + .withPalette(coolBlueItemPalette) + .withNativeFont(itemFont.fontData, itemFont.fontMag) + .withSpacing(2); + + if(needEditingIcons) { + themeBuilder.withStandardMedResCursorIcons(); + } + + if(useUnicode) { + themeBuilder.enableTcUnicode(); + } + + themeBuilder.defaultItemProperties() + .withJustification(GridPosition::JUSTIFY_TITLE_LEFT_VALUE_RIGHT) + .apply(); + + themeBuilder.defaultTitleProperties() + .withJustification(GridPosition::JUSTIFY_CENTER_WITH_VALUE) + .withNativeFont(titleFont.fontData, titleFont.fontMag) + .withPalette(coolBlueTitlePalette) + .withSpacing(3) + .apply(); + + + themeBuilder.defaultActionProperties() + .withJustification(GridPosition::JUSTIFY_CENTER_WITH_VALUE) + .withPalette(coolBlueActionPalette) + .withBorder(MenuBorder(ACTION_BORDER_WIDTH)) + .apply(); + + themeBuilder.apply(); +} + +#endif //THEME_COOL_BLUE \ No newline at end of file diff --git a/examples/esp/espCapTouchTft/ThemeDarkModeTraditionalBuilder.h b/examples/esp/espCapTouchTft/ThemeDarkModeTraditionalBuilder.h deleted file mode 100644 index f5510085..00000000 --- a/examples/esp/espCapTouchTft/ThemeDarkModeTraditionalBuilder.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Dark mode modern theme by TheCodersCorner.com. This is part of the standard themes shipped with TcMenu. - * This file will not be updated by the designer, you can edit. - */ -#ifndef THEME_DARK_MODE -#define THEME_DARK_MODE - -#include - -const color_t darkModeTitlePalette[] = {RGB(255,255,255), RGB(43,43,43), RGB(192,192,192), RGB(0,133,255)}; -const color_t darkModeItemPalette[] = {RGB(255, 255, 255), RGB(0,0,0), RGB(43,43,43), RGB(65,65,65)}; -const color_t darkModeActionPalette[] = {RGB(255, 255, 255), RGB(35,35,35), RGB(20,45,110), RGB(192,192,192)}; - -/** - * This is one of the stock themes, you can modify it to meet your requirements, and it will not be updated by tcMenu - * Designer unless you delete it. This sets up the fonts, spacing and padding for all items. - * @param gr the graphical renderer - * @param itemFont the font for items - * @param titleFont the font for titles - * @param needEditingIcons if editing icons are needed - * @param titleMode the way that the title should be drawn (choose from the enum values) - * @param useUnicode if using tcUnicode drawing functions - */ -void installDarkModeTraditionalTheme(GraphicsDeviceRenderer& gr, const MenuFontDef& itemFont, const MenuFontDef& titleFont, - bool needEditingIcons, BaseGraphicalRenderer::TitleMode titleMode, bool useUnicode) { - - TcThemeBuilder themeBuilder(gr); - bool medResOrBetter = gr.getWidth() > 160; - MenuPadding titlePadding(medResOrBetter ? 4 : 2); - MenuPadding itemPadding(medResOrBetter ? 2 : 1); - - themeBuilder.dimensionsFromRenderer() - .withSelectedColors(RGB(46, 66, 161), RGB(255, 255, 255)) - .withItemPadding(itemPadding) - .withTitlePadding(titlePadding) - .withRenderingSettings(titleMode, false) - .withPalette(darkModeItemPalette) - .withNativeFont(itemFont.fontData, itemFont.fontMag) - .withSpacing(1); - - if(needEditingIcons) { - if(medResOrBetter) { - themeBuilder.withStandardMedResCursorIcons(); - } else { - themeBuilder.withStandardLowResCursorIcons(); - } - } - - if(useUnicode) { - themeBuilder.enableTcUnicode(); - } - - themeBuilder.defaultItemProperties() - .withJustification(GridPosition::JUSTIFY_TITLE_LEFT_VALUE_RIGHT) - .apply(); - - themeBuilder.defaultTitleProperties() - .withJustification(GridPosition::JUSTIFY_CENTER_WITH_VALUE) - .withNativeFont(titleFont.fontData, titleFont.fontMag) - .withPalette(darkModeTitlePalette) - .withSpacing(medResOrBetter ? 3 : 1) - .apply(); - - themeBuilder.defaultActionProperties() - .withJustification(GridPosition::JUSTIFY_TITLE_LEFT_WITH_VALUE) - .withPalette(darkModeActionPalette) - .apply(); - - themeBuilder.apply(); -} - -#endif //THEME_DARK_MODE diff --git a/examples/esp/espCapTouchTft/espCapTouchTft.emf b/examples/esp/espCapTouchTft/espCapTouchTft.emf index b9c557f9..8899bda1 100644 --- a/examples/esp/espCapTouchTft/espCapTouchTft.emf +++ b/examples/esp/espCapTouchTft/espCapTouchTft.emf @@ -163,7 +163,7 @@ "lastRemoteUuids": [ "2c101fec-1f7d-4ff3-8d2b-992ad41e7fcb" ], - "lastThemeUuid": "2F1EAB1E-0469-42C8-A222-BE2DF96D6D81", + "lastThemeUuid": "1947F585-9D36-448C-8A80-B425686107BD", "applicationUUID": "a32450f4-91fc-4747-9e6f-6317dd9e2309", "applicationName": "espCapTouchTft", "lastProperties": [ @@ -312,6 +312,11 @@ "latestValue": "num:,4", "subsystem": "THEME" }, + { + "name": "BORDER_FOR_ACTIONS", + "latestValue": "0", + "subsystem": "THEME" + }, { "name": "TITLE_SHOW_MODE", "latestValue": "TITLE_ALWAYS", @@ -322,6 +327,11 @@ "latestValue": "false", "subsystem": "THEME" }, + { + "name": "USE_SLIDER_ANALOG", + "latestValue": "true", + "subsystem": "THEME" + }, { "name": "NEED_EDITING_ICONS", "latestValue": "true", diff --git a/examples/esp/espCapTouchTft/espCapTouchTft_menu.cpp b/examples/esp/espCapTouchTft/espCapTouchTft_menu.cpp index 0404fbbd..e38a66c6 100644 --- a/examples/esp/espCapTouchTft/espCapTouchTft_menu.cpp +++ b/examples/esp/espCapTouchTft/espCapTouchTft_menu.cpp @@ -8,11 +8,11 @@ use elsewhere. */ -// Generated for Arduino ESP32 by TcMenu 4.3.1-SNAPSHOT on 2024-08-31T09:58:46.844277900Z. +// Generated for Arduino ESP32 by TcMenu 4.3.1 on 2024-09-08T11:36:32.065655600Z. #include #include "espCapTouchTft_menu.h" -#include "ThemeDarkModeTraditionalBuilder.h" +#include "ThemeCoolBlueModernBuilder.h" // Global variable declarations const PROGMEM ConnectorLocalInfo applicationInfo = { "espCapTouchTft", "a32450f4-91fc-4747-9e6f-6317dd9e2309" }; @@ -61,6 +61,6 @@ void setupMenu() { touchInterrogator.init(); touchScreen.start(); menuMgr.initWithoutInput(&renderer, &menuPercentage); - installDarkModeTraditionalTheme(renderer, MenuFontDef(nullptr, 2), MenuFontDef(nullptr, 4), true, BaseGraphicalRenderer::TITLE_ALWAYS, false); + installCoolBlueModernTheme(renderer, MenuFontDef(nullptr, 2), MenuFontDef(nullptr, 4), true, BaseGraphicalRenderer::TITLE_ALWAYS, false); } diff --git a/examples/mbed/stm32OledEncoder/ScreenSaverCustomDrawing.h b/examples/mbed/stm32OledEncoder/ScreenSaverCustomDrawing.h index a6f3df3e..a05bdbbe 100644 --- a/examples/mbed/stm32OledEncoder/ScreenSaverCustomDrawing.h +++ b/examples/mbed/stm32OledEncoder/ScreenSaverCustomDrawing.h @@ -3,7 +3,7 @@ #define TCMENUEXAMPLE_SCREENSAVERCUSTOMDRAWING_H #include "generated/stm32OledEncoder_menu.h" -#include +#include /** * Here we implement the custom drawing class so that we can register for drawing and reset events with it. * When the display times out the reset method is called, where in this case we take over the display. Then @@ -34,9 +34,8 @@ class ScreenSaverCustomDrawing : public CustomDrawing { offsetX = 16; offsetY = 16; - gfx.clearDisplay(); - gfx.setFont(&FreeSans9pt7b); - gfx.setTextSize(1); + gfx->clearDisplay(); + gfx->setFont(OpenSansRegular8pt); } /** @@ -55,22 +54,22 @@ class ScreenSaverCustomDrawing : public CustomDrawing { offsetY = rand() % 25; } - gfx.clearDisplay(); + gfx->clearDisplay(); - gfx.setCursor(offsetX, offsetY + 12); - gfx.print("Mbed demo"); + gfx->setCursor(offsetX, offsetY + 12); + gfx->print("Mbed demo"); - gfx.setFont(nullptr); - gfx.setCursor(5 + offsetX, 20 + offsetY); + gfx->setFont(OpenSansRegular8pt); + gfx->setCursor(5 + offsetX, 20 + offsetY); char sz[32]; menuRTCDate.copyValue(sz, sizeof sz); - gfx.print(sz); + gfx->print(sz); - gfx.setCursor(5 + offsetX, 32 + offsetY); + gfx->setCursor(5 + offsetX, 32 + offsetY); menuRTCTime.copyValue(sz, sizeof sz); - gfx.print(sz); + gfx->print(sz); - gfx.display(); + gfx->display(); renderTickCount++; } diff --git a/examples/mbed/stm32OledEncoder/ThemeMonoInverse.h b/examples/mbed/stm32OledEncoder/ThemeMonoInverse.h deleted file mode 100644 index 1d689400..00000000 --- a/examples/mbed/stm32OledEncoder/ThemeMonoInverse.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef TCMENU_THEME_MONO_INVERSE -#define TCMENU_THEME_MONO_INVERSE - -color_t defaultItemPaletteMono[] = {1, 0, 1, 1}; -color_t defaultTitlePaletteMono[] = {0, 1, 0, 0}; - -#define TITLE_PADDING 2 -#define TITLE_SPACING 2 - -void installMonoInverseTitleTheme(GraphicsDeviceRenderer& bgr, const MenuFontDef& itemFont, const MenuFontDef& titleFont, bool needEditingIcons) { - bgr.setDisplayDimensions(bgr.getDeviceDrawable()->getDisplayDimensions().x, bgr.getDeviceDrawable()->getDisplayDimensions().y); - auto& factory = bgr.getGraphicsPropertiesFactory(); - - factory.setSelectedColors(0, 2); - - MenuPadding titlePadding(TITLE_PADDING); - MenuPadding itemPadding(1); - int titleHeight = bgr.heightForFontPadding(titleFont.fontData, titleFont.fontMag, titlePadding); - int itemHeight = bgr.heightForFontPadding(itemFont.fontData, itemFont.fontMag, itemPadding); - - factory.addImageToCache(DrawableIcon(SPECIAL_ID_EDIT_ICON, Coord(8, 6),DrawableIcon::ICON_XBITMAP, loResEditingIcon)); - factory.addImageToCache(DrawableIcon(SPECIAL_ID_ACTIVE_ICON, Coord(8, 6),DrawableIcon::ICON_XBITMAP, loResActiveIcon)); - - factory.setDrawingPropertiesDefault(ItemDisplayProperties::COMPTYPE_TITLE, defaultTitlePaletteMono, titlePadding, titleFont.fontData, titleFont.fontMag, - TITLE_SPACING, titleHeight + 1, GridPosition::JUSTIFY_TITLE_LEFT_WITH_VALUE, MenuBorder(0)); - factory.setDrawingPropertiesDefault(ItemDisplayProperties::COMPTYPE_ITEM, defaultItemPaletteMono, itemPadding, itemFont.fontData, itemFont.fontMag, - 1, itemHeight, GridPosition::JUSTIFY_TITLE_LEFT_VALUE_RIGHT , MenuBorder(0)); - factory.setDrawingPropertiesDefault(ItemDisplayProperties::COMPTYPE_ACTION, defaultItemPaletteMono, itemPadding, itemFont.fontData, itemFont.fontMag, - 1, itemHeight, GridPosition::JUSTIFY_TITLE_LEFT_WITH_VALUE, MenuBorder(0)); - - tcgfx::ConfigurableItemDisplayPropertiesFactory::refreshCache(); -} - -#endif //TCMENU_THEME_MONO_INVERSE \ No newline at end of file diff --git a/examples/mbed/stm32OledEncoder/ThemeMonoInverseBuilder.h b/examples/mbed/stm32OledEncoder/ThemeMonoInverseBuilder.h new file mode 100644 index 00000000..1ef2d8a6 --- /dev/null +++ b/examples/mbed/stm32OledEncoder/ThemeMonoInverseBuilder.h @@ -0,0 +1,60 @@ +#ifndef TCMENU_THEME_MONO_INVERSE +#define TCMENU_THEME_MONO_INVERSE + +#include + +color_t defaultItemPaletteMono[] = {1, 0, 1, 1}; +color_t defaultTitlePaletteMono[] = {0, 1, 0, 0}; + +#define TITLE_PADDING 2 +#define TITLE_SPACING 2 + +/** + * This is one of the stock themes, you can modify it to meet your requirements, and it will not be updated by tcMenu + * Designer unless you delete it. This sets up the fonts, spacing and padding for all items. + * @param gr the graphical renderer + * @param itemFont the font for items + * @param titleFont the font for titles + * @param needEditingIcons if editing icons are needed + */ +void installMonoInverseTitleTheme(GraphicsDeviceRenderer& gr, const MenuFontDef& itemFont, const MenuFontDef& titleFont, + bool needEditingIcons, BaseGraphicalRenderer::TitleMode titleMode, bool useUnicode) { + + // See https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/themes/rendering-with-themes-icons-grids/ + TcThemeBuilder themeBuilder(gr); + themeBuilder.withSelectedColors(0, 2) + .dimensionsFromRenderer() + .withItemPadding(MenuPadding(1)) + .withRenderingSettings(titleMode, false) + .withPalette(defaultItemPaletteMono) + .withNativeFont(itemFont.fontData, itemFont.fontMag) + .withSpacing(1); + + if(needEditingIcons) { + themeBuilder.withStandardLowResCursorIcons(); + } + + if(useUnicode) { + themeBuilder.enableTcUnicode(); + } + + themeBuilder.defaultTitleProperties() + .withNativeFont(titleFont.fontData, titleFont.fontMag) + .withPalette(defaultTitlePaletteMono) + .withPadding(MenuPadding(TITLE_PADDING)) + .withJustification(tcgfx::GridPosition::JUSTIFY_TITLE_LEFT_WITH_VALUE) + .withSpacing(TITLE_SPACING) + .apply(); + + themeBuilder.defaultActionProperties() + .withJustification(tcgfx::GridPosition::JUSTIFY_TITLE_LEFT_WITH_VALUE) + .apply(); + + themeBuilder.defaultItemProperties() + .withJustification(tcgfx::GridPosition::JUSTIFY_TITLE_LEFT_VALUE_RIGHT) + .apply(); + + themeBuilder.apply(); +} + +#endif //TCMENU_THEME_MONO_INVERSE diff --git a/examples/mbed/stm32OledEncoder/generated/stm32OledEncoder_menu.cpp b/examples/mbed/stm32OledEncoder/generated/stm32OledEncoder_menu.cpp index ae429434..9c02825e 100644 --- a/examples/mbed/stm32OledEncoder/generated/stm32OledEncoder_menu.cpp +++ b/examples/mbed/stm32OledEncoder/generated/stm32OledEncoder_menu.cpp @@ -8,17 +8,20 @@ use elsewhere. */ +// Generated for mbed RTOS by TcMenu 4.3.1 on 2024-09-14T20:54:48.076722800Z. + #include #include "stm32OledEncoder_menu.h" -#include "../ThemeMonoInverse.h" +#include "../ThemeMonoInverseBuilder.h" +#include // Global variable declarations const ConnectorLocalInfo applicationInfo = { "Demo mbed", "f5325e26-a7f6-40ff-876e-47afa06df532" }; TcMenuRemoteServer remoteServer(applicationInfo); HalStm32EepromAbstraction glBspRom; EepromAuthenticatorManager authManager(6); -Adafruit_SSD1306_Spi gfx(spi, PD_15, PF_12, PF_13, 64, 128, SSD_1306); -AdafruitDrawable gfxDrawable(&gfx); +AdafruitSSD1306Spi* gfx; +AdafruitDrawable gfxDrawable; GraphicsDeviceRenderer renderer(30, applicationInfo.name, &gfxDrawable); MbedEthernetInitialiser mbedEthInitialisation(3333); MBedEthernetTransport ethernetTransport; @@ -82,22 +85,23 @@ void setupMenu() { authManager.initialise(menuMgr.getEepromAbstraction(), 100); menuMgr.setAuthenticator(&authManager); // Now add any readonly, non-remote and visible flags. - menuEdit.setReadOnly(true); menuIP.setReadOnly(true); + menuEdit.setReadOnly(true); menuCommits.setReadOnly(true); - menuAuthenticator.setLocalOnly(true); menuIoTMonitor.setLocalOnly(true); + menuAuthenticator.setLocalOnly(true); // Code generated by plugins and new operators. - gfx.setRotation(0); - gfx.begin(); + gfx = new AdafruitSSD1306Spi(SPIWithSettings(&spi, PF_13, 10000000), PD_15, PF_12, 64, 128, ENCMODE_UTF8, SSD_1306); + gfx->setRotation(0); + gfx->begin(); renderer.setUpdatesPerSecond(5); + gfxDrawable.setGraphics(gfx); + gfxDrawable.setFontHandler(gfx->getFontHandler()); switches.init(internalDigitalIo(), SWITCHES_POLL_EVERYTHING, true); menuMgr.initForEncoder(&renderer, &menuRTCDate, PC_8, PC_10, PC_9); remoteServer.addConnection(ðernetConnection); - renderer.setTitleMode(BaseGraphicalRenderer::TITLE_ALWAYS); - renderer.setUseSliderForAnalog(false); - installMonoInverseTitleTheme(renderer, MenuFontDef(nullptr, 1), MenuFontDef(nullptr, 1), true); + installMonoInverseTitleTheme(renderer, MenuFontDef(&OpenSansRegular7pt, 0), MenuFontDef(&OpenSansRegular7pt, 0), true, BaseGraphicalRenderer::TITLE_ALWAYS, true); // We have an IoT monitor, register the server menuIoTMonitor.setRemoteServer(remoteServer); diff --git a/examples/mbed/stm32OledEncoder/generated/stm32OledEncoder_menu.h b/examples/mbed/stm32OledEncoder/generated/stm32OledEncoder_menu.h index 1fe0c3b5..ff071d8e 100644 --- a/examples/mbed/stm32OledEncoder/generated/stm32OledEncoder_menu.h +++ b/examples/mbed/stm32OledEncoder/generated/stm32OledEncoder_menu.h @@ -14,6 +14,7 @@ #include #include +#include #include "Adafruit_SSD1306.h" #include "tcMenuAdaFruitGfxMono.h" #include "MBedEthernetTransport.h" @@ -31,10 +32,11 @@ extern const PROGMEM ConnectorLocalInfo applicationInfo; extern TcMenuRemoteServer remoteServer; extern SPI spi; -extern Adafruit_SSD1306_Spi gfx; +extern AdafruitSSD1306Spi* gfx; extern AdafruitDrawable gfxDrawable; extern GraphicsDeviceRenderer renderer; extern MbedEthernetInitialiser mbedEthInitialisation; +extern const UnicodeFont OpenSansRegular7pt[]; // Any externals needed by IO expanders, EEPROMs etc diff --git a/examples/mbed/stm32OledEncoder/generated/tcMenuAdaFruitGfxMono.cpp b/examples/mbed/stm32OledEncoder/generated/tcMenuAdaFruitGfxMono.cpp index 339ca403..e39b1fd7 100644 --- a/examples/mbed/stm32OledEncoder/generated/tcMenuAdaFruitGfxMono.cpp +++ b/examples/mbed/stm32OledEncoder/generated/tcMenuAdaFruitGfxMono.cpp @@ -21,7 +21,7 @@ using namespace tcgfx; void AdafruitDrawable::transaction(bool isStarting, bool redrawNeeded) { if(!isStarting && redrawNeeded) { - reinterpret_cast(graphics)->display(); + reinterpret_cast(graphics)->display(); } } diff --git a/examples/mbed/stm32OledEncoder/generated/tcMenuAdaFruitGfxMono.h b/examples/mbed/stm32OledEncoder/generated/tcMenuAdaFruitGfxMono.h index 23bdb313..1753ff84 100644 --- a/examples/mbed/stm32OledEncoder/generated/tcMenuAdaFruitGfxMono.h +++ b/examples/mbed/stm32OledEncoder/generated/tcMenuAdaFruitGfxMono.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/mbed/stm32OledEncoder/stm32OledEncoder.emf b/examples/mbed/stm32OledEncoder/stm32OledEncoder.emf index a343c933..1f5daf00 100644 --- a/examples/mbed/stm32OledEncoder/stm32OledEncoder.emf +++ b/examples/mbed/stm32OledEncoder/stm32OledEncoder.emf @@ -317,15 +317,20 @@ ], "codeOptions": { "embeddedPlatform": "MBED_RTOS", - "lastDisplayUuid": "8a15d500-410f-489d-b3dc-540b05e630ed", + "lastDisplayUuid": "61159C5B-F23A-4050-980F-A8FE114E2965", "lastInputUuid": "6dd87e7d-e751-4912-a70d-91793b1d3d87", "lastRemoteUuids": [ "27e7a502-330e-4570-9f8e-bd26ac88051f" ], - "lastThemeUuid": "0dd60ceb-7e0f-46e2-8d40-b264eb3aa7e0", + "lastThemeUuid": "396ED4DF-AD7B-4951-A848-A9E5838A549B", "applicationUUID": "f5325e26-a7f6-40ff-876e-47afa06df532", "applicationName": "Demo mbed", "lastProperties": [ + { + "name": "BUS_TYPE", + "latestValue": "SPI", + "subsystem": "DISPLAY" + }, { "name": "SERIAL_BUS", "latestValue": "spi", @@ -352,8 +357,8 @@ "subsystem": "DISPLAY" }, { - "name": "BUS_TYPE", - "latestValue": "SPI", + "name": "DISPLAY_I2C_ADDR", + "latestValue": "0xFF", "subsystem": "DISPLAY" }, { @@ -371,6 +376,11 @@ "latestValue": "PD_15", "subsystem": "DISPLAY" }, + { + "name": "DISPLAY_SPI_FREQ", + "latestValue": "10000000", + "subsystem": "DISPLAY" + }, { "name": "DISPLAY_ROTATION", "latestValue": "0", @@ -381,6 +391,11 @@ "latestValue": "5", "subsystem": "DISPLAY" }, + { + "name": "TEXT_ENCODING", + "latestValue": "ENCMODE_UTF8", + "subsystem": "DISPLAY" + }, { "name": "SW_POLLING_MODE", "latestValue": "SWITCHES_POLL_EVERYTHING", @@ -448,12 +463,12 @@ }, { "name": "ITEM_FONT", - "latestValue": "def:,1", + "latestValue": "ada:OpenSansRegular7pt,0", "subsystem": "THEME" }, { "name": "TITLE_FONT", - "latestValue": "def:,1", + "latestValue": "ada:OpenSansRegular7pt,0", "subsystem": "THEME" }, { @@ -473,7 +488,7 @@ }, { "name": "USE_TC_UNICODE", - "latestValue": "false", + "latestValue": "true", "subsystem": "THEME" } ], diff --git a/src/EepromItemStorage.cpp b/src/EepromItemStorage.cpp index 50f63d90..42956924 100644 --- a/src/EepromItemStorage.cpp +++ b/src/EepromItemStorage.cpp @@ -15,11 +15,11 @@ uint16_t saveRecursively(EepromAbstraction* eeprom, MenuItem* nextMenuItem) { uint16_t lastItemSaved = 0; while (nextMenuItem) { if (nextMenuItem->getMenuType() == MENUTYPE_SUB_VALUE) { - lastItemSaved = max(lastItemSaved, saveRecursively(eeprom, ((SubMenuItem *) nextMenuItem)->getChild())); + lastItemSaved = internal_max(lastItemSaved, saveRecursively(eeprom, ((SubMenuItem *) nextMenuItem)->getChild())); } else { saveMenuItem(eeprom, nextMenuItem); if(nextMenuItem->getEepromPosition() != 0xFFFF) { - lastItemSaved = max(lastItemSaved, nextMenuItem->getEepromPosition()); + lastItemSaved = internal_max(lastItemSaved, nextMenuItem->getEepromPosition()); } } nextMenuItem = nextMenuItem->getNext(); diff --git a/src/RemoteConnector.cpp b/src/RemoteConnector.cpp index 0050a8ca..e28eae2e 100644 --- a/src/RemoteConnector.cpp +++ b/src/RemoteConnector.cpp @@ -567,7 +567,8 @@ void TagValueRemoteConnector::encodeAcknowledgement(uint32_t correlation, AckRes if(!prepareWriteMsg(MSG_ACKNOWLEDGEMENT)) return; transport->writeFieldInt(FIELD_ACK_STATUS, status); char sz[10]; - ltoa(correlation, sz, 16); + sz[0]=0; + intToHexString(sz, sizeof sz, correlation, 8, false); transport->writeField(FIELD_CORRELATION, sz); transport->endMsg(); @@ -739,7 +740,7 @@ void TagValueTransport::writeFieldLong(uint16_t field, long value) { sz[2] = '='; sz[3] = 0; writeStr(sz); - ltoa(value, sz, 10); + ltoaClrBuff(sz, value, 9, NOT_PADDED, sizeof sz); writeStr(sz); writeChar('|'); } diff --git a/src/graphics/BaseGraphicalRenderer.cpp b/src/graphics/BaseGraphicalRenderer.cpp index ba0ef6ff..5876eda1 100644 --- a/src/graphics/BaseGraphicalRenderer.cpp +++ b/src/graphics/BaseGraphicalRenderer.cpp @@ -70,7 +70,7 @@ uint8_t BaseGraphicalRenderer::setActiveItem(MenuItem *item) { adjustedHeight -= startY; totalHeight -= startY; } - totalHeight = max(0, totalHeight); + totalHeight = internal_max(0, totalHeight); serlogF4(SER_TCMENU_DEBUG, "totH, actIdx, adjH ", totalHeight, activeIndex, adjustedHeight); while (totalHeight > adjustedHeight) { diff --git a/src/graphics/MenuTouchScreenEncoder.cpp b/src/graphics/MenuTouchScreenEncoder.cpp index 6fe471e6..8795250d 100644 --- a/src/graphics/MenuTouchScreenEncoder.cpp +++ b/src/graphics/MenuTouchScreenEncoder.cpp @@ -39,8 +39,8 @@ void MenuTouchScreenManager::sendEvent(float locationX, float locationY, float t } if(currentlySelected) { // find the local size and ensure it does not drop below 0 in either dimension! - int locX = max(0, (int)(lastCoord.x - localStart.x)); - int locY = max(0, (int)(lastCoord.y - localStart.y)); + int locX = internal_max(0, (int)(lastCoord.x - localStart.x)); + int locY = internal_max(0, (int)(lastCoord.y - localStart.y)); sendToObservers(TouchNotification(currentlySelected, Coord(locX, locY), localStart, localSize, touched)); } else { diff --git a/src/graphics/TcThemeBuilder.h b/src/graphics/TcThemeBuilder.h index 86959413..ac364942 100644 --- a/src/graphics/TcThemeBuilder.h +++ b/src/graphics/TcThemeBuilder.h @@ -70,7 +70,7 @@ namespace tcgfx { */ ThemePropertiesBuilder& withAdaFont(const GFXfont* font, int mag = 1) { fontData = font; - fontMag = min(1, mag); + fontMag = internal_min(1, mag); needsProps(); return *this; } @@ -327,7 +327,7 @@ namespace tcgfx { */ TcThemeBuilder& withAdaFont(const GFXfont* font, int mag = 1) { fontData = font; - fontMag = min(1, mag); + fontMag = internal_min(1, mag); return *this; }