mirror of
https://github.com/puzzle/lightning-beer-tap.git
synced 2025-12-17 15:14:25 +01:00
Cleanup GPIO handler, support third tap
This commit is contained in:
@@ -20,6 +20,7 @@ r_ch3 = 21
|
|||||||
# single tap
|
# single tap
|
||||||
t_large_beer = 6
|
t_large_beer = 6
|
||||||
t_small_beer = 2
|
t_small_beer = 2
|
||||||
|
|
||||||
# double tap
|
# double tap
|
||||||
t_left_tap = 6
|
t_left_tap = 6
|
||||||
t_right_tap = 6
|
t_right_tap = 6
|
||||||
@@ -27,8 +28,6 @@ t_right_tap = 6
|
|||||||
t_flush = 20
|
t_flush = 20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Syntax suger because of negative logic
|
# Syntax suger because of negative logic
|
||||||
S_ON = GPIO.LOW
|
S_ON = GPIO.LOW
|
||||||
S_OFF = GPIO.HIGH
|
S_OFF = GPIO.HIGH
|
||||||
@@ -58,25 +57,24 @@ def cli_args_parser():
|
|||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-f',
|
'-f1',
|
||||||
'--flush',
|
'--flush1',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Flush tap for 20s!"
|
help="Flush tap 1 for 20s!"
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-f2',
|
'-f2',
|
||||||
'--flush2',
|
'--flush2',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Flush tap for 20s!"
|
help="Flush tap 2 for 20s!"
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-m',
|
'-f3',
|
||||||
'--memo',
|
'--flush3',
|
||||||
action='store',
|
action='store_true',
|
||||||
dest='memo',
|
help="Flush tap 3 for 20s!"
|
||||||
help="Precise product information"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
@@ -140,12 +138,15 @@ if __name__ == "__main__":
|
|||||||
if args.test:
|
if args.test:
|
||||||
print("Test mode enabled")
|
print("Test mode enabled")
|
||||||
gpio_test()
|
gpio_test()
|
||||||
elif args.flush:
|
elif args.flush1:
|
||||||
print("Choice: Flush tap")
|
print("Choice: Flush tap1")
|
||||||
draw_beer(r_ch1, t_flush)
|
draw_beer(r_ch1, t_flush)
|
||||||
elif args.flush2:
|
elif args.flush2:
|
||||||
print("Choice: Flush tap2")
|
print("Choice: Flush tap2")
|
||||||
draw_beer(r_ch2, t_flush)
|
draw_beer(r_ch2, t_flush)
|
||||||
|
elif args.flush3:
|
||||||
|
print("Choice: Flush tap3")
|
||||||
|
draw_beer(r_ch3, t_flush)
|
||||||
elif args.products == "LARGE":
|
elif args.products == "LARGE":
|
||||||
print("Choice: Large beer")
|
print("Choice: Large beer")
|
||||||
draw_beer(r_ch1, t_large_beer)
|
draw_beer(r_ch1, t_large_beer)
|
||||||
|
|||||||
Reference in New Issue
Block a user