Skip to content

Commit f7d4bab

Browse files
committed
Pico examples recompiled
1 parent 8f7cab6 commit f7d4bab

File tree

7 files changed

+114
-40
lines changed

7 files changed

+114
-40
lines changed

cmakeProject/nativeExamples/ControlAppOledEncoderPico/ControlAppOledEncoderPico.emf

+32-3
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@
445445
"lastRemoteUuids": [
446446
"DFE97583-1897-4F87-BEFA-10CB72C43F0E"
447447
],
448-
"lastThemeUuid": "b186c809-d9ef-4ca8-9d4b-e4780a041ccc",
448+
"lastThemeUuid": "8D9B49C7-FD28-4533-9B00-21A4184BB0C9",
449449
"applicationUUID": "3acc6301-dadd-4730-b142-9541180d2aa8",
450450
"applicationName": "PicoSDK Oled",
451451
"lastProperties": [
@@ -563,6 +563,36 @@
563563
"name": "ENCODER_IS_QUARTER_CYCLE",
564564
"latestValue": "false",
565565
"subsystem": "INPUT"
566+
},
567+
{
568+
"name": "ITEM_FONT",
569+
"latestValue": "ada:OpenSansRegular7pt,0",
570+
"subsystem": "THEME"
571+
},
572+
{
573+
"name": "TITLE_FONT",
574+
"latestValue": "ada:OpenSansRegular7pt,0",
575+
"subsystem": "THEME"
576+
},
577+
{
578+
"name": "TITLE_HEADER_PADDING",
579+
"latestValue": "2",
580+
"subsystem": "THEME"
581+
},
582+
{
583+
"name": "TITLE_TO_ITEM_SPACING",
584+
"latestValue": "2",
585+
"subsystem": "THEME"
586+
},
587+
{
588+
"name": "TITLE_SHOW_MODE",
589+
"latestValue": "TITLE_FIRST_ROW",
590+
"subsystem": "THEME"
591+
},
592+
{
593+
"name": "USE_TC_UNICODE",
594+
"latestValue": "true",
595+
"subsystem": "THEME"
566596
}
567597
],
568598
"namingRecursive": false,
@@ -578,8 +608,7 @@
578608
"menuDefinitions": []
579609
},
580610
"packageNamespace": "",
581-
"appIsModular": false,
582-
"listOfEmbeddedForms": []
611+
"appIsModular": false
583612
},
584613
"stringLists": [
585614
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#ifndef TCMENU_THEME_MONO_INVERSE
2+
#define TCMENU_THEME_MONO_INVERSE
3+
4+
#include <graphics/TcThemeBuilder.h>
5+
6+
color_t defaultItemPaletteMono[] = {WHITE, BLACK, WHITE, WHITE};
7+
8+
#define TITLE_BORDER_THICKNESS 2
9+
#define TITLE_SPACING 2
10+
11+
/**
12+
* This is one of the stock themes, you can modify it to meet your requirements, and it will not be updated by tcMenu
13+
* Designer unless you delete it. This sets up the fonts, spacing and padding for all items.
14+
* @param gr the graphical renderer
15+
* @param itemFont the font for items
16+
* @param titleFont the font for titles
17+
* @param needEditingIcons if editing icons are needed
18+
*/
19+
void installMonoBorderTitleTheme(GraphicsDeviceRenderer& gr, const MenuFontDef& itemFont, const MenuFontDef& titleFont,
20+
bool needEditingIcons, BaseGraphicalRenderer::TitleMode titleMode, bool useUnicode) {
21+
22+
// See https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/themes/rendering-with-themes-icons-grids/
23+
TcThemeBuilder themeBuilder(gr);
24+
themeBuilder.withSelectedColors(0, 1)
25+
.dimensionsFromRenderer()
26+
.withItemPadding(MenuPadding(1))
27+
.withRenderingSettings(titleMode, false)
28+
.withPalette(defaultItemPaletteMono)
29+
.withNativeFont(itemFont.fontData, itemFont.fontMag)
30+
.withSpacing(1);
31+
32+
if(needEditingIcons) {
33+
themeBuilder.withStandardLowResCursorIcons();
34+
}
35+
36+
if(useUnicode) {
37+
themeBuilder.enableTcUnicode();
38+
}
39+
40+
themeBuilder.defaultTitleProperties()
41+
.withNativeFont(titleFont.fontData, titleFont.fontMag)
42+
.withJustification(tcgfx::GridPosition::JUSTIFY_TITLE_LEFT_WITH_VALUE)
43+
.withSpacing(TITLE_SPACING)
44+
.withBorder(MenuBorder(0, 0, TITLE_BORDER_THICKNESS, 0))
45+
.apply();
46+
47+
themeBuilder.defaultActionProperties()
48+
.withJustification(tcgfx::GridPosition::JUSTIFY_TITLE_LEFT_WITH_VALUE)
49+
.apply();
50+
51+
themeBuilder.defaultItemProperties()
52+
.withJustification(tcgfx::GridPosition::JUSTIFY_TITLE_LEFT_VALUE_RIGHT)
53+
.apply();
54+
55+
themeBuilder.apply();
56+
}
57+
58+
#endif //TCMENU_THEME_MONO_INVERSE

cmakeProject/nativeExamples/ControlAppOledEncoderPico/appTheme.cpp

+1-26
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#include <graphics/TcThemeBuilder.h>
55
#include "generated/ControlAppOledEncoderPico_menu.h"
6-
#include <Fonts/OpenSansRegular8pt.h>
76

87
// Direct width=20, height=20, size=60
98
const uint8_t directBitmapOn[] PROGMEM = {
@@ -37,31 +36,7 @@ const uint8_t speakerBitmapOff[] PROGMEM = {
3736

3837
void setupTheme() {
3938

40-
color_t defaultItemPaletteMono[] = {WHITE, BLACK, WHITE, WHITE};
41-
TcThemeBuilder themeBuilder(renderer);
42-
themeBuilder.withSelectedColors(0, 1)
43-
.dimensionsFromRenderer()
44-
.withRenderingSettings(BaseGraphicalRenderer::TITLE_FIRST_ROW, false)
45-
.enablingTcUnicode()
46-
.withItemPadding(MenuPadding(1))
47-
.withTitlePadding(MenuPadding(1))
48-
.withStandardLowResCursorIcons()
49-
.withPalette(defaultItemPaletteMono)
50-
.withTcUnicodeFont(OpenSansRegular8pt)
51-
.withSpacing(2);
52-
53-
themeBuilder.defaultItemProperties()
54-
.withJustification(tcgfx::GridPosition::JUSTIFY_TITLE_LEFT_VALUE_RIGHT)
55-
.apply();
56-
57-
themeBuilder.defaultActionProperties()
58-
.withJustification(tcgfx::GridPosition::JUSTIFY_TITLE_LEFT_VALUE_RIGHT)
59-
.apply();
60-
61-
themeBuilder.defaultTitleProperties()
62-
.withBorder(MenuBorder(0, 0, 2, 0))
63-
.withJustification(tcgfx::GridPosition::JUSTIFY_CENTER_NO_VALUE)
64-
.apply();
39+
TcThemeBuilder themeBuilder(renderer);
6540

6641
themeBuilder.menuItemOverride(menuDirect)
6742
.onRowCol(3, 1, 2)

cmakeProject/nativeExamples/ControlAppOledEncoderPico/generated/ControlAppOledEncoderPico_menu.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
use elsewhere.
99
*/
1010

11-
// Generated for PicoSDK CMake by TcMenu 4.3.0-SNAPSHOT on 2024-05-27T09:37:52.926525800Z.
11+
// Generated for PicoSDK CMake by TcMenu 4.3.1 on 2024-10-05T14:43:02.812258100Z.
1212

1313
#include <tcMenu.h>
1414
#include "ControlAppOledEncoderPico_menu.h"
15+
#include "../ThemeMonoBorderedBuilder.h"
16+
#include <Fonts/OpenSansRegular7pt.h>
1517

1618
// Global variable declarations
1719
const ConnectorLocalInfo applicationInfo = { "PicoSDK Oled", "3acc6301-dadd-4730-b142-9541180d2aa8" };
@@ -122,5 +124,6 @@ void setupMenu() {
122124
switches.init(internalDigitalIo(), SWITCHES_POLL_KEYS_ONLY, true);
123125
menuMgr.initForEncoder(&renderer, &menuVolume, 16, 17, 21);
124126
remoteServer.addConnection(&stdioConnection);
127+
installMonoBorderTitleTheme(renderer, MenuFontDef(&OpenSansRegular7pt, 0), MenuFontDef(&OpenSansRegular7pt, 0), true, BaseGraphicalRenderer::TITLE_FIRST_ROW, true);
125128
}
126129

cmakeProject/nativeExamples/ControlAppOledEncoderPico/generated/ControlAppOledEncoderPico_menu.h

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <PlatformDetermination.h>
1515
#include <tcMenu.h>
1616

17+
#include <tcUnicodeHelper.h>
1718
#include "Adafruit_SSD1306.h"
1819
#include "tcMenuAdaFruitGfxMono.h"
1920
#include <RemoteConnector.h>
@@ -29,6 +30,7 @@ extern TcMenuRemoteServer remoteServer;
2930
extern AdafruitSSD1306Spi* gfx;
3031
extern AdafruitDrawable gfxDrawable;
3132
extern GraphicsDeviceRenderer renderer;
33+
extern const UnicodeFont OpenSansRegular7pt[];
3234

3335
// Any externals needed by IO expanders, EEPROMs etc
3436

cmakeProject/nativeExamples/ControlAppOledEncoderPico/tcmenu_main.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ void setup() {
3737
stdio_init_all();
3838

3939
setupMenu();
40+
4041
setupTheme();
4142

4243
setTitlePressedCallback([](int) {

platformio.ini

+16-10
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
; https://docs.platformio.org/page/projectconf.html
1010

1111
[platformio]
12-
;src_dir = cmakeProject/lib/tcMenu/examples/mbed/stm32OledEncoder
12+
src_dir = cmakeProject/lib/tcMenu/examples/arduino32/picoAdafruitDashboard
1313
;src_dir = cmakeProject/lib/LiquidCrystalIO/examples/aw9523Example
1414
;src_dir = cmakeProject/lib/IoAbstraction/examples/touchScreenFT6206Lib
1515
;src_dir = cmakeProject/lib/TaskManagerIO/examples/taskManagement
@@ -29,21 +29,26 @@
2929
;src_dir = cmakeProject/lib/tcUnicodeHelper/tests/utf8Processing
3030
;src_dir = cmakeProject/lib/tcUnicodeHelper/examples/utf8decoder
3131
;src_dir = cmakeProject/lib/TcMenuLog/examples/textUtilities
32-
src_dir = cmakeProject/lib/TcMenuLog/test/test_text_utils
32+
;src_dir = cmakeProject/lib/TcMenuLog/test/test_text_utils
3333
;src_dir = i2cScanner
3434
;src_dir = experimental
3535
;src_dir = adaAvrTest
3636
;src_dir = turboBagDog
37+
3738
lib_dir = cmakeProject/lib
3839

39-
[env:uno]
40-
platform = atmelavr
41-
board = uno
40+
[env:uno_r4_wifi]
41+
platform = renesas-ra
42+
board = uno_r4_wifi
4243
framework = arduino
4344
monitor_speed = 115200
44-
lib_deps = IoAbstraction
45-
SSD1306Ascii
46-
;build_flags = -DDEFAULT_TASK_SIZE=4
45+
build_flags = -DIO_LOGGING_DEBUG=1
46+
lib_deps =
47+
SPI
48+
Wire
49+
adafruit/Adafruit GFX Library
50+
Adafruit ST7735 and ST7789 Library
51+
adafruit/Adafruit BusIO
4752

4853
[env:WIZATmega2560]
4954
platform = atmelavr
@@ -192,8 +197,9 @@ build_flags = -DIO_LOGGING_DEBUG=1 -D_POSIX_THREADS
192197
lib_deps = WiFi
193198
Wire
194199
SPI
195-
TFT_eSPI
196-
FS
200+
adafruit/Adafruit GFX Library @ ^1.10.1
201+
Adafruit ST7735 and ST7789 Library
202+
adafruit/Adafruit BusIO @ ^1.5.0
197203

198204
[env:ESP32Wrover]
199205
platform = espressif32

0 commit comments

Comments
 (0)