Merge branch 'main' into dev-v2.3

This commit is contained in:
Gunnar Skjold
2023-12-25 07:41:01 +01:00
36 changed files with 500 additions and 297 deletions

View File

@@ -13,12 +13,12 @@
let config = {};
function point(v,e) {
function point(v) {
return {
label: fmtnum(v) + 'A',
title: (e ? 'Estimated ' : '') + v.toFixed(1) + ' A',
title: v.toFixed(1) + ' A',
value: isNaN(v) ? 0 : v,
color: ampcol(v ? (v)/(max)*100 : 0, e)
color: ampcol(v ? (v)/(max)*100 : 0)
};
};
@@ -30,8 +30,19 @@
points.push(point(i1));
}
if(u2 > 0) {
xTicks.push({ label: 'L2' });
points.push(point(i2, i2e));
if(i2e) {
xTicks.push({ label: 'L2' });
points.push({
label: 'Not available',
labelAngle: -90,
title: 'L2 current is not reported by your meter',
value: 0,
color: '#7c3aedcc'
});
} else {
xTicks.push({ label: 'L2' });
points.push(point(i2));
}
}
if(u3 > 0) {
xTicks.push({ label: 'L3' });

View File

@@ -82,9 +82,9 @@
<text
width="{barWidth - 4}"
dominant-baseline="middle"
text-anchor="{barWidth < vertSwitch ? 'left' : 'middle'}"
text-anchor="{barWidth < vertSwitch || point.labelAngle ? 'left' : 'middle'}"
fill="{yScale(point.value) > yScale(0)-labelOffset ? point.color : 'white'}"
transform="translate({xScale(i) + barWidth/2} {yScale(point.value) > yScale(0) - labelOffset ? yScale(point.value) - labelOffset : yScale(point.value) + 10}) rotate({barWidth < vertSwitch ? 90 : 0})"
transform="translate({xScale(i) + barWidth/2} {yScale(point.value) > yScale(0) - labelOffset ? yScale(point.value) - labelOffset : yScale(point.value) + 10}) rotate({point.labelAngle ? point.labelAngle : barWidth < vertSwitch ? 90 : 0})"
>{point.label}</text>
{#if point.title}

View File

@@ -11,7 +11,7 @@ export function voltcol(volt) {
return '#d90000';
};
export function ampcol(pct, est) {
export function ampcol(pct) {
let col;
if(pct > 90) col = '#d90000';
else if(pct > 85) col = '#e32100';
@@ -19,7 +19,7 @@ export function ampcol(pct, est) {
else if(pct > 75) col = '#dcd800';
else col = '#32d900';
return col+(est?'88':'');
return col;
};
export function exportcol(pct) {

View File

@@ -35,9 +35,12 @@
}
let cc = false;
$: {
sysinfoStore.subscribe(update => {
sysinfo = update;
if(update.fwconsent === 1) {
cc = !sysinfo.usrcfg;
}
}
});
</script>
<div class="grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2">