Skip to content

Commit 48aae89

Browse files
committed
pylint
1 parent 7de9dd1 commit 48aae89

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

PyPortal_Wakeup_Light/wake_up_light.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
num_pixels = 30
2828
ORDER = neopixel.RGBW
2929
strip = neopixel.NeoPixel(board.D3, num_pixels, brightness=BRIGHTNESS,
30-
pixel_order=ORDER)
30+
pixel_order=ORDER)
3131
strip.fill(0)
3232
# color of strip
3333
WHITE = (255, 255, 255, 255)
@@ -52,22 +52,23 @@
5252
time_color = 0xFFFFFF
5353
time_position = (75,130)
5454
time_textarea = Label(big_font, max_glyphs=15, color=time_color,
55-
x=time_position[0], y=time_position[1])
55+
x=time_position[0], y=time_position[1])
5656

5757
wakeup_time_color = 0xFFFFFF
5858
wakeup_time_position = (15,200)
5959
wakeup_time_textarea = Label(info_font, max_glyphs=30, color=wakeup_time_color,
60-
x=wakeup_time_position[0], y=wakeup_time_position[1])
60+
x=wakeup_time_position[0], y=wakeup_time_position[1])
6161

6262
light_on_time_color = 0xFFFFFF
6363
light_on_time_position = (15,220)
6464
light_on_time_textarea = Label(info_font, max_glyphs=30, color=light_on_time_color,
65-
x=light_on_time_position[0], y=light_on_time_position[1])
65+
x=light_on_time_position[0], y=light_on_time_position[1])
6666

6767
pyportal.splash.append(time_textarea)
6868
pyportal.splash.append(wakeup_time_textarea)
6969
pyportal.splash.append(light_on_time_textarea)
7070

71+
# determines which day to pull wake up time from
7172
def whichDay():
7273
now = time.localtime()
7374
current_day = now[6]
@@ -89,6 +90,7 @@ def whichDay():
8990
wakeup_time_textarea.text = input_wake_up_time_text
9091
return input_wake_up_time
9192

93+
# subtract 30 min from given time to tell program when to start lights
9294
def subtract30min(time_before):
9395
hours_before, minutes_before = time_before.split(":")
9496
AM_PM_str = minutes_before[-1:]
@@ -112,7 +114,6 @@ def subtract30min(time_before):
112114
hours_after = 12
113115
sub30_str = format_str % (hours_after, minutes_after)
114116
light_on_time_textarea.text = "Light starting at: " + sub30_str
115-
return sub30_str
116117
elif minutes_before < 30:
117118
minutes_after = minutes_before + 30
118119
hours_after = hours_before - 1
@@ -128,8 +129,9 @@ def subtract30min(time_before):
128129
format_str = format_str[:-1]+"P"
129130
sub30_str = format_str % (hours_after, minutes_after)
130131
light_on_time_textarea.text = "Light starting at: " + sub30_str
131-
return sub30_str
132+
return sub30_str
132133

134+
# display current time
133135
def displayTime():
134136
now = time.localtime()
135137
hour, minute = now[3:5]
@@ -161,30 +163,28 @@ def displayTime():
161163
print("Some error occured, retrying! -", e)
162164
continue
163165
time_str_text = displayTime()
164-
print(time_str_text)
165166
currentHour = time.localtime()
166-
# if after 9am and before 9pm light is = 0.8
167+
# if after 9am and before 9pm backlight is = 0.8
167168
if currentHour[3] > 9 and currentHour[3] < 21:
168169
pyportal.set_backlight(0.8)
169-
# if after 9pm and before 9am light = 0.1
170+
# if after 9pm and before 9am backlight = 0.1
170171
else:
171172
pyportal.set_backlight(0.1)
172-
input_wake_up_time = whichDay()
173-
start_light_time = subtract30min(input_wake_up_time)
174-
print(start_light_time)
173+
wake_up_time = whichDay()
174+
start_light_time = subtract30min(wake_up_time)
175175
# If wake up time - 30 minutes equals current time, start the light
176176
if time_str_text == start_light_time:
177177
print("Starting wake up light")
178178
for i in range(light_minutes - 1):
179-
BRIGHTNESS = BRIGHTNESS + (MAX_BRIGHTNESS/light_minutes) # max 0.25, min 0.0
179+
BRIGHTNESS = BRIGHTNESS + (MAX_BRIGHTNESS/light_minutes)
180180
strip.fill(WHITE)
181181
strip.brightness = BRIGHTNESS
182182
displayTime()
183-
time.sleep(60) # 60 for once per min
183+
time.sleep(60) # increase brightness once per min
184184
while not pyportal.touchscreen.touch_point: # turn strip off
185185
displayTime()
186186
time.sleep(1)
187-
pass
187+
continue
188188
strip.brightness = MIN_BRIGHTNESS
189189
# update every 15 seconds
190-
time.sleep(15)
190+
time.sleep(15)

0 commit comments

Comments
 (0)