Skip to content

Commit 42fce39

Browse files
author
dave
committed
#103 examples recompiled with designer 2.1, remove the legacy and out of date renderers, minor fix
1 parent 48e603b commit 42fce39

37 files changed

+760
-628
lines changed

examples/colorTftEthernet32/colorTftEthernet.emf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
"version": "1.00",
33
"projectName": "/Users/dave/Documents/Arduino/tcLibraryDev/lib/tcMenu/examples/colorTftEthernet32/colorTftEthernet.emf",
44
"author": "dave",
5-
"lastEdited": {
6-
"seconds": 1617353180,
7-
"nanos": 147621000
8-
},
9-
"namingRecursive": false,
105
"items": [
116
{
127
"parentId": 0,

examples/colorTftEthernet32/colorTftEthernet32.ino

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,3 @@ int CALLBACK_FUNCTION fnRomLocationRtCall(RuntimeMenuItem * item, uint8_t row, R
267267
default: return false;
268268
}
269269
}
270-
271-
272-
273-
274-
275-
276-
277-
278-
279-
280-
281-

examples/colorTftEthernet32/colorTftEthernet32.ino.backup

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,5 @@ int CALLBACK_FUNCTION fnRomLocationRtCall(RuntimeMenuItem * item, uint8_t row, R
277277

278278

279279

280+
281+

examples/colorTftEthernet32/colorTftEthernet32_menu.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// Global variable declarations
1616

1717
const ConnectorLocalInfo applicationInfo = { "Ada32 Ethernet", "22813e5e-88b1-42d5-9601-4831b2be369b" };
18-
1918
Adafruit_ST7735 gfx(6, 7, 3);
2019
AdafruitDrawable gfxDrawable(&gfx);
2120
GraphicsDeviceRenderer renderer(30, applicationInfo.name, &gfxDrawable);

examples/colorTftEthernet32/colorTftEthernet32_menu.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,25 @@
1313

1414
#include <Arduino.h>
1515
#include <tcMenu.h>
16-
1716
#include "tcMenuAdaFruitGfx.h"
1817
#include "EthernetTransport.h"
1918
#include <RemoteConnector.h>
2019
#include <RuntimeMenuItem.h>
2120
#include <ScrollChoiceMenuItem.h>
2221

23-
// all variables that need exporting
22+
void setupMenu(); // forward reference of the menu setup function.
23+
extern const PROGMEM ConnectorLocalInfo applicationInfo; // contains app name and ID
24+
25+
// Global variables that need exporting
26+
2427
extern Adafruit_ST7735 gfx;
2528
extern AdafruitDrawable gfxDrawable;
2629
extern GraphicsDeviceRenderer renderer;
2730
extern IoAbstractionRef io8574;
2831
extern EthernetServer server;
2932

30-
// all menu item forward references.
33+
// Global Menu Item exports
34+
3135
extern ActionMenuItem menuTakeDisplay;
3236
extern ActionMenuItem menuSaveItem;
3337
extern TextMenuItem menuRomText;
@@ -55,7 +59,9 @@ extern SubMenuItem menuSettings;
5559
extern EnumMenuItem menuLimit;
5660
extern AnalogMenuItem menuCurrent;
5761
extern AnalogMenuItem menuVoltage;
58-
extern const ConnectorLocalInfo applicationInfo;
62+
63+
// Provide a wrapper to get hold of the root menu item
64+
inline MenuItem& rootMenuItem() { return menuVoltage; }
5965

6066
// Callback functions must always include CALLBACK_FUNCTION after the return type
6167
#define CALLBACK_FUNCTION
@@ -69,6 +75,4 @@ void CALLBACK_FUNCTION onSaveRom(int id);
6975
void CALLBACK_FUNCTION onTakeDisplay(int id);
7076
void CALLBACK_FUNCTION onVoltageChange(int id);
7177

72-
void setupMenu();
73-
7478
#endif // MENU_GENERATED_CODE_H

examples/esp32SimHub/ESP32TouchKeysAbstraction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ ESP32TouchKeysAbstraction::ESP32TouchKeysAbstraction(int defThreshold, touch_hig
4343
startedUp = false;
4444
pinThreshold = defThreshold;
4545
enabledPinMask = 0;
46-
taskManager.scheduleFixedRate(5, [] {serdebugF2("intCount=", intCount);}, TIME_SECONDS);
4746
}
4847

4948
void ESP32TouchKeysAbstraction::ensureInterruptRegistered() {
5049
if(!startedUp) {
5150
startedUp = true;
5251
touch_pad_filter_start(DEFAULT_TOUCHKEY_FILTER_FREQ);
52+
touch_pad_set_filter_period(10);
5353
}
5454

5555
if(interruptCodeNeeded) {

examples/esp32SimHub/esp32SimHub.emf

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
"version": "1.00",
33
"projectName": "/Users/dave/Documents/Arduino/tcLibraryDev/lib/tcMenu/examples/esp32SimHub/esp32SimHub.emf",
44
"author": "dave",
5-
"lastEdited": {
6-
"seconds": 1616593214,
7-
"nanos": 888722000
8-
},
9-
"namingRecursive": false,
105
"items": [
116
{
127
"parentId": 0,
@@ -137,6 +132,36 @@
137132
"visible": true
138133
}
139134
},
135+
{
136+
"parentId": 4,
137+
"type": "boolItem",
138+
"item": {
139+
"naming": "ON_OFF",
140+
"name": "Overboost",
141+
"variableName": "SettingsOverboost",
142+
"id": 12,
143+
"eepromAddress": -1,
144+
"readOnly": false,
145+
"localOnly": false,
146+
"visible": true
147+
}
148+
},
149+
{
150+
"parentId": 4,
151+
"type": "largeNumItem",
152+
"item": {
153+
"digitsAllowed": 12,
154+
"decimalPlaces": 4,
155+
"negativeAllowed": true,
156+
"name": "LargeTest",
157+
"variableName": "SettingsLargeTest",
158+
"id": 13,
159+
"eepromAddress": -1,
160+
"readOnly": false,
161+
"localOnly": false,
162+
"visible": true
163+
}
164+
},
140165
{
141166
"parentId": 0,
142167
"type": "enumItem",

examples/esp32SimHub/esp32SimHub.ino

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,16 @@ DashCustomDrawing* dashCustomDrawing;
4949
void setupDashboard();
5050
bool currentLedStatus = false;
5151

52+
HardwareRotaryEncoder* secondEncoder;
53+
5254
void setup() {
5355
SPI.begin(18, 19, 23);
5456
SPI.setFrequency(20000000);
5557

5658
// we start the serial bus at 115200 so it's ready for our connector to use
5759
Serial.begin(115200);
5860

61+
5962
// initialise the menu library, the following line was automatically added to setup by tcMenu.
6063
setupMenu();
6164

@@ -89,7 +92,7 @@ void setup() {
8992
// if you want to test your rendering without simhub connected, uncomment the below code, it will update all the
9093
// values a few times a second.
9194
//
92-
/* taskManager.scheduleFixedRate(3000, [] {
95+
taskManager.scheduleFixedRate(3000, [] {
9396
menuTyreTemp.setCurrentValue(random(50) + 40);
9497
auto gear = random(10);
9598
if(gear == 0) menuGear.setTextValue("N");
@@ -117,7 +120,8 @@ void setup() {
117120
rpm = min(16000, max(1500, rpm + (rand() % 100) - 25));
118121
menuRPM.setCurrentValue(rpm);
119122
menuSpeed.setCurrentValue(speed);
120-
});*/
123+
});
124+
// end simulation code
121125

122126
taskManager.scheduleFixedRate(250, [] {
123127
int rpm = menuRPM.getCurrentValue();
@@ -266,5 +270,3 @@ void CALLBACK_FUNCTION onShowDialogs(int id) {
266270
dlg->copyIntoBuffer("text 1");
267271
}
268272
}
269-
270-

examples/esp32SimHub/esp32SimHub_menu.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
// Global variable declarations
1818

1919
const PROGMEM ConnectorLocalInfo applicationInfo = { "SimHub Link", "4db9fbfe-9fab-4759-b8ff-3e0c6700f475" };
20-
2120
Adafruit_ILI9341 gfx(22, 17, 16);
2221
AdafruitDrawable gfxDrawable(&gfx);
2322
GraphicsDeviceRenderer renderer(30, applicationInfo.name, &gfxDrawable);
@@ -36,8 +35,12 @@ const char enumStrDashboard_2[] PROGMEM = "Custom";
3635
const char* const enumStrDashboard[] PROGMEM = { enumStrDashboard_0, enumStrDashboard_1, enumStrDashboard_2 };
3736
const PROGMEM EnumMenuInfo minfoDashboard = { "Dashboard", 8, 0xffff, 2, onDashChanged, enumStrDashboard };
3837
EnumMenuItem menuDashboard(&minfoDashboard, 0, &menuLap);
38+
RENDERING_CALLBACK_NAME_INVOKE(fnSettingsLargeTestRtCall, largeNumItemRenderFn, "LargeTest", -1, NO_CALLBACK)
39+
EditableLargeNumberMenuItem menuSettingsLargeTest(fnSettingsLargeTestRtCall, 13, 12, 4, true, NULL);
40+
const PROGMEM BooleanMenuInfo minfoSettingsOverboost = { "Overboost", 12, 0xffff, 1, NO_CALLBACK, NAMING_ON_OFF };
41+
BooleanMenuItem menuSettingsOverboost(&minfoSettingsOverboost, false, &menuSettingsLargeTest);
3942
const PROGMEM AnyMenuInfo minfoSettingsShowDialogs = { "Show Dialogs", 11, 0xffff, 0, onShowDialogs };
40-
ActionMenuItem menuSettingsShowDialogs(&minfoSettingsShowDialogs, NULL);
43+
ActionMenuItem menuSettingsShowDialogs(&minfoSettingsShowDialogs, &menuSettingsOverboost);
4144
const PROGMEM AnalogMenuInfo minfoSettingsTestItem1 = { "Test Item 1", 5, 0xffff, 100, NO_CALLBACK, 0, 2, "" };
4245
AnalogMenuItem menuSettingsTestItem1(&minfoSettingsTestItem1, 0, &menuSettingsShowDialogs);
4346
RENDERING_CALLBACK_NAME_INVOKE(fnSettingsRtCall, backSubItemRenderFn, "Settings", -1, NO_CALLBACK)
@@ -58,7 +61,6 @@ AnalogMenuItem menuSpeed(&minfoSpeed, 0, &menuRPM);
5861
// Set up code
5962

6063
void setupMenu() {
61-
// Read only and local only function calls
6264
menuTyreTemp.setReadOnly(true);
6365
menuSpeed.setReadOnly(true);
6466
menuRPM.setReadOnly(true);

examples/esp32SimHub/esp32SimHub_menu.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,31 @@
1313

1414
#include <Arduino.h>
1515
#include <tcMenu.h>
16-
1716
#include "tcMenuAdaFruitGfx.h"
1817
#include "ESP32TouchKeysAbstraction.h"
1918
#include "SimhubConnector.h"
2019
#include <RuntimeMenuItem.h>
20+
#include <EditableLargeNumberMenuItem.h>
21+
22+
void setupMenu(); // forward reference of the menu setup function.
23+
extern const PROGMEM ConnectorLocalInfo applicationInfo; // contains app name and ID
24+
25+
// Global variables that need exporting
2126

22-
// all variables that need exporting
2327
extern Adafruit_ILI9341 gfx;
2428
extern AdafruitDrawable gfxDrawable;
2529
extern GraphicsDeviceRenderer renderer;
2630
extern ESP32TouchKeysAbstraction esp32Touch;
2731
extern const GFXfont FreeSans9pt7b;
2832
extern const GFXfont FreeSans12pt7b;
2933

30-
// all menu item forward references.
34+
// Global Menu Item exports
35+
3136
extern ActionMenuItem menuShowDashboard;
3237
extern AnalogMenuItem menuLap;
3338
extern EnumMenuItem menuDashboard;
39+
extern EditableLargeNumberMenuItem menuSettingsLargeTest;
40+
extern BooleanMenuItem menuSettingsOverboost;
3441
extern ActionMenuItem menuSettingsShowDialogs;
3542
extern AnalogMenuItem menuSettingsTestItem1;
3643
extern BackMenuItem menuBackSettings;
@@ -40,7 +47,9 @@ extern AnalogMenuItem menuTyreTemp;
4047
extern TextMenuItem menuGear;
4148
extern AnalogMenuItem menuRPM;
4249
extern AnalogMenuItem menuSpeed;
43-
extern const ConnectorLocalInfo applicationInfo;
50+
51+
// Provide a wrapper to get hold of the root menu item
52+
inline MenuItem& rootMenuItem() { return menuSpeed; }
4453

4554
// Callback functions must always include CALLBACK_FUNCTION after the return type
4655
#define CALLBACK_FUNCTION
@@ -50,6 +59,4 @@ void CALLBACK_FUNCTION onDashChanged(int id);
5059
void CALLBACK_FUNCTION onShowDash(int id);
5160
void CALLBACK_FUNCTION onShowDialogs(int id);
5261

53-
void setupMenu();
54-
5562
#endif // MENU_GENERATED_CODE_H

0 commit comments

Comments
 (0)