* added active power control in `W` to live view #201, #673
* updated docu, active power control related #706
* added current AC-Power to `index` page and removed version #763
* improved statistic data, moved to entire struct
* removed `/api/statistics` endpoint from REST-API
This commit is contained in:
lumapu 2023-09-17 01:55:45 +02:00
parent 181cc6fc24
commit 9a09b5f4f8
13 changed files with 109 additions and 105 deletions

View file

@ -57,45 +57,52 @@
]);
}
function parseStat(stat) {
return [
tr("TX count", stat.tx_cnt),
tr("RX success", stat.rx_success),
tr("RX fail", stat.rx_fail),
tr("RX no answer", stat.rx_fail_answer),
tr("RX fragments", stat.frame_cnt),
tr("TX retransmits", stat.retransmits)
];
}
function parseRadio(obj) {
const pa = ["MIN (recommended)", "LOW", "HIGH", "MAX"];
const dr = ["1 M", "2 M", "250 k"]
if(obj.radioNrf.en)
if(obj.radioNrf.en) {
lines = [
tr("NRF24L01", badge(obj.radioNrf.isconnected, ((obj.radioNrf.isconnected) ? "" : "not ") + "connected")),
tr("NRF24 Power Level", pa[obj.radioNrf.power_level]),
tr("NRF24 Data Rate", dr[obj.radioNrf.dataRate] + "bps")
];
else
Array.prototype.push.apply(lines, parseStat(obj.statistics[0]));
} else
lines = [tr("NRF24L01", badge(false, "not enabled"))];
/*IF_ESP32*/
if(obj.radioCmt.en)
lines.push(tr("CMT2300A", badge(obj.radioCmt.isconnected, ((obj.radioCmt.isconnected) ? "" : "not ") + "connected")));
else
lines.push(tr("CMT2300A", badge(false, "not enabled")));
/*ENDIF_ESP32*/
var stat = obj.statistics;
document.getElementById("info").append(
headline("Radio"),
headline("Radio NRF"),
ml("table", {class: "table"},
ml("tbody", {}, lines)
),
headline("Statistics"),
ml("table", {class: "table"},
ml("tbody", {}, [
tr("TX count", stat.tx_cnt),
tr("RX success", stat.rx_success),
tr("RX fail", stat.rx_fail),
tr("RX no answer", stat.rx_fail_answer),
tr("RX fragments", stat.frame_cnt),
tr("TX retransmits", stat.retransmits)
])
)
);
/*IF_ESP32*/
if(obj.radioCmt.en) {
cmt = [tr("CMT2300A", badge(obj.radioCmt.isconnected, ((obj.radioCmt.isconnected) ? "" : "not ") + "connected"))];
Array.prototype.push.apply(cmt, parseStat(obj.statistics[1]));
} else
cmt = [tr("CMT2300A", badge(false, "not enabled"))];
document.getElementById("info").append(
headline("Radio CMT"),
ml("table", {class: "table"},
ml("tbody", {}, cmt)
)
);
/*ENDIF_ESP32*/
}
function parseMqtt(obj) {