kopia lustrzana https://github.com/peterhinch/micropython-samples
Temp commit
rodzic
0062b0f9a1
commit
f9107de893
|
@ -126,6 +126,10 @@ time (`MT`).
|
||||||
not computed, saving some processor time. Offsets are positive numbers
|
not computed, saving some processor time. Offsets are positive numbers
|
||||||
representing degrees below the horizon where twilight is deemed to start and end.
|
representing degrees below the horizon where twilight is deemed to start and end.
|
||||||
|
|
||||||
|
By default when an application instantiates `RiSet` for the first time the
|
||||||
|
constructor prints the system date and time. This can be inhibited by setting
|
||||||
|
the class variable `verbose` to `False`.
|
||||||
|
|
||||||
## 2.2 Methods
|
## 2.2 Methods
|
||||||
|
|
||||||
* `set_day(day: int = 0)` `day` is an offset in days from the current system
|
* `set_day(day: int = 0)` `day` is an offset in days from the current system
|
||||||
|
|
|
@ -201,6 +201,8 @@ def minimoon(t):
|
||||||
|
|
||||||
|
|
||||||
class RiSet:
|
class RiSet:
|
||||||
|
verbose = True
|
||||||
|
|
||||||
def __init__(self, lat=LAT, long=LONG, lto=0, tl=None): # Local defaults
|
def __init__(self, lat=LAT, long=LONG, lto=0, tl=None): # Local defaults
|
||||||
self.sglat = sin(radians(lat))
|
self.sglat = sin(radians(lat))
|
||||||
self.cglat = cos(radians(lat))
|
self.cglat = cos(radians(lat))
|
||||||
|
@ -213,6 +215,10 @@ class RiSet:
|
||||||
# [sunrise, sunset, moonrise, moonset, cvend, cvstart]
|
# [sunrise, sunset, moonrise, moonset, cvend, cvstart]
|
||||||
self._times = [None] * 6
|
self._times = [None] * 6
|
||||||
self.set_day() # Initialise to today's date
|
self.set_day() # Initialise to today's date
|
||||||
|
if RiSet.verbose:
|
||||||
|
t = time.localtime()
|
||||||
|
print(f"Machine time: {t[2]:02}/{t[1]:02}/{t[0]:4} {t[3]:02}:{t[4]:02}:{t[5]:02}")
|
||||||
|
RiSet.verbose = False
|
||||||
|
|
||||||
# ***** API start *****
|
# ***** API start *****
|
||||||
# Examine Julian dates either side of current one to cope with localtime.
|
# Examine Julian dates either side of current one to cope with localtime.
|
||||||
|
|
Ładowanie…
Reference in New Issue