kopia lustrzana https://github.com/peterhinch/micropython-samples
astronomy: Changes to README.md
rodzic
2068a3946e
commit
e55334f690
|
@ -309,7 +309,7 @@ from sched.sun_moon import RiSet
|
|||
|
||||
async def turn_off_lights(rs): # Runs every day at 00:01:00
|
||||
rs.set_day() # Re-calculate for new daylight
|
||||
asyncio.sleep(rs.sunrise() - 60)
|
||||
await asyncio.sleep(rs.sunrise() - 60)
|
||||
# Actually turn them off
|
||||
|
||||
async def main():
|
||||
|
@ -328,7 +328,7 @@ from sched.sched import schedule, Sequence
|
|||
from sched.sun_moon import RiSet
|
||||
|
||||
async def turn_off_lights(t):
|
||||
asyncio.sleep(t)
|
||||
await asyncio.sleep(t)
|
||||
# Actually turn them off
|
||||
|
||||
async def main():
|
||||
|
|
|
@ -254,7 +254,7 @@ class RiSet:
|
|||
st = self.sunset(1) if sun else self.moonset(1)
|
||||
if rt is None:
|
||||
if st is None:
|
||||
t = (now % 86400) / 3600 # Time as UTC hours (float)
|
||||
t = (now % 86400) / 3600 # Time as UTC hour of day (float)
|
||||
return self.sin_alt(t, sun) > 0
|
||||
return st > now
|
||||
if st is None:
|
||||
|
|
Ładowanie…
Reference in New Issue