From 1128de9297377a9cfd75dda0bb1601721ed8511d Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Tue, 7 Nov 2023 16:03:46 +0700 Subject: [PATCH] new OTA page --- src/espmega_iot_core.cpp | 11 +- src/espmega_iot_ota.cpp | 25 ++-- src/espmega_iot_ota.hpp | 9 +- src/ota_html/config copy.html | 188 ++++++++++++++++++++++++++++++ src/ota_html/config.html | 33 ------ src/ota_html/ota-part1.html | 6 +- src/ota_html/ota-part2-1_itr.html | 1 + src/ota_html/ota-part2-2_itr.html | 1 + src/ota_html/ota-part2-3_itr.html | 2 + src/ota_html/ota-part2.html | 5 - src/ota_html/ota-part3.html | 149 ++++++++++++++++++++++- src/ota_html/ota-part4.html | 5 - src/ota_html/ota-part5.html | 5 - src/ota_html/ota-part6.html | 5 - src/ota_html/ota-part7.html | 5 - src/ota_html/ota-part8.html | 125 -------------------- 16 files changed, 357 insertions(+), 218 deletions(-) create mode 100644 src/ota_html/config copy.html create mode 100644 src/ota_html/ota-part2-1_itr.html create mode 100644 src/ota_html/ota-part2-2_itr.html create mode 100644 src/ota_html/ota-part2-3_itr.html delete mode 100644 src/ota_html/ota-part2.html delete mode 100644 src/ota_html/ota-part4.html delete mode 100644 src/ota_html/ota-part5.html delete mode 100644 src/ota_html/ota-part6.html delete mode 100644 src/ota_html/ota-part7.html delete mode 100644 src/ota_html/ota-part8.html diff --git a/src/espmega_iot_core.cpp b/src/espmega_iot_core.cpp index d336ada..a7f2fae 100644 --- a/src/espmega_iot_core.cpp +++ b/src/espmega_iot_core.cpp @@ -245,12 +245,19 @@ void ota_begin() otaserver.on("/", HTTP_GET, []() { otaserver.sendHeader("Connection", "close"); - String otabuffer = ota_part1+HOSTNAME+ota_part2+IP.toString()+ota_part3+ETH.macAddress()+ota_part4+ESPMEGA_REV+ota_part5+MQTT_SERVER.toString()+ota_part6+String(MQTT_BASE_TOPIC)+ota_part7; + String otabuffer = ota_part1; + otabuffer+=ota_part2_1+"Hostname"+ota_part2_2+String(HOSTNAME)+ota_part2_3; + otabuffer+=ota_part2_1+"IP Address"+ota_part2_2+IP.toString()+ota_part2_3; + otabuffer+=ota_part2_1+"MAC Address"+ota_part2_2+ETH.macAddress()+ota_part2_3; + otabuffer+=ota_part2_1+"Device"+ota_part2_2+ESPMEGA_REV+ota_part2_3; + otabuffer+=ota_part2_1+"BMS Server"+ota_part2_2+MQTT_SERVER.toString()+ota_part2_3; + otabuffer+=ota_part2_1+"BMS Endpoint"+ota_part2_2+String(MQTT_BASE_TOPIC)+ota_part2_3; + otabuffer+=ota_part2_1+"Centrally Managed"+ota_part2_2; if(standalone) otabuffer+=String("No"); else otabuffer+=String("Yes"); - otabuffer+=ota_part8; + otabuffer+=ota_part2_3+ota_part3; otaserver.send(200, "text/html", otabuffer); }); otaserver.on( "/update", HTTP_POST, []() diff --git a/src/espmega_iot_ota.cpp b/src/espmega_iot_ota.cpp index 282ffd5..f3f1682 100644 --- a/src/espmega_iot_ota.cpp +++ b/src/espmega_iot_ota.cpp @@ -3,24 +3,15 @@ const String ota_part1 = { #include "ota_html/ota-part1.html" }; -const String ota_part2 = { -#include "ota_html/ota-part2.html" +const String ota_part2_1 = { +#include "ota_html/ota-part2-1_itr.html" +}; +const String ota_part2_2 = { +#include "ota_html/ota-part2-2_itr.html" +}; +const String ota_part2_3 = { +#include "ota_html/ota-part2-3_itr.html" }; const String ota_part3 = { #include "ota_html/ota-part3.html" -}; -const String ota_part4 = { -#include "ota_html/ota-part4.html" -}; -const String ota_part5 = { -#include "ota_html/ota-part5.html" -}; -const String ota_part6 = { -#include "ota_html/ota-part6.html" -}; -const String ota_part7 = { -#include "ota_html/ota-part7.html" -}; -const String ota_part8 = { -#include "ota_html/ota-part8.html" }; \ No newline at end of file diff --git a/src/espmega_iot_ota.hpp b/src/espmega_iot_ota.hpp index 8ca414b..01f62dd 100644 --- a/src/espmega_iot_ota.hpp +++ b/src/espmega_iot_ota.hpp @@ -1,10 +1,7 @@ #pragma once #include extern const String ota_part1; -extern const String ota_part2; +extern const String ota_part2_1; +extern const String ota_part2_2; +extern const String ota_part2_3; extern const String ota_part3; -extern const String ota_part4; -extern const String ota_part5; -extern const String ota_part6; -extern const String ota_part7; -extern const String ota_part8; \ No newline at end of file diff --git a/src/ota_html/config copy.html b/src/ota_html/config copy.html new file mode 100644 index 0000000..eaacb2f --- /dev/null +++ b/src/ota_html/config copy.html @@ -0,0 +1,188 @@ + +
+

ESPMega PRO

+

Device Configurations

+

IP Address

+
+

Network Mask

+
+

Gateway

+
+

DNS Server

+
+

Hostname

+
+

BMS Server - IP Address

+
+

BMS Server - Port

+
+ +

BMS Server - Username

+
+

BMS Server - Password

+
+

BMS Server - Endpoint

+
+ + SIWAT SYSTEM 2023 +
+ \ No newline at end of file diff --git a/src/ota_html/config.html b/src/ota_html/config.html index 38bfdc3..eaacb2f 100644 --- a/src/ota_html/config.html +++ b/src/ota_html/config.html @@ -29,32 +29,6 @@ SIWAT SYSTEM 2023 - )=====" \ No newline at end of file diff --git a/src/ota_html/ota-part4.html b/src/ota_html/ota-part4.html deleted file mode 100644 index 76b974c..0000000 --- a/src/ota_html/ota-part4.html +++ /dev/null @@ -1,5 +0,0 @@ -R"=====( -

-

- Device - )=====" \ No newline at end of file diff --git a/src/ota_html/ota-part5.html b/src/ota_html/ota-part5.html deleted file mode 100644 index d7745f3..0000000 --- a/src/ota_html/ota-part5.html +++ /dev/null @@ -1,5 +0,0 @@ -R"=====( -

-

- API Server - )=====" \ No newline at end of file diff --git a/src/ota_html/ota-part6.html b/src/ota_html/ota-part6.html deleted file mode 100644 index 743ba2a..0000000 --- a/src/ota_html/ota-part6.html +++ /dev/null @@ -1,5 +0,0 @@ -R"=====( -

-

- API Endpoint - )=====" \ No newline at end of file diff --git a/src/ota_html/ota-part7.html b/src/ota_html/ota-part7.html deleted file mode 100644 index 567deb3..0000000 --- a/src/ota_html/ota-part7.html +++ /dev/null @@ -1,5 +0,0 @@ -R"=====( -

-

- Centrally Managed - )=====" \ No newline at end of file diff --git a/src/ota_html/ota-part8.html b/src/ota_html/ota-part8.html deleted file mode 100644 index 4f94bee..0000000 --- a/src/ota_html/ota-part8.html +++ /dev/null @@ -1,125 +0,0 @@ -R"=====( -

- - - -

-
-
-
-
-
-
-SIWAT SYSTEM 2023 - - -)=====" \ No newline at end of file