mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-13 15:37:03 +00:00
Adjustments for v2.3 testing
This commit is contained in:
parent
785cefabb5
commit
23cbcf9a0a
2
lib/SvelteUi/app/dist/index.css
vendored
2
lib/SvelteUi/app/dist/index.css
vendored
File diff suppressed because one or more lines are too long
12
lib/SvelteUi/app/dist/index.js
vendored
12
lib/SvelteUi/app/dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -11,16 +11,16 @@
|
||||
export let fullTimeColor;
|
||||
export let offset;
|
||||
|
||||
let showFull;
|
||||
let clockOk;
|
||||
$:{
|
||||
showFull = Math.abs(new Date().getTime()-timestamp.getTime()) < 300000;
|
||||
clockOk = Math.abs(new Date().getTime()-timestamp.getTime()) < 300000;
|
||||
if(!isNaN(offset))
|
||||
addHours(timestamp, offset - ((24 + timestamp.getHours() - timestamp.getUTCHours())%24));
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if showFull }
|
||||
{`${zeropad(timestamp.getDate())}. ${translations.months?.[timestamp.getMonth()]} ${zeropad(timestamp.getHours())}:${zeropad(timestamp.getMinutes())}`}
|
||||
{#if clockOk }
|
||||
{`${zeropad(timestamp.getDate())}. ${translations.months ? translations.months?.[timestamp.getMonth()] : zeropad(timestamp.getMonth())} ${zeropad(timestamp.getHours())}:${zeropad(timestamp.getMinutes())}`}
|
||||
{:else}
|
||||
<span class="{fullTimeColor}">{`${zeropad(timestamp.getDate())}.${zeropad(timestamp.getMonth()+1)}.${timestamp.getFullYear()} ${zeropad(timestamp.getHours())}:${zeropad(timestamp.getMinutes())}`}</span>
|
||||
{/if}
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
import { Link, navigate } from 'svelte-navigator';
|
||||
import SubnetOptions from './SubnetOptions.svelte';
|
||||
import QrCode from 'svelte-qrcode';
|
||||
import { scanForDevice } from './Helpers.js';
|
||||
|
||||
export let basepath = "/";
|
||||
export let sysinfo = {};
|
||||
@ -153,13 +152,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
function updateSysinfo(url) {
|
||||
sysinfoStore.update(s => {
|
||||
s.trying = url;
|
||||
return s;
|
||||
});
|
||||
}
|
||||
|
||||
async function handleSubmit(e) {
|
||||
saving = true;
|
||||
const formData = new FormData(e.target);
|
||||
@ -185,7 +177,6 @@
|
||||
s.net.gw = formData.get('ng');
|
||||
s.net.dns1 = formData.get('nd');
|
||||
}
|
||||
setTimeout(scanForDevice, 5000, sysinfo, updateSysinfo);
|
||||
return s;
|
||||
});
|
||||
|
||||
@ -583,8 +574,8 @@
|
||||
{/if}
|
||||
<br/>
|
||||
<div class="flex">
|
||||
<input name="qh" bind:value={configuration.q.h} type="text" class="in-f w-3/4"/>
|
||||
<input name="qp" bind:value={configuration.q.p} type="number" min="1024" max="65535" class="in-l tr w-1/4"/>
|
||||
<input name="qh" bind:value={configuration.q.h} type="text" class="in-f w-2/3"/>
|
||||
<input name="qp" bind:value={configuration.q.p} type="number" min="1024" max="65535" class="in-l tr w-1/3"/>
|
||||
</div>
|
||||
</div>
|
||||
{#if configuration.q.s.e}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { readable, writable } from 'svelte/store';
|
||||
import { isBusPowered, zeropad } from './Helpers';
|
||||
import { isBusPowered, zeropad, scanForDevice } from './Helpers';
|
||||
|
||||
export async function fetchWithTimeout(resource, options = {}) {
|
||||
const { timeout = 8000 } = options;
|
||||
@ -45,12 +45,20 @@ export async function getSysinfo() {
|
||||
sysinfoStore.set(sysinfo);
|
||||
};
|
||||
|
||||
function updateSysinfo(url) {
|
||||
sysinfoStore.update(s => {
|
||||
s.trying = url;
|
||||
return s;
|
||||
});
|
||||
}
|
||||
|
||||
let tries = 0;
|
||||
let lastTemp = -127;
|
||||
let lastPrice = null;
|
||||
let data = {};
|
||||
export const dataStore = readable(data, (set) => {
|
||||
let timeout;
|
||||
let scanTimeout;
|
||||
async function getData() {
|
||||
fetchWithTimeout("data.json")
|
||||
.then((res) => res.json())
|
||||
@ -95,6 +103,7 @@ export const dataStore = readable(data, (set) => {
|
||||
mm: 0
|
||||
});
|
||||
timeout = setTimeout(getData, 15000);
|
||||
if(!scanTimeout) scanTimeout = setTimeout(scanForDevice, 5000, sysinfo, updateSysinfo);
|
||||
} else {
|
||||
timeout = setTimeout(getData, isBusPowered(sysinfo.board) ? 10000 : 5000);
|
||||
}
|
||||
|
||||
@ -78,15 +78,15 @@
|
||||
<Clock timestamp={ data.c ? new Date(data.c * 1000) : new Date(0) } offset={sysinfo.clock_offset} fullTimeColor="text-red-500" />
|
||||
</div>
|
||||
{#if sysinfo.vndcfg && sysinfo.usrcfg}
|
||||
<div class="flex-none px-1 mt-1" title={translations.header?.config ?? ""}>
|
||||
<Link to="/configuration">⚙</Link>
|
||||
<div class="flex-none px-1 mt-1" style="font-size: 24px;font-weight:bold;" title={translations.header?.config ?? ""}>
|
||||
<Link to="/configuration">⛭</Link>
|
||||
</div>
|
||||
<div class="flex-none px-1 mt-1" title={translations.header?.status ?? ""}>
|
||||
<div class="flex-none px-1 mt-1" style="font-size: 18px;font-weight:bold;" title={translations.header?.status ?? ""}>
|
||||
<Link to="/status">ⓘ</Link>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="flex-none px-1 mt-1" title={translations.header?.doc ?? ""}>
|
||||
<a href={wiki('')} target='_blank' rel="noreferrer">🗎</a>
|
||||
<div class="flex-none px-1 mt-1" style="font-size: 18px;font-weight:bold;" title={translations.header?.doc ?? ""}>
|
||||
<a href={wiki('')} target='_blank' rel="noreferrer">🕮</a>
|
||||
</div>
|
||||
{#if sysinfo.fwconsent === 1 && nextVersion}
|
||||
<div class="flex-none mr-3 text-yellow-500" title={(translations.header?.new_version ?? "New version") + ': ' + nextVersion.tag_name}>
|
||||
|
||||
@ -255,7 +255,7 @@
|
||||
<button type="button" on:click={()=>{firmwareFileInput.click();}} class="btn-pri-sm float-right">{translations.status?.firmware?.btn_select_file ?? "Select file"}</button>
|
||||
{:else}
|
||||
{firmwareFiles[0].name}
|
||||
<button type="submit" class="btn-pri-sm float-right">{translations.btn?.upload ?? "Upload"}</button>
|
||||
<button type="submit" class="btn-pri-sm float-right ml-2">{translations.btn?.upload ?? "Upload"}</button>
|
||||
{/if}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@ -1189,7 +1189,11 @@ void AmsWebServer::translationsJson() {
|
||||
return;
|
||||
}
|
||||
|
||||
server.sendHeader(HEADER_CACHE_CONTROL, CACHE_1DA);
|
||||
// server.sendHeader(HEADER_CACHE_CONTROL, CACHE_1DA);
|
||||
server.sendHeader(HEADER_CACHE_CONTROL, CACHE_CONTROL_NO_CACHE);
|
||||
server.sendHeader(HEADER_PRAGMA, PRAGMA_NO_CACHE);
|
||||
server.sendHeader(HEADER_EXPIRES, EXPIRES_OFF);
|
||||
|
||||
File file = LittleFS.open(buf, "r");
|
||||
server.setContentLength(file.size());
|
||||
|
||||
|
||||
@ -505,7 +505,11 @@ void setup() {
|
||||
ws.setup(&config, &gpioConfig, &meterState, &ds, &ea, &rtp);
|
||||
|
||||
UiConfig ui;
|
||||
if(config.getUiConfig(ui) && strlen(ui.language) > 0) {
|
||||
if(config.getUiConfig(ui)) {
|
||||
if(strlen(ui.language) == 0) {
|
||||
strcpy(ui.language, "en");
|
||||
config.setUiConfig(ui);
|
||||
}
|
||||
snprintf_P((char*) commonBuffer, BUF_SIZE_COMMON, PSTR("/translations-%s.json"), ui.language);
|
||||
if(!LittleFS.exists((char*) commonBuffer)) {
|
||||
debugI_P(PSTR("Marking %s for download"), commonBuffer);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user