parent
7ecd601073
commit
1090c210f7
|
@ -13,6 +13,8 @@
|
|||
"type_traits": "cpp",
|
||||
"utility": "cpp",
|
||||
"*.d": "cpp",
|
||||
"*.html": "cpp"
|
||||
"*.html": "cpp",
|
||||
"*.tcc": "cpp",
|
||||
"regex": "cpp"
|
||||
}
|
||||
}
|
|
@ -265,7 +265,7 @@ void ota_begin()
|
|||
String configbuffer = config_part1;
|
||||
configbuffer += config_part1;
|
||||
configbuffer+=config_txt_part1+"IP Address"+config_txt_part2+"text"+config_txt_part3+"dev_ip"+config_txt_part4+"dev_ip"+config_txt_part5+IP.toString()+config_txt_part6;
|
||||
configbuffer+=config_txt_part1+"Network Mask"+config_txt_part2+"text"+config_txt_part3+"netmask"+config_txt_part4+"netmask"+config_txt_part5+IP.toString()+config_txt_part6;
|
||||
configbuffer+=config_txt_part1+"Network Mask"+config_txt_part2+"text"+config_txt_part3+"netmask"+config_txt_part4+"netmask"+config_txt_part5+SUBNET.toString()+config_txt_part6;
|
||||
configbuffer+=config_txt_part1+"Gateway"+config_txt_part2+"text"+config_txt_part3+"gateway"+config_txt_part4+"gateway"+config_txt_part5+GATEWAY.toString()+config_txt_part6;
|
||||
configbuffer+=config_txt_part1+"DNS Server"+config_txt_part2+"text"+config_txt_part3+"dns"+config_txt_part4+"dns"+config_txt_part5+DNS.toString()+config_txt_part6;
|
||||
configbuffer+=config_txt_part1+"Hostname"+config_txt_part2+"text"+config_txt_part3+"hostname"+config_txt_part4+"hostname"+config_txt_part5+String(HOSTNAME)+config_txt_part6;
|
||||
|
@ -277,7 +277,50 @@ void ota_begin()
|
|||
configbuffer+=config_txt_part1+"BMS Server - Endpoint"+config_txt_part2+"text"+config_txt_part3+"bms_endpoint"+config_txt_part4+"bms_endpoint"+config_txt_part5+String(MQTT_BASE_TOPIC)+config_txt_part6;
|
||||
configbuffer+=config_part2;
|
||||
otaserver.send(200, "text/html", configbuffer); });
|
||||
|
||||
|
||||
otaserver.on("/save_config", HTTP_GET, []()
|
||||
{
|
||||
otaserver.sendHeader("Connection", "close");
|
||||
String configbuffer = "Configuration Saved. Rebooting . . .";
|
||||
otaserver.send(200, "text/html", configbuffer);
|
||||
bool use_auth = false;
|
||||
for(int i=0;i<otaserver.args();i++) {
|
||||
String arg = otaserver.argName(i);
|
||||
String value = otaserver.arg(i);
|
||||
if(!arg.compareTo("dev_ip")) {
|
||||
set_ip(value);
|
||||
} else if(!arg.compareTo("netmask")) {
|
||||
set_netmask(value);
|
||||
} else if(!arg.compareTo("gateway")) {
|
||||
set_gw(value);
|
||||
} else if(!arg.compareTo("dns")) {
|
||||
set_dns(value);
|
||||
} else if(!arg.compareTo("hostname")) {
|
||||
set_hostname(value);
|
||||
} else if(!arg.compareTo("bms_ip")) {
|
||||
set_mqtt_server(value);
|
||||
} else if(!arg.compareTo("bms_username")) {
|
||||
set_mqtt_username(value);
|
||||
}else if(!arg.compareTo("bms_port")) {
|
||||
uint16_t port = value.toInt();
|
||||
mqtt_port_set(port);
|
||||
}else if(!arg.compareTo("bms_endpoint")) {
|
||||
set_basetopic(value);
|
||||
}
|
||||
else if(!arg.compareTo("bms_password")) {
|
||||
set_mqtt_password(value);
|
||||
} else if(!arg.compareTo("bms_useauth")) {
|
||||
if(!value.compareTo("yes"))
|
||||
use_auth = true;
|
||||
}
|
||||
}
|
||||
set_mqtt_useauth(use_auth);
|
||||
otaserver.send(200, "text/html", configbuffer);
|
||||
delay(500);
|
||||
ESP.restart();
|
||||
});
|
||||
|
||||
|
||||
otaserver.on(
|
||||
"/update", HTTP_POST, []()
|
||||
{
|
||||
|
@ -867,8 +910,8 @@ void lcd_refresh()
|
|||
panel.writeNum("port_set.val", MQTT_PORT);
|
||||
panel.writeStr("topic_set.txt", MQTT_BASE_TOPIC);
|
||||
panel.writeStr("user_set.txt", MQTT_USERNAME);
|
||||
panel.writeStr("password_set.txt",MQTT_PASSWORD);
|
||||
panel.writeNum("use_auth.val",MQTT_USE_AUTH);
|
||||
panel.writeStr("password_set.txt", MQTT_PASSWORD);
|
||||
panel.writeNum("use_auth.val", MQTT_USE_AUTH);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue