Skip to content

Commit 42c69c3

Browse files
author
dave
committed
More examples recompiled on TcMenu 2.0, a few small fixes
1 parent e6ebee4 commit 42c69c3

36 files changed

+2024
-655
lines changed

examples/esp32SimHub/esp32SimHub.emf

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"projectName": "/Users/dave/Documents/Arduino/tcLibraryDev/lib/tcMenu/examples/esp32SimHub/esp32SimHub.emf",
44
"author": "dave",
55
"lastEdited": {
6-
"seconds": 1616260100,
7-
"nanos": 660482000
6+
"seconds": 1616593214,
7+
"nanos": 888722000
88
},
99
"namingRecursive": false,
1010
"items": [
@@ -322,11 +322,6 @@
322322
"latestValue": "ada:FreeSans12pt7b,1",
323323
"subsystem": "THEME"
324324
},
325-
{
326-
"name": "FONT_INCLUDE_FOLDER",
327-
"latestValue": "Fonts",
328-
"subsystem": "THEME"
329-
},
330325
{
331326
"name": "BORDER_FOR_ACTIONS",
332327
"latestValue": "0",

examples/esp32SimHub/esp32SimHub.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <AnalogDeviceAbstraction.h>
3535
#include "DashCustomDrawing.h"
3636
#include "RobotoMonoBold60pt.h"
37+
#include <Fonts/FreeSans18pt7b.h>
3738

3839
// here we pulsate an LED using the ESP32's DAC
3940
const int dacPin = 32;
@@ -266,3 +267,4 @@ void CALLBACK_FUNCTION onShowDialogs(int id) {
266267
}
267268
}
268269

270+

examples/esp32SimHub/esp32SimHub_menu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ void setupMenu() {
7272
connector.begin(&Serial, 3);
7373
renderer.setTitleMode(BaseGraphicalRenderer::TITLE_FIRST_ROW);
7474
renderer.setUseSliderForAnalog(true);
75-
installCoolBlueTraditionalTheme(renderer, MenuFontDef(FreeSans9pt7b, 1), MenuFontDef(FreeSans12pt7b, 1), true);
75+
installCoolBlueTraditionalTheme(renderer, MenuFontDef(&FreeSans9pt7b, 1), MenuFontDef(&FreeSans12pt7b, 1), true);
7676
}
7777

examples/esp32SimHub/esp32SimHub_menu.h

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,45 +19,13 @@
1919
#include "SimhubConnector.h"
2020
#include <RuntimeMenuItem.h>
2121

22-
// all define statements needed
23-
#define DISPLAY_VARIABLE gfx
24-
#define DISPLAY_TYPE Adafruit_ILI9341
25-
#define DISPLAY_WIDTH 320
26-
#define DISPLAY_HEIGHT 240
27-
#define DISPLAY_RESET_PIN 16
28-
#define DISPLAY_CS_PIN 22
29-
#define DISPLAY_RS_PIN 17
30-
#define DISPLAY_DATA_PIN -1
31-
#define DISPLAY_CLOCK_PIN -1
32-
#define DISPLAY_ROTATION 1
33-
#define UPDATES_PER_SEC 5
34-
#define SWITCH_THRESHOLD 800
35-
#define INTERRUPT_SWITCHES true
36-
#define TP_HIGH_VOLTAGE TOUCH_HVOLT_2V7
37-
#define TP_LOW_VOLTAGE TOUCH_LVOLT_0V5
38-
#define TP_ATTENUATION TOUCH_HVOLT_ATTEN_1V
39-
#define UP_SENSOR 5
40-
#define DOWN_SENSOR 7
41-
#define BACK_SENSOR -1
42-
#define NEXT_SENSOR -1
43-
#define SELECT_SENSOR 6
44-
#define SERIAL_PORT Serial
45-
#define STATUS_MENUITEM 3
46-
#define ITEM_FONT ada:FreeSans9pt7b,1
47-
#define TITLE_FONT ada:FreeSans12pt7b,1
48-
#define FONT_INCLUDE_FOLDER Fonts
49-
#define BORDER_FOR_ACTIONS 0
50-
#define TITLE_SHOW_MODE TITLE_FIRST_ROW
51-
#define USE_SLIDER_ANALOG true
52-
#define NEED_EDITING_ICONS true
53-
5422
// all variables that need exporting
5523
extern Adafruit_ILI9341 gfx;
5624
extern AdafruitDrawable gfxDrawable;
5725
extern GraphicsDeviceRenderer renderer;
5826
extern ESP32TouchKeysAbstraction esp32Touch;
59-
extern const GFXfont* FreeSans9pt7b;
60-
extern const GFXfont* FreeSans12pt7b;
27+
extern const GFXfont FreeSans9pt7b;
28+
extern const GFXfont FreeSans12pt7b;
6129

6230
// all menu item forward references.
6331
extern ActionMenuItem menuShowDashboard;

