mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-28 17:56:21 +02:00
0.8.114
* fix ESP8266 compile * fix history graph * fix close button color of modal windows in dark mode #1598 * fix only one total field in `/live` #1579
This commit is contained in:
parent
177420fce2
commit
4fe5c8eef8
6 changed files with 33 additions and 25 deletions
|
@ -1,5 +1,11 @@
|
|||
# Development Changes
|
||||
|
||||
## 0.8.114 - 2024-04-29
|
||||
* fix ESP8266 compile
|
||||
* fix history graph
|
||||
* fix close button color of modal windows in dark mode #1598
|
||||
* fix only one total field in `/live` #1579
|
||||
|
||||
## 0.8.113 - 2024-04-25
|
||||
* code cleanup
|
||||
* fix ESP32-C3 compile
|
||||
|
|
|
@ -239,9 +239,9 @@ class settings {
|
|||
std::fill(reinterpret_cast<char*>(&mCfg), reinterpret_cast<char*>(&mCfg) + sizeof(mCfg), 0);
|
||||
}
|
||||
|
||||
void setup(settings_t *&cfg) {
|
||||
void setup(settings_t *&c) {
|
||||
DPRINTLN(DBG_INFO, F("Initializing FS .."));
|
||||
cfg = &mCfg;
|
||||
c = &mCfg;
|
||||
|
||||
mCfg.valid = false;
|
||||
#if !defined(ESP32)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//-------------------------------------
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 8
|
||||
#define VERSION_PATCH 113
|
||||
#define VERSION_PATCH 114
|
||||
//-------------------------------------
|
||||
typedef struct {
|
||||
uint8_t ch;
|
||||
|
|
|
@ -45,12 +45,11 @@
|
|||
s.x_mul = 60
|
||||
s.ts_start = obj.lastValueTs - (obj.refresh * obj.value.length)
|
||||
s.ts_dur = obj.lastValueTs - s.ts_start
|
||||
s.ts_pad = (s.ts_dur < 1800) ? s.ts_start % 300 : s.ts_start % 1800
|
||||
s.ts_dur -= s.ts_pad
|
||||
s.ts_pad = (s.ts_dur < 1800) ? 0 : s.ts_start % 1800
|
||||
s.ts_dur += s.ts_pad
|
||||
while(s.x_mul * 10 <= s.ts_dur)
|
||||
s.x_mul += (s.x_mul == 60) ? 240 : ((s.x_mul < 1800) ? 300 : 1800)
|
||||
s.x_step = Math.ceil(s.ts_dur / s.x_mul)
|
||||
s.x_max = s.x_mul * s.x_step
|
||||
|
||||
s.y_mul = 10
|
||||
while(s.y_mul * 10 <= obj.max)
|
||||
|
@ -79,7 +78,7 @@
|
|||
...gridText(n*2, scale),
|
||||
mlNs("g", {transform: "translate(30, 5)"}, [
|
||||
...grid(n*2, scale),
|
||||
...poly(obj, scale)
|
||||
...poly(n*2, obj, scale)
|
||||
])
|
||||
])
|
||||
}
|
||||
|
@ -90,10 +89,10 @@
|
|||
for(let i = 0; i <= scale.y_max; i += scale.y_mul) {
|
||||
g.push(mlNs("text", {x: 0, y: height-(i*div)+9}, String(i)))
|
||||
}
|
||||
div = x2 / scale.x_max
|
||||
for(let i = 0; i < scale.x_max; i++) {
|
||||
if((i + scale.ts_pad) % scale.x_mul == 0) {
|
||||
let d = new Date((scale.ts_start + i) * 1000)
|
||||
div = x2 / scale.ts_dur
|
||||
for(let i = 0; i < scale.ts_dur; i++) {
|
||||
if(i % scale.x_mul == 0) {
|
||||
let d = new Date((scale.ts_start - scale.ts_pad + i) * 1000)
|
||||
g.push(mlNs("text", {x: (i*div)+17, y: height+20}, ("0"+d.getHours()).slice(-2) + ":" + ("0"+d.getMinutes()).slice(-2)))
|
||||
}
|
||||
}
|
||||
|
@ -106,28 +105,29 @@
|
|||
for(let i = 0; i <= scale.y_max; i += scale.y_mul) {
|
||||
g.push(mlNs("line", {x1: 0, x2: x2, y1: height-i*div, y2: height-i*div, "stroke-width": 1, "stroke-dasharray": "1,3", stroke: "#aaa"}))
|
||||
}
|
||||
div = x2 / scale.x_max
|
||||
for(let i = 0; i <= scale.x_max; i++) {
|
||||
if((i + scale.ts_pad) % scale.x_mul == 0) {
|
||||
div = x2 / scale.ts_dur
|
||||
for(let i = 0; i <= scale.ts_dur; i++) {
|
||||
if(i % scale.x_mul == 0) {
|
||||
g.push(mlNs("line", {x1: (i*div), x2: (i*div), y1: 0, y2: height, "stroke-width": 1, "stroke-dasharray": "1,3", stroke: "#aaa"}))
|
||||
}
|
||||
}
|
||||
return g
|
||||
}
|
||||
|
||||
function poly(obj, scale) {
|
||||
function poly(x2, obj, scale) {
|
||||
let pts = ""
|
||||
let i = 0, first = -1, last = -1, lastVal = 0
|
||||
let div = scale.y_max / height
|
||||
let xOff = x2 / scale.ts_dur * scale.ts_pad
|
||||
if(div == 0)
|
||||
div = 1
|
||||
for (val of obj.value) {
|
||||
if(val > 0) {
|
||||
lastVal = val
|
||||
pts += " " + String(i) + "," + String(height - val / div)
|
||||
pts += " " + String(i + xOff) + "," + String(height - val / div)
|
||||
if(first < 0)
|
||||
first = i
|
||||
last = i
|
||||
first = i + xOff
|
||||
last = i + xOff
|
||||
}
|
||||
i += 2
|
||||
}
|
||||
|
|
|
@ -758,6 +758,7 @@ div.hr {
|
|||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
button.close {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
var mNum = 0;
|
||||
var total = Array(6).fill(0);
|
||||
var tPwrAck;
|
||||
var totalsRendered = false
|
||||
|
||||
function getErrStr(code) {
|
||||
if("ERR_AUTH") return "{#ERR_AUTH}"
|
||||
|
@ -74,6 +75,7 @@
|
|||
for(var i = 0; i < 6; i++) {
|
||||
total[i] = Math.round(total[i] * 100) / 100;
|
||||
}
|
||||
totalsRendered = true
|
||||
|
||||
return ml("div", {class: "row mt-3 mb-5"},
|
||||
ml("div", {class: "col"}, [
|
||||
|
@ -240,20 +242,18 @@
|
|||
])
|
||||
);
|
||||
|
||||
|
||||
var last = true;
|
||||
for(var i = obj.id + 1; i < ivEn.length; i++) {
|
||||
if((i != ivEn.length) && ivEn[i]) {
|
||||
last = false;
|
||||
getAjax("/api/inverter/id/" + i, parseIv);
|
||||
break;
|
||||
return
|
||||
}
|
||||
}
|
||||
if(last) {
|
||||
if(mNum > 1)
|
||||
|
||||
if(mNum > 1) {
|
||||
if(!totalsRendered)
|
||||
mIvHtml.unshift(totals());
|
||||
document.getElementById("live").replaceChildren(...mIvHtml);
|
||||
}
|
||||
document.getElementById("live").replaceChildren(...mIvHtml);
|
||||
}
|
||||
|
||||
function parseIvAlarm(obj) {
|
||||
|
@ -514,6 +514,7 @@
|
|||
ivEn = Object.values(Object.assign({}, obj["iv"]));
|
||||
mIvHtml = [];
|
||||
mNum = 0;
|
||||
totalsRendered = false
|
||||
total.fill(0);
|
||||
for(var i = 0; i < obj.iv.length; i++) {
|
||||
if(obj.iv[i]) {
|
||||
|
|
Loading…
Add table
Reference in a new issue