G6EJD / ESP32-e-Paper-Weather-Display

An ESP32 and 2.9", 4.2" or 7.5" ePaper Display reads Weather Underground data via their API and then displays the weather
Other
946 stars 206 forks source link

Sun Icon During Nighttime #207

Closed Jarod96 closed 1 year ago

Jarod96 commented 1 year ago

I'm looking for a way to get rid of the sun icon during nighttime, say between sunset and sunrise, and displaying the moon in it's place instead. is there a change that can be done easily without having to rewrite everything? how to proceed? please enlighten me! Thank you, 20230421_014324 EPD 5.83inch

G6EJD commented 1 year ago

The OWM icons are the same day and night, so I added the moon symbol. you could in each function add a test in from of the addsun function to only draw it when there is no moon request.

G6EJD commented 1 year ago

if (!IconName.endsWith("n")) addsun(..

Jarod96 commented 1 year ago

Thanks for your helpful reply, I was struggling to figure out a way to fix that! What is the condition that make a moon request? I've searched everywhere in the code to understand how it work but without success... Also, can I make the sun appear only after sunrise and before sunset? since sometime the moon is up there in the sky with the sun altogether

G6EJD commented 1 year ago

OWM issue the icon number eg 01d or 01n hence the test checks endswith ‘n’ they calculate when it is passed sunset for your region and add ‘n’ at night