Allow empty DeviceName

This commit is contained in:
Theo Arends 2020-05-17 17:55:36 +02:00
parent 90e833238f
commit 4e38cb7ba9
1 changed files with 3 additions and 4 deletions

View File

@ -456,7 +456,7 @@ const char HTTP_FORM_OTHER[] PROGMEM =
"<br>"
"<label><input id='b1' type='checkbox'%s><b>" D_MQTT_ENABLE "</b></label><br>"
"<br>"
"<label><b>" D_DEVICE_NAME "</b> (%s)</label><br><input id='dn' placeholder='%s' value='%s'><br>"
"<label><b>" D_DEVICE_NAME "</b> (%s)</label><br><input id='dn' placeholder='' value='%s'><br>"
"<br>";
const char HTTP_FORM_END[] PROGMEM =
@ -1996,7 +1996,7 @@ void HandleOtherConfiguration(void)
strlcpy(stemp, mqtt_data, sizeof(stemp)); // Get JSON template
WSContentSend_P(HTTP_FORM_OTHER, stemp, (USER_MODULE == Settings.module) ? " checked disabled" : "",
(Settings.flag.mqtt_enabled) ? " checked" : "", // SetOption3 - Enable MQTT
SettingsText(SET_FRIENDLYNAME1), SettingsText(SET_DEVICENAME), SettingsText(SET_DEVICENAME));
SettingsText(SET_FRIENDLYNAME1), SettingsText(SET_DEVICENAME));
uint32_t maxfn = (devices_present > MAX_FRIENDLYNAMES) ? MAX_FRIENDLYNAMES : (!devices_present) ? 1 : devices_present;
#ifdef USE_SONOFF_IFAN
@ -2047,8 +2047,7 @@ void OtherSaveSettings(void)
char message[LOGSZ];
WebGetArg("dn", tmp, sizeof(tmp));
SettingsUpdateText(SET_DEVICENAME, (!strlen(tmp)) ? SettingsText(SET_FRIENDLYNAME1) : tmp);
SettingsUpdateText(SET_DEVICENAME, (!strlen(tmp)) ? "" : (!strcmp(tmp,"1")) ? SettingsText(SET_FRIENDLYNAME1) : tmp);
WebGetArg("wp", tmp, sizeof(tmp));
SettingsUpdateText(SET_WEBPWD, (!strlen(tmp)) ? "" : (strchr(tmp,'*')) ? SettingsText(SET_WEBPWD) : tmp);
Settings.flag.mqtt_enabled = Webserver->hasArg("b1"); // SetOption3 - Enable MQTT