This commit is contained in:
Jonas Zeunert
2022-08-31 17:39:19 +02:00
parent 7dea027c6c
commit 0e786ac17f
2 changed files with 17 additions and 6 deletions

View File

@@ -49,21 +49,29 @@ class GameState:
def stopIdleLoop(self):
self.isIdle.set()
self.deactivate_all()
pass
def deactivate_all(self):
all_cabinet_lamps = [BONUS_LAMPS, BONUS_MULTIPLIER_LAMPS, CHAMP_LAMPS,
UPPER_PLAYFIELD_TIME_LAMPS, TUNNEL_NUMBER_LAMPS,
TUNNEL_LAMPS, TUNNEL_SCORE_LAMPS]
for lamp_group in all_cabinet_lamps:
lamp_group.deactivate()
async def idleLoop(self):
all_cabinet_lamps = [BONUS_LAMPS, BONUS_MULTIPLIER_LAMPS, CHAMP_LAMPS,
UPPER_PLAYFIELD_TIME_LAMPS, TUNNEL_NUMBER_LAMPS,
TUNNEL_LAMPS, TUNNEL_SCORE_LAMPS]
while True:
#for lamps in all_cabinet_lamps:
#for _ in lamps.lamps:
#lamps.cycle()
#if not self.isIdle:
# return
#time.sleep(0.1)
random_group = random.choice(all_cabinet_lamps)
random_group.toggleRandom(0.2)
for lamps in all_cabinet_lamps:
for _ in lamps.lamps:
lamps.cycle()
if self.isIdle.is_set():
return
time.sleep(0.05)
if self.isIdle.is_set():
return

View File

@@ -43,9 +43,12 @@ class LampGroup:
def toggleRandom(self, sleepTime):
count = random.randint(1,3)
random_lamps = random.choices(self.lamps, k=count)
for lamp in random_lamps:
lamp.activate()
time.sleep(sleepTime)
for lamp in random_lamps:
lamp.deactivate()