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();
}