@@ -111,10 +111,7 @@ def divide_time(z):
111111def sun_countdown (sun_event ):
112112 n = get_request (5 , io .receive_time ())
113113 remaining = time .mktime (sun_event ) - time .mktime (n )
114- < << << << Updated upstream
115- == == == =
116114 r = remaining
117- >> >> >> > Stashed changes
118115 # print(remaining)
119116 # calculate the seconds remaining
120117 secs_remaining = remaining % 60 # pylint: disable=unused-variable
@@ -125,12 +122,6 @@ def sun_countdown(sun_event):
125122 # calculate the hours remaining
126123 hours_until = remaining % 24
127124 remaining //= 24
128- < << << << Updated upstream
129- return remaining , hours_until , minutes_until , n
130-
131- total_until_rise , hours_until_sunrise , mins_until_sunrise , now = sun_countdown (rise_time )
132- total_until_set , hours_until_sunset , mins_until_sunset , now = sun_countdown (set_time )
133- == == == =
134125 return r , hours_until , minutes_until , n
135126try :
136127 total_until_rise , hours_until_sunrise , mins_until_sunrise , now = sun_countdown (rise_time )
@@ -140,7 +131,6 @@ def sun_countdown(sun_event):
140131 total_until_set , hours_until_sunset , mins_until_sunset , now = sun_countdown (set_time )
141132except Exception as e :
142133 reset_on_error (10 , e )
143- >> >> >> > Stashed changes
144134
145135# red and yellow color percentage for neopixels
146136percent_red = 0
@@ -156,10 +146,7 @@ def sun_countdown(sun_event):
156146print (total_until_set )
157147# check to see if the star fragment should be lit up on start-up
158148if total_until_set < 0 :
159- < << << << Updated upstream
160- == == == =
161149 print ("star glow true" )
162- >> >> >> > Stashed changes
163150 star_glow = True
164151 percent_red = 255
165152 percent_yellow = 125
@@ -196,33 +183,21 @@ def sun_countdown(sun_event):
196183 sunrise , sunset = sun_clock ()
197184 (total_until_set , hours_until_sunset ,
198185 mins_until_sunset , now ) = sun_countdown (set_time )
199- << << << < Updated upstream
200- == == == =
201186 print (now )
202- >> >> >> > Stashed changes
203187 print ("%d hour(s) until sunset" % hours_until_sunset )
204188 print ("%d minutes(s) until sunset" % mins_until_sunset )
205189 print (sunset )
190+ print (percent_red )
206191 print ()
207192 # less than an hour until sunset...
208- < << << << Updated upstream
209- if hours_until_sunset == 0 or hours_until_sunset == 23 :
210- # check every minute
211- time_check = 60000
212- == == == =
213193 if hours_until_sunset in (0 , 23 ):
214194 # check every minute
215195 time_check = 300000
216- > >> >> >> Stashed changes
217196 # map color to ramp up in brightness over the course of the final hour
218197 percent_red = simpleio .map_range (mins_until_sunset , 59 , 0 , 0 , 255 )
219198 percent_yellow = simpleio .map_range (mins_until_sunset , 59 , 0 , 0 , 125 )
220199 # if the sun has set..
221- < << << << Updated upstream
222- if mins_until_sunset < 1 :
223- == == == =
224200 if total_until_set < 0 :
225- > >> >> >> Stashed changes
226201 percent_red = 255
227202 percent_yellow = 125
228203 time_check = 900000
@@ -250,36 +225,21 @@ def sun_countdown(sun_event):
250225 sunrise , sunset = sun_clock ()
251226 (total_until_rise , hours_until_sunrise ,
252227 mins_until_sunrise , now ) = sun_countdown (rise_time )
253- < << << << Updated upstream
254- print ("%d hour(s) until sunrise" % hours_until_sunrise )
255- print ("%d minutes(s) until sunrise" % mins_until_sunrise )
256- print (sunrise )
257- print (now )
258- print ()
259- # less than an hour until sunset...
260- if hours_until_sunrise == 0 or hours_until_sunrise == 23 :
261- # check every minute
262- time_check = 60000
263- == == == =
264228 print (now )
265229 print ("%d hour(s) until sunrise" % hours_until_sunrise )
266230 print ("%d minutes(s) until sunrise" % mins_until_sunrise )
267231 print (sunrise )
232+ print (now )
268233 print ()
269234 # less than an hour until sunset...
270235 if hours_until_sunrise in (0 , 23 ):
271236 # check every minute
272237 time_check = 300000
273- > >> >> >> Stashed changes
274238 # map color to decrease brightness over the course of the final hour
275239 percent_red = simpleio .map_range (mins_until_sunrise , 59 , 0 , 255 , 0 )
276240 percent_yellow = simpleio .map_range (mins_until_sunrise , 59 , 0 , 125 , 0 )
277241 # if the sun has risen..
278- < << << << Updated upstream
279- if mins_until_sunrise < 1 :
280- == == == =
281242 if total_until_rise < 0 :
282- > >> >> >> Stashed changes
283243 percent_red = 0
284244 percent_yellow = 0
285245 time_check = 900000
@@ -310,14 +270,5 @@ def sun_countdown(sun_event):
310270 # turn neopixels on using RGB values
311271 pixels .fill ((percent_red , percent_yellow , 0 ))
312272 pixels .show ()
313- < << << << Updated upstream
314- # pylint: disable=broad-except
315- except Exception as e :
316- print ("Error:\n " , str (e ))
317- print ("Resetting microcontroller in 10 seconds" )
318- time .sleep (10 )
319- microcontroller .reset ()
320- == == == =
321273 except Exception as e :
322274 reset_on_error (10 , e )
323- >> >> >> > Stashed changes
0 commit comments