mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-17 00:59:29 -07:00
timing cleanup
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user