Cleanup GPIO handler, support third tap

This commit is contained in:
Oliver Gugger
2019-08-09 15:34:31 +02:00
parent 48e5efb196
commit fa6fc8dc6a

View File

@@ -20,6 +20,7 @@ r_ch3 = 21
# single tap
t_large_beer = 6
t_small_beer = 2
# double tap
t_left_tap = 6
t_right_tap = 6
@@ -27,8 +28,6 @@ t_right_tap = 6
t_flush = 20
# Syntax suger because of negative logic
S_ON = GPIO.LOW
S_OFF = GPIO.HIGH
@@ -58,25 +57,24 @@ def cli_args_parser():
)
parser.add_argument(
'-f',
'--flush',
'-f1',
'--flush1',
action='store_true',
help="Flush tap for 20s!"
help="Flush tap 1 for 20s!"
)
parser.add_argument(
'-f2',
'--flush2',
action='store_true',
help="Flush tap for 20s!"
help="Flush tap 2 for 20s!"
)
parser.add_argument(
'-m',
'--memo',
action='store',
dest='memo',
help="Precise product information"
'-f3',
'--flush3',
action='store_true',
help="Flush tap 3 for 20s!"
)
return parser.parse_args()
@@ -140,12 +138,15 @@ if __name__ == "__main__":
if args.test:
print("Test mode enabled")
gpio_test()
elif args.flush:
print("Choice: Flush tap")
elif args.flush1:
print("Choice: Flush tap1")
draw_beer(r_ch1, t_flush)
elif args.flush2:
print("Choice: Flush tap2")
draw_beer(r_ch2, t_flush)
elif args.flush3:
print("Choice: Flush tap3")
draw_beer(r_ch3, t_flush)
elif args.products == "LARGE":
print("Choice: Large beer")
draw_beer(r_ch1, t_large_beer)