diff --git a/components/wifi-manager/code.js b/components/wifi-manager/code.js index 7921c0c8..af0f94f9 100644 --- a/components/wifi-manager/code.js +++ b/components/wifi-manager/code.js @@ -214,7 +214,7 @@ $(document).ready(function(){ var id = $(this)[0].id; var pin = $(this).val(); if (pin != '') { - headers[id] = pin; + headers["X-Custom-"+id] = pin; } }); $.ajax({ @@ -222,8 +222,41 @@ $(document).ready(function(){ dataType: 'json', method: 'POST', cache: false, - headers: JSON.stringify(headers), - data: { 'timestamp': Date.now() } + headers: headers, + data: { 'timestamp': Date.now() }, + error: function (xhr, ajaxOptions, thrownError) { + console.log(xhr.status); + console.log(thrownError); + } + }); + console.log('sent config JSON with headers:', JSON.stringify(headers)); + }); + + $("#save-nvs").on("click", function() { + var headers = {}; + $("input.nvs").each(function() { + var key = $(this)[0].id; + var val = $(this).val(); + if (key != '') { + headers["X-Custom-"+key] = val; + } + }); + var key = $("#nvs-new-key").val(); + var val = $("#nvs-new-value").val(); + if (key != '') { + headers["X-Custom-"+key] = val; + } + $.ajax({ + url: '/config.json', + dataType: 'json', + method: 'POST', + cache: false, + headers: headers, + data: { 'timestamp': Date.now() }, + error: function (xhr, ajaxOptions, thrownError) { + console.log(xhr.status); + console.log(thrownError); + } }); console.log('sent config JSON with headers:', JSON.stringify(headers)); }); @@ -503,7 +536,7 @@ function checkStatus(){ $("#otadiv").hide(); $('a[href^="#tab-audio"]').show(); $('a[href^="#tab-gpio"]').show(); - //$('a[href^="#tab-nvs"]').hide(); //TODO + $('a[href^="#tab-nvs"]').hide(); $( "footer.footer" ).removeClass('recovery'); $( "footer.footer" ).addClass('sl'); enableStatusTimer = false; @@ -549,34 +582,35 @@ function getConfig() { $("#autoexec-cb")[0].checked=false; } } else if (key == 'autoexec1') { - $("#autoexec1").val(data["autoexec1"]); + $("input#autoexec1").val(data["autoexec1"]); } if (recovery) { $("tbody#nvsTable").append( ""+ ""+key+""+ - ""+ - ""+ + ""+ + ""+ ""+ "" ); - //TODO append empty line + $("input#"+key).val(data[key]); + console.log("#"+key, data[key]); } } } -/* - if (data.hasOwnProperty('autoexec')) { - if (data["autoexec"] === 1) { - $("#autoexec-cb")[0].checked=true; - } else { - $("#autoexec-cb")[0].checked=false; - } + if (recovery) { + $("tbody#nvsTable").append( + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + "" + ); } - if (data.hasOwnProperty('autoexec')) { - $("#autoexec1").val(data["autoexec1"]); - } - */ }) .fail(function() { console.log("failed to fetch config!"); diff --git a/components/wifi-manager/index.html b/components/wifi-manager/index.html index 163b89ef..9673f83f 100644 --- a/components/wifi-manager/index.html +++ b/components/wifi-manager/index.html @@ -204,50 +204,36 @@ Signal - GPIO pin + I2S pin + SPDIF pin - I2S - - - I2S Bit clock + Bit clock + + + - I2S Word select + Word select + + + - I2S Data + Data - - - SPDIF - - - SPDIF Bit clock - - - - - SPDIF Word select - - - - - - SPDIF Data - - + diff --git a/components/wifi-manager/style.css b/components/wifi-manager/style.css index 6a530f16..9dd9eb38 100644 --- a/components/wifi-manager/style.css +++ b/components/wifi-manager/style.css @@ -323,3 +323,7 @@ span#flash-status { .recovery { background-color: #3c0505; } + +td.value { + width: 80%; +}