Skip to content

Commit

Permalink
Finish queue
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwohlbruck committed May 2, 2022
1 parent 4386b17 commit e70fa17
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions client/src/views/LampSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
v-container.d-flex.flex-column.align-center
v-card.pa-6.d-flex.flex-column.small-container(flat outlined style='gap: 2rem')
v-fade-transition
v-overlay(absolute v-if='loadingConfigf')
v-overlay(absolute v-if='loadingConfig')
v-progress-circular(indeterminate)

.d-flex
Expand All @@ -12,7 +12,7 @@ v-container.d-flex.flex-column.align-center
| {{ name && name.length ? name : (lamp ? lamp.name : 'Lamp') }} settings
v-spacer
transition(name='bounce')
.d-flex.mt-2(v-hide='!saving')
.d-flex.mt-2(v-if='saving')
span.mr-2 Saving
v-progress-circular.mt-1.ml-1(indeterminate size='20')

Expand Down
11 changes: 10 additions & 1 deletion micro/app/commander.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

server = None
last_active = False
last_colors = [(255,255,255)]
last_colors = ['#ffffff']
reading_light_on = False

last_room_is_lit = True
Expand Down Expand Up @@ -79,6 +79,7 @@ def deactivate_local():
if reading_light_on:
turn_on_reading_light(last_colors)
else:
print(last_colors)
state = state_from_color_list(last_colors, BRIGHTNESS * .05)
set(state)

Expand Down Expand Up @@ -108,6 +109,12 @@ def room_is_lit(val):
print('room is lit' + str(val))
global last_room_is_lit
last_room_is_lit = val

# If dark, turn off the light completely
if not val:
turn_off()
return

dequeue()

# Triggered by input.py when motion is detected
Expand All @@ -121,6 +128,7 @@ def motion_detected(val):
def dequeue():
global last_room_is_lit
global last_motion_detected
print(last_room_is_lit, last_motion_detected)
if last_room_is_lit and last_motion_detected:
# Wait 1 second between dequeuing
while len(message_queue) > 0:
Expand Down Expand Up @@ -194,6 +202,7 @@ def update_config(config):
else:
global last_active
global last_colors

if last_active:
activate_local()
else:
Expand Down
2 changes: 1 addition & 1 deletion micro/app/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def input_watcher():
if motion_old != motion_new:
# print('motion =', motion_new)
motion_old = motion_new
motion_detected(motion_new)
motion_detected(motion_new == 1)

# Light sensor
light_values.append(light_new)
Expand Down

0 comments on commit e70fa17

Please sign in to comment.