From e81fd75e679583f0a09121659959015ab67377d8 Mon Sep 17 00:00:00 2001 From: Matt Walsh Date: Fri, 25 Sep 2020 13:25:12 -0500 Subject: [PATCH] timing cleanup --- server/scripts/modules/almanac.js | 4 ++-- server/scripts/modules/weatherdisplay.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/scripts/modules/almanac.js b/server/scripts/modules/almanac.js index 7263682..92ec089 100644 --- a/server/scripts/modules/almanac.js +++ b/server/scripts/modules/almanac.js @@ -293,8 +293,6 @@ class Almanac extends WeatherDisplay { })(); this.context.drawImage(image, 75+Index*130, 270); }); - - this.finishDraw(); break; case 1: @@ -317,5 +315,7 @@ class Almanac extends WeatherDisplay { var Precipitation = info.outlook.precipitation; draw.text(this.context, 'Star4000', '24pt', '#FFFFFF', 70, 380, 'Precipitation: ' + Precipitation, 2); } + + this.finishDraw(); } } \ No newline at end of file diff --git a/server/scripts/modules/weatherdisplay.js b/server/scripts/modules/weatherdisplay.js index 85345d9..c8b31de 100644 --- a/server/scripts/modules/weatherdisplay.js +++ b/server/scripts/modules/weatherdisplay.js @@ -422,8 +422,10 @@ class WeatherDisplay { // get the screen index for the current base count, returns false if past end of timing array (go to next screen, stop timing) screenIndexFromBaseCount() { + // test for timing enabled + if (!this.timing) return 0; // find the first timing in the timing array that is greater than the base count - if (!this.timing.fullDelay) this.calcNavTiming(); + if (this.timing && !this.timing.fullDelay) this.calcNavTiming(); const timingIndex = this.timing.fullDelay.findIndex(delay => delay > this.navBaseCount); if (timingIndex === -1) return false; return this.timing.screenIndexes[timingIndex];