Closed ivanrad1 closed 4 years ago
As per https://github.com/ThingPulse/esp8266-weather-station/blob/master/src/SunMoonCalc.cpp#L24 our class is a port of a proven and popular Java class. If there's a bug upstream - and I have yet to see one - then it's here as well.
I have run through both of sources. In Java class angular values are returned in Radians and converted in degrees just before printing (see Main test program in Java source). In the ESP port they are returned in degrees in all cases except for result.sun.transitElevation & result.moon.transitElevation. So, multiplying with RAD_TO_DEG before printing has solved a problem for me.
Ouch, thanks for the analysis! Converting the transitElevation
property is missing in translateToHumanReadable()
at https://github.com/ThingPulse/esp8266-weather-station/blob/master/src/SunMoonCalc.cpp#L768.
Is anyone else getting this?
8<------------------------ BUG REPORT -----------------------------------------
Expected behavior
Expected Noon Time & Elevation for Sun & Moon for current date.
Actual behavior
Actual output: For both Moon and Sun transit elevation results are below 1 degree. Transit times seem to be OK.
Test code
Test.code: Examples/SunMoonCalcDemo.ino
Test.code.setings: SunMoonCalc smCalc = SunMoonCalc(tnow, 44.8531, 20.3687); WIFI_SSID, WIFI_PASSWORD as required
in void printResult(SunMoonCalc::Result result) added:
Serial.println("\tnoonTime: " + formatTime(result.sun.transit)); Serial.println("\tnoonElevation: " + String(result.sun.transitElevation) + "°"); Serial.println("\tnoonTime: " + formatTime(result.moon.transit)); Serial.println("\tnoonTimeElevation: " + String(result.moon.transitElevation) + "°");
Weather Station version
ESP2866 Weather Station 1.6.6
Hardware
ESP-01 black board 1M (noSPIFFS) Arduino 1.8.10 ESP8266 by ESP8266 Community 2.52 ESP2866 Weather Station 1.6.6 8<------------------------ END BUG REPORT -------------------------------------