mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-01 10:11:37 +02:00
0.7.49
* add option to strip webUI for ESP8266 (reduce code size, add ESP32 special features; `IF_ESP32` directives) * started to get CMT info into `system` - not finished
This commit is contained in:
parent
b9c5a54510
commit
9dd689b395
8 changed files with 134 additions and 48 deletions
|
@ -4,6 +4,8 @@
|
||||||
* merge PR: symbolic icons for mono displays, PR #1136
|
* merge PR: symbolic icons for mono displays, PR #1136
|
||||||
* merge MI code restructuring PR #1145
|
* merge MI code restructuring PR #1145
|
||||||
* merge Prometheus PR #1148
|
* merge Prometheus PR #1148
|
||||||
|
* add option to strip webUI for ESP8266 (reduce code size, add ESP32 special features; `IF_ESP32` directives)
|
||||||
|
* started to get CMT info into `system` - not finished
|
||||||
|
|
||||||
## 0.7.48 - 2023-09-10
|
## 0.7.48 - 2023-09-10
|
||||||
* fix SSD1309 2.42" display pinout
|
* fix SSD1309 2.42" display pinout
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
|
|
||||||
#include "appInterface.h"
|
|
||||||
#include "config/settings.h"
|
#include "config/settings.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "appInterface.h"
|
||||||
#include "hm/hmPayload.h"
|
#include "hm/hmPayload.h"
|
||||||
#include "hm/hmSystem.h"
|
#include "hm/hmSystem.h"
|
||||||
#include "hm/hmRadio.h"
|
#include "hm/hmRadio.h"
|
||||||
|
@ -75,11 +75,17 @@ class app : public IApp, public ah::Scheduler {
|
||||||
void handleIntr(void) {
|
void handleIntr(void) {
|
||||||
mNrfRadio.handleIntr();
|
mNrfRadio.handleIntr();
|
||||||
}
|
}
|
||||||
|
const HmRadio<>& getNrfRadioObj(void) const {
|
||||||
|
return mNrfRadio;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
void handleHmsIntr(void) {
|
void handleHmsIntr(void) {
|
||||||
mCmtRadio.handleIntr();
|
mCmtRadio.handleIntr();
|
||||||
}
|
}
|
||||||
|
const CmtRadioType& getCmtRadioObj(void) const {
|
||||||
|
return mCmtRadio;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t getUptime() {
|
uint32_t getUptime() {
|
||||||
|
|
|
@ -14,6 +14,11 @@
|
||||||
#include "ESPAsyncWebServer.h"
|
#include "ESPAsyncWebServer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//#include "hms/hmsRadio.h"
|
||||||
|
#if defined(ESP32)
|
||||||
|
//typedef CmtRadio<esp32_3wSpi<>> CmtRadioType;
|
||||||
|
#endif
|
||||||
|
|
||||||
// abstract interface to App. Make members of App accessible from child class
|
// abstract interface to App. Make members of App accessible from child class
|
||||||
// like web or API without forward declaration
|
// like web or API without forward declaration
|
||||||
class IApp {
|
class IApp {
|
||||||
|
@ -62,6 +67,10 @@ class IApp {
|
||||||
|
|
||||||
virtual void getNrfRadioCounters(uint32_t *sendCnt, uint32_t *retransmits) = 0;
|
virtual void getNrfRadioCounters(uint32_t *sendCnt, uint32_t *retransmits) = 0;
|
||||||
//virtual void getCmtRadioCounters(uint32_t *sendCnt, uint32_t *retransmits) = 0;
|
//virtual void getCmtRadioCounters(uint32_t *sendCnt, uint32_t *retransmits) = 0;
|
||||||
|
|
||||||
|
#if defined(ESP32)
|
||||||
|
//virtual const CmtRadioType& getCmtRadioObj(void) const = 0;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*__IAPP_H__*/
|
#endif /*__IAPP_H__*/
|
||||||
|
|
|
@ -239,6 +239,9 @@ class RestApi {
|
||||||
getGeneric(request, obj);
|
getGeneric(request, obj);
|
||||||
|
|
||||||
getRadioNrf(obj.createNestedObject(F("radio")));
|
getRadioNrf(obj.createNestedObject(F("radio")));
|
||||||
|
#if defined(ESP32)
|
||||||
|
getRadioCmtInfo(obj.createNestedObject(F("radioCmt")));
|
||||||
|
#endif
|
||||||
getStatistics(obj.createNestedObject(F("statistics")));
|
getStatistics(obj.createNestedObject(F("statistics")));
|
||||||
|
|
||||||
#if defined(ESP32)
|
#if defined(ESP32)
|
||||||
|
@ -490,19 +493,25 @@ class RestApi {
|
||||||
obj[F("led_high_active")] = mConfig->led.led_high_active;
|
obj[F("led_high_active")] = mConfig->led.led_high_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(ESP32)
|
||||||
void getRadioCmt(JsonObject obj) {
|
void getRadioCmt(JsonObject obj) {
|
||||||
obj[F("csb")] = mConfig->cmt.pinCsb;
|
obj[F("csb")] = mConfig->cmt.pinCsb;
|
||||||
obj[F("fcsb")] = mConfig->cmt.pinFcsb;
|
obj[F("fcsb")] = mConfig->cmt.pinFcsb;
|
||||||
obj[F("gpio3")] = mConfig->cmt.pinIrq;
|
obj[F("gpio3")] = mConfig->cmt.pinIrq;
|
||||||
obj[F("en")] = (bool) mConfig->cmt.enabled;
|
obj[F("en")] = (bool) mConfig->cmt.enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getRadioCmtInfo(JsonObject obj) {
|
||||||
|
obj[F("en")] = (bool) mConfig->cmt.enabled;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void getRadioNrf(JsonObject obj) {
|
void getRadioNrf(JsonObject obj) {
|
||||||
obj[F("power_level")] = mConfig->nrf.amplifierPower;
|
obj[F("power_level")] = mConfig->nrf.amplifierPower;
|
||||||
obj[F("isconnected")] = mRadio->isChipConnected();
|
obj[F("isconnected")] = mRadio->isChipConnected();
|
||||||
obj[F("DataRate")] = mRadio->getDataRate();
|
//obj[F("DataRate")] = mRadio->getDataRate();
|
||||||
obj[F("isPVariant")] = mRadio->isPVariant();
|
//obj[F("isPVariant")] = mRadio->isPVariant();
|
||||||
obj[F("en")] = (bool) mConfig->nrf.enabled;
|
obj[F("en")] = (bool) mConfig->nrf.enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getSerial(JsonObject obj) {
|
void getSerial(JsonObject obj) {
|
||||||
|
@ -593,7 +602,9 @@ class RestApi {
|
||||||
getNtp(obj.createNestedObject(F("ntp")));
|
getNtp(obj.createNestedObject(F("ntp")));
|
||||||
getSun(obj.createNestedObject(F("sun")));
|
getSun(obj.createNestedObject(F("sun")));
|
||||||
getPinout(obj.createNestedObject(F("pinout")));
|
getPinout(obj.createNestedObject(F("pinout")));
|
||||||
|
#if defined(ESP32)
|
||||||
getRadioCmt(obj.createNestedObject(F("radioCmt")));
|
getRadioCmt(obj.createNestedObject(F("radioCmt")));
|
||||||
|
#endif
|
||||||
getRadioNrf(obj.createNestedObject(F("radioNrf")));
|
getRadioNrf(obj.createNestedObject(F("radioNrf")));
|
||||||
getSerial(obj.createNestedObject(F("serial")));
|
getSerial(obj.createNestedObject(F("serial")));
|
||||||
getStaticIp(obj.createNestedObject(F("static_ip")));
|
getStaticIp(obj.createNestedObject(F("static_ip")));
|
||||||
|
|
|
@ -6,6 +6,7 @@ import shutil
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import subprocess
|
import subprocess
|
||||||
|
Import("env")
|
||||||
|
|
||||||
|
|
||||||
def get_git_sha():
|
def get_git_sha():
|
||||||
|
@ -60,13 +61,41 @@ def htmlParts(file, header, nav, footer, version):
|
||||||
link = '<a target="_blank" href="https://github.com/lumapu/ahoy/commits/' + get_git_sha() + '">GIT SHA: ' + get_git_sha() + ' :: ' + version + '</a>'
|
link = '<a target="_blank" href="https://github.com/lumapu/ahoy/commits/' + get_git_sha() + '">GIT SHA: ' + get_git_sha() + ' :: ' + version + '</a>'
|
||||||
p = p.replace("{#VERSION}", version)
|
p = p.replace("{#VERSION}", version)
|
||||||
p = p.replace("{#VERSION_GIT}", link)
|
p = p.replace("{#VERSION_GIT}", link)
|
||||||
|
|
||||||
|
# remove if - endif ESP32
|
||||||
|
p = checkIf(p)
|
||||||
|
|
||||||
f = open("tmp/" + file, "w")
|
f = open("tmp/" + file, "w")
|
||||||
f.write(p);
|
f.write(p);
|
||||||
f.close();
|
f.close();
|
||||||
return p
|
return p
|
||||||
|
|
||||||
|
def checkIf(data):
|
||||||
|
if (env['PIOENV'][0:5] == "esp32") or env['PIOENV'][0:4] == "open":
|
||||||
|
data = data.replace("<!--IF_ESP32-->", "")
|
||||||
|
data = data.replace("<!--ENDIF_ESP32-->", "")
|
||||||
|
data = data.replace("/*IF_ESP32*/", "")
|
||||||
|
data = data.replace("/*ENDIF_ESP32*/", "")
|
||||||
|
else:
|
||||||
|
while 1:
|
||||||
|
start = data.find("<!--IF_ESP32-->")
|
||||||
|
end = data.find("<!--ENDIF_ESP32-->")+18
|
||||||
|
if -1 == start:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
data = data[0:start] + data[end:]
|
||||||
|
while 1:
|
||||||
|
start = data.find("/*IF_ESP32*/")
|
||||||
|
end = data.find("/*ENDIF_ESP32*/")+15
|
||||||
|
if -1 == start:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
data = data[0:start] + data[end:]
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
def convert2Header(inFile, version):
|
def convert2Header(inFile, version):
|
||||||
fileType = inFile.split(".")[1]
|
fileType = inFile.split(".")[1]
|
||||||
define = inFile.split(".")[0].upper()
|
define = inFile.split(".")[0].upper()
|
||||||
define2 = inFile.split(".")[1].upper()
|
define2 = inFile.split(".")[1].upper()
|
||||||
inFileVarName = inFile.replace(".", "_")
|
inFileVarName = inFile.replace(".", "_")
|
||||||
|
|
|
@ -35,10 +35,10 @@
|
||||||
|
|
||||||
<p class="des">Radio (NRF24L01+)</p>
|
<p class="des">Radio (NRF24L01+)</p>
|
||||||
<div id="rf24"></div>
|
<div id="rf24"></div>
|
||||||
|
<!--IF_ESP32-->
|
||||||
<p class="des">Radio (CMT2300A)</p>
|
<p class="des">Radio (CMT2300A)</p>
|
||||||
<div id="cmt"><div class="col-12">(ESP32 only)</div></div>
|
<div id="cmt"><div class="col-12">(ESP32 only)</div></div>
|
||||||
|
<!--ENDIF_ESP32-->
|
||||||
<p class="des">Serial Console</p>
|
<p class="des">Serial Console</p>
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-8 col-sm-3">print inverter data</div>
|
<div class="col-8 col-sm-3">print inverter data</div>
|
||||||
|
@ -366,6 +366,8 @@
|
||||||
[15, "D8 (GPIO15)"],
|
[15, "D8 (GPIO15)"],
|
||||||
[16, "D0 (GPIO16 - no IRQ!)"]
|
[16, "D0 (GPIO16 - no IRQ!)"]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/*IF_ESP32*/
|
||||||
var esp32pins = [
|
var esp32pins = [
|
||||||
[255, "off / default"],
|
[255, "off / default"],
|
||||||
[0, "GPIO0"],
|
[0, "GPIO0"],
|
||||||
|
@ -443,6 +445,7 @@
|
||||||
[47, "GPIO47"],
|
[47, "GPIO47"],
|
||||||
[48, "GPIO48"],
|
[48, "GPIO48"],
|
||||||
];
|
];
|
||||||
|
/*ENDIF_ESP32*/
|
||||||
var led_high_active = [
|
var led_high_active = [
|
||||||
[0, "low active"],
|
[0, "low active"],
|
||||||
[1, "high active"],
|
[1, "high active"],
|
||||||
|
@ -796,6 +799,7 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*IF_ESP32*/
|
||||||
function parseCmtRadio(obj, type, system) {
|
function parseCmtRadio(obj, type, system) {
|
||||||
var e = document.getElementById("cmt");
|
var e = document.getElementById("cmt");
|
||||||
var en = inp("cmtEnable", null, null, ["cb"], "cmtEnable", "checkbox");
|
var en = inp("cmtEnable", null, null, ["cb"], "cmtEnable", "checkbox");
|
||||||
|
@ -819,6 +823,7 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*ENDIF_ESP32*/
|
||||||
|
|
||||||
function parseSerial(obj) {
|
function parseSerial(obj) {
|
||||||
for(var i of [["serEn", "show_live_data"], ["serDbg", "debug"]])
|
for(var i of [["serEn", "show_live_data"], ["serDbg", "debug"]])
|
||||||
|
@ -833,8 +838,9 @@
|
||||||
var e = document.getElementById("dispPins");
|
var e = document.getElementById("dispPins");
|
||||||
//KEEP this order !!!
|
//KEEP this order !!!
|
||||||
var pins = [['clock', 'disp_clk'], ['data', 'disp_data'], ['cs', 'disp_cs'], ['dc', 'disp_dc'], ['reset', 'disp_rst']];
|
var pins = [['clock', 'disp_clk'], ['data', 'disp_data'], ['cs', 'disp_cs'], ['dc', 'disp_dc'], ['reset', 'disp_rst']];
|
||||||
if("ESP32" == type)
|
/*IF_ESP32*/
|
||||||
pins.push(['busy', 'disp_bsy']);
|
pins.push(['busy', 'disp_bsy']);
|
||||||
|
/*ENDIF_ESP32*/
|
||||||
for(p of pins) {
|
for(p of pins) {
|
||||||
e.append(
|
e.append(
|
||||||
ml("div", {class: "row mb-3", id: "row_" + p[1]}, [
|
ml("div", {class: "row mb-3", id: "row_" + p[1]}, [
|
||||||
|
@ -848,8 +854,9 @@
|
||||||
|
|
||||||
// keep display types grouped
|
// keep display types grouped
|
||||||
var opts = [[0, "None"], [2, "SH1106 1.3\" 128X64"], [5, "SSD1306 0.66\" 64X48 (Wemos OLED Shield)"], [4, "SSD1306 0.91\" 128X32"], [1, "SSD1306 0.96\" 128X64"], [6, "SSD1309 2.42\" 128X64"], [3, "Nokia5110"]];
|
var opts = [[0, "None"], [2, "SH1106 1.3\" 128X64"], [5, "SSD1306 0.66\" 64X48 (Wemos OLED Shield)"], [4, "SSD1306 0.91\" 128X32"], [1, "SSD1306 0.96\" 128X64"], [6, "SSD1309 2.42\" 128X64"], [3, "Nokia5110"]];
|
||||||
if("ESP32" == type)
|
/*IF_ESP32*/
|
||||||
opts.push([10, "ePaper"]);
|
opts.push([10, "ePaper"]);
|
||||||
|
/*ENDIF_ESP32*/
|
||||||
var dispType = sel("disp_typ", opts, obj["disp_typ"]);
|
var dispType = sel("disp_typ", opts, obj["disp_typ"]);
|
||||||
document.getElementById("dispType").append(
|
document.getElementById("dispType").append(
|
||||||
ml("div", {class: "row mb-3"}, [
|
ml("div", {class: "row mb-3"}, [
|
||||||
|
@ -862,10 +869,10 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
opts = [[0, "0°"], [2, "180°"]];
|
opts = [[0, "0°"], [2, "180°"]];
|
||||||
if("ESP32" == type) {
|
/*IF_ESP32*/
|
||||||
opts.push([1, "90°"]);
|
opts.push([1, "90°"]);
|
||||||
opts.push([3, "270°"]);
|
opts.push([3, "270°"]);
|
||||||
}
|
/*ENDIF_ESP32*/
|
||||||
document.getElementById("dispRot").append(
|
document.getElementById("dispRot").append(
|
||||||
ml("div", {class: "row mb-3"}, [
|
ml("div", {class: "row mb-3"}, [
|
||||||
ml("div", {class: "col-12 col-sm-3 my-2"}, "Rotation"),
|
ml("div", {class: "col-12 col-sm-3 my-2"}, "Rotation"),
|
||||||
|
@ -916,8 +923,9 @@
|
||||||
parseSun(root["sun"]);
|
parseSun(root["sun"]);
|
||||||
parsePinout(root["pinout"], root["system"]["esp_type"], root["system"]);
|
parsePinout(root["pinout"], root["system"]["esp_type"], root["system"]);
|
||||||
parseNrfRadio(root["radioNrf"], root["pinout"], root["system"]["esp_type"], root["system"]);
|
parseNrfRadio(root["radioNrf"], root["pinout"], root["system"]["esp_type"], root["system"]);
|
||||||
if(root["generic"]["esp_type"] == "ESP32")
|
/*IF_ESP32*/
|
||||||
parseCmtRadio(root["radioCmt"], root["system"]["esp_type"], root["system"]);
|
parseCmtRadio(root["radioCmt"], root["system"]["esp_type"], root["system"]);
|
||||||
|
/*ENDIF_ESP32*/
|
||||||
parseSerial(root["serial"]);
|
parseSerial(root["serial"]);
|
||||||
parseDisplay(root["display"], root["system"]["esp_type"], root["system"]);
|
parseDisplay(root["display"], root["system"]["esp_type"], root["system"]);
|
||||||
getAjax("/api/inverter/list", parseIv);
|
getAjax("/api/inverter/list", parseIv);
|
||||||
|
|
|
@ -756,7 +756,7 @@ h5 {
|
||||||
.badge {
|
.badge {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: .25em .4em;
|
padding: .25em .4em;
|
||||||
font-size: 75%;
|
font-size: 85%;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
@ -8,10 +8,7 @@
|
||||||
{#HTML_NAV}
|
{#HTML_NAV}
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<pre id="stat"></pre>
|
|
||||||
<div id="info" class="col-sm-12 col-md-6 mt-3"></div>
|
<div id="info" class="col-sm-12 col-md-6 mt-3"></div>
|
||||||
<div id="radio" class="col-sm-12 col-md-6 mt-3"></div>
|
|
||||||
<div id="sun" class="col-sm-12 col-md-6 mt-3"></div>
|
|
||||||
<div id="html" class="mt-3 mb-3"></div>
|
<div id="html" class="mt-3 mb-3"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,8 +46,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function badge(success, text) {
|
function badge(success, text, second="error") {
|
||||||
return ml("span", {class: "badge badge-" + ((success) ? "success" : "error")}, text);
|
return ml("span", {class: "badge badge-" + ((success) ? "success" : second)}, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
function headline(text) {
|
function headline(text) {
|
||||||
|
@ -68,19 +65,23 @@
|
||||||
|
|
||||||
function parseRadio(obj, stat) {
|
function parseRadio(obj, stat) {
|
||||||
const pa = ["MIN (recommended)", "LOW", "HIGH", "MAX"];
|
const pa = ["MIN (recommended)", "LOW", "HIGH", "MAX"];
|
||||||
const datarate = ["1 MBps", "2 MBps", "250 kbps"];
|
|
||||||
|
|
||||||
document.getElementById("radio").append(
|
if(obj.en)
|
||||||
|
lines = [
|
||||||
|
tr("NRF24L01", badge(obj.isconnected, ((obj.isconnected) ? "" : "not ") + "connected")),
|
||||||
|
tr("Power Level", pa[obj.power_level])
|
||||||
|
];
|
||||||
|
else
|
||||||
|
lines = tr("NRF24L01", badge(false, "not enabled"));
|
||||||
|
|
||||||
|
document.getElementById("info").append(
|
||||||
headline("NRF Radio"),
|
headline("NRF Radio"),
|
||||||
ml("table", {class: "table"}, [
|
ml("table", {class: "table"},
|
||||||
ml("tbody", {}, [
|
ml("tbody", {}, lines)
|
||||||
tr("NRF24L01", badge(obj.isconnected, ((obj.isconnected) ? "" : "not ") + "connected")),
|
),
|
||||||
tr("Power Level", pa[obj.power_level])
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
|
|
||||||
headline("Statistics"),
|
headline("Statistics"),
|
||||||
ml("table", {class: "table"}, [
|
ml("table", {class: "table"},
|
||||||
ml("tbody", {}, [
|
ml("tbody", {}, [
|
||||||
tr("TX count", stat.tx_cnt),
|
tr("TX count", stat.tx_cnt),
|
||||||
tr("RX success", stat.rx_success),
|
tr("RX success", stat.rx_success),
|
||||||
|
@ -89,24 +90,41 @@
|
||||||
tr("RX fragments", stat.frame_cnt),
|
tr("RX fragments", stat.frame_cnt),
|
||||||
tr("TX retransmits", stat.retransmits)
|
tr("TX retransmits", stat.retransmits)
|
||||||
])
|
])
|
||||||
])
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseIndex(obj) {
|
/*IF_ESP32*/
|
||||||
if(obj["ts_sunrise"] > 0) {
|
function parseCmt(obj) {
|
||||||
var h = div(["head", "p-2"]);
|
if(obj.en)
|
||||||
var r = div(["row"]);
|
lines = [
|
||||||
r.appendChild(div(["col", "a-c"], "Sun"));
|
tr("CMT2300A", badge(obj.isconnected, ((obj.isconnected) ? "" : "not ") + "connected"))
|
||||||
h.appendChild(r);
|
];
|
||||||
|
else
|
||||||
|
lines = tr("CMT2300A", badge(false, "not enabled"));
|
||||||
|
|
||||||
document.getElementById("sun").append (
|
document.getElementById("info").append(
|
||||||
h,
|
headline("CMT Radio"),
|
||||||
genTabRow("Sunrise", new Date(obj["ts_sunrise"] * 1000).toLocaleString('de-DE')),
|
ml("table", {class: "table"},
|
||||||
genTabRow("Sunset", new Date(obj["ts_sunset"] * 1000).toLocaleString('de-DE')),
|
ml("tbody", {}, lines)
|
||||||
genTabRow("Communication start", new Date((obj["ts_sunrise"] - obj["ts_offset"]) * 1000).toLocaleString('de-DE')),
|
)
|
||||||
genTabRow("Communication stop", new Date((obj["ts_sunset"] + obj["ts_offset"]) * 1000).toLocaleString('de-DE')),
|
);
|
||||||
genTabRow("Night Communication", ((obj["disNightComm"]) ? "disabled" : "enabled"))
|
}
|
||||||
|
/*ENDIF_ESP32*/
|
||||||
|
|
||||||
|
function parseIndex(obj) {
|
||||||
|
if(obj.ts_sunrise > 0) {
|
||||||
|
document.getElementById("info").append(
|
||||||
|
headline("Sun"),
|
||||||
|
ml("table", {class: "table"},
|
||||||
|
ml("tbody", {}, [
|
||||||
|
tr("Sunrise", new Date(obj.ts_sunrise * 1000).toLocaleString('de-DE')),
|
||||||
|
tr("Sunset", new Date(obj.ts_sunset * 1000).toLocaleString('de-DE')),
|
||||||
|
tr("Communication start", new Date((obj.ts_sunrise - obj.ts_offset) * 1000).toLocaleString('de-DE')),
|
||||||
|
tr("Communication stop", new Date((obj.ts_sunset + obj.ts_offset) * 1000).toLocaleString('de-DE')),
|
||||||
|
tr("Night behaviour", badge(obj.disNightComm, ((obj.disNightComm) ? "not" : "") + " communicating", "warning"))
|
||||||
|
])
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,6 +142,9 @@
|
||||||
else {
|
else {
|
||||||
parseSysInfo(obj["system"]);
|
parseSysInfo(obj["system"]);
|
||||||
parseRadio(obj["system"]["radio"], obj["system"]["statistics"]);
|
parseRadio(obj["system"]["radio"], obj["system"]["statistics"]);
|
||||||
|
/*IF_ESP32*/
|
||||||
|
parseCmt(obj["system"]["radioCmt"]);
|
||||||
|
/*ENDIF_ESP32*/
|
||||||
getAjax('/api/index', parseIndex);
|
getAjax('/api/index', parseIndex);
|
||||||
}
|
}
|
||||||
document.getElementById("html").innerHTML = obj["html"];
|
document.getElementById("html").innerHTML = obj["html"];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue