diff --git a/README.md b/README.md index f366021..63fe4c6 100644 --- a/README.md +++ b/README.md @@ -335,6 +335,10 @@ Before reporting an issue or requesting a feature please consider that this is n Note: not all units are converted to metric, if selected. Some text-based products such as warnings are simple text strings provided from the national weather service and thus have baked-in units such as "gusts up to 60 mph." These values will not be converted. +## The full moon icon is broken + +This is a known problem with the Ws4kp as it ages. It was a problem with the [actual Weatherstar hardware](https://youtu.be/rcUwlZ4pqh0?feature=shared&t=116) as well. + ## Related Projects Not retro enough? Try the [Weatherstar 3000+](https://github.com/netbymatt/ws3kp) diff --git a/server/images/gimp/Full-Moon-Degraded.xcf b/server/images/gimp/Full-Moon-Degraded.xcf new file mode 100644 index 0000000..955a36e Binary files /dev/null and b/server/images/gimp/Full-Moon-Degraded.xcf differ diff --git a/server/images/icons/current-conditions/No-Data.png b/server/images/gimp/No-Data.png similarity index 100% rename from server/images/icons/current-conditions/No-Data.png rename to server/images/gimp/No-Data.png diff --git a/server/images/gimp/No-Data.xcf b/server/images/gimp/No-Data.xcf new file mode 100644 index 0000000..fba360c Binary files /dev/null and b/server/images/gimp/No-Data.xcf differ diff --git a/server/images/icons/current-conditions/No-Data.gif b/server/images/icons/current-conditions/No-Data.gif new file mode 100644 index 0000000..b056822 Binary files /dev/null and b/server/images/icons/current-conditions/No-Data.gif differ diff --git a/server/images/icons/moon-phases/Full-Moon-Degraded.gif b/server/images/icons/moon-phases/Full-Moon-Degraded.gif new file mode 100644 index 0000000..109272f Binary files /dev/null and b/server/images/icons/moon-phases/Full-Moon-Degraded.gif differ diff --git a/server/scripts/modules/almanac.mjs b/server/scripts/modules/almanac.mjs index 7d9190f..3eee356 100644 --- a/server/scripts/modules/almanac.mjs +++ b/server/scripts/modules/almanac.mjs @@ -9,11 +9,19 @@ class Almanac extends WeatherDisplay { constructor(navId, elemId) { super(navId, elemId, 'Almanac', true); + // occasional degraded moon icon + this.iconPaths = { + Full: imageName(Math.random() > 0.995 ? 'Degraded' : 'Full'), + Last: imageName('Last'), + New: imageName('New'), + First: imageName('First'), + }; + // preload the moon images - preloadImg(imageName('Full')); - preloadImg(imageName('Last')); - preloadImg(imageName('New')); - preloadImg(imageName('First')); + preloadImg(this.iconPaths.Full); + preloadImg(this.iconPaths.Last); + preloadImg(this.iconPaths.New); + preloadImg(this.iconPaths.First); this.timing.totalScreens = 1; } @@ -142,7 +150,7 @@ class Almanac extends WeatherDisplay { fill.date = date; fill.type = MoonPhase.phase; - fill.icon = { type: 'img', src: imageName(MoonPhase.phase) }; + fill.icon = { type: 'img', src: this.iconPaths[MoonPhase.phase] }; return this.fillTemplate('day', fill); }); @@ -169,6 +177,8 @@ const imageName = (type) => { switch (type) { case 'Full': return 'images/icons/moon-phases/Full-Moon.gif'; + case 'Degraded': + return 'images/icons/moon-phases/Full-Moon-Degraded.gif'; case 'Last': return 'images/icons/moon-phases/Last-Quarter.gif'; case 'New': diff --git a/server/scripts/modules/currentweather.mjs b/server/scripts/modules/currentweather.mjs index 045cefe..af9ff1c 100644 --- a/server/scripts/modules/currentweather.mjs +++ b/server/scripts/modules/currentweather.mjs @@ -85,7 +85,6 @@ class CurrentWeather extends WeatherDisplay { const requiredFields = [ { name: 'temperature', check: (props) => props.temperature?.value === null, required: true }, { name: 'textDescription', check: (props) => props.textDescription === null || props.textDescription === '', required: true }, - { name: 'icon', check: (props) => props.icon === null, required: true }, { name: 'windSpeed', check: (props) => props.windSpeed?.value === null, required: false }, { name: 'dewpoint', check: (props) => props.dewpoint?.value === null, required: false }, { name: 'barometricPressure', check: (props) => props.barometricPressure?.value === null, required: false }, diff --git a/server/scripts/modules/icons/icons-large.mjs b/server/scripts/modules/icons/icons-large.mjs index be24564..7280590 100644 --- a/server/scripts/modules/icons/icons-large.mjs +++ b/server/scripts/modules/icons/icons-large.mjs @@ -13,7 +13,7 @@ const largeIcon = (link, _isNightTime) => { } catch (error) { console.warn(`largeIcon: ${error.message}`); // Return a fallback icon to prevent downstream errors - return addPath(_isNightTime ? 'Clear.gif' : 'Sunny.gif'); + return addPath(`No-Data.gif?${conditionIcon}${isNightTime ? '-n' : ''}`); } // find the icon @@ -169,7 +169,7 @@ const largeIcon = (link, _isNightTime) => { default: { console.warn(`Unknown weather condition '${conditionIcon}' from ${link}; using fallback icon`); // Return a reasonable fallback instead of false to prevent downstream errors - return addPath(isNightTime ? 'Clear.gif' : 'Sunny.gif'); + return addPath(`No-Data.gif?${conditionIcon}${isNightTime ? '-n' : ''}`); } } };