@@ -111,10 +111,7 @@ def divide_time(z):
111
111
def sun_countdown (sun_event ):
112
112
n = get_request (5 , io .receive_time ())
113
113
remaining = time .mktime (sun_event ) - time .mktime (n )
114
- < << << << Updated upstream
115
- == == == =
116
114
r = remaining
117
- >> >> >> > Stashed changes
118
115
# print(remaining)
119
116
# calculate the seconds remaining
120
117
secs_remaining = remaining % 60 # pylint: disable=unused-variable
@@ -125,12 +122,6 @@ def sun_countdown(sun_event):
125
122
# calculate the hours remaining
126
123
hours_until = remaining % 24
127
124
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
- == == == =
134
125
return r , hours_until , minutes_until , n
135
126
try :
136
127
total_until_rise , hours_until_sunrise , mins_until_sunrise , now = sun_countdown (rise_time )
@@ -140,7 +131,6 @@ def sun_countdown(sun_event):
140
131
total_until_set , hours_until_sunset , mins_until_sunset , now = sun_countdown (set_time )
141
132
except Exception as e :
142
133
reset_on_error (10 , e )
143
- >> >> >> > Stashed changes
144
134
145
135
# red and yellow color percentage for neopixels
146
136
percent_red = 0
@@ -156,10 +146,7 @@ def sun_countdown(sun_event):
156
146
print (total_until_set )
157
147
# check to see if the star fragment should be lit up on start-up
158
148
if total_until_set < 0 :
159
- < << << << Updated upstream
160
- == == == =
161
149
print ("star glow true" )
162
- >> >> >> > Stashed changes
163
150
star_glow = True
164
151
percent_red = 255
165
152
percent_yellow = 125
@@ -196,33 +183,21 @@ def sun_countdown(sun_event):
196
183
sunrise , sunset = sun_clock ()
197
184
(total_until_set , hours_until_sunset ,
198
185
mins_until_sunset , now ) = sun_countdown (set_time )
199
- << << << < Updated upstream
200
- == == == =
201
186
print (now )
202
- >> >> >> > Stashed changes
203
187
print ("%d hour(s) until sunset" % hours_until_sunset )
204
188
print ("%d minutes(s) until sunset" % mins_until_sunset )
205
189
print (sunset )
190
+ print (percent_red )
206
191
print ()
207
192
# 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
- == == == =
213
193
if hours_until_sunset in (0 , 23 ):
214
194
# check every minute
215
195
time_check = 300000
216
- > >> >> >> Stashed changes
217
196
# map color to ramp up in brightness over the course of the final hour
218
197
percent_red = simpleio .map_range (mins_until_sunset , 59 , 0 , 0 , 255 )
219
198
percent_yellow = simpleio .map_range (mins_until_sunset , 59 , 0 , 0 , 125 )
220
199
# if the sun has set..
221
- < << << << Updated upstream
222
- if mins_until_sunset < 1 :
223
- == == == =
224
200
if total_until_set < 0 :
225
- > >> >> >> Stashed changes
226
201
percent_red = 255
227
202
percent_yellow = 125
228
203
time_check = 900000
@@ -250,36 +225,21 @@ def sun_countdown(sun_event):
250
225
sunrise , sunset = sun_clock ()
251
226
(total_until_rise , hours_until_sunrise ,
252
227
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
- == == == =
264
228
print (now )
265
229
print ("%d hour(s) until sunrise" % hours_until_sunrise )
266
230
print ("%d minutes(s) until sunrise" % mins_until_sunrise )
267
231
print (sunrise )
232
+ print (now )
268
233
print ()
269
234
# less than an hour until sunset...
270
235
if hours_until_sunrise in (0 , 23 ):
271
236
# check every minute
272
237
time_check = 300000
273
- > >> >> >> Stashed changes
274
238
# map color to decrease brightness over the course of the final hour
275
239
percent_red = simpleio .map_range (mins_until_sunrise , 59 , 0 , 255 , 0 )
276
240
percent_yellow = simpleio .map_range (mins_until_sunrise , 59 , 0 , 125 , 0 )
277
241
# if the sun has risen..
278
- < << << << Updated upstream
279
- if mins_until_sunrise < 1 :
280
- == == == =
281
242
if total_until_rise < 0 :
282
- > >> >> >> Stashed changes
283
243
percent_red = 0
284
244
percent_yellow = 0
285
245
time_check = 900000
@@ -310,14 +270,5 @@ def sun_countdown(sun_event):
310
270
# turn neopixels on using RGB values
311
271
pixels .fill ((percent_red , percent_yellow , 0 ))
312
272
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
- == == == =
321
273
except Exception as e :
322
274
reset_on_error (10 , e )
323
- >> >> >> > Stashed changes
0 commit comments