diff --git a/lib/AmsConfiguration/include/AmsConfiguration.h b/lib/AmsConfiguration/include/AmsConfiguration.h index 51dffe7c..2036fa94 100644 --- a/lib/AmsConfiguration/include/AmsConfiguration.h +++ b/lib/AmsConfiguration/include/AmsConfiguration.h @@ -5,6 +5,7 @@ #define EEPROM_SIZE 1024*3 #define EEPROM_CHECK_SUM 100 // Used to check if config is stored. Change if structure changes +#define EEPROM_CLEARED_INDICATOR 0xFC #define EEPROM_CONFIG_ADDRESS 0 #define EEPROM_TEMP_CONFIG_ADDRESS 2048 diff --git a/lib/AmsConfiguration/src/AmsConfiguration.cpp b/lib/AmsConfiguration/src/AmsConfiguration.cpp index d6b96e94..ab09b497 100644 --- a/lib/AmsConfiguration/src/AmsConfiguration.cpp +++ b/lib/AmsConfiguration/src/AmsConfiguration.cpp @@ -1,8 +1,9 @@ #include "AmsConfiguration.h" bool AmsConfiguration::getSystemConfig(SystemConfig& config) { - if(hasConfig()) { - EEPROM.begin(EEPROM_SIZE); + EEPROM.begin(EEPROM_SIZE); + uint8_t configVersion = EEPROM.read(EEPROM_CONFIG_ADDRESS); + if(configVersion == EEPROM_CHECK_SUM || configVersion == EEPROM_CLEARED_INDICATOR) { EEPROM.get(CONFIG_SYSTEM_START, config); EEPROM.end(); return true; @@ -573,6 +574,15 @@ void AmsConfiguration::ackEnergyAccountingChange() { void AmsConfiguration::clear() { EEPROM.begin(EEPROM_SIZE); + + SystemConfig sys; + EEPROM.get(CONFIG_SYSTEM_START, sys); + sys.userConfigured = false; + sys.dataCollectionConsent = 0; + strcpy(sys.country, ""); + EEPROM.put(CONFIG_SYSTEM_START, sys); + + MeterConfig meter; clearMeter(meter); EEPROM.put(CONFIG_METER_START, meter); @@ -605,7 +615,7 @@ void AmsConfiguration::clear() { clearEnergyAccountingConfig(eac); EEPROM.put(CONFIG_ENERGYACCOUNTING_START, eac); - EEPROM.put(EEPROM_CONFIG_ADDRESS, -1); + EEPROM.put(EEPROM_CONFIG_ADDRESS, EEPROM_CLEARED_INDICATOR); EEPROM.commit(); EEPROM.end(); } @@ -833,8 +843,8 @@ bool AmsConfiguration::relocateConfig96() { SystemConfig sys; EEPROM.begin(EEPROM_SIZE); EEPROM.get(CONFIG_SYSTEM_START, sys); - sys.vendorConfigured = false; - sys.userConfigured = false; + sys.vendorConfigured = true; + sys.userConfigured = true; sys.dataCollectionConsent = 0; strcpy(sys.country, ""); EEPROM.put(CONFIG_SYSTEM_START, sys); diff --git a/lib/SvelteUi/app/src/App.svelte b/lib/SvelteUi/app/src/App.svelte index 71d9bf08..55a30f41 100644 --- a/lib/SvelteUi/app/src/App.svelte +++ b/lib/SvelteUi/app/src/App.svelte @@ -6,8 +6,8 @@ import Dashboard from './lib/Dashboard.svelte'; import ConfigurationPanel from './lib/ConfigurationPanel.svelte'; import StatusPage from './lib/StatusPage.svelte'; - import VendorModal from './lib/VendorModal.svelte'; - import SetupModal from './lib/SetupModal.svelte'; + import VendorPanel from './lib/VendorPanel.svelte'; + import SetupPanel from './lib/SetupPanel.svelte'; import Mask from './lib/Mask.svelte'; let sysinfo = {}; @@ -25,7 +25,13 @@
+ {#if sysinfo.vndcfg === false} + + {:else if sysinfo.usrcfg === false} + + {:else} + {/if} @@ -34,19 +40,10 @@ + {#if sysinfo.upgrading} - {:else if sysinfo.vndcfg === false} - {#if sysinfo.booting} + {:else if sysinfo.booting} - {:else} - - {/if} - {:else if sysinfo.usrcfg === false} - {#if sysinfo.booting} - - {:else} - - {/if} {/if} diff --git a/lib/SvelteUi/app/src/lib/AmpPlot.svelte b/lib/SvelteUi/app/src/lib/AmpPlot.svelte index ca495f3e..40bec75a 100644 --- a/lib/SvelteUi/app/src/lib/AmpPlot.svelte +++ b/lib/SvelteUi/app/src/lib/AmpPlot.svelte @@ -40,8 +40,6 @@ }); } config = { - height: 250, - width: 224, padding: { top: 20, right: 15, bottom: 20, left: 35 }, y: { min: 0, diff --git a/lib/SvelteUi/app/src/lib/BarChart.svelte b/lib/SvelteUi/app/src/lib/BarChart.svelte index fb5f5c74..1d279983 100644 --- a/lib/SvelteUi/app/src/lib/BarChart.svelte +++ b/lib/SvelteUi/app/src/lib/BarChart.svelte @@ -1,30 +1,37 @@ -
- +
+ {#if config.title} + {config.title} + {/if} + {#each config.y.ticks as tick} @@ -38,7 +45,7 @@ {#each config.x.ticks as point, i} - + {point.label} {/each} @@ -60,7 +67,7 @@ dominant-baseline="middle" text-anchor="{barWidth < 25 ? 'left' : 'middle'}" fill="{yScale(point.value) > yScale(0)-15 ? point.color : 'white'}" - transform="rotate({barWidth < 25 ? 90 : 0}, {xScale(i) + (barWidth/2)}, {yScale(point.value) > yScale(0)-12 ? yScale(point.value) - 12 : yScale(point.value)+10})" + transform="rotate({barWidth < 25 ? 90 : 0}, {xScale(i) + (barWidth/2)}, {yScale(point.value) > yScale(0)-12 ? yScale(point.value) - 12 : yScale(point.value)+9})" >{point.label} {/each} @@ -70,6 +77,7 @@
{/if} -
- Cloud - -
Hardware {#if sysinfo.board > 20} @@ -557,6 +567,8 @@ {/if}
- + + + diff --git a/lib/SvelteUi/app/src/lib/Dashboard.svelte b/lib/SvelteUi/app/src/lib/Dashboard.svelte index 4dc0fe1e..73600ef8 100644 --- a/lib/SvelteUi/app/src/lib/Dashboard.svelte +++ b/lib/SvelteUi/app/src/lib/Dashboard.svelte @@ -32,16 +32,20 @@
-
+
+ +
{data.mt ? metertype(data.mt) : '-'}
{data.ic ? data.ic.toFixed(1) : '-'} kWh
- {#if data.om} + {#if data.om || data.e > 0}
-
+
+ +
{data.ec ? data.ec.toFixed(1) : '-'} kWh
@@ -60,18 +64,18 @@
{#if prices.currency} -
+
{/if} -
+
-
+
{#if data.t && data.t != -127 && temperatures.c > 1} -
+
{/if} diff --git a/lib/SvelteUi/app/src/lib/DayPlot.svelte b/lib/SvelteUi/app/src/lib/DayPlot.svelte index c6ac15f3..6c10098a 100644 --- a/lib/SvelteUi/app/src/lib/DayPlot.svelte +++ b/lib/SvelteUi/app/src/lib/DayPlot.svelte @@ -70,6 +70,7 @@ } config = { + title: "Energy use last 24 hours (kWh)", height: 226, width: 1520, padding: { top: 20, right: 15, bottom: 20, left: 35 }, @@ -86,7 +87,5 @@ }; -
- Energy use last 24 hours (kWh) - -
+ + diff --git a/lib/SvelteUi/app/src/lib/Header.svelte b/lib/SvelteUi/app/src/lib/Header.svelte index 8f813a02..c177de0b 100644 --- a/lib/SvelteUi/app/src/lib/Header.svelte +++ b/lib/SvelteUi/app/src/lib/Header.svelte @@ -55,7 +55,7 @@