Skip to content

Commit 3443377

Browse files
committed
#246 different allocation strategy for info blocks.
1 parent e597d92 commit 3443377

8 files changed

Lines changed: 464 additions & 408 deletions

File tree

examples/arduino32/mkrEthernetOled/mkrEthernetOled.emf

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": "1.00",
33
"projectName": "MKR project with eInk display\t",
4-
"author": "dave",
4+
"author": "root",
55
"items": [
66
{
77
"parentId": 0,
@@ -17,6 +17,7 @@
1717
"variableName": "Kitchen",
1818
"id": 1,
1919
"eepromAddress": -1,
20+
"functionName": "",
2021
"readOnly": false,
2122
"localOnly": false,
2223
"visible": true,
@@ -37,6 +38,7 @@
3738
"variableName": "Lounge",
3839
"id": 2,
3940
"eepromAddress": -1,
41+
"functionName": "",
4042
"readOnly": false,
4143
"localOnly": false,
4244
"visible": true,
@@ -57,6 +59,7 @@
5759
"variableName": "Hallway",
5860
"id": 3,
5961
"eepromAddress": -1,
62+
"functionName": "",
6063
"readOnly": false,
6164
"localOnly": false,
6265
"visible": true,
@@ -72,6 +75,7 @@
7275
"variableName": "Settings",
7376
"id": 4,
7477
"eepromAddress": -1,
78+
"functionName": "",
7579
"readOnly": false,
7680
"localOnly": false,
7781
"visible": true,
@@ -92,6 +96,7 @@
9296
"variableName": "SettingsTempDesired",
9397
"id": 5,
9498
"eepromAddress": 4,
99+
"functionName": "",
95100
"readOnly": false,
96101
"localOnly": false,
97102
"visible": true,
@@ -112,6 +117,7 @@
112117
"variableName": "SettingsMode",
113118
"id": 6,
114119
"eepromAddress": 6,
120+
"functionName": "",
115121
"readOnly": false,
116122
"localOnly": false,
117123
"visible": true,
@@ -128,6 +134,7 @@
128134
"variableName": "SettingsProtection",
129135
"id": 7,
130136
"eepromAddress": 8,
137+
"functionName": "",
131138
"readOnly": false,
132139
"localOnly": false,
133140
"visible": true,
@@ -142,6 +149,7 @@
142149
"variableName": "SettingsEmergencyOff",
143150
"id": 8,
144151
"eepromAddress": -1,
152+
"functionName": "",
145153
"readOnly": false,
146154
"localOnly": false,
147155
"visible": true,
@@ -157,6 +165,7 @@
157165
"variableName": "OtherTypes",
158166
"id": 9,
159167
"eepromAddress": -1,
168+
"functionName": "",
160169
"readOnly": false,
161170
"localOnly": false,
162171
"visible": true,
@@ -174,6 +183,7 @@
174183
"variableName": "OtherTypesText",
175184
"id": 10,
176185
"eepromAddress": 9,
186+
"functionName": "",
177187
"readOnly": false,
178188
"localOnly": false,
179189
"visible": true,
@@ -190,6 +200,7 @@
190200
"variableName": "OtherTypesRGBItem",
191201
"id": 11,
192202
"eepromAddress": 19,
203+
"functionName": "",
193204
"readOnly": false,
194205
"localOnly": false,
195206
"visible": true,
@@ -210,6 +221,7 @@
210221
"variableName": "OtherTypesFoods",
211222
"id": 12,
212223
"eepromAddress": 23,
224+
"functionName": "",
213225
"readOnly": false,
214226
"localOnly": false,
215227
"visible": true,
@@ -226,7 +238,7 @@
226238
],
227239
"lastThemeUuid": "8D9B49C7-FD28-4533-9B00-21A4184BB0C9",
228240
"applicationUUID": "2d36dbe4-4892-410f-b0d6-775ec3637f6f",
229-
"applicationName": "MKR eInk",
241+
"applicationName": "Mkr Ethernet OLED",
230242
"lastProperties": [
231243
{
232244
"name": "DISPLAY_VARIABLE",
@@ -361,19 +373,19 @@
361373
],
362374
"namingRecursive": true,
363375
"useCppMain": false,
364-
"saveLocation": "ALL_TO_CURRENT",
365-
"usingSizedEEPROMStorage": true,
376+
"saveLocation": "ONE_SINGLE_FILE",
377+
"useDynamicMenus": true,
378+
"usingSizedEEPROMStorage": false,
379+
"eepromSaveMode": "DYNAMIC_WRITE_BY_ID",
366380
"eepromDefinition": "",
367381
"authenticatorDefinition": "",
368382
"projectIoExpanders": [
369-
"pcf8574:io8574:32:6:false",
370-
"deviceIO:"
383+
"deviceIO:",
384+
"pcf8574:io8574:32:6:false"
371385
],
372386
"menuInMenuCollection": {
373387
"menuDefinitions": []
374-
},
375-
"packageNamespace": "",
376-
"appIsModular": false
388+
}
377389
},
378390
"stringLists": []
379391
}
Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,52 @@
1-
#include "mkrEthernetOled_menu.h"
1+
/*
2+
* Simple demo project that runs on our MKR1300 boards with Ethernet module
3+
* and OLED screen. It uses the fluent menu builder and all-in-one plugin
4+
* support added in 4.5.
5+
*
6+
* Setup:
7+
*
8+
* OLED: configured on standard I2C GPIOs using an SH1106 driver.
9+
* Ethernet: We have the regular MKR ethernet shield.
10+
* Menu, a simple menu structure defined in TcMenu Designer Turbo
11+
*
12+
* To build your own menu: https://designer.thecoderscorner.com/
13+
* Getting started: https://www.thecoderscorner.com/products/apps/tcmenu-designer/
14+
* Documentation: https://tcmenu.github.io/documentation/
15+
*/
16+
17+
#include "MkrEthernetOLED_menu.h"
218

