diff --git a/server/scripts/modules/currentweatherscroll.mjs b/server/scripts/modules/currentweatherscroll.mjs index a6ee798..7a1badf 100644 --- a/server/scripts/modules/currentweatherscroll.mjs +++ b/server/scripts/modules/currentweatherscroll.mjs @@ -261,6 +261,7 @@ const parseMessage = (event) => { if (event?.data?.type === 'current-weather-scroll') { if (event.data?.method === 'start') start(); if (event.data?.method === 'reload') stop(true); + if (event.data?.method === 'non-display') nonDisplay(); if (event.data?.method === 'show') show(); if (event.data?.method === 'hide') hide(); } @@ -274,6 +275,20 @@ const hide = () => { mainScroll.style.display = 'none'; }; +const nonDisplay = () => { + if (interval) { + clearInterval(interval); + interval = null; + stop(); + // if greater than default update (typically long scroll) skip to the next weather screen + if (nextUpdate > DEFAULT_UPDATE) { + screenIndex = (screenIndex + 1) % (workingScreens.length); + sinceLastUpdate = 0; + nextUpdate = DEFAULT_UPDATE; + } + } +}; + const screenCount = () => workingScreens.length; const atDefault = () => defaultScreensLoaded; diff --git a/server/scripts/modules/extendedforecast.mjs b/server/scripts/modules/extendedforecast.mjs index 33537e4..01cd9db 100644 --- a/server/scripts/modules/extendedforecast.mjs +++ b/server/scripts/modules/extendedforecast.mjs @@ -138,15 +138,14 @@ const parse = (fullForecast, forecastUrl) => { // get the object to modify/populate const fDay = forecast[destIndex]; - // preload the icon - preloadImg(fDay.icon); - if (period.isDaytime) { // day time is the high temperature fDay.high = period.temperature; fDay.icon = getLargeIcon(period.icon); fDay.text = shortenExtendedForecastText(period.shortForecast); fDay.dayName = dates[destIndex]; + // preload the icon + preloadImg(fDay.icon); // Wait for the corresponding night period to increment } else { // low temperature diff --git a/server/scripts/modules/weatherdisplay.mjs b/server/scripts/modules/weatherdisplay.mjs index dfa5c0f..7e53cc5 100644 --- a/server/scripts/modules/weatherdisplay.mjs +++ b/server/scripts/modules/weatherdisplay.mjs @@ -172,6 +172,7 @@ class WeatherDisplay { if (this.screenIndex < 0) this.screenIndex = 0; if (this.okToDrawCurrentDateTime) this.drawCurrentDateTime(); if (this.okToDrawCurrentConditions) postMessage({ type: 'current-weather-scroll', method: 'start' }); + if (!this.okToDrawCurrentConditions) postMessage({ type: 'current-weather-scroll', method: 'non-display' }); if (this.okToDrawCurrentConditions === false) postMessage({ type: 'current-weather-scroll', method: 'hide' }); }