fix play timing for regional forecast and local forecast
This commit is contained in:
parent
b9a85031bd
commit
36673b1f1d
|
@ -271,7 +271,7 @@ class WeatherDisplay {
|
||||||
if (!this.timing) return;
|
if (!this.timing) return;
|
||||||
}
|
}
|
||||||
hideCanvas() {
|
hideCanvas() {
|
||||||
this.stopNavBaseCount(true);
|
this.resetNavBaseCount();
|
||||||
|
|
||||||
if (!this.canvas) return;
|
if (!this.canvas) return;
|
||||||
this.canvas.style.display = 'none';
|
this.canvas.style.display = 'none';
|
||||||
|
@ -314,7 +314,6 @@ class WeatherDisplay {
|
||||||
// must compare with false as nextScreenIndex could be 0 which is valid
|
// must compare with false as nextScreenIndex could be 0 which is valid
|
||||||
if (nextScreenIndex === false) {
|
if (nextScreenIndex === false) {
|
||||||
this.sendNavDisplayMessage(navigation.msg.response.next);
|
this.sendNavDisplayMessage(navigation.msg.response.next);
|
||||||
this.stopNavBaseCount();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,6 +340,7 @@ class WeatherDisplay {
|
||||||
// this.timing.fullDelay = [end of screen index 0 in base counts, end of screen index 1...]
|
// this.timing.fullDelay = [end of screen index 0 in base counts, end of screen index 1...]
|
||||||
// this.timing.screenIndexes = [screen index to use during this.timing.fullDelay[0], screen index to use during this.timing.fullDelay[1], ...]
|
// this.timing.screenIndexes = [screen index to use during this.timing.fullDelay[0], screen index to use during this.timing.fullDelay[1], ...]
|
||||||
calcNavTiming() {
|
calcNavTiming() {
|
||||||
|
if (this.timing === false) return;
|
||||||
// update total screens
|
// update total screens
|
||||||
if (Array.isArray(this.timing.delay)) this.timing.totalScreens = this.timing.delay.length;
|
if (Array.isArray(this.timing.delay)) this.timing.totalScreens = this.timing.delay.length;
|
||||||
|
|
||||||
|
@ -412,6 +412,7 @@ 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() {
|
||||||
// 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();
|
||||||
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];
|
||||||
|
@ -421,14 +422,16 @@ class WeatherDisplay {
|
||||||
startNavCount() {
|
startNavCount() {
|
||||||
if (!this.navInterval) this.navInterval = setInterval(()=>this.navBaseTime(), this.timing.baseDelay);
|
if (!this.navInterval) this.navInterval = setInterval(()=>this.navBaseTime(), this.timing.baseDelay);
|
||||||
}
|
}
|
||||||
stopNavBaseCount(reset) {
|
|
||||||
clearInterval(this.navInterval);
|
|
||||||
this.navInterval = undefined;
|
|
||||||
if (reset) this.resetNavBaseCount();
|
|
||||||
}
|
|
||||||
resetNavBaseCount() {
|
resetNavBaseCount() {
|
||||||
this.navBaseCount = 0;
|
this.navBaseCount = 0;
|
||||||
this.screenIndex = -1;
|
this.screenIndex = -1;
|
||||||
|
// reset the timing so we don't short-change the first screen
|
||||||
|
if (this.navInterval) {
|
||||||
|
clearInterval(this.navInterval);
|
||||||
|
this.navInterval = undefined;
|
||||||
|
}
|
||||||
|
this.startNavCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendNavDisplayMessage(message) {
|
sendNavDisplayMessage(message) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
module.exports = '3.1.0';
|
module.exports = '3.1.1';
|
Loading…
Reference in a new issue