Message |
|
Just to prove that changing that Serial.print text actually changes the "header text" on the menu.
What's odd, is if I use Visual Studio with PlatformIO to flash the arduino, the text is taken from somewhere else, not the same line...
|
|
|
Hi Dave!
That worked! I needed to remove the variable declarations as it was giving an error as posted.
One small issue. For some reason (see pics below) the text "LED Brightness" is being displayed on the LCD instead of the String text expected "Test Dialog Text". The only place "LED Brightness" is in my sketch is way down in a seperate function, and it's part of a Serial.println command. I've confirmed it's "taking" that text from that location by changing the text, and it reflects on the LCD.
The working truncated code is below:
// Near the top, right after includes
void onDialogFinished(ButtonType btnPressed, void* /*userdata*/);
void CALLBACK_FUNCTION restoreDefaults(int id) {
BaseDialog* dlg = renderer.getDialog();
dlg->setButtons(BTNTYPE_OK, BTNTYPE_CANCEL, 1);
dlg->show("Test Dialog Text", true, onDialogFinished); // true = shows on remote sessions.
dlg->copyIntoBuffer("Factory Defaults?");
}
void onDialogFinished(ButtonType btnPressed, void* /*userdata*/) {
if(btnPressed != BTNTYPE_OK) {
renderer.takeOverDisplay(restoreFactoryDefaults);
}
}
void restoreFactoryDefaults() {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("--------------------"));
lcd.setCursor(0, 1);
lcd.print(F("| RESTORING FACTORY|"));
lcd.setCursor(0, 2);
lcd.print(F("| DEFAULTS - WAIT! |"));
lcd.setCursor(0, 3);
lcd.print(F("--------------------"));
Serial.println(F("Wiping EEPROM settings and setting back to default."));
Serial.println(F("WAIT UNTIL COMPLETED!"));
EEPROM.write(2, 100); // LCD Brightness to 100%
EEPROM.write(4, 50); // LCD Contrast to 50%
EEPROM.write(6, 0); // Serial Output Disabled
EEPROM.write(7, 2); // Serial Output Speed to 2
EEPROM.write(9, 3); // LED Display to 100%
EEPROM.write(11, 0); // Preinfuse Time ????
EEPROM.write(13, 0); // Preinfuse Disabled
EEPROM.write(14, 5); // Service Boiler Temperature Calibration Value
EEPROM.write(16, 80); // Service Boiler Set Temp F
EEPROM.write(18, 1); // Enable LED Display
EEPROM.write(20, 5); // Coffee Boiler/Group Temperature Calibration Value
EEPROM.write(22, 80); // Coffee Boiler/Group Set Temp F
EEPROM.write(24, 0); // Dose 1 Impulses
EEPROM.write(26, 0); // Dose 2 Impulses
EEPROM.write(28, 0); // Service Boiler Set Pressure
delay(5000);
Serial.println(F("Factory Reset Complete"));
lcd.clear();
renderer.giveBackDisplay();
}
|
|
|
Hi Dave, thanks in advance for any assistance you can provide.
I have an action item, that I'd like to present a "Are you Sure" kind of dialog box. I'm having issues following the documentation. I know it's something simple I'm missing, and I have an idea of what is missing, but not how to actually execute it.
Going by the compile error, I think it's not calling the onDialogFinished function because of the missing parameters (ButtonType btnPressed, void* /*userdata*/) ??
Compile error is 'onDialogFinished' was not declared in this scope
More specifically, I'm almost positive it's "void* /*userdata*/" that is the error, but I'm not sure what is *supposed* to be there.
Thank you.
void CALLBACK_FUNCTION restoreDefaults(int id) {
String pgmHeaderText = "TEST DIALOG TEXT";
bool remoteAllowed = true;
BaseDialog* dlg = renderer.getDialog();
dlg->setButtons(BTNTYPE_OK, BTNTYPE_CANCEL, 1);
dlg->show(pgmHeaderText, remoteAllowed, onDialogFinished); // true = shows on remote sessions.
dlg->copyIntoBuffer("Hello");
}
void onDialogFinished(ButtonType btnPressed, void* /*userdata*/) {
if(btnPressed != BTNTYPE_OK) {
renderer.takeOverDisplay(restoreFactoryDefaults);
}
}
void restoreFactoryDefaults() {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("--------------------"));
lcd.setCursor(0, 1);
lcd.print(F("| RESTORING FACTORY|"));
lcd.setCursor(0, 2);
lcd.print(F("| DEFAULTS - WAIT! |"));
lcd.setCursor(0, 3);
lcd.print(F("--------------------"));
Serial.println(F("Wiping EEPROM settings and setting back to default."));
Serial.println(F("WAIT UNTIL COMPLETED!"));
/* Test EEPROM write - commented out for testing
EEPROM.write(2, 100); // LCD Brightness to 100%
*/
delay(5000);
Serial.println(F("Factory Reset Complete"));
lcd.clear();
renderer.giveBackDisplay();
}
|
|
|
Yes sir! Worked fantastically.
Trying to write a password manager function, for changing password. Please keep in mind I have limited knowledge, so I'm learning as I go.
I'm trying to figure out how the password is stored in memory. I did an eeprom dump. My password starts at address 50, and I get this:
Memory Address: 50 50
Memory Address: 51 155
Memory Address: 52 0
Memory Address: 53 255
Memory Address: 54 255
Memory Address: 55 255
Memory Address: 56 255
Memory Address: 57 255
Memory Address: 58 255
Memory Address: 59 255
Memory Address: 60 255
Memory Address: 61 255
Memory Address: 62 255
Memory Address: 63 255
Memory Address: 64 255
Memory Address: 65 255
Memory Address: 66 255
Memory Address: 67 255
Memory Address: 68 0
Now I'm not sure if address 68 is something I've done in the past, or if that's the end of the memory needed for eeprom authentication manager.
Trying my hardest not to just ask everytime I have a question. Tried converting "1234" into hex, binary, etc and I'm not seeing the connection to 50 155 0.
Feel free to overlook, but if you want some cringe from a newbie, here's my sketch... Not anywhere done yet, not much free time. I'm sure there's.... quite alot.... that could use improvement/optimizing but hey... it's working so far.
Thank you again for a wonderful app/library/foundation. Looking forward to trying the new designerUI!
#include "Control_Board_Test_1_menu.h"
#include <EepromAbstraction.h>
#include <ArduinoEEPROMAbstraction.h>
AvrEeprom eeprom;
EepromAuthenticatorManager eepromAuth;
const unsigned int authRomStart = 50; // Start locatin for eeprom authentication manager
// **** Callback Global Variables ****
// Inputs
const int flowMeter1 = 40; // For water flow, not used yet
const int thermistor1 = A0; // Honeywell 10K thermistor
const int thermistor2 = A1; // Honeywell 10k thermistor
const int pressureSensor1 = A2; // 0-16 bar. 5V supply. 10%min 90%max
const int pressureSensor2 = A3; // 0-16 bar. 5V supply. 10%min 90%max
const int dispenseButton = 35; // For automatic dosing, not used yet
// Outputs
const int heater1 = 50; // SSR output for service boiler
const int heater2 = 51; // SSR output for coffee boiler
const int group1Solenoid = 52; // Dispense solenoid relay, not used yet
const int fillSolenoid = 53; // Service boiler fill relay, not used yet
bool serialEnableOut;
// **** Thermistor & Temperature Setup ****
int Vo1, Vo2;
int pullup1 = 10000;
int pullup2 = 10000;
float logR2_1, logR2_2, R2_1, R2_2, serviceBoilerTemp, coffeeBoilerTemp;
float c1_1 = 1.009249522e-03, c2_1 = 2.378405444e-04, c3_1 = 2.019202697e-07;
float c1_2 = 1.009249522e-03, c2_2 = 2.378405444e-04, c3_2 = 2.019202697e-07;
// **** Delay Variables Setup ****
unsigned long now, now2 = millis();
long lastMeasure, lastMeasure2 = 0;
// **** Flow Meter Setup ****
int count1; // Flowwmeter impulses
float flowRate1; // Flow-rate calculation
// **** Pressure Sensor Variables
int boilerPressureRaw; // Raw ADC value of pressure sensor
float boilerPressure; // Converted pressure in bar
int coffeePressureRaw;
float coffeePressure;
float maxServiceBoilerPressure = 2.0;
float maxGroupPressure = 15.0;
// **** Brew Parameter Setup ****
float preinfuseSec; // Time to dispense without engaging pump, not used yet
int impulse1, impulse2; // Dosing impulses, not used yet
int boilerTempCalibration; // Change relative value of pullup resistor for calibrating thermistor
int coffeeTempCalibration; // Change relative value of pullup resistor for calibrating thermistor
int serviceBoilerSetTemp; // User programmable temperature of service boiler
float coffeeBoilerSetTemp; // User programmable temperature of coffee boiler/group head
// **** 4 Digit 7 Segment LED Screen Setup ****
#include "SevenSegmentTM1637.h"
#include "SevenSegmentExtended.h"
const byte PIN_CLK = 32; // TM1637 CLK pin
const byte PIN_DIO = 33; // TM1637 DIO pin
SevenSegmentTM1637 display(PIN_CLK, PIN_DIO);
int ledBrightness; // User programmable brightness of LED screen
// **** Serial Debugging and EEPROM Dump ****
int address;
int addressMax = 100; // Number of memory addresses to dump starting at 0
byte value;
int readSerialOutSpeed; // For enable serial debugging, set message rate
int serialOutSpeed; // For enable serial debugging, set message rate
void setup() {
Serial.begin(115200);
// EEPROM Authentication
eepromAuth.initialise(&eeprom, authRomStart);
menuMgr.setAuthenticator(&eepromAuth);
menuConfigurationTechnicianSettings.setSecured(true); // Secure "Technician Settings" sub-menu
setupMenu();
menuMgr.load(eeprom); // Load default EEPROM values
// Setup Inputs/Outputs
pinMode(heater1, OUTPUT); // Service Boiler SSR
pinMode(heater2, OUTPUT); // Coffee Boiler/Group Head SSR
pinMode(group1Solenoid, OUTPUT); // Dispense Solenoid Relay
pinMode(fillSolenoid, OUTPUT); // Service Boiler Relay
pinMode(flowMeter1, INPUT); // Flowmeter Input
pinMode(dispenseButton, INPUT); // Dispense Request Button
pinMode(13, OUTPUT); // Turn stupid onboard LED off!
digitalWrite(13, LOW); // Turn stupid onboard LED off!
// Ensure all outputs are off on boot
digitalWrite(heater1, LOW);
digitalWrite(heater2, LOW);
digitalWrite(group1Solenoid, LOW);
digitalWrite(fillSolenoid, LOW);
// Flowmeter Interrupt, not used yet
//attachInterrupt(0, flow1, CHANGE);
display.begin(); //Start TM1637 LED Display
// Display welcome on LED display.
//display.setPrintDelay(150);
//display.print(" WELCOME ");
// Bootup Serial Output
Serial.println(F("Input Pins:"));
Serial.print(F("Flow Meter 1: Pin "));
Serial.println(flowMeter1);
Serial.print(F("Steam Boiler Thermistor: Pin "));
Serial.println(thermistor1);
Serial.print(F("Coffee Boiler Thermistor: Pin "));
Serial.println(thermistor2);
Serial.print(F("Steam Boiler Pressure Sensor: Pin "));
Serial.println(pressureSensor1);
Serial.print(F("Coffee Boiler/Group Pressure Sensor: Pin "));
Serial.println(pressureSensor2);
Serial.println();
Serial.println(F("Output Pins:"));
Serial.print(F("Fill Solenoid: Pin "));
Serial.println(fillSolenoid);
Serial.print(F("Group 1 Solenoid: Pin "));
Serial.println(group1Solenoid);
Serial.print(F("Boiler Heater 1: Pin "));
Serial.println(heater1);
Serial.print(F("Boiler Heater 2: Pin "));
Serial.println(heater2);
Serial.println();
Serial.println();
Serial.println(F("Enable Serial Debugging in Configuration/Technician Settings menu for input/output data"));
Serial.println();
Serial.println();
}
float mapFloat(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
// **** MENU CALLBACKS ****
void flow1() { // Count flow-meter pulses, not used yet
}
void CALLBACK_FUNCTION preinfuseTime(int id) { // Update pre-infuse time, not used yet
}
void CALLBACK_FUNCTION ledScreenBrightness(int id) { // Change TM1637 LED Screen Brightness
ledBrightness = menuConfigurationDisplaySettingsLEDBrightness.getCurrentValue();
ledBrightness = map(ledBrightness, 0, 5, 10, 70); // User selectable brightness of 0-5 scaled to 10%-70%
display.setBacklight(ledBrightness);
}
void CALLBACK_FUNCTION lcdBrightness(int id) {
// TODO - your menu change code
}
void CALLBACK_FUNCTION heater1Test(int id) {
// TODO - your menu change code
}
void CALLBACK_FUNCTION ledScreenEnable(int id) {
bool ledEnable = menuConfigurationDisplaySettingsEnableLEDDisp.getBoolean();
if (ledEnable == true) {
display.setBacklight(ledBrightness);
return;
}
else {
display.setBacklight(0); // "Turn Off" LED screen by changing brightness to 0%
return;
}
}
void CALLBACK_FUNCTION groupSolenoidTest(int id) {
// TODO - your menu change code
}
void CALLBACK_FUNCTION lcdContrast(int id) {
// TODO - your menu change code
}
void CALLBACK_FUNCTION heater2Test(int id) {
// TODO - your menu change code
}
void CALLBACK_FUNCTION preinfuseEnable(int id) {
// TODO - your menu change code
}
void CALLBACK_FUNCTION boilerTempAdjust(int id) {
boilerTempCalibration = menuConfigurationTechnicianSettingsCalibrateSensorsBoilerTempAdjustCalibrationValue.getCurrentValue();
pullup1 = map(boilerTempCalibration, 0, 10, 9000, 11000);
menuConfigurationTechnicianSettingsCalibrateSensorsBoilerTempAdjustBoilerTemp.setFloatValue(serviceBoilerTemp, true);
}
void CALLBACK_FUNCTION coffeeTempAdjust(int id) {
coffeeTempCalibration = menuConfigurationTechnicianSettingsCalibrateSensorsGroupTempAdjustCalibrationValue.getCurrentValue();
pullup2 = map(coffeeTempCalibration, 0, 10, 9000, 11000);
menuConfigurationTechnicianSettingsCalibrateSensorsGroupTempAdjustGroupTemp.setFloatValue(coffeeBoilerTemp, true);
}
void CALLBACK_FUNCTION setBoilerTemp(int id) {
serviceBoilerSetTemp = menuConfigurationMachineSettingsServiceBoiler.getCurrentValue();
//menuMgr.save(eeprom);
}
void CALLBACK_FUNCTION setCoffeeBoilerTemp(int id) {
coffeeBoilerSetTemp = menuConfigurationMachineSettingsCoffeeBoiler.getCurrentValue();
//menuMgr.save(eeprom);
}
void CALLBACK_FUNCTION saveSettings(int id) {
menuMgr.save(eeprom);
}
void CALLBACK_FUNCTION pressureProfile2(int id) {
// TODO - your menu change code
}
void CALLBACK_FUNCTION pressureProfile3(int id) {
// TODO - your menu change code
}
void CALLBACK_FUNCTION pressureProfile1(int id) {
// TODO - your menu change code
}
void CALLBACK_FUNCTION serialEnable(int id) {
serialEnableOut = menuConfigurationTechnicianSettingsSerialDebuggingSerialOutput.getCurrentValue();
}
void CALLBACK_FUNCTION serialSpeed(int id) {
readSerialOutSpeed = menuConfigurationTechnicianSettingsSerialDebuggingOutputSpeed.getCurrentValue();
serialOutSpeed = map(readSerialOutSpeed, 0, 5, 5000, 1000);
}
// **** END CALLBACKS ****
// **** Serial Debug Output ****
void serialOutput() {
Serial.print(F("Steam Boiler Set Temp:............... "));
Serial.println(serviceBoilerSetTemp);
Serial.print(F("Boiler Temperature:.................. "));
Serial.println(serviceBoilerTemp);
Serial.print(F("Boiler Heat On/Off:.................. "));
if (serviceBoilerTemp <= serviceBoilerSetTemp) {
Serial.println(F("ON"));
}
else {
Serial.println(F("OFF"));
}
Serial.print(F("Coffee Boiler Set Temp:.............. "));
Serial.println(coffeeBoilerSetTemp);
Serial.print(F("Coffee Boiler Temp:.................. "));
Serial.println(coffeeBoilerTemp);
Serial.print(F("Coffee Heat On/Off:.................. "));
if (coffeeBoilerTemp <= coffeeBoilerSetTemp) {
Serial.println(F("ON"));
}
else {
Serial.println(F("OFF"));
}
Serial.println();
Serial.print(F("Boiler Pressure Raw Value:........... "));
Serial.println(boilerPressureRaw);
Serial.print(F("Boiler Pressure BAR:................. "));
Serial.println(boilerPressure, 2);
Serial.println();
Serial.print(F("Coffee Pressure Raw Value:........... "));
Serial.println(coffeePressureRaw);
Serial.print(F("Coffee Pressure BAR:................. "));
Serial.println(coffeePressure, 2);
Serial.println();
Serial.println();
Serial.println();
Serial.println();
}
void CALLBACK_FUNCTION dumpEeprom(int id) {
Serial.println(F("Memory allocation as follows:"));
Serial.println(F("0-1 Fixed"));
Serial.println(F("2-3 LCD Brightness"));
Serial.println(F("4-5 LCD Contrast"));
Serial.println(F("6-6 Serial Output Enabled"));
Serial.println(F("7-8 Serial Output Speed"));
Serial.println(F("9-10 LED Brightness"));
Serial.println(F("11-12 Preinfuse Time"));
Serial.println(F("13-13 Preinfuse Enable"));
Serial.println(F("14-15 Service Boiler Temp Calibration Value"));
Serial.println(F("16-17 Service Boiler Set Temp"));
Serial.println(F("18-18 Enable LED Display"));
Serial.println(F("20-21 Coffee Boiler Temp Calibration Value"));
Serial.println(F("22-23 Coffee Boiler Set Temp"));
Serial.println(F("24-25 Dose 1"));
Serial.println(F("26-27 Dose 2"));
Serial.println();
Serial.println(F("50-68 Password Auth"));
Serial.println();
Serial.print(F("Dumping first "));
Serial.print(addressMax);
Serial.println(F(" locations in memory"));
Serial.println(F("_______________________________________"));
for (address = 0; address <= addressMax; address++) {
value = EEPROM.read(address);
Serial.print(F("Memory Address: "));
Serial.print(address);
Serial.print("\t");
Serial.print(value, DEC);
Serial.println();
}
Serial.println(F("_______________________________________"));
Serial.println();
Serial.println(F("Memory Dump Complete"));
}
// **** Main LOOP ****
void loop() {
taskManager.runLoop();
// **** Pressure Reading ASAP ****
// Service/Steam Boiler
boilerPressureRaw = analogRead(pressureSensor1);
boilerPressure = mapFloat(boilerPressureRaw, 0.0, 1023.0, 0.0, 3.0);
menuBoilerPres.setCurrentValue((boilerPressure * 10), true);
menuConfigurationTechnicianSettingsInputTestsBoilerPres.setCurrentValue((boilerPressure * 10), true);
// Group/Coffee Boiler
coffeePressureRaw = analogRead(pressureSensor2);
coffeePressure = mapFloat(coffeePressureRaw, 00.0, 1023.0, 0.0, 16.5);
menuGroupPres.setCurrentValue((coffeePressure * 10), true);
menuConfigurationTechnicianSettingsInputTestsGroupPres.setCurrentValue((coffeePressure * 10), true);
// **** Thermistor Reading Every 1 Second ****
now = millis();
if (now - lastMeasure > 1000) { // Only take temp reading ever XX seconds
lastMeasure = now;
Vo1 = analogRead(thermistor1);
Vo2 = analogRead(thermistor2);
R2_1 = pullup1 * (1023.0 / (float)Vo1 - 1.0);
R2_2 = pullup2 * (1023.0 / (float)Vo2 - 1.0);
logR2_1 = log(R2_1);
logR2_2 = log(R2_2);
serviceBoilerTemp = (1.0 / (c1_1 + c2_1*logR2_1 + c3_1*logR2_1*logR2_1*logR2_1));
coffeeBoilerTemp = (1.0 / (c1_2 + c2_2*logR2_2 + c3_2*logR2_2*logR2_2*logR2_2));
serviceBoilerTemp = serviceBoilerTemp - 273.15;
coffeeBoilerTemp = coffeeBoilerTemp - 273.15;
serviceBoilerTemp = (serviceBoilerTemp * 9.0)/ 5.0 + 32.0;
coffeeBoilerTemp = (coffeeBoilerTemp * 9.0)/ 5.0 + 32.0;
// **** Update Menu Screens with temp values ****
menuConfigurationTechnicianSettingsCalibrateSensorsBoilerTempAdjustBoilerTemp.setFloatValue(serviceBoilerTemp, true); // Updates menu data on temp calibration screen
menuConfigurationTechnicianSettingsCalibrateSensorsGroupTempAdjustGroupTemp.setFloatValue(coffeeBoilerTemp, true); // Updates menu data on temp calibration screen
menuConfigurationTechnicianSettingsInputTestsGroupBoiler.setCurrentValue((coffeeBoilerTemp * 10), true); // Updates Input Test Screen with Temp
menuConfigurationTechnicianSettingsInputTestsServBoiler.setCurrentValue((serviceBoilerTemp * 10), true); // Updates Input Test Screen with Temp
// Update LED Screen with temperatres, just for testing will find other purpose later
display.setColonOn(true);
display.setCursor(0, 0);
display.print(serviceBoilerTemp, 0);
display.setCursor(0, 2);
display.print(coffeeBoilerTemp, 0);
}
// **** Constant Loop Checks ****
// Control Heaters
if (boilerPressure > maxServiceBoilerPressure) { // Safety check - Disable Steam Boiler if above max pressure;
digitalWrite(heater1, LOW);
}
else {
// To be replaced by a PID loop eventually...
if (serviceBoilerTemp <= (serviceBoilerSetTemp - 1)) { // Turn on steam boiler SSR if temp is less than set temp
digitalWrite(heater1, HIGH);
}
else if(serviceBoilerTemp >= (serviceBoilerSetTemp + 1)){
digitalWrite(heater1, LOW);
}
}
if (coffeePressure > maxGroupPressure) { // Safety check - Disable Coffee Boiler if above 14 bar
digitalWrite(heater2, LOW);
}
else {
// To be replaced by a PID loop...
if (coffeeBoilerTemp <= (coffeeBoilerSetTemp - 1)) { // Turn on coffee boiler SSR if temp is less than set temp
digitalWrite(heater2, HIGH);
}
else if(coffeeBoilerTemp >= (coffeeBoilerSetTemp + 1)) {
digitalWrite(heater2, LOW);
}
}
// **** Serial Output - Speed controlled by config setting
now2 = millis();
if (now2 - lastMeasure2 > serialOutSpeed) {
lastMeasure2 = now2;
while (serialEnableOut == true) {
serialOutput();
break;
}
}
}
// **** END LOOP ****
|
|
|
App & API 1.3.5
Build Date 2019-11-09 07:31
TcMenu Version 1.3.5
IoAbstraction Version 1.4.10
LiquidCrystalO Version 1.1.0
Windows 10 Home 64 Bit
|
|
|
Actually appears not even saving, just navigating away from the selected submenu (to a different submenu) causes the checkbox to revert to unchecked.
I can get around this, if I knew what is changed in the files generated and just enter the value(s) manually. I'm guessing something in "NAME_menu.h" changes?
|
|
|
Thank you Dave! Got it compiled as follows:
In header
#include <EepromAbstraction.h>
#include <ArduinoEEPROMAbstraction.h>
AvrEeprom eeprom;
EepromAuthenticatorManager eepromAuth;
const unsigned int authRomStart = 50;
In void setup()
// EEPROM Authentication
eepromAuth.initialise(&eeprom, authRomStart);
menuMgr.setAuthenticator(&eepromAuth);
Now I'm not getting the designerUi to actually secure the submenu.
If I check the box for securing the submenu, then save, the checkbox reverts back to unchecked.
If I generate code before saving, I can't tell that anything actually changes in the files, and submenu isn't secured.
Thank you so much for your help!
|
|
|
Been trying to get this to work for hours, I feel like I'm missing something minor, but not sure what to do.
EEPROM is working fine for saving parameters.
Tried to snip only necessary parts for below.
I have this in my include area:
#include <EepromAbstraction.h>
#include <ArduinoEEPROMAbstraction.h>
AvrEeprom eeprom;
EepromAuthenticatorManager eepromAuth;
const unsigned int authRomStart = 800;
In my void setup:
menuMgr.load(eeprom); // Load default EEPROM values
// EEPROM Authentication
eepromAuth.initialise(&eepromAbstraction, authRomStart);
remoteServer.setAuthenticator(&eepromAuth);
menuMgr.setAuthenticator(&authManager);
The submenu that I have checked to secure in the DesignerUI is "SubMenuItem menuConfigurationTechnicianSettings;"
I'm getting a compile error "eepromAbstraction was not declared in this scope".
Where is this variable supposed to be setup? Am I missing an Include?
|
|
|
Here's where she stands so far...
|
|
|
Awesome, thank you for the info Dave.
The menu is quickly growing out of control haha. However the code happily puts along! A true testament to the foundation you have built.
I am designing an "universal" espresso machine control board. I restore old Italian semi-automatic espresso machines in my spare time and the control boards are getting harder and harder to find, and repairing them I feel takes more time than me coming up with an alternative. So I'm designing a "universal" board, that will have a much higher amount of customization including variable pressure profiles, support for dual boilers, etc etc. (not sure if you're in the espresso world at all, if not I'm sure that all sounds like garbldy goop.
Having a very nice menu, with LCD, has been a feature I'd love to add to my own (and other) espresso machines, so with the large number of GPIO pins on the mega, and your wonderful menu the dream is slowly becoming a reality.
For now, this is for my own personal machine, and a few for friends/family however in the future I'd like to make a product available to people I can sell.
When you get time, can you send me any info on commercial licensing for the menu? I see on your site where you offer commercial support/customization. I'm going to take it DIY as far as I can, but want to make sure if I do (big IF) make this a commercially viable product I do it on the straight'n arrow.
Cheers,
Jonathan
|
|
|
Thank you for the fast reply Dave.
I will refrain from writing to eeprom on each change.
Is it safe to still have a "master save" callback. Where the only menu function is to save to eeprom, and it wouldn't be done often.
How much time are we talking about to write to eeprom? My menu isn't utilizing much now, and I expect by the time I'm done the number of spaces will be roughly doubled. I'm guessing it's 2 bytes per field? So I'm at 46 bytes now (up to space 23).
More than one second? I have not been taking a wait time into account. Thinking I need to add a delay with a "confirmation" to the save settings callback, to make sure nothing else happens while writing to eeprom.
EDIT: Should clarify this is an Arduino Mega 2560, using builtin Avreeprom.
|
|
|
Instead of having a separate menu item that's calback contains menuMgr.save(eeprom); , i thought I could just add menuMgr.save(eeprom); to the end of each menu item's callback so after setting the value it "auto saves".
However, 2 things happen. One, the value isn't written to EEPROM, and two some values fail to load on the next boot cycle.
Example:
Two basic callbacks updating an integer.
void CALLBACK_FUNCTION setBoilerTemp(int id) {
serviceBoilerSetTemp = menuConfigurationMachineSettingsServiceBoiler.getCurrentValue();
//menuMgr.save(eeprom);
}
void CALLBACK_FUNCTION setCoffeeBoilerTemp(int id) {
coffeeBoilerSetTemp = menuConfigurationMachineSettingsCoffeeBoiler.getCurrentValue();
//menuMgr.save(eeprom);
}
I have a seperate callback for "Save Settings" action item built into the menu. It works fine.
void CALLBACK_FUNCTION saveSettings(int id) {
menuMgr.save(eeprom);
}
Again, with the menuMg.save(eeprom); commented out, the EEPROM values are saved correctly, when the menu option "Save Settings" is selected. The values are read correctly on start up.
With them un-commented some values are loaded with a 0 value, and when adjusting the value they do not save as expected.
What am I doing wrong?
Thanks!
Jon
|
|
|
|
|