mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-26 12:47:18 +02:00
improved mqtt
removed wrong "inverter type can't be detected!" messages repaired NTP and static IP #459 MQTT status about availability and produce are retain messages now
This commit is contained in:
parent
f4c3aea964
commit
0a5833e6ec
11 changed files with 96 additions and 87 deletions
|
@ -11,6 +11,7 @@
|
|||
#include "web.h"
|
||||
|
||||
#include "../utils/ahoyTimer.h"
|
||||
#include "../utils/helper.h"
|
||||
|
||||
#include "html/h/index_html.h"
|
||||
#include "html/h/login_html.h"
|
||||
|
@ -343,28 +344,16 @@ void web::showSave(AsyncWebServerRequest *request) {
|
|||
|
||||
|
||||
// static ip
|
||||
if(request->arg("ipAddr") != "") {
|
||||
request->arg("ipAddr").toCharArray(buf, SSID_LEN);
|
||||
ip2Arr(mConfig->sys.ip.ip, buf);
|
||||
if(request->arg("ipMask") != "") {
|
||||
request->arg("ipMask").toCharArray(buf, SSID_LEN);
|
||||
ip2Arr(mConfig->sys.ip.mask, buf);
|
||||
}
|
||||
if(request->arg("ipDns1") != "") {
|
||||
request->arg("ipDns1").toCharArray(buf, SSID_LEN);
|
||||
ip2Arr(mConfig->sys.ip.dns1, buf);
|
||||
}
|
||||
if(request->arg("ipDns2") != "") {
|
||||
request->arg("ipDns2").toCharArray(buf, SSID_LEN);
|
||||
ip2Arr(mConfig->sys.ip.dns2, buf);
|
||||
}
|
||||
if(request->arg("ipGateway") != "") {
|
||||
request->arg("ipGateway").toCharArray(buf, SSID_LEN);
|
||||
ip2Arr(mConfig->sys.ip.gateway, buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
memset(&mConfig->sys.ip.ip, 0, 4);
|
||||
request->arg("ipAddr").toCharArray(buf, 20);
|
||||
ah::ip2Arr(mConfig->sys.ip.ip, buf);
|
||||
request->arg("ipMask").toCharArray(buf, 20);
|
||||
ah::ip2Arr(mConfig->sys.ip.mask, buf);
|
||||
request->arg("ipDns1").toCharArray(buf, 20);
|
||||
ah::ip2Arr(mConfig->sys.ip.dns1, buf);
|
||||
request->arg("ipDns2").toCharArray(buf, 20);
|
||||
ah::ip2Arr(mConfig->sys.ip.dns2, buf);
|
||||
request->arg("ipGateway").toCharArray(buf, 20);
|
||||
ah::ip2Arr(mConfig->sys.ip.gateway, buf);
|
||||
|
||||
|
||||
// inverter
|
||||
|
@ -437,12 +426,14 @@ void web::showSave(AsyncWebServerRequest *request) {
|
|||
String addr = request->arg("mqttAddr");
|
||||
addr.trim();
|
||||
addr.toCharArray(mConfig->mqtt.broker, MQTT_ADDR_LEN);
|
||||
request->arg("mqttUser").toCharArray(mConfig->mqtt.user, MQTT_USER_LEN);
|
||||
if(request->arg("mqttPwd") != "{PWD}")
|
||||
request->arg("mqttPwd").toCharArray(mConfig->mqtt.pwd, MQTT_PWD_LEN);
|
||||
request->arg("mqttTopic").toCharArray(mConfig->mqtt.topic, MQTT_TOPIC_LEN);
|
||||
mConfig->mqtt.port = request->arg("mqttPort").toInt();
|
||||
}
|
||||
else
|
||||
mConfig->mqtt.broker[0] = '\0';
|
||||
request->arg("mqttUser").toCharArray(mConfig->mqtt.user, MQTT_USER_LEN);
|
||||
if(request->arg("mqttPwd") != "{PWD}")
|
||||
request->arg("mqttPwd").toCharArray(mConfig->mqtt.pwd, MQTT_PWD_LEN);
|
||||
request->arg("mqttTopic").toCharArray(mConfig->mqtt.topic, MQTT_TOPIC_LEN);
|
||||
mConfig->mqtt.port = request->arg("mqttPort").toInt();
|
||||
|
||||
// serial console
|
||||
if(request->arg("serIntvl") != "") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue