streamline flash logic

This commit is contained in:
Christian Herzog
2019-09-26 20:08:22 +02:00
parent 7bfc46af0f
commit 6888b53c6c
3 changed files with 27 additions and 52 deletions

View File

@@ -212,7 +212,7 @@ $(document).ready(function(){
console.log('sent config JSON with headers:', autoexec1); console.log('sent config JSON with headers:', autoexec1);
}); });
$("#recovery").on("click", function() { $("#flash").on("click", function() {
var url = $("#fwurl").val(); var url = $("#fwurl").val();
$.ajax({ $.ajax({
url: '/config.json', url: '/config.json',
@@ -222,23 +222,6 @@ $(document).ready(function(){
headers: { "X-Custom-fwurl": url }, headers: { "X-Custom-fwurl": url },
data: { 'timestamp': Date.now() } data: { 'timestamp': Date.now() }
}); });
$.ajax({
url: '/recovery.json',
dataType: 'json',
method: 'POST',
cache: false,
data: { 'timestamp': Date.now()}
});
});
$("#reboot").on("click", function() {
$.ajax({
url: '/reboot.json',
dataType: 'json',
method: 'POST',
cache: false,
data: { 'timestamp': Date.now()}
});
}); });
$("#generate-command").on("click", function() { $("#generate-command").on("click", function() {
@@ -494,11 +477,9 @@ function getConfig() {
if (data.hasOwnProperty('recovery')) { if (data.hasOwnProperty('recovery')) {
if (data["recovery"] === 1) { if (data["recovery"] === 1) {
recovery = true; recovery = true;
//$("#recoverydiv").hide();
$("#otadiv").show(); $("#otadiv").show();
} else { } else {
recovery = false; recovery = false;
$("#recoverydiv").show();
$("#otadiv").hide(); $("#otadiv").hide();
} }
} }

View File

@@ -199,40 +199,30 @@
</div> </div>
<div class="tab-pane fade" id="tab-system"> <div class="tab-pane fade" id="tab-system">
<div id="recoverydiv"> <h1>Check for firmware upgrade</h1>
<h1>Check for firmware upgrade</h1> <div class="buttons">
<div class="buttons"> <input type="button" id="fwcheck" class="btn btn-info" value="Check for updates" />
<input type="button" id="fwcheck" class="btn btn-info" value="Check for updates" /> </div>
</div> <table class="table table-hover">
<table class="table table-hover"> <thead>
<thead> <tr>
<tr> <th scope="col">Firmware version</th>
<th scope="col">Firmware version</th> <th scope="col">IDF version</th>
<th scope="col">IDF version</th> <th scope="col">HW platform</th>
<th scope="col">HW platform</th> <th scope="col">Branch</th>
<th scope="col">Branch</th> <th scope="col">Flash this FW</th>
<th scope="col">Flash this FW</th> </tr>
</tr> </thead>
</thead> <tbody id="releaseTable">
<tbody id="releaseTable"> </tbody>
</tbody> </table>
</table> <h2>Firmware URL:</h2>
<h2>Firmware URL:</h2> <textarea id="fwurl" maxlength="120"></textarea>
<textarea id="fwurl" maxlength="120"></textarea> <div class="buttons">
<h1>Reboot to recovery system to perform firmware upgrade</h1> <input type="button" id="flash" class="btn btn-danger" value="Flash!" />
<div class="buttons">
<input type="button" id="recovery" class="btn btn-warning" value="Recovery" />
</div>
</div> </div>
<div id="otadiv"> <div id="otadiv">
<header><h1>Firmware upgrade</h1></header> <div id="progress">Progress: <progress id="progr" value="0" max="100" ></progress></div>
<form name="multipart" action="otaform" method="post" enctype="multipart/form-data" onsubmit="do_upload(this); return false;">
<progress id="progr" value="0" max="100" >Upload Progress</progress>
</form>
<h1>Reboot system with new firmware</h1>
<div class="buttons">
<input type="button" id="reboot" class="btn btn-warning" value="Reboot" />
</div>
</div> </div>
</div> </div>

View File

@@ -290,3 +290,7 @@ input, textarea {
font-family: monospace, monospace; font-family: monospace, monospace;
font-size: 70%; font-size: 70%;
} }
#progress {
margin-left: 13px;
}