Skip to content

Commit 9c20525

Browse files
author
dave
committed
#124 use int32 for calculating the displayable value of Analog items. Recompiled a few examples ready for the next release.
1 parent b375d5c commit 9c20525

File tree

7 files changed

+26
-9
lines changed

7 files changed

+26
-9
lines changed

examples/esp32Amplifier/esp32Amplifier.emf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,23 @@
308308
"visible": true
309309
}
310310
},
311+
{
312+
"parentId": 6,
313+
"type": "analogItem",
314+
"item": {
315+
"maxValue": 65535,
316+
"offset": -5000,
317+
"divisor": 10,
318+
"unitName": "U",
319+
"name": "Test",
320+
"variableName": "StatusTest",
321+
"id": 28,
322+
"eepromAddress": -1,
323+
"readOnly": false,
324+
"localOnly": false,
325+
"visible": true
326+
}
327+
},
311328
{
312329
"parentId": 0,
313330
"type": "subMenu",

examples/esp32Amplifier/esp32Amplifier_menu.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ RENDERING_CALLBACK_NAME_INVOKE(fnConnectivityRtCall, backSubItemRenderFn, "Conne
4646
const PROGMEM SubMenuInfo minfoConnectivity = { "Connectivity", 12, 0xffff, 0, NO_CALLBACK };
4747
BackMenuItem menuBackConnectivity(fnConnectivityRtCall, &menuConnectivityIPAddress);
4848
SubMenuItem menuConnectivity(&minfoConnectivity, &menuBackConnectivity, NULL);
49-
ListRuntimeMenuItem menuStatusDataList(21, 0, fnStatusDataListRtCall, NULL);
49+
const PROGMEM AnalogMenuInfo minfoStatusTest = { "Test", 28, 0xffff, 65535, NO_CALLBACK, -5000, 10, "U" };
50+
AnalogMenuItem menuStatusTest(&minfoStatusTest, 0, NULL);
51+
ListRuntimeMenuItem menuStatusDataList(21, 0, fnStatusDataListRtCall, &menuStatusTest);
5052
const PROGMEM AnyMenuInfo minfoStatusShowDialogs = { "Show Dialogs", 20, 0xffff, 0, onShowDialogs };
5153
ActionMenuItem menuStatusShowDialogs(&minfoStatusShowDialogs, &menuStatusDataList);
5254
const PROGMEM AnalogMenuInfo minfoStatusRightVU = { "Right VU", 16, 0xffff, 30000, NO_CALLBACK, -20000, 1000, "dB" };

examples/esp32Amplifier/esp32Amplifier_menu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ extern TextMenuItem menuConnectivitySSID;
4848
extern IpAddressMenuItem menuConnectivityIPAddress;
4949
extern BackMenuItem menuBackConnectivity;
5050
extern SubMenuItem menuConnectivity;
51+
extern AnalogMenuItem menuStatusTest;
5152
extern ListRuntimeMenuItem menuStatusDataList;
5253
extern ActionMenuItem menuStatusShowDialogs;
5354
extern AnalogMenuItem menuStatusRightVU;

examples/esp32Amplifier/tcMenuTfteSpi.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
* TFT_eSPI renderer that renders menus onto this type of display. This file is a plugin file and should not
88
* be directly edited, it will be replaced each time the project is built. If you want to edit this file in place,
99
* make sure to rename it first.
10-
*
11-
* LIBRARY REQUIREMENT
12-
1 * This library requires the AdaGfx library along with a suitable driver.
1310
*/
1411

1512
#ifndef TCMENU_PLUGIN_TCMENUTFTESPI_H

examples/esp8266WifiOled/Greenhouse.emf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@
415415
"eepromDefinition": "eeprom:",
416416
"authenticatorDefinition": "rom:100:6",
417417
"projectIoExpanders": [
418-
"pcf8574:io8574:32:12",
419-
"deviceIO:"
418+
"deviceIO:",
419+
"pcf8574:io8574:32:12"
420420
]
421421
}
422422
}

examples/esp8266WifiOled/esp8266WifiOled_menu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#include <RemoteMenuItem.h>
2020
#include <RuntimeMenuItem.h>
2121
#include <ScrollChoiceMenuItem.h>
22-
#include <IoAbstractionWire.h>
2322
#include <IoAbstraction.h>
23+
#include <IoAbstractionWire.h>
2424
#include <ArduinoEEPROMAbstraction.h>
2525
#include <RemoteAuthentication.h>
2626

src/MenuItems.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ uint16_t AnalogMenuItem::getActualDecimalDivisor() const {
192192

193193
WholeAndFraction AnalogMenuItem::getWholeAndFraction() const {
194194
WholeAndFraction wf;
195-
int calcVal = int16_t(getCurrentValue()) + getOffset();
196-
int divisor = getDivisor();
195+
int32_t calcVal = int32_t(getCurrentValue()) + int32_t(getOffset());
196+
int32_t divisor = getDivisor();
197197

198198
wf.negative = (calcVal < 0);
199199

0 commit comments

Comments
 (0)