mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 20:47:08 +03:00
show ota_dsc and block flash button while OTA is running
This commit is contained in:
@@ -16,8 +16,9 @@ var recovery = false;
|
|||||||
var enableAPTimer = true;
|
var enableAPTimer = true;
|
||||||
var enableStatusTimer = true;
|
var enableStatusTimer = true;
|
||||||
var commandHeader = 'squeezelite -b 500:2000 -d all=info ';
|
var commandHeader = 'squeezelite -b 500:2000 -d all=info ';
|
||||||
var pname, ver, otapct;
|
var pname, ver, otapct, otadsc;
|
||||||
var blockAjax = false;
|
var blockAjax = false;
|
||||||
|
var blockFlashButton = false;
|
||||||
|
|
||||||
var apList = null;
|
var apList = null;
|
||||||
var selectedSSID = "";
|
var selectedSSID = "";
|
||||||
@@ -228,6 +229,8 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("#flash").on("click", function() {
|
$("#flash").on("click", function() {
|
||||||
|
if (blockFlashButton) return;
|
||||||
|
blockFlashButton = true;
|
||||||
var url = $("#fwurl").val();
|
var url = $("#fwurl").val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/config.json',
|
url: '/config.json',
|
||||||
@@ -508,6 +511,16 @@ function checkStatus(){
|
|||||||
$('.progress-bar').css('width', otapct+'%').attr('aria-valuenow', otapct);
|
$('.progress-bar').css('width', otapct+'%').attr('aria-valuenow', otapct);
|
||||||
$('.progress-bar').html(otapct+'%');
|
$('.progress-bar').html(otapct+'%');
|
||||||
}
|
}
|
||||||
|
if(data.hasOwnProperty('ota_dsc') && data['ota_dsc'] != ''){
|
||||||
|
otadsc = data['ota_dsc'];
|
||||||
|
$("span#flash-status").html(otadsc);
|
||||||
|
if (otadsc.match(/Error:/) || otapct > 95) {
|
||||||
|
blockFlashButton = false;
|
||||||
|
enableStatusTimer = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$("span#flash-status").html('');
|
||||||
|
}
|
||||||
blockAjax = false;
|
blockAjax = false;
|
||||||
})
|
})
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
|
|||||||
@@ -276,7 +276,7 @@
|
|||||||
<h2>Firmware URL:</h2>
|
<h2>Firmware URL:</h2>
|
||||||
<textarea id="fwurl" maxlength="120"></textarea>
|
<textarea id="fwurl" maxlength="120"></textarea>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<input type="button" id="flash" class="btn btn-danger" value="Flash!" />
|
<input type="button" id="flash" class="btn btn-danger" value="Flash!" /><span id="flash-status"></span>
|
||||||
</div>
|
</div>
|
||||||
<div id="otadiv">
|
<div id="otadiv">
|
||||||
<div class="progress" id="progress">
|
<div class="progress" id="progress">
|
||||||
|
|||||||
@@ -302,6 +302,11 @@ input, textarea {
|
|||||||
background-color: #037AF0;
|
background-color: #037AF0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span#flash-status {
|
||||||
|
padding-left: 15px;
|
||||||
|
font-size: 120%;
|
||||||
|
}
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user