1
0
Fork 0

Solar Clock: BUGFIX:Sun sometimes disappearing from view completely until button1 is pressed.

master
adrian w kirk 2021-08-05 20:36:58 +01:00
parent 581e2773d7
commit 91a957adeb
2 changed files with 1 additions and 11 deletions

View File

@ -350,7 +350,7 @@ location.addUpdateListener(
// The function also has to detect when the end of the solar
// day has been reached and flip the day over.
function dayInfo(now) {
if (day_info == null || now > day_info.day_end) {
if (day_info == null || now > day_info.day_end || now < day_info.day_start) {
var coords = location.getCoordinates();
if(coords != null) {
day_info = DateUtils.sunrise_sunset(now, coords[0], coords[1], location.getUTCOffset());

View File

@ -121,7 +121,6 @@ class SolarMode {
}
}
class NightMode extends SolarMode {
toString(){return "NightMode";}
test(time, day_info, screen_info, img_info) {
return (time < day_info.sunrise_date || time > day_info.sunset_date);
}
@ -130,9 +129,6 @@ class NightMode extends SolarMode {
}
}
class DayLightMode extends SolarMode {
toString(){
return "DayLightMode";
}
test(time, day_info, screen_info){
var sun_height = screen_info.sunrise_y - screen_info.sun_y;
/*console.log("DayLightMode " +
@ -190,9 +186,6 @@ class DayLightMode extends SolarMode {
}
}
class TwiLightMode extends SolarMode {
toString(){
return "TwilightMode";
}
test(time, day_info, screen_info){
if(screen_info.sunrise_y == null) {
console.log("warning no sunrise_defined");
@ -233,9 +226,6 @@ class SolarControllerImpl {
this.default_mode = new NightMode();
this.last = null;
}
toString(){
return "SolarControllerImpl";
}
// The mode method is responsible for selecting the
// correct mode to the time given.
mode(time, day_info, screen_info){