mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-14 07:39:29 -07:00
almanac, current weather, extended forecast, hazards #193
This commit is contained in:
@@ -47,10 +47,7 @@ class Almanac extends WeatherDisplay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
calcSunMoonData(weatherParameters) {
|
calcSunMoonData(weatherParameters) {
|
||||||
const sun = [
|
const sun = [0, 1, 2, 3, 4, 5, 6].map((days) => SunCalc.getTimes(DateTime.local().plus({ days }).toJSDate(), weatherParameters.latitude, weatherParameters.longitude));
|
||||||
SunCalc.getTimes(new Date(), weatherParameters.latitude, weatherParameters.longitude),
|
|
||||||
SunCalc.getTimes(DateTime.local().plus({ days: 1 }).toJSDate(), weatherParameters.latitude, weatherParameters.longitude),
|
|
||||||
];
|
|
||||||
|
|
||||||
// brute force the moon phases by scanning the next 30 days
|
// brute force the moon phases by scanning the next 30 days
|
||||||
const moon = [];
|
const moon = [];
|
||||||
|
|||||||
@@ -17,7 +17,13 @@ class ExtendedForecast extends WeatherDisplay {
|
|||||||
super(navId, elemId, 'Extended Forecast', true);
|
super(navId, elemId, 'Extended Forecast', true);
|
||||||
|
|
||||||
// set timings
|
// set timings
|
||||||
this.timing.totalScreens = 2;
|
if (settings.enhancedScreens?.value) {
|
||||||
|
this.timing.totalScreens = 1;
|
||||||
|
this.perPage = 4;
|
||||||
|
} else {
|
||||||
|
this.timing.totalScreens = 2;
|
||||||
|
this.perPage = 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getData(weatherParameters, refresh) {
|
async getData(weatherParameters, refresh) {
|
||||||
@@ -54,7 +60,7 @@ class ExtendedForecast extends WeatherDisplay {
|
|||||||
|
|
||||||
// determine bounds
|
// determine bounds
|
||||||
// grab the first three or second set of three array elements
|
// grab the first three or second set of three array elements
|
||||||
const forecast = parse(this.data.properties.periods, this.weatherParameters.forecast).slice(0 + 3 * this.screenIndex, 3 + this.screenIndex * 3);
|
const forecast = parse(this.data.properties.periods, this.weatherParameters.forecast).slice(0 + this.perPage * this.screenIndex, this.perPage + this.screenIndex * this.perPage);
|
||||||
|
|
||||||
// create each day template
|
// create each day template
|
||||||
const days = forecast.map((Day) => {
|
const days = forecast.map((Day) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user