Skip to content

Commit

Permalink
Allow changing the number of exit jingles at runtime (j / J)
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-stepanov committed Apr 27, 2024
1 parent ffec03b commit d88ff20
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion advent/advent.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def handleKeyboard(self, key):
global REC_INTERVAL
global FORCE_HIT
global FORCE_HIT_OVERRIDE
global NUM_EXIT_JINGLES

threading.current_thread().name = "Thread-KB"
print('')
Expand Down Expand Up @@ -215,7 +216,7 @@ def handleKeyboard(self, key):
if REC_INTERVAL > 0.5:
LOGGER.info(f'User: decrease interval. Interval decreased by 0.5 s ({REC_INTERVAL} s --> {REC_INTERVAL - 0.5} s)')
else:
LOGGER.info('User: decrease interval')
LOGGER.info('User: decrease interval. Interval is already at minimum (0.5 s)')
updateInterval(REC_INTERVAL - 0.5)
elif key == 'I':
LOGGER.info(f'User: increase interval. Interval increased by 0.5 s ({REC_INTERVAL} s --> {REC_INTERVAL + 0.5} s)')
Expand All @@ -232,10 +233,20 @@ def handleKeyboard(self, key):
LOGGER.info('User: emulate a hit without TV dead time')
FORCE_HIT_OVERRIDE = True
FORCE_HIT = True
elif key == 'j':
if NUM_EXIT_JINGLES > 1:
NUM_EXIT_JINGLES -= 1
LOGGER.info(f'User: decrease number of exit jingles. Number decreased {NUM_EXIT_JINGLES + 1} --> {NUM_EXIT_JINGLES}')
else:
LOGGER.info(f'User: decrease number of exit jingles. The number is already at minimum (1)')
elif key == 'J':
NUM_EXIT_JINGLES += 1
LOGGER.info(f'User: increase number of exit jingles. Number increased {NUM_EXIT_JINGLES - 1} --> {NUM_EXIT_JINGLES}')
elif key == 'h':
print('h - help')
print('t / T - emulate a hit / unconditionally')
print('a - toggle \'in action\' status')
print('j / J - exit jingles\' number decrease / increase')
# n / N is reserved for potential change of threads at runtime
print('i / I - interval decrease / increase')
print('c / C - confidence decrease / increase')
Expand Down

0 comments on commit d88ff20

Please sign in to comment.