mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-07 20:17:04 +03:00
start nvs editor
This commit is contained in:
@@ -492,10 +492,16 @@ function checkStatus(){
|
|||||||
if (data["recovery"] === 1) {
|
if (data["recovery"] === 1) {
|
||||||
recovery = true;
|
recovery = true;
|
||||||
$("#otadiv").show();
|
$("#otadiv").show();
|
||||||
|
$('a[href^="#tab-audio"]').hide();
|
||||||
|
$('a[href^="#tab-gpio"]').hide();
|
||||||
|
$('a[href^="#tab-nvs"]').show();
|
||||||
enableStatusTimer = true;
|
enableStatusTimer = true;
|
||||||
} else {
|
} else {
|
||||||
recovery = false;
|
recovery = false;
|
||||||
$("#otadiv").hide();
|
$("#otadiv").hide();
|
||||||
|
$('a[href^="#tab-audio"]').show();
|
||||||
|
$('a[href^="#tab-gpio"]').show();
|
||||||
|
//$('a[href^="#tab-nvs"]').hide();
|
||||||
enableStatusTimer = false;
|
enableStatusTimer = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -530,25 +536,43 @@ function checkStatus(){
|
|||||||
|
|
||||||
function getConfig() {
|
function getConfig() {
|
||||||
$.getJSON("/config.json", function(data) {
|
$.getJSON("/config.json", function(data) {
|
||||||
|
for (var key in data) {
|
||||||
|
if (data.hasOwnProperty(key)) {
|
||||||
|
if (key == 'autoexec') {
|
||||||
|
if (data["autoexec"] === "1") {
|
||||||
|
$("#autoexec-cb")[0].checked=true;
|
||||||
|
} else {
|
||||||
|
$("#autoexec-cb")[0].checked=false;
|
||||||
|
}
|
||||||
|
} else if (key == 'autoexec1') {
|
||||||
|
$("#autoexec1").val(data["autoexec1"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (recovery) {
|
||||||
|
$("tbody#nvsTable").append(
|
||||||
|
"<tr>"+
|
||||||
|
"<td>"+key+"</td>"+
|
||||||
|
"<td>"+
|
||||||
|
"<input type='text' class='form-control' id='nvs'+key value='"+data[key]+"'>"+
|
||||||
|
"</td>"+
|
||||||
|
"</tr>"
|
||||||
|
);
|
||||||
|
//TODO append empty line
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
if (data.hasOwnProperty('autoexec')) {
|
if (data.hasOwnProperty('autoexec')) {
|
||||||
if (data["autoexec"] === 1) {
|
if (data["autoexec"] === 1) {
|
||||||
console.log('turn on autoexec');
|
|
||||||
$("#autoexec-cb")[0].checked=true;
|
$("#autoexec-cb")[0].checked=true;
|
||||||
} else {
|
} else {
|
||||||
console.log('turn off autoexec');
|
|
||||||
$("#autoexec-cb")[0].checked=false;
|
$("#autoexec-cb")[0].checked=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data.hasOwnProperty('list')) {
|
if (data.hasOwnProperty('autoexec')) {
|
||||||
data.list.forEach(function(line) {
|
$("#autoexec1").val(data["autoexec1"]);
|
||||||
let key = Object.keys(line)[0];
|
|
||||||
let val = Object.values(line)[0];
|
|
||||||
console.log(key, val);
|
|
||||||
if (key == 'autoexec1') {
|
|
||||||
$("#autoexec1").val(val);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
})
|
})
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
console.log("failed to fetch config!");
|
console.log("failed to fetch config!");
|
||||||
|
|||||||
@@ -34,6 +34,9 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#tab-gpio">GPIO</a>
|
<a class="nav-link" data-toggle="tab" href="#tab-gpio">GPIO</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="tab" href="#tab-nvs">NVS editor</a>
|
||||||
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#tab-system">System</a>
|
<a class="nav-link" data-toggle="tab" href="#tab-system">System</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -254,6 +257,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="tab-nvs">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Key</th>
|
||||||
|
<th scope="col">Value</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="nvsTable">
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="buttons">
|
||||||
|
<input id="save-nvs" type="button" class="btn btn-success" value="Save" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="tab-system">
|
<div class="tab-pane fade" id="tab-system">
|
||||||
<h1>Check for firmware upgrade</h1>
|
<h1>Check for firmware upgrade</h1>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
|
|||||||
Reference in New Issue
Block a user