From 3c2cddb0d35030a95286018438b5e3d1bfb8547e Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com> Date: Thu, 24 Feb 2022 00:59:10 +0100 Subject: [PATCH] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BC=D0=BD=D0=BE=D0=B6=D0=B5=D1=81=D1=82=D0=B2=D0=BE?= =?UTF-8?q?=20=D0=B1=D0=B0=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.svelte | 68 ++++++++++++++-------------------- src/components/Alarm.svelte | 2 +- src/components/Card.svelte | 2 +- src/components/Progress.svelte | 12 +++--- src/pages/System.svelte | 2 +- 5 files changed, 37 insertions(+), 49 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index c345dcb..7747626 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -29,11 +29,11 @@ //****************************************************constants section*********************************************************/ //******************************************************************************************************************************/ - let version = 408; + let version = 410; let debug = true; let LOG_MAX_MESSAGES = 100; let reconnectTimeout = 20000; - let rebootingTimeout = 15000; + let rebootingTimeout = 18000; let updatingTimeout = 80000; let opened = false; let preventMove = false; @@ -48,6 +48,9 @@ let showInput = false; let showModalFlag = false; + let rebootingUpdatingInProgress = false; + const myTimeout = undefined; + let additionalParams = false; //dashboard @@ -119,7 +122,7 @@ let selectedDeviceData = undefined; let selectedWs = 0; - let flag = true; + let firstTime = true; let newDevice = {}; let coreMessages = []; @@ -669,18 +672,22 @@ function wsTestMsgTask() { setTimeout(wsTestMsgTask, reconnectTimeout); - if (debug) console.log("[i]", "----timer tick----"); - if (!flag) { - deviceList.forEach((device) => { - if (!getDeviceStatus(device.ws)) { - wsConnect(device.ws); - wsEventAdd(device.ws); - } else { - wsSendMsg(device.ws, "/tst|"); - } - }); + if (!rebootingUpdatingInProgress) { + if (debug) console.log("[i]", "----timer tick----"); + if (!firstTime) { + deviceList.forEach((device) => { + if (!getDeviceStatus(device.ws)) { + wsConnect(device.ws); + wsEventAdd(device.ws); + } else { + wsSendMsg(device.ws, "/tst|"); + } + }); + } + firstTime = false; + } else { + if (debug) console.log("[i]", "----timer skipped----"); } - flag = false; } function wsSendMsg(ws, msg) { @@ -960,13 +967,10 @@ wsSendMsg(selectedWs, "/scan|"); } - let rebootingInProgress = false; - const myTimeout = undefined; - function rebootEsp() { if (debug) console.log("[i]", "reboot..."); wsSendMsg(selectedWs, "/reboot|"); - rebootingInProgress = true; + rebootingUpdatingInProgress = true; myTimeout = setTimeout(rebootingTask, rebootingTimeout); } @@ -974,7 +978,7 @@ clearTimeout(myTimeout); clearData(); connectToAllDevices(); - rebootingInProgress = false; + rebootingUpdatingInProgress = false; } function cancelAlarm(alarmKey) { @@ -1020,7 +1024,7 @@ wsSendMsg(selectedWs, '/rorre|{"chver":' + choosingVersion + "}"); //начнем обновление wsSendMsg(selectedWs, "/update|"); - rebootingInProgress = true; + rebootingUpdatingInProgress = true; myTimeout = setTimeout(rebootingTask, updatingTimeout); } else { console.log("update canceled"); @@ -1036,7 +1040,7 @@ - {#if rebootingInProgress} + {#if rebootingUpdatingInProgress} {/if}
@@ -1057,7 +1061,8 @@
@@ -1111,16 +1107,6 @@ saveSett()} rebootEsp={() => rebootEsp()} cancelAlarm={(alarmKey) => cancelAlarm(alarmKey)} versionsList={versionsList} bind:choosingVersion startUpdate={() => startUpdate()} coreMessages={coreMessages} /> - - - - - - - - - - {/if} diff --git a/src/components/Alarm.svelte b/src/components/Alarm.svelte index 398920c..2ff52a4 100644 --- a/src/components/Alarm.svelte +++ b/src/components/Alarm.svelte @@ -28,7 +28,7 @@ @layer components { .alm { - @apply mb-2 w-full p-2 sm:p-2 md:p-2 lg:p-2 xl:px-4 xl:py-2 2xl:px-4 2xl:py-2 bg-white shadow-md lg:shadow-lg border border-gray-200 rounded-lg; + @apply mt-4 w-full p-2 sm:p-2 md:p-2 lg:p-2 xl:px-4 xl:py-2 2xl:px-4 2xl:py-2 bg-white shadow-md lg:shadow-lg border border-gray-200 rounded-lg; } .alm-hdr { @apply text-center text-base text-red-400 font-bold pb-0; diff --git a/src/components/Card.svelte b/src/components/Card.svelte index 98b60e3..2f70bec 100644 --- a/src/components/Card.svelte +++ b/src/components/Card.svelte @@ -19,7 +19,7 @@ @layer components { .crd { - @apply w-full mb-2 p-2 sm:p-2 md:p-2 lg:p-2 xl:px-4 xl:py-4 2xl:px-4 2xl:py-4 bg-white shadow-md lg:shadow-lg border border-gray-200 rounded-lg; + @apply w-full mt-4 p-2 sm:p-2 md:p-2 lg:p-2 xl:px-4 xl:py-4 2xl:px-4 2xl:py-4 bg-white shadow-md lg:shadow-lg border border-gray-200 rounded-lg; } .crd-hdr { @apply text-center text-lg text-gray-500 font-bold pb-4; diff --git a/src/components/Progress.svelte b/src/components/Progress.svelte index ac483fb..8363307 100644 --- a/src/components/Progress.svelte +++ b/src/components/Progress.svelte @@ -1,11 +1,13 @@ -
-