start nvs editor

This commit is contained in:
Christian Herzog
2019-09-30 22:41:25 +02:00
parent b3d1a33a7a
commit f3dd6adaf3
2 changed files with 54 additions and 11 deletions

View File

@@ -492,10 +492,16 @@ function checkStatus(){
if (data["recovery"] === 1) {
recovery = true;
$("#otadiv").show();
$('a[href^="#tab-audio"]').hide();
$('a[href^="#tab-gpio"]').hide();
$('a[href^="#tab-nvs"]').show();
enableStatusTimer = true;
} else {
recovery = false;
$("#otadiv").hide();
$('a[href^="#tab-audio"]').show();
$('a[href^="#tab-gpio"]').show();
//$('a[href^="#tab-nvs"]').hide();
enableStatusTimer = false;
}
}
@@ -530,25 +536,43 @@ function checkStatus(){
function getConfig() {
$.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["autoexec"] === 1) {
console.log('turn on autoexec');
$("#autoexec-cb")[0].checked=true;
} else {
console.log('turn off autoexec');
$("#autoexec-cb")[0].checked=false;
}
}
if (data.hasOwnProperty('list')) {
data.list.forEach(function(line) {
let key = Object.keys(line)[0];
let val = Object.values(line)[0];
console.log(key, val);
if (key == 'autoexec1') {
$("#autoexec1").val(val);
}
});
if (data.hasOwnProperty('autoexec')) {
$("#autoexec1").val(data["autoexec1"]);
}
*/
})
.fail(function() {
console.log("failed to fetch config!");

View File

@@ -34,6 +34,9 @@
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#tab-gpio">GPIO</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#tab-nvs">NVS editor</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#tab-system">System</a>
</li>
@@ -254,6 +257,22 @@
</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">
<h1>Check for firmware upgrade</h1>
<div class="buttons">