New Moon Icon not all black
G6EJD opened this issue · comments
A new moon has no light reflected from it, currently there is a light edge on the right of the moon.
Also add Northern or Southern Hemisphere to the setup. Icons are reversed for Sothern hemisphere.
Hemisphere support would have to be added in the other repository at https://github.com/ThingPulse/esp8266-weather-station/blob/master/src/WundergroundAstronomy.cpp#L99. WU provides a hemisphere
property for this: http://api.wunderground.com/api/KEY/astronomy/q/Australia/Sydney.json has "South", https://api.wunderground.com/api/KEY/astronomy/q/CA/San_Francisco.json has "North". Interested in helping out with a PR?
As for the new moon image, are you saying that the calculation at https://github.com/ThingPulse/esp8266-weather-station-color/blob/master/esp8266-weather-station-color.ino#L278 be wrong or that the actual icon be wrong?
This is the WU response for my location today:
, "moon_phase": {
"percentIlluminated":"0",
"ageOfMoon":"0",
"phaseofMoon":"New Moon",
"hemisphere":"North",
"current_time": {
"hour":"13",
"minute":"42"
},
The moon age is 0 as it's a new moon. The conversion of 0 as a moon age results in a character of 65, which should be an all black icon, instead it is showing about 2% of illumination on the East side of the moon. You should have the same in your location. I think the icon is wrong. Not checked yet I'm using the Espaper version, so it seems to be common to the moonphase icon library.
I think the Northern/Southern switch would be straightforward as the images are all the same just used in a different order:
South /North
1 New(S)=New(N) 1
2 Waxing Crescent(S)=Waning Crescent(N) 8
3 First Quarter(S)=Third Quarter(N) 7
4 Waxing Gibbous(S)=Waning Gibbous(N) 6
5 Full(S)=Full(N) 5
6 Waning Gibbous(S)=Waxing Gibbous(N) 4
7 Third Quarter(S)=First Quarter(N) 3
8 Waning Crescent(S)=Waxing Crescent(N) 2
So the change is (Phase==1?1:10-Phase)
Such that:
1=1
2=8
3=7
And so on.
If I can find the time I'll modify it, may take a few days or more.
OK, I've tested a modification:
- There are 30 WU Moon icons for display, copied into moonphases.h
- Image 1.gif at WU is the New Moon and is all Black, in your library image A (=WU 1) has 2% white on the right, so the library is wrong and needs a new all black image adding.
- When a new property extraction is added to the JSON 'hemisphere' this will work:
// moonAgeImage = String((char) (65 + 26 * (((abs((astronomy.hemisphere=="North"?0:30)-astronomy.moonAge.toInt())) % 30) / 30.0))); - If in the Southern Hemisphere it reverses all the images.
Weather Underground closed their existing API for non-paying customers on 2018-12-31. After they stopped issuing free API keys for low-volume personal use in May we migrated to OpenWeatherMap and deprecated all WU code in this library.
We are now closing all WU-related issues and PRs.