Skip to content

Commit e1c422b

Browse files
author
dave
committed
examples recompiled and a few small fixes
1 parent 8aed509 commit e1c422b

File tree

77 files changed

+421
-2026
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+421
-2026
lines changed

examples/arduino32/dynamicMenuItems/dynamicMenuItems.emf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
"type": "runtimeList",
272272
"item": {
273273
"initialRows": 116,
274-
"usingInfoBlock": false,
274+
"listCreationMode": "CUSTOM_RTCALL",
275275
"name": "List",
276276
"variableName": "List",
277277
"id": 13,
@@ -595,18 +595,19 @@
595595
],
596596
"namingRecursive": true,
597597
"useCppMain": false,
598-
"saveLocation": "ALL_TO_CURRENT",
598+
"saveLocation": "PROJECT_TO_CURRENT_WITH_GENERATED",
599599
"usingSizedEEPROMStorage": false,
600600
"eepromDefinition": "",
601601
"authenticatorDefinition": "",
602602
"projectIoExpanders": [
603-
"mcp23017:io23017:32:10",
604-
"deviceIO:"
603+
"deviceIO:",
604+
"mcp23017:io23017:32:10"
605605
],
606606
"menuInMenuCollection": {
607607
"menuDefinitions": []
608608
},
609609
"packageNamespace": "",
610610
"appIsModular": false
611-
}
611+
},
612+
"stringLists": []
612613
}

examples/arduino32/dynamicMenuItems/dynamicMenuItems.ino

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* MenuManager: https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/menumanager-and-iteration/
1313
*/
1414

15-
#include "dynamicMenuItems_menu.h"
15+
#include "generated/dynamicMenuItems_menu.h"
1616
#include <BaseDialog.h>
1717
#include <IoAbstractionWire.h>
1818
#include <graphics/RuntimeTitleMenuItem.h>
@@ -322,40 +322,27 @@ void CALLBACK_FUNCTION onDialogController(int id) {
322322
});
323323
}
324324

325+
// This callback needs to be implemented by you, see the below docs:
326+
// 1. List Docs - https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/menu-item-types/list-menu-item/
327+
// 2. ScrollChoice Docs - https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/menu-item-types/scrollchoice-menu-item/
325328
//
326329
// This is called back each time a list item needs to draw data. This is a list that is based on an array of string values.
327330
//
328331
int CALLBACK_FUNCTION fnListRtCall(RuntimeMenuItem* item, uint8_t row, RenderFnMode mode, char* buffer, int bufferSize) {
329-
switch(mode) {
330-
case RENDERFN_INVOKE:
332+
if(mode == RENDERFN_ACTIVATE) {
333+
Serial.print("Activated "); Serial.println(row);
334+
return true;
335+
} else if(mode == RENDERFN_INVOKE) {
331336
Serial.print("Selected "); Serial.println(row);
332337
// do something with the selected item.
333338
menuMgr.resetMenu(false);
334339
return true;
335-
case RENDERFN_NAME:
336-
if(row > 253) {
337-
// 254 and 255 are reserved for title and back, this is what is rendered in the back item text and also
338-
// as the list name / title on the parent menu.
339-
strncpy(buffer, "Food List", bufferSize);
340-
}
341-
else {
342-
// when row is between 0..253 then the name is the item name.
343-
ltoaClrBuff(buffer, row, 2, NOT_PADDED, bufferSize); // otherwise it's an active row
344-
}
345-
return true;
346-
case RENDERFN_VALUE:
347-
if(row < numListItems) {
348-
// if the value is in range we copy the value from our array
349-
strncpy(buffer, listElements[row], bufferSize);
350-
}
351-
else {
352-
// otherwise just blank it.
353-
buffer[0] = 0;
354-
}
355-
return true;
356-
case RENDERFN_EEPROM_POS: return 0xffff; // lists are generally not saved to EEPROM
357-
default: return false;
340+
} else if(mode == RENDERFN_VALUE && row < numListItems) {
341+
// if the value is in range we copy the value from our array
342+
strncpy(buffer, listElements[row], bufferSize);
343+
return true; // we have copied.
358344
}
345+
return defaultRtListCallback(item, row, mode, buffer, bufferSize);
359346
}
360347

361348
void CALLBACK_FUNCTION onDialogBack(int id) {

examples/arduino32/dynamicMenuItems/dynamicMenuItems_menu.cpp

Lines changed: 0 additions & 102 deletions
This file was deleted.

examples/arduino32/dynamicMenuItems/dynamicMenuItems_menu.h

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)