added various useful commands

This commit is contained in:
2022-03-16 18:44:28 +01:00
parent d188b10f64
commit 6e14e1b268
5 changed files with 106 additions and 24 deletions

View File

@ -29,8 +29,8 @@ class ActionIds:
def pack_heater_test_into(object_id: bytearray, tc_queue: TcQueueT):
tc_queue.appendleft((QueueCommands.PRINT, "Testing Heater Switching"))
heater_number = int(input("Type number of heater to switch: "))
if heater_number >= SwitchNumbers.NUMBER_OF_SWITCHES:
heater_number = int(input("Type number of heater to switch [0-7]: "))
if heater_number >= SwitchNumbers.NUMBER_OF_SWITCHES or heater_number < 0:
print("Invalid heater switch number")
return
action = int(input("Turn switch on or off? (0 - off, 1 - on): "))
@ -52,7 +52,8 @@ def pack_switch_heater_command(
@param switch_action Action to perform. 0 - Sets switch off, 1 - Sets switch on.
"""
action_id = ActionIds.SWITCH_HEATER
command = object_id + action_id
command = bytearray()
command += object_id + action_id
command.append(switch_nr)
command.append(switch_action)
return command