timing cleanup

This commit is contained in:
Matt Walsh 2020-09-25 13:25:12 -05:00
parent 4826801491
commit e81fd75e67
2 changed files with 5 additions and 3 deletions

View file

@ -293,8 +293,6 @@ class Almanac extends WeatherDisplay {
})(); })();
this.context.drawImage(image, 75+Index*130, 270); this.context.drawImage(image, 75+Index*130, 270);
}); });
this.finishDraw();
break; break;
case 1: case 1:
@ -317,5 +315,7 @@ class Almanac extends WeatherDisplay {
var Precipitation = info.outlook.precipitation; var Precipitation = info.outlook.precipitation;
draw.text(this.context, 'Star4000', '24pt', '#FFFFFF', 70, 380, 'Precipitation: ' + Precipitation, 2); draw.text(this.context, 'Star4000', '24pt', '#FFFFFF', 70, 380, 'Precipitation: ' + Precipitation, 2);
} }
this.finishDraw();
} }
} }

View file

@ -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) // get the screen index for the current base count, returns false if past end of timing array (go to next screen, stop timing)
screenIndexFromBaseCount() { 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 // 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); const timingIndex = this.timing.fullDelay.findIndex(delay => delay > this.navBaseCount);
if (timingIndex === -1) return false; if (timingIndex === -1) return false;
return this.timing.screenIndexes[timingIndex]; return this.timing.screenIndexes[timingIndex];