diff --git a/firmware/data/bottom.js b/firmware/data/bottom.js index 976c0d9..4307630 100644 --- a/firmware/data/bottom.js +++ b/firmware/data/bottom.js @@ -13,6 +13,7 @@ tabTDE.classList.remove("visible"); amain.classList.add("pure-button-primary"); acfg.classList.remove("pure-button-primary"); atde.classList.remove("pure-button-primary"); +loadGraphData(); }); acfg.addEventListener("click", function() { tabMain.classList.remove("visible"); @@ -50,10 +51,10 @@ var channel3 = []; var channel4 = []; for (var i = 0; i < data['tcdata'].length; i++) { time.push(data['tcdata'][i]['hour'] + ':' + (data['tcdata'][i]['min'] < 10 ? '0' : '') + data['tcdata'][i]['min']); -channel1.push(data['tcdata'][i]['ch1']); -channel2.push(data['tcdata'][i]['ch2']); -channel3.push(data['tcdata'][i]['ch3']); -channel4.push(data['tcdata'][i]['ch4']); +channel1.push(data['tcdata'][i]['ch1'] * 100 / 255); +channel2.push(data['tcdata'][i]['ch2'] * 100 / 255); +channel3.push(data['tcdata'][i]['ch3'] * 100 / 255); +channel4.push(data['tcdata'][i]['ch4'] * 100 / 255); } currenttime.push(data['currenttime']['hour']); currenttime.push(data['currenttime']['min']); @@ -130,7 +131,7 @@ tickangle: -45, }, yaxis: { title: 'Brightness', -range: [0, 255], +range: [0, 100], }, shapes: [{ type: 'line', diff --git a/firmware/html/bottom.js b/firmware/html/bottom.js index c19e1bd..f26968d 100644 --- a/firmware/html/bottom.js +++ b/firmware/html/bottom.js @@ -19,6 +19,8 @@ function addTabListener() { amain.classList.add("pure-button-primary"); acfg.classList.remove("pure-button-primary"); atde.classList.remove("pure-button-primary"); + + loadGraphData(); // reload the graph }); acfg.addEventListener("click", function() { @@ -64,10 +66,10 @@ function loadGraphData() { var channel4 = []; for (var i = 0; i < data['tcdata'].length; i++) { time.push(data['tcdata'][i]['hour'] + ':' + (data['tcdata'][i]['min'] < 10 ? '0' : '') + data['tcdata'][i]['min']); - channel1.push(data['tcdata'][i]['ch1']); - channel2.push(data['tcdata'][i]['ch2']); - channel3.push(data['tcdata'][i]['ch3']); - channel4.push(data['tcdata'][i]['ch4']); + channel1.push(data['tcdata'][i]['ch1'] * 100 / 255); + channel2.push(data['tcdata'][i]['ch2'] * 100 / 255); + channel3.push(data['tcdata'][i]['ch3'] * 100 / 255); + channel4.push(data['tcdata'][i]['ch4'] * 100 / 255); } currenttime.push(data['currenttime']['hour']); currenttime.push(data['currenttime']['min']); @@ -155,7 +157,7 @@ function loadGraphData() { }, yaxis: { title: 'Brightness', - range: [0, 255], + range: [0, 100], }, shapes: [{ type: 'line',