Skip to content

Commit bdb288c

Browse files
author
dave
committed
#103 all examples now recompiled with 2.1
1 parent 4b7bd1f commit bdb288c

File tree

8 files changed

+156
-136
lines changed

8 files changed

+156
-136
lines changed

examples/colorTftEthernet32/colorTftEthernet.emf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@
339339
"lastDisplayUuid": "4dcb12ec-13d8-4466-b8b6-bd575eae4612",
340340
"lastInputUuid": "6dd87e7d-e751-4912-a70d-91793b1d3d87",
341341
"lastRemoteUuid": "0877131c-e03e-426b-8eaf-228e01f5e7f1",
342-
"lastThemeUuid": "e4524028-edd8-4e0a-ae15-a1f2ba05354f",
342+
"lastThemeUuid": "03c6b25f-db63-402a-8447-a5ce1484c14d",
343343
"applicationUUID": "22813e5e-88b1-42d5-9601-4831b2be369b",
344344
"applicationName": "Ada32 Ethernet",
345345
"lastProperties": [

examples/colorTftEthernet32/colorTftEthernet32.ino.backup

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_menu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void setupMenu() {
8888
switches.initialiseInterrupt(io8574, true);
8989
menuMgr.initForEncoder(&renderer, &menuVoltage, 7, 6, 5);
9090
remoteServer.begin(&server, &applicationInfo);
91-
renderer.setTitleMode(BaseGraphicalRenderer::TITLE_FIRST_ROW);
91+
renderer.setTitleMode(BaseGraphicalRenderer::TITLE_ALWAYS);
9292
renderer.setUseSliderForAnalog(true);
9393
installCoolBlueTraditionalTheme(renderer, MenuFontDef(nullptr, 1), MenuFontDef(nullptr, 1), true);
9494
}

examples/unoSsd1306Ascii/src/unoSsd1306Ascii_menu.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,54 @@
66
77
All the variables you may need access to are marked extern in this file for easy
88
use elsewhere.
9-
*/
9+
*/
1010

11-
#include <Arduino.h>
1211
#include <tcMenu.h>
1312
#include "unoSsd1306Ascii_menu.h"
1413

1514
// Global variable declarations
1615

17-
const PROGMEM ConnectorLocalInfo applicationInfo = { "Uno1306Ascii", "c4858c2f-4134-4597-a7a0-b6719631a99b" };
16+
const PROGMEM ConnectorLocalInfo applicationInfo = { "Uno1306Ascii", "c4858c2f-4134-4597-a7a0-b6719631a99b" };
1817
SSD1306AsciiRenderer renderer(20, Arial14, System5x7);
1918

2019
// Global Menu Item declarations
2120

2221
ListRuntimeMenuItem menuListItem(11, 10, fnListItemRtCall, NULL);
23-
const AnalogMenuInfo PROGMEM minfoStatusTemprature = { "Temprature", 9, 0xFFFF, 255, NO_CALLBACK, -40, 2, "C" };
22+
const PROGMEM AnalogMenuInfo minfoStatusTemprature = { "Temprature", 9, 0xffff, 255, NO_CALLBACK, -40, 2, "C" };
2423
AnalogMenuItem menuStatusTemprature(&minfoStatusTemprature, 0, NULL);
25-
const FloatMenuInfo PROGMEM minfoStatusVoltageIn = { "Voltage In", 8, 0xFFFF, 0, NO_CALLBACK };
24+
const PROGMEM FloatMenuInfo minfoStatusVoltageIn = { "Voltage In", 8, 0xffff, 0, NO_CALLBACK };
2625
FloatMenuItem menuStatusVoltageIn(&minfoStatusVoltageIn, &menuStatusTemprature);
27-
const FloatMenuInfo PROGMEM minfoStatusPowerUse = { "Power Use", 7, 0xFFFF, 2, NO_CALLBACK };
26+
const PROGMEM FloatMenuInfo minfoStatusPowerUse = { "Power Use", 7, 0xffff, 2, NO_CALLBACK };
2827
FloatMenuItem menuStatusPowerUse(&minfoStatusPowerUse, &menuStatusVoltageIn);
29-
const SubMenuInfo PROGMEM minfoStatus = { "Status", 6, 0xFFFF, 0, NO_CALLBACK };
3028
RENDERING_CALLBACK_NAME_INVOKE(fnStatusRtCall, backSubItemRenderFn, "Status", -1, NO_CALLBACK)
29+
const PROGMEM SubMenuInfo minfoStatus = { "Status", 6, 0xffff, 0, NO_CALLBACK };
3130
BackMenuItem menuBackStatus(fnStatusRtCall, &menuStatusPowerUse);
3231
SubMenuItem menuStatus(&minfoStatus, &menuBackStatus, &menuListItem);
33-
const AnyMenuInfo PROGMEM minfoPressMe = { "Press me", 10, 0xFFFF, 0, onActionPressed };
32+
const PROGMEM AnyMenuInfo minfoPressMe = { "Press me", 10, 0xffff, 0, onActionPressed };
3433
ActionMenuItem menuPressMe(&minfoPressMe, &menuStatus);
35-
const BooleanMenuInfo PROGMEM minfoStandby = { "Standby", 5, 10, 1, NO_CALLBACK, NAMING_YES_NO };
34+
const PROGMEM BooleanMenuInfo minfoStandby = { "Standby", 5, 10, 1, NO_CALLBACK, NAMING_YES_NO };
3635
BooleanMenuItem menuStandby(&minfoStandby, false, &menuPressMe);
37-
const AnalogMenuInfo PROGMEM minfoBlue = { "Blue", 4, 8, 100, NO_CALLBACK, 0, 1, "%" };
36+
const PROGMEM AnalogMenuInfo minfoBlue = { "Blue", 4, 8, 100, NO_CALLBACK, 0, 1, "%" };
3837
AnalogMenuItem menuBlue(&minfoBlue, 0, &menuStandby);
39-
const AnalogMenuInfo PROGMEM minfoGreen = { "Green", 3, 6, 100, NO_CALLBACK, 0, 1, "%" };
38+
const PROGMEM AnalogMenuInfo minfoGreen = { "Green", 3, 6, 100, NO_CALLBACK, 0, 1, "%" };
4039
AnalogMenuItem menuGreen(&minfoGreen, 0, &menuBlue);
41-
const AnalogMenuInfo PROGMEM minfoRed = { "Red", 2, 4, 100, NO_CALLBACK, 0, 1, "%" };
40+
const PROGMEM AnalogMenuInfo minfoRed = { "Red", 2, 4, 100, NO_CALLBACK, 0, 1, "%" };
4241
AnalogMenuItem menuRed(&minfoRed, 0, &menuGreen);
43-
const AnalogMenuInfo PROGMEM minfoBrightness = { "Brightness", 1, 2, 100, NO_CALLBACK, 0, 1, "%" };
42+
const PROGMEM AnalogMenuInfo minfoBrightness = { "Brightness", 1, 2, 100, NO_CALLBACK, 0, 1, "%" };
4443
AnalogMenuItem menuBrightness(&minfoBrightness, 0, &menuRed);
4544

46-
4745
// Set up code
4846

4947
void setupMenu() {
50-
menuStatusPowerUse.setReadOnly(true);
51-
menuStatusVoltageIn.setReadOnly(true);
5248
menuStatusTemprature.setReadOnly(true);
49+
menuStatusVoltageIn.setReadOnly(true);
50+
menuStatusPowerUse.setReadOnly(true);
5351

5452
renderer.setGraphicsDevice(&gfx);
5553
pinMode(A0, INPUT);
5654
switches.initialise(inputFromDfRobotShield(), false);
5755
menuMgr.initForUpDownOk(&renderer, &menuBrightness, DF_KEY_DOWN, DF_KEY_UP, DF_KEY_SELECT);
56+
menuMgr.setBackButton(DF_KEY_LEFT);
57+
menuMgr.setNextButton(DF_KEY_RIGHT);
5858
}
59+

examples/unoSsd1306Ascii/src/unoSsd1306Ascii_menu.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,49 @@
66
77
All the variables you may need access to are marked extern in this file for easy
88
use elsewhere.
9-
*/
9+
*/
1010

1111
#ifndef MENU_GENERATED_CODE_H
1212
#define MENU_GENERATED_CODE_H
1313

1414
#include <Arduino.h>
1515
#include <tcMenu.h>
1616
#include <SSD1306Ascii.h>
17-
#include <RuntimeMenuItem.h>
1817
#include <SSD1306AsciiAvrI2c.h>
1918
#include "ssd1306asciiRenderer.h"
2019
#include <DfRobotInputAbstraction.h>
20+
#include <RuntimeMenuItem.h>
2121

2222
void setupMenu(); // forward reference of the menu setup function.
23-
extern const PROGMEM ConnectorLocalInfo applicationInfo; // defines the app info to the linker.
23+
extern const PROGMEM ConnectorLocalInfo applicationInfo; // contains app name and ID
2424

2525
// Global variables that need exporting
2626

2727
extern SSD1306AsciiAvrI2c gfx;
2828
extern SSD1306AsciiRenderer renderer;
2929

30-
// Callback functions must always include CALLBACK_FUNCTION after the return type
31-
#define CALLBACK_FUNCTION
32-
3330
// Global Menu Item exports
3431

35-
int fnListItemRtCall(RuntimeMenuItem * item, uint8_t row, RenderFnMode mode, char * buffer, int bufferSize);
3632
extern ListRuntimeMenuItem menuListItem;
3733
extern AnalogMenuItem menuStatusTemprature;
3834
extern FloatMenuItem menuStatusVoltageIn;
3935
extern FloatMenuItem menuStatusPowerUse;
36+
extern BackMenuItem menuBackStatus;
4037
extern SubMenuItem menuStatus;
41-
void CALLBACK_FUNCTION onActionPressed(int id);
4238
extern ActionMenuItem menuPressMe;
4339
extern BooleanMenuItem menuStandby;
4440
extern AnalogMenuItem menuBlue;
4541
extern AnalogMenuItem menuGreen;
4642
extern AnalogMenuItem menuRed;
4743
extern AnalogMenuItem menuBrightness;
4844

45+
// Provide a wrapper to get hold of the root menu item
46+
inline MenuItem& rootMenuItem() { return menuBrightness; }
47+
48+
// Callback functions must always include CALLBACK_FUNCTION after the return type
49+
#define CALLBACK_FUNCTION
50+
51+
int fnListItemRtCall(RuntimeMenuItem* item, uint8_t row, RenderFnMode mode, char* buffer, int bufferSize);
52+
void CALLBACK_FUNCTION onActionPressed(int id);
53+
4954
#endif // MENU_GENERATED_CODE_H

0 commit comments

Comments
 (0)