319
// This variable is the RAM data for scroll choice item Foods
4-
// 1234567890 1234567890 1234567890 1234567890 1234567890
5-
char ScrollRam[] = "Pizza\0 Pasta \0Salad\0 Apple\0 Orange\0 ~";
20+
char ScrollRam[] = "1\0 2\0 3\0 4\0 5\0 ~";
621

722

823
void setup() {
9-
while (!Serial && millis() < 15000) {
10-
}
24+
// On SAMD/MKR it's best to wait for the serial port to start before proceeding.
25+
while (!Serial && millis() < 15000) {}
26+
27+
// Before we do anything else, we start things up.
1128
Serial.begin(115200);
1229
Wire.begin();
13-
serlogF(SER_DEBUG, "TcMenu MKR example starting");
30+
31+
serEnableLevel(SER_TCMENU_DEBUG, true);
32+
33+
// in TcMenu we set up the menu using this method.
1434
setupMenu();
15-
serlogF(SER_DEBUG, "TcMenu MKR example started");
35+
serlogF(SER_TCMENU_DEBUG, "Menu setup complete");
1636

37+
// here we use task manager to schedule some tasks to happen ever 500 millis
38+
// https://tcmenu.github.io/documentation/arduino-libraries/taskmanager-io/task-manager-scheduling-guide/
39+
taskManager.schedule(repeatMillis(500), [] {
40+
// Here we adjust some menu items at runtime, every 500 millis.
41+
//https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/
42+
getAnalogItemById(MENU_KITCHEN_ID).setCurrentValue(random(100));
43+
getAnalogItemById(MENU_LOUNGE_ID).setCurrentValue(random(100));
44+
// menuKitchen.setCurrentValue(random(100));
45+
// menuLounge.setCurrentValue(random(100));
46+
});
1747
}
1848

49+
// All TcMenu projects use taskmanager
1950
void loop() {
2051
taskManager.runLoop();
21-
2252
}

0 commit comments

Comments
 (0)