Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions OTGW-firmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ bool bCheckOTGWPICupdate = true;

//All things that are settings
String settingHostname = _HOSTNAME;
bool settingOTGWPICautoUpdate = true;

//MQTT settings
bool statusMQTTconnection = false;
Expand Down
2 changes: 1 addition & 1 deletion OTGW-firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void do5minevent(){
sendMQTTuptime();
sendMQTTversioninfo();
sendMQTTstateinformation();
if (bCheckOTGWPICupdate) {
if (settingOTGWPICautoUpdate && bCheckOTGWPICupdate) {
bCheckOTGWPICupdate = false;
checkOTWGpicforupdate();
}
Expand Down
1 change: 1 addition & 0 deletions data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@
,[ "gpiooutputsenabled", "GPIO Output Enabled"]
,[ "gpiooutputspin", "GPIO pin # to switch on/off"]
,[ "gpiooutputstriggerbit", "Bit X (master/slave) to trigger on (0-15)"]
,[ "otgwpicautoupdate", "Automatically check for PIC firmware update"]

];

Expand Down
1 change: 1 addition & 0 deletions restAPI.ino
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ void sendDeviceSettings()
sendJsonSettingObj("gpiooutputstriggerbit", settingGPIOOUTPUTStriggerBit, "i", 0,16);
sendJsonSettingObj("otgwcommandenable", settingOTGWcommandenable, "b");
sendJsonSettingObj("otgwcommands", CSTR(settingOTGWcommands), "s", 128);
sendJsonSettingObj("otgwpicautoupdate", settingOTGWPICautoUpdate, "b");

sendEndJsonObj("settings");

Expand Down
8 changes: 7 additions & 1 deletion settingStuff.ino
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void writeSettings(bool show)
root["GPIOOUTPUTSenabled"] = settingGPIOOUTPUTSenabled;
root["GPIOOUTPUTSpin"] = settingGPIOOUTPUTSpin;
root["GPIOOUTPUTStriggerBit"] = settingGPIOOUTPUTStriggerBit;
root["OTGWPICautoUpdate"] = settingOTGWPICautoUpdate;

serializeJsonPretty(root, file);
Debugln(F("... done!"));
Expand Down Expand Up @@ -94,7 +95,8 @@ void readSettings(bool show)
// Copy values from the JsonDocument to the Config
settingHostname = doc["hostname"].as<String>();
if (settingHostname.length()==0) settingHostname = _HOSTNAME;
settingMQTTenable = doc["MQTTenable"]|settingMQTTenable;
settingMQTTenable = doc["MQTTenable"]|settingMQTTenable;
settingOTGWPICautoUpdate = doc["OTGWPICautoUpdate"] | settingOTGWPICautoUpdate;
settingMQTTbroker = doc["MQTTbroker"].as<String>();
settingMQTTbrokerPort = doc["MQTTbrokerPort"]; //default port
settingMQTTuser = doc["MQTTuser"].as<String>();
Expand Down Expand Up @@ -168,6 +170,7 @@ void readSettings(bool show)
Debugf("GPIO Outputs : %s\r\n", CBOOLEAN(settingGPIOOUTPUTSenabled));
Debugf("GPIO Out. Pin : %d\r\n", settingGPIOOUTPUTSpin);
Debugf("GPIO Out. Trg. Bit : %d\r\n", settingGPIOOUTPUTStriggerBit);
Debugf("PIC autoupdate enabled: %s\r\n", CBOOLEAN(settingOTGWPICautoUpdate));
}

Debugln(F("-\r\n"));
Expand Down Expand Up @@ -293,6 +296,9 @@ void updateSetting(const char *field, const char *newValue)
DebugTf(PSTR("Need reboot before GPIO OUTPUTS will use new trigger bit %d!\r\n\n"), settingGPIOOUTPUTStriggerBit);
}

if (strcasecmp(field, "OTGWPICautoUpdate") == 0)
settingOTGWPICautoUpdate = EVALBOOLEAN(newValue);

//finally update write settings
writeSettings(false);

Expand Down