examples/esp8266WifiOled/Greenhouse.emf

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"projectName": "/Users/dave/Documents/Arduino/tcLibraryDev/lib/tcMenu/examples/esp8266WifiOled/Greenhouse.emf",
44
"author": "dave",
55
"lastEdited": {
6-
"seconds": 1616263272,
7-
"nanos": 841746000
6+
"seconds": 1616594396,
7+
"nanos": 866114000
88
},
99
"namingRecursive": false,
1010
"items": [
@@ -344,11 +344,6 @@
344344
"latestValue": "avl:u8g2_font_sirclivethebold_tr,1",
345345
"subsystem": "THEME"
346346
},
347-
{
348-
"name": "FONT_INCLUDE_FOLDER",
349-
"latestValue": "",
350-
"subsystem": "THEME"
351-
},
352347
{
353348
"name": "TITLE_HEADER_PADDING",
354349
"latestValue": "2",

examples/esp8266WifiOled/esp8266WifiOled.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,3 +329,4 @@ void CALLBACK_FUNCTION onLockDoor(int id) {
329329

330330

331331

332+

examples/esp8266WifiOled/esp8266WifiOled_menu.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,6 @@
2020
#include <RuntimeMenuItem.h>
2121
#include <ScrollChoiceMenuItem.h>
2222

23-
// all define statements needed
24-
#define DISPLAY_VARIABLE gfx
25-
#define DISPLAY_TYPE U8G2_SH1106_128X64_NONAME_F_SW_I2C
26-
#define DISPLAY_ROTATION U8G2_R0
27-
#define YIELDING_WIRE_CB true
28-
#define DISPLAY_CLOCK_PIN 5
29-
#define DISPLAY_DATA_PIN 4
30-
#define DISPLAY_RESET_PIN 16
31-
#define DISPLAY_CS_PIN U8X8_PIN_NONE
32-
#define DISPLAY_RS_PIN U8X8_PIN_NONE
33-
#define UPDATES_PER_SEC 10
34-
#define PULLUP_LOGIC true
35-
#define INTERRUPT_SWITCHES false
36-
#define SWITCH_IODEVICE
37-
#define ENCODER_PIN_A 13
38-
#define ENCODER_PIN_B 12
39-
#define ENCODER_PIN_OK 14
40-
#define ENCODER_BACK_PIN -1
41-
#define ENCODER_NEXT_PIN -1
42-
#define LISTEN_PORT 3333
43-
#define ITEM_FONT def:,1
44-
#define TITLE_FONT avl:u8g2_font_sirclivethebold_tr,1
45-
#define FONT_INCLUDE_FOLDER
46-
#define TITLE_HEADER_PADDING 2
47-
#define TITLE_TO_ITEM_SPACING 2
48-
#define TITLE_SHOW_MODE TITLE_FIRST_ROW
49-
5023
// all variables that need exporting
5124
extern U8G2_SH1106_128X64_NONAME_F_SW_I2C gfx;
5225
extern GraphicsDeviceRenderer renderer;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#ifndef TCMENU_THEME_MONO_BORDER
2+
#define TCMENU_THEME_MONO_BORDER
3+
4+
color_t defaultItemPaletteMono[] = {1, 0, 1, 1};
5+
6+
#define TITLE_BORDER_THICKNESS 2
7+
#define TITLE_SPACING 2
8+
9+
void installMonoBorderedTheme(GraphicsDeviceRenderer& bgr, const MenuFontDef& itemFont, const MenuFontDef& titleFont, bool needEditingIcons) {
10+
bgr.setDisplayDimensions(bgr.getDeviceDrawable()->getDisplayDimensions().x, bgr.getDeviceDrawable()->getDisplayDimensions().y);
11+
auto& factory = bgr.getGraphicsPropertiesFactory();
12+
13+
factory.setSelectedColors(0, 1);
14+
15+
MenuPadding titlePadding(1);
16+
MenuPadding itemPadding(1);
17+
int titleHeight = bgr.heightForFontPadding(titleFont.fontData, titleFont.fontMag, titlePadding);
18+
int itemHeight = bgr.heightForFontPadding(itemFont.fontData, itemFont.fontMag, itemPadding);
19+
20+
factory.addImageToCache(DrawableIcon(SPECIAL_ID_EDIT_ICON, Coord(8, 6),DrawableIcon::ICON_XBITMAP, loResEditingIcon));
21+
factory.addImageToCache(DrawableIcon(SPECIAL_ID_ACTIVE_ICON, Coord(8, 6),DrawableIcon::ICON_XBITMAP, loResActiveIcon));
22+
23+
factory.setDrawingPropertiesDefault(ItemDisplayProperties::COMPTYPE_TITLE, defaultItemPaletteMono, titlePadding, titleFont.fontData, titleFont.fontMag,
24+
TITLE_SPACING, titleHeight + 1, GridPosition::JUSTIFY_TITLE_LEFT_WITH_VALUE,
25+
MenuBorder(0, 0, TITLE_BORDER_THICKNESS, 0));
26+
factory.setDrawingPropertiesDefault(ItemDisplayProperties::COMPTYPE_ITEM, defaultItemPaletteMono, itemPadding, itemFont.fontData, itemFont.fontMag,
27+
1, itemHeight, GridPosition::JUSTIFY_TITLE_LEFT_VALUE_RIGHT , MenuBorder(0));
28+
factory.setDrawingPropertiesDefault(ItemDisplayProperties::COMPTYPE_ACTION, defaultItemPaletteMono, itemPadding, itemFont.fontData, itemFont.fontMag,
29+
1, itemHeight, GridPosition::JUSTIFY_TITLE_LEFT_WITH_VALUE, MenuBorder(0));
30+
31+
tcgfx::ConfigurableItemDisplayPropertiesFactory::refreshCache();
32+
}
33+
34+
#endif //TCMENU_THEME_MONO_BORDER

0 commit comments

Comments
 (0)