diff --git a/.vscode/settings.json b/.vscode/settings.json index c66a10b..69aa100 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,6 +13,8 @@ "type_traits": "cpp", "utility": "cpp", "*.d": "cpp", - "*.html": "cpp" + "*.html": "cpp", + "*.tcc": "cpp", + "regex": "cpp" } } \ No newline at end of file diff --git a/src/espmega_iot_core.cpp b/src/espmega_iot_core.cpp index 1975ded..ea82440 100644 --- a/src/espmega_iot_core.cpp +++ b/src/espmega_iot_core.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