new OTA page
This commit is contained in:
		
							parent
							
								
									897d8694e1
								
							
						
					
					
						commit
						1128de9297
					
				
					 16 changed files with 357 additions and 218 deletions
				
			
		| 
						 | 
					@ -245,12 +245,19 @@ void ota_begin()
 | 
				
			||||||
  otaserver.on("/", HTTP_GET, []()
 | 
					  otaserver.on("/", HTTP_GET, []()
 | 
				
			||||||
               {
 | 
					               {
 | 
				
			||||||
    otaserver.sendHeader("Connection", "close");
 | 
					    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)
 | 
					    if(standalone)
 | 
				
			||||||
    otabuffer+=String("No");
 | 
					    otabuffer+=String("No");
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    otabuffer+=String("Yes");
 | 
					    otabuffer+=String("Yes");
 | 
				
			||||||
    otabuffer+=ota_part8;
 | 
					    otabuffer+=ota_part2_3+ota_part3;
 | 
				
			||||||
    otaserver.send(200, "text/html", otabuffer); });
 | 
					    otaserver.send(200, "text/html", otabuffer); });
 | 
				
			||||||
  otaserver.on(
 | 
					  otaserver.on(
 | 
				
			||||||
      "/update", HTTP_POST, []()
 | 
					      "/update", HTTP_POST, []()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,24 +3,15 @@
 | 
				
			||||||
const String ota_part1 = {
 | 
					const String ota_part1 = {
 | 
				
			||||||
#include "ota_html/ota-part1.html"
 | 
					#include "ota_html/ota-part1.html"
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
const String ota_part2 = {
 | 
					const String ota_part2_1 = {
 | 
				
			||||||
#include "ota_html/ota-part2.html"
 | 
					#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 = {
 | 
					const String ota_part3 = {
 | 
				
			||||||
#include "ota_html/ota-part3.html"
 | 
					#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"
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,10 +1,7 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
#include <ESPMegaPRO.h>
 | 
					#include <ESPMegaPRO.h>
 | 
				
			||||||
extern const String ota_part1;
 | 
					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_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;
 | 
					 | 
				
			||||||
							
								
								
									
										188
									
								
								src/ota_html/config copy.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										188
									
								
								src/ota_html/config copy.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,188 @@
 | 
				
			||||||
 | 
					<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
 | 
				
			||||||
 | 
					<form enctype="multipart/form-data" id="config_form" onsubmit="send_config()" action="/save_config">
 | 
				
			||||||
 | 
					  <h1>ESPMega PRO</h1>
 | 
				
			||||||
 | 
					  <h3>Device Configurations</h3>
 | 
				
			||||||
 | 
					  <p class="config_title">IP Address</p>
 | 
				
			||||||
 | 
					  <input type="text" id="dev_ip" name="dev_ip" class="conf_txt" value="0.0.0.0"><br>
 | 
				
			||||||
 | 
					  <p class="config_title">Network Mask</p>
 | 
				
			||||||
 | 
					  <input type="text" id="netmask" name="netmask" class="conf_txt" value="0.0.0.0"><br>
 | 
				
			||||||
 | 
					  <p class="config_title">Gateway</p>
 | 
				
			||||||
 | 
					  <input type="text" id="gateway" name="gateway" class="conf_txt" value="0.0.0.0"><br>
 | 
				
			||||||
 | 
					  <p class="config_title">DNS Server</p>
 | 
				
			||||||
 | 
					  <input type="text" id="dns" name="dns" class="conf_txt" value="0.0.0.0"><br>
 | 
				
			||||||
 | 
					  <p class="config_title">Hostname</p>
 | 
				
			||||||
 | 
					  <input type="text" id="hostname" name="hostname" class="conf_txt" value="ESPMegaPRO"><br>
 | 
				
			||||||
 | 
					  <p class="config_title">BMS Server - IP Address</p>
 | 
				
			||||||
 | 
					  <input type="text" id="bms_ip" name="bms_ip" class="conf_txt" value="0.0.0.0"><br>
 | 
				
			||||||
 | 
					  <p class="config_title">BMS Server - Port</p>
 | 
				
			||||||
 | 
					  <input type="text" id="bms_port" name="bms_port" class="conf_txt" value="1883"><br>
 | 
				
			||||||
 | 
					  <label class="container">Authentication
 | 
				
			||||||
 | 
					    <input type="checkbox" name="bms_useauth"  id="bms_useauth" checked="checked" value="yes">
 | 
				
			||||||
 | 
					    <span class="checkmark"></span>
 | 
				
			||||||
 | 
					  </label>
 | 
				
			||||||
 | 
					  <p class="config_title">BMS Server - Username</p>
 | 
				
			||||||
 | 
					  <input type="text" id="bms_username" name="bms_username" class="conf_txt" value="user"><br>
 | 
				
			||||||
 | 
					  <p class="config_title">BMS Server - Password</p>
 | 
				
			||||||
 | 
					  <input type="password" id="bms_password" name="bms_password" class="conf_txt" value="password"><br>
 | 
				
			||||||
 | 
					  <p class="config_title">BMS Server - Endpoint</p>
 | 
				
			||||||
 | 
					  <input type="text" id="bms_endpoint" name="bms_endpoint" class="conf_txt" value="/espmegapro"><br>
 | 
				
			||||||
 | 
					  <input type="submit" class="btn" value="Save">
 | 
				
			||||||
 | 
					  <b>SIWAT SYSTEM 2023</b>
 | 
				
			||||||
 | 
					</form>
 | 
				
			||||||
 | 
					<style>
 | 
				
			||||||
 | 
					  p.config_title {
 | 
				
			||||||
 | 
					    font-size: 12;
 | 
				
			||||||
 | 
					    font-weight: bold;
 | 
				
			||||||
 | 
					    text-align: left;
 | 
				
			||||||
 | 
					    align-self: left;
 | 
				
			||||||
 | 
					    margin-bottom: 0;
 | 
				
			||||||
 | 
					    margin-top: 0;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  hr {
 | 
				
			||||||
 | 
					    display: block;
 | 
				
			||||||
 | 
					    color: #aaaaaa;
 | 
				
			||||||
 | 
					    background-color: #aaaaaa;
 | 
				
			||||||
 | 
					    margin-top: 0.5em;
 | 
				
			||||||
 | 
					    margin-bottom: 0.5em;
 | 
				
			||||||
 | 
					    margin-left: auto;
 | 
				
			||||||
 | 
					    margin-right: auto;
 | 
				
			||||||
 | 
					    border-style: inset;
 | 
				
			||||||
 | 
					    border-width: 0px;
 | 
				
			||||||
 | 
					    height: 3px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #file-input,
 | 
				
			||||||
 | 
					  input {
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    height: 44px;
 | 
				
			||||||
 | 
					    border-radius: 4px;
 | 
				
			||||||
 | 
					    margin: 10px auto;
 | 
				
			||||||
 | 
					    font-size: 15px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  input {
 | 
				
			||||||
 | 
					    background: #f1f1f1;
 | 
				
			||||||
 | 
					    border: 0;
 | 
				
			||||||
 | 
					    padding: 0 15px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  body {
 | 
				
			||||||
 | 
					    background-image: url("https://fs.siwatsystem.com/arona_bg.png");
 | 
				
			||||||
 | 
					    background-size: cover;
 | 
				
			||||||
 | 
					    font-family: sans-serif;
 | 
				
			||||||
 | 
					    font-size: 14px;
 | 
				
			||||||
 | 
					    color: #777;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #file-input {
 | 
				
			||||||
 | 
					    background-color: #CCCCCC;
 | 
				
			||||||
 | 
					    color: #5E5E5E;
 | 
				
			||||||
 | 
					    padding: 0;
 | 
				
			||||||
 | 
					    border: 1px solid #ddd;
 | 
				
			||||||
 | 
					    line-height: 44px;
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					    display: block;
 | 
				
			||||||
 | 
					    cursor: pointer;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #bar,
 | 
				
			||||||
 | 
					  #prgbar {
 | 
				
			||||||
 | 
					    background-color: #D9D9D9;
 | 
				
			||||||
 | 
					    border-radius: 10px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #bar {
 | 
				
			||||||
 | 
					    background-color: #29CD1F;
 | 
				
			||||||
 | 
					    width: 0%;
 | 
				
			||||||
 | 
					    height: 10px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  form {
 | 
				
			||||||
 | 
					    background: rgba(255, 255, 255, 0.95);
 | 
				
			||||||
 | 
					    max-width: 258px;
 | 
				
			||||||
 | 
					    margin: 75px auto;
 | 
				
			||||||
 | 
					    padding: 30px;
 | 
				
			||||||
 | 
					    border-radius: 15px;
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .btn {
 | 
				
			||||||
 | 
					    background: #CA3D3D;
 | 
				
			||||||
 | 
					    color: #fff;
 | 
				
			||||||
 | 
					    cursor: pointer;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .conf {
 | 
				
			||||||
 | 
					    background: #417df3;
 | 
				
			||||||
 | 
					    color: #fff;
 | 
				
			||||||
 | 
					    cursor: pointer;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  .conf_txt {
 | 
				
			||||||
 | 
					    background-color: #e2e2e2;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .checkbox {
 | 
				
			||||||
 | 
					    size: 4;
 | 
				
			||||||
 | 
					    display: inline-block;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  .container {
 | 
				
			||||||
 | 
					  display: block;
 | 
				
			||||||
 | 
					  position: relative;
 | 
				
			||||||
 | 
					  padding-left: 0px;
 | 
				
			||||||
 | 
					  margin-bottom: 12px;
 | 
				
			||||||
 | 
					  cursor: pointer;
 | 
				
			||||||
 | 
					  font-size: 20px;
 | 
				
			||||||
 | 
					  -webkit-user-select: none;
 | 
				
			||||||
 | 
					  -moz-user-select: none;
 | 
				
			||||||
 | 
					  -ms-user-select: none;
 | 
				
			||||||
 | 
					  user-select: none;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.container input {
 | 
				
			||||||
 | 
					  position: absolute;
 | 
				
			||||||
 | 
					  opacity: 0;
 | 
				
			||||||
 | 
					  cursor: pointer;
 | 
				
			||||||
 | 
					  height: 0;
 | 
				
			||||||
 | 
					  width: 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.checkmark {
 | 
				
			||||||
 | 
					  position: absolute;
 | 
				
			||||||
 | 
					  top: 0;
 | 
				
			||||||
 | 
					  left: 0;
 | 
				
			||||||
 | 
					  height: 25px;
 | 
				
			||||||
 | 
					  width: 25px;
 | 
				
			||||||
 | 
					  background-color: #eee;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.container:hover input ~ .checkmark {
 | 
				
			||||||
 | 
					  background-color: #ccc;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.container input:checked ~ .checkmark {
 | 
				
			||||||
 | 
					  background-color: #2196F3;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.checkmark:after {
 | 
				
			||||||
 | 
					  content: "";
 | 
				
			||||||
 | 
					  position: absolute;
 | 
				
			||||||
 | 
					  display: none;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.container input:checked ~ .checkmark:after {
 | 
				
			||||||
 | 
					  display: block;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.container .checkmark:after {
 | 
				
			||||||
 | 
					  left: 9px;
 | 
				
			||||||
 | 
					  top: 5px;
 | 
				
			||||||
 | 
					  width: 5px;
 | 
				
			||||||
 | 
					  height: 10px;
 | 
				
			||||||
 | 
					  border: solid white;
 | 
				
			||||||
 | 
					  border-width: 0 3px 3px 0;
 | 
				
			||||||
 | 
					  -webkit-transform: rotate(45deg);
 | 
				
			||||||
 | 
					  -ms-transform: rotate(45deg);
 | 
				
			||||||
 | 
					  transform: rotate(45deg);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					</style>
 | 
				
			||||||
| 
						 | 
					@ -29,32 +29,6 @@
 | 
				
			||||||
  <input type="submit" class="btn" value="Save">
 | 
					  <input type="submit" class="btn" value="Save">
 | 
				
			||||||
  <b>SIWAT SYSTEM 2023</b>
 | 
					  <b>SIWAT SYSTEM 2023</b>
 | 
				
			||||||
</form>
 | 
					</form>
 | 
				
			||||||
<script>
 | 
					 | 
				
			||||||
    function send_config() {
 | 
					 | 
				
			||||||
        var form = $("#config_form")[0];
 | 
					 | 
				
			||||||
        var data = new FormData(form);
 | 
					 | 
				
			||||||
        var dev_ip = data.get("dev_ip")
 | 
					 | 
				
			||||||
        var netmask = data.get("netmask")
 | 
					 | 
				
			||||||
        var gateway = data.get("gateway")
 | 
					 | 
				
			||||||
        var dns = data.get("dns")
 | 
					 | 
				
			||||||
        var bms_ip = data.get("bms_ip")
 | 
					 | 
				
			||||||
        var bms_port = data.get("bms_port")
 | 
					 | 
				
			||||||
        var bms_useauth = data.get("bms_useauth")
 | 
					 | 
				
			||||||
        var bms_username = data.get("bms_username")
 | 
					 | 
				
			||||||
        var bms_password = data.get("bms_password")
 | 
					 | 
				
			||||||
        var bms_endpoint = data.get("bms_endpoint")
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
//   $("form").submit(function (e) {
 | 
					 | 
				
			||||||
//     e.preventDefault();
 | 
					 | 
				
			||||||
//     var form = $("#config_form")[0];
 | 
					 | 
				
			||||||
//     var data = new FormData(form);
 | 
					 | 
				
			||||||
//     console.log(data)
 | 
					 | 
				
			||||||
//     $.ajax({
 | 
					 | 
				
			||||||
//         //Insert Configuration Upload Code
 | 
					 | 
				
			||||||
//     });
 | 
					 | 
				
			||||||
//   });
 | 
					 | 
				
			||||||
</script>
 | 
					 | 
				
			||||||
<style>
 | 
					<style>
 | 
				
			||||||
  p.config_title {
 | 
					  p.config_title {
 | 
				
			||||||
    font-size: 12;
 | 
					    font-size: 12;
 | 
				
			||||||
| 
						 | 
					@ -165,7 +139,6 @@
 | 
				
			||||||
  user-select: none;
 | 
					  user-select: none;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Hide the browser's default checkbox */
 | 
					 | 
				
			||||||
.container input {
 | 
					.container input {
 | 
				
			||||||
  position: absolute;
 | 
					  position: absolute;
 | 
				
			||||||
  opacity: 0;
 | 
					  opacity: 0;
 | 
				
			||||||
| 
						 | 
					@ -174,7 +147,6 @@
 | 
				
			||||||
  width: 0;
 | 
					  width: 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Create a custom checkbox */
 | 
					 | 
				
			||||||
.checkmark {
 | 
					.checkmark {
 | 
				
			||||||
  position: absolute;
 | 
					  position: absolute;
 | 
				
			||||||
  top: 0;
 | 
					  top: 0;
 | 
				
			||||||
| 
						 | 
					@ -184,29 +156,24 @@
 | 
				
			||||||
  background-color: #eee;
 | 
					  background-color: #eee;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* On mouse-over, add a grey background color */
 | 
					 | 
				
			||||||
.container:hover input ~ .checkmark {
 | 
					.container:hover input ~ .checkmark {
 | 
				
			||||||
  background-color: #ccc;
 | 
					  background-color: #ccc;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* When the checkbox is checked, add a blue background */
 | 
					 | 
				
			||||||
.container input:checked ~ .checkmark {
 | 
					.container input:checked ~ .checkmark {
 | 
				
			||||||
  background-color: #2196F3;
 | 
					  background-color: #2196F3;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Create the checkmark/indicator (hidden when not checked) */
 | 
					 | 
				
			||||||
.checkmark:after {
 | 
					.checkmark:after {
 | 
				
			||||||
  content: "";
 | 
					  content: "";
 | 
				
			||||||
  position: absolute;
 | 
					  position: absolute;
 | 
				
			||||||
  display: none;
 | 
					  display: none;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Show the checkmark when checked */
 | 
					 | 
				
			||||||
.container input:checked ~ .checkmark:after {
 | 
					.container input:checked ~ .checkmark:after {
 | 
				
			||||||
  display: block;
 | 
					  display: block;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Style the checkmark/indicator */
 | 
					 | 
				
			||||||
.container .checkmark:after {
 | 
					.container .checkmark:after {
 | 
				
			||||||
  left: 9px;
 | 
					  left: 9px;
 | 
				
			||||||
  top: 5px;
 | 
					  top: 5px;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,4 @@
 | 
				
			||||||
R"=====(<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
 | 
					R"=====(<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
 | 
				
			||||||
<form method="POST" action="#" enctype="multipart/form-data" id="upload_form">
 | 
					<form method="POST" action="#" enctype="multipart/form-data" id="upload_form">
 | 
				
			||||||
  <h1>ESPMega PRO</h1>
 | 
					  <h1>ESPMega PRO</h1>
 | 
				
			||||||
  <h3>Software Management</h3>
 | 
					  <h3>Device Information</h3>)====="
 | 
				
			||||||
 | 
					 | 
				
			||||||
  <p style="text-align: left">
 | 
					 | 
				
			||||||
    Hostname
 | 
					 | 
				
			||||||
    <span style="float: right">)====="
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								src/ota_html/ota-part2-1_itr.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/ota_html/ota-part2-1_itr.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					R"=====(<p style="text-align: left">)====="
 | 
				
			||||||
							
								
								
									
										1
									
								
								src/ota_html/ota-part2-2_itr.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/ota_html/ota-part2-2_itr.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					R"=====(<span style="float: right">)====="
 | 
				
			||||||
							
								
								
									
										2
									
								
								src/ota_html/ota-part2-3_itr.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/ota_html/ota-part2-3_itr.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					R"=====(</span>
 | 
				
			||||||
 | 
					  </p>)====="
 | 
				
			||||||
| 
						 | 
					@ -1,5 +0,0 @@
 | 
				
			||||||
R"=====(</span>
 | 
					 | 
				
			||||||
</p>
 | 
					 | 
				
			||||||
<p style="text-align: left">
 | 
					 | 
				
			||||||
  IP Address
 | 
					 | 
				
			||||||
  <span style="float: right">)====="
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,144 @@
 | 
				
			||||||
R"=====(</span>
 | 
					R"=====(<button type="button" class="conf" onclick="window.location.href='config.html'">Settings</button><br /><br />
 | 
				
			||||||
</p>
 | 
					  <hr>
 | 
				
			||||||
<p style="text-align: left">
 | 
					  <h3>Upload Software Package</h3>
 | 
				
			||||||
  MAC Address
 | 
					  <input type="file" name="update" id="file" onchange="sub(this)" style="display: none" />
 | 
				
			||||||
  <span style="float: right">)====="
 | 
					  <label id="file-input" for="file">Choose file...</label>
 | 
				
			||||||
 | 
					  <input type="submit" class="btn" value="Program" /><br /><br />
 | 
				
			||||||
 | 
					  <div id="prg"></div>
 | 
				
			||||||
 | 
					  <br />
 | 
				
			||||||
 | 
					  <div id="prgbar">
 | 
				
			||||||
 | 
					    <div id="bar"></div>
 | 
				
			||||||
 | 
					  </div>
 | 
				
			||||||
 | 
					  <br />
 | 
				
			||||||
 | 
					  <b>SIWAT SYSTEM 2023</b>
 | 
				
			||||||
 | 
					</form>
 | 
				
			||||||
 | 
					<script>
 | 
				
			||||||
 | 
					  function sub(obj) {
 | 
				
			||||||
 | 
					    var fileName = obj.value.split("\\");
 | 
				
			||||||
 | 
					    document.getElementById("file-input").innerHTML =
 | 
				
			||||||
 | 
					      "   " + fileName[fileName.length - 1];
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  $("form").submit(function (e) {
 | 
				
			||||||
 | 
					    e.preventDefault();
 | 
				
			||||||
 | 
					    var form = $("#upload_form")[0];
 | 
				
			||||||
 | 
					    var data = new FormData(form);
 | 
				
			||||||
 | 
					    $.ajax({
 | 
				
			||||||
 | 
					      url: "/update",
 | 
				
			||||||
 | 
					      type: "POST",
 | 
				
			||||||
 | 
					      data: data,
 | 
				
			||||||
 | 
					      contentType: false,
 | 
				
			||||||
 | 
					      processData: false,
 | 
				
			||||||
 | 
					      xhr: function () {
 | 
				
			||||||
 | 
					        var xhr = new window.XMLHttpRequest();
 | 
				
			||||||
 | 
					        xhr.upload.addEventListener(
 | 
				
			||||||
 | 
					          "progress",
 | 
				
			||||||
 | 
					          function (evt) {
 | 
				
			||||||
 | 
					            if (evt.lengthComputable) {
 | 
				
			||||||
 | 
					              var per = evt.loaded / evt.total;
 | 
				
			||||||
 | 
					              if (Math.round(per * 100) < 100) {
 | 
				
			||||||
 | 
					                $("#prg").html("Updating . . . (" + Math.round(per * 100) + "%)");
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					              else {
 | 
				
			||||||
 | 
					                $("#prg").html("Update Completed, Rebooting . . .");
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					              $("#bar").css("width", Math.round(per * 100) + "%");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					          false
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					        return xhr;
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      success: function (d, s) {
 | 
				
			||||||
 | 
					        console.log("success!");
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      error: function (a, b, c) { },
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					<style>
 | 
				
			||||||
 | 
					  hr {
 | 
				
			||||||
 | 
					    display: block;
 | 
				
			||||||
 | 
					    color: #aaaaaa;
 | 
				
			||||||
 | 
					    background-color: #aaaaaa;
 | 
				
			||||||
 | 
					    margin-top: 0.5em;
 | 
				
			||||||
 | 
					    margin-bottom: 0.5em;
 | 
				
			||||||
 | 
					    margin-left: auto;
 | 
				
			||||||
 | 
					    margin-right: auto;
 | 
				
			||||||
 | 
					    border-style: inset;
 | 
				
			||||||
 | 
					    border-width: 0px;
 | 
				
			||||||
 | 
					    height: 3px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #file-input,
 | 
				
			||||||
 | 
					  input {
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    height: 44px;
 | 
				
			||||||
 | 
					    border-radius: 4px;
 | 
				
			||||||
 | 
					    margin: 10px auto;
 | 
				
			||||||
 | 
					    font-size: 15px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  input {
 | 
				
			||||||
 | 
					    background: #f1f1f1;
 | 
				
			||||||
 | 
					    border: 0;
 | 
				
			||||||
 | 
					    padding: 0 15px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  body {
 | 
				
			||||||
 | 
					    background-image: url("https://fs.siwatsystem.com/arona_bg.png");
 | 
				
			||||||
 | 
					    background-size: cover;
 | 
				
			||||||
 | 
					    font-family: sans-serif;
 | 
				
			||||||
 | 
					    font-size: 14px;
 | 
				
			||||||
 | 
					    color: #777;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #file-input {
 | 
				
			||||||
 | 
					    background-color: #CCCCCC;
 | 
				
			||||||
 | 
					    color: #5E5E5E;
 | 
				
			||||||
 | 
					    padding: 0;
 | 
				
			||||||
 | 
					    border: 1px solid #ddd;
 | 
				
			||||||
 | 
					    line-height: 44px;
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					    display: block;
 | 
				
			||||||
 | 
					    cursor: pointer;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #bar,
 | 
				
			||||||
 | 
					  #prgbar {
 | 
				
			||||||
 | 
					    background-color: #D9D9D9;
 | 
				
			||||||
 | 
					    border-radius: 10px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #bar {
 | 
				
			||||||
 | 
					    background-color: #29CD1F;
 | 
				
			||||||
 | 
					    width: 0%;
 | 
				
			||||||
 | 
					    height: 10px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  form {
 | 
				
			||||||
 | 
					    background: rgba(255, 255, 255, 0.95);
 | 
				
			||||||
 | 
					    max-width: 258px;
 | 
				
			||||||
 | 
					    margin: 75px auto;
 | 
				
			||||||
 | 
					    padding: 30px;
 | 
				
			||||||
 | 
					    border-radius: 15px;
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .btn {
 | 
				
			||||||
 | 
					    background: #CA3D3D;
 | 
				
			||||||
 | 
					    color: #fff;
 | 
				
			||||||
 | 
					    cursor: pointer;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .conf {
 | 
				
			||||||
 | 
					    background: #417df3;
 | 
				
			||||||
 | 
					    color: #fff;
 | 
				
			||||||
 | 
					    cursor: pointer;
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    height: 44px;
 | 
				
			||||||
 | 
					    border-radius: 4px;
 | 
				
			||||||
 | 
					    margin: 10px auto;
 | 
				
			||||||
 | 
					    font-size: 15px;
 | 
				
			||||||
 | 
					    border: 0;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					</style>)====="
 | 
				
			||||||
| 
						 | 
					@ -1,5 +0,0 @@
 | 
				
			||||||
R"=====(</span>
 | 
					 | 
				
			||||||
</p>
 | 
					 | 
				
			||||||
<p style="text-align: left">
 | 
					 | 
				
			||||||
  Device
 | 
					 | 
				
			||||||
  <span style="float: right">)====="
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,5 +0,0 @@
 | 
				
			||||||
R"=====(</span>
 | 
					 | 
				
			||||||
</p>
 | 
					 | 
				
			||||||
<p style="text-align: left">
 | 
					 | 
				
			||||||
  API Server
 | 
					 | 
				
			||||||
  <span style="float: right">)====="
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,5 +0,0 @@
 | 
				
			||||||
R"=====(</span>
 | 
					 | 
				
			||||||
</p>
 | 
					 | 
				
			||||||
<p style="text-align: left">
 | 
					 | 
				
			||||||
  API Endpoint
 | 
					 | 
				
			||||||
  <span style="float: right">)====="
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,5 +0,0 @@
 | 
				
			||||||
R"=====(</span>
 | 
					 | 
				
			||||||
</p>
 | 
					 | 
				
			||||||
<p style="text-align: left">
 | 
					 | 
				
			||||||
  Centrally Managed
 | 
					 | 
				
			||||||
  <span style="float: right">)====="
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,125 +0,0 @@
 | 
				
			||||||
R"=====(</span>
 | 
					 | 
				
			||||||
</p>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<input
 | 
					 | 
				
			||||||
  type="file"
 | 
					 | 
				
			||||||
  name="update"
 | 
					 | 
				
			||||||
  id="file"
 | 
					 | 
				
			||||||
  onchange="sub(this)"
 | 
					 | 
				
			||||||
  style="display: none"
 | 
					 | 
				
			||||||
/>
 | 
					 | 
				
			||||||
<label id="file-input" for="file">Choose file...</label>
 | 
					 | 
				
			||||||
<input type="submit" class="btn" value="Program" /><br /><br />
 | 
					 | 
				
			||||||
<div id="prg"></div>
 | 
					 | 
				
			||||||
<br />
 | 
					 | 
				
			||||||
<div id="prgbar">
 | 
					 | 
				
			||||||
  <div id="bar"></div>
 | 
					 | 
				
			||||||
</div>
 | 
					 | 
				
			||||||
<br />
 | 
					 | 
				
			||||||
<b>SIWAT SYSTEM 2023</b>
 | 
					 | 
				
			||||||
</form>
 | 
					 | 
				
			||||||
<script>
 | 
					 | 
				
			||||||
function sub(obj) {
 | 
					 | 
				
			||||||
  var fileName = obj.value.split("\\");
 | 
					 | 
				
			||||||
  document.getElementById("file-input").innerHTML =
 | 
					 | 
				
			||||||
    "   " + fileName[fileName.length - 1];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
$("form").submit(function (e) {
 | 
					 | 
				
			||||||
  e.preventDefault();
 | 
					 | 
				
			||||||
  var form = $("#upload_form")[0];
 | 
					 | 
				
			||||||
  var data = new FormData(form);
 | 
					 | 
				
			||||||
  $.ajax({
 | 
					 | 
				
			||||||
    url: "/update",
 | 
					 | 
				
			||||||
    type: "POST",
 | 
					 | 
				
			||||||
    data: data,
 | 
					 | 
				
			||||||
    contentType: false,
 | 
					 | 
				
			||||||
    processData: false,
 | 
					 | 
				
			||||||
    xhr: function () {
 | 
					 | 
				
			||||||
      var xhr = new window.XMLHttpRequest();
 | 
					 | 
				
			||||||
      xhr.upload.addEventListener(
 | 
					 | 
				
			||||||
        "progress",
 | 
					 | 
				
			||||||
        function (evt) {
 | 
					 | 
				
			||||||
          if (evt.lengthComputable) {
 | 
					 | 
				
			||||||
            var per = evt.loaded / evt.total;
 | 
					 | 
				
			||||||
            if(Math.round(per*100)<100) {
 | 
					 | 
				
			||||||
            $("#prg").html("Updating . . . (" + Math.round(per * 100) + "%)");
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else {
 | 
					 | 
				
			||||||
              $("#prg").html("Update Completed, Rebooting . . .");
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            $("#bar").css("width", Math.round(per * 100) + "%");
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        false
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      return xhr;
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    success: function (d, s) {
 | 
					 | 
				
			||||||
      console.log("success!");
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    error: function (a, b, c) {},
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
</script>
 | 
					 | 
				
			||||||
<style>
 | 
					 | 
				
			||||||
#file-input,
 | 
					 | 
				
			||||||
input {
 | 
					 | 
				
			||||||
  width: 100%;
 | 
					 | 
				
			||||||
  height: 44px;
 | 
					 | 
				
			||||||
  border-radius: 4px;
 | 
					 | 
				
			||||||
  margin: 10px auto;
 | 
					 | 
				
			||||||
  font-size: 15px;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
input {
 | 
					 | 
				
			||||||
  background: #f1f1f1;
 | 
					 | 
				
			||||||
  border: 0;
 | 
					 | 
				
			||||||
  padding: 0 15px;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
body {
 | 
					 | 
				
			||||||
  background-image: url("https://fs.siwatsystem.com/arona_bg.png");
 | 
					 | 
				
			||||||
  background-size: cover;
 | 
					 | 
				
			||||||
  font-family: sans-serif;
 | 
					 | 
				
			||||||
  font-size: 14px;
 | 
					 | 
				
			||||||
  color: #777;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#file-input {
 | 
					 | 
				
			||||||
  background-color: #CCCCCC;
 | 
					 | 
				
			||||||
  color: #5E5E5E;
 | 
					 | 
				
			||||||
  padding: 0;
 | 
					 | 
				
			||||||
  border: 1px solid #ddd;
 | 
					 | 
				
			||||||
  line-height: 44px;
 | 
					 | 
				
			||||||
  text-align: center;
 | 
					 | 
				
			||||||
  display: block;
 | 
					 | 
				
			||||||
  cursor: pointer;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#bar,
 | 
					 | 
				
			||||||
#prgbar {
 | 
					 | 
				
			||||||
  background-color: #D9D9D9;
 | 
					 | 
				
			||||||
  border-radius: 10px;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#bar {
 | 
					 | 
				
			||||||
  background-color: #29CD1F;
 | 
					 | 
				
			||||||
  width: 0%;
 | 
					 | 
				
			||||||
  height: 10px;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
form {
 | 
					 | 
				
			||||||
  background: rgba(255,255,255,0.95);
 | 
					 | 
				
			||||||
  max-width: 258px;
 | 
					 | 
				
			||||||
  margin: 75px auto;
 | 
					 | 
				
			||||||
  padding: 30px;
 | 
					 | 
				
			||||||
  border-radius: 15px;
 | 
					 | 
				
			||||||
  text-align: center;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.btn {
 | 
					 | 
				
			||||||
  background: #CA3D3D;
 | 
					 | 
				
			||||||
  color: #fff;
 | 
					 | 
				
			||||||
  cursor: pointer;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
</style>)====="
 | 
					 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue