fix mqtt ptr init bug

This commit is contained in:
Siwat Sirichai 2023-12-31 17:55:13 +07:00
parent 443a02c319
commit 14767df9ec
4 changed files with 93 additions and 41 deletions

View file

@ -163,6 +163,9 @@ void InternalDisplay::saveMQTTConfig()
// password_set -> a text input to set the mqtt password
// topic_set -> a text input to set the mqtt base topic
// Send the stop bytes to flush the serial buffer
this->sendStopBytes();
// Save the mqtt server
if(!this->getStringToBuffer("mqttsv_set.txt", this->mqttConfig->mqtt_server, 16))
return;
@ -183,7 +186,10 @@ void InternalDisplay::saveMQTTConfig()
return;
// Save the mqtt use auth
this->mqttConfig->mqtt_useauth = this->getNumber("use_auth.val") == 1 ? true : false;
uint8_t use_auth = this->getNumber("use_auth.val");
Serial.print("use_auth: ");
Serial.println(use_auth);
this->mqttConfig->mqtt_useauth = use_auth == 1 ? true : false;
this->iot->saveMqttConfig();
ESP.restart();
}