Merge branch 'main' of https://egit.irs.uni-stuttgart.de/eive/eive-tmtc
This commit is contained in:
@ -19,8 +19,8 @@ from tmtccmd.config.tmtc import tmtc_definitions_provider, OpCodeEntry
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
|
||||
from tmtccmd.tc.pus_8_fsfw_funccmd import create_fsfw_action_cmd
|
||||
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
|
||||
@ -83,7 +83,7 @@ FACTORY_RESET_OPS = {
|
||||
}
|
||||
|
||||
|
||||
class SupvActionIds:
|
||||
class SupvActionId:
|
||||
HK_REPORT = 1
|
||||
START_MPSOC = 3
|
||||
SHUTWOWN_MPSOC = 4
|
||||
@ -232,19 +232,19 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
prefix = "PLOC Supervisor"
|
||||
if op_code in OpCodes.OFF:
|
||||
q.add_log_cmd(f"{prefix}: {Info.OFF}")
|
||||
command = pack_mode_data(object_id.as_bytes, Modes.OFF, 0)
|
||||
command = pack_mode_data(object_id.as_bytes, Mode.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code in OpCodes.ON:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ON}")
|
||||
command = pack_mode_data(object_id.as_bytes, Modes.ON, 0)
|
||||
command = pack_mode_data(object_id.as_bytes, Mode.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code in OpCodes.NORMAL:
|
||||
q.add_log_cmd(f"{prefix}: {Info.NML}")
|
||||
command = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0)
|
||||
command = pack_mode_data(object_id.as_bytes, Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code in OpCodes.HK_TO_OBC:
|
||||
q.add_log_cmd(f"{prefix}: {Info.HK_TO_OBC}")
|
||||
command = obyt + struct.pack("!I", SupvActionIds.HK_REPORT)
|
||||
command = obyt + struct.pack("!I", SupvActionId.HK_REPORT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.REQUEST_HK:
|
||||
q.add_log_cmd(f"{prefix}: {Info.REQUEST_HK}")
|
||||
@ -253,11 +253,11 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
q.add_pus_tc(cmd)
|
||||
elif op_code in OpCodes.START_MPSOC:
|
||||
q.add_log_cmd("PLOC Supervisor: Start MPSoC")
|
||||
command = obyt + struct.pack("!I", SupvActionIds.START_MPSOC)
|
||||
command = obyt + struct.pack("!I", SupvActionId.START_MPSOC)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.SHUTDOWN_MPSOC:
|
||||
q.add_log_cmd("PLOC Supervisor: Shutdown MPSoC")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.SHUTWOWN_MPSOC)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.SHUTWOWN_MPSOC)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.SEL_NVM:
|
||||
q.add_log_cmd("PLOC Supervisor: Select MPSoC boot image")
|
||||
@ -279,9 +279,9 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
print("Key invalid!")
|
||||
break
|
||||
q.add_pus_tc(
|
||||
create_fsfw_action_cmd(
|
||||
create_action_cmd(
|
||||
object_id=PLOC_SUPV_ID,
|
||||
action_id=SupvActionIds.FACTORY_RESET,
|
||||
action_id=SupvActionId.FACTORY_RESET,
|
||||
user_data=bytes([key]),
|
||||
)
|
||||
)
|
||||
@ -290,35 +290,35 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
restart_tries = int(input("Specify maximum restart tries: "))
|
||||
command = (
|
||||
object_id.as_bytes
|
||||
+ struct.pack("!I", SupvActionIds.SET_MAX_RESTART_TRIES)
|
||||
+ struct.pack("!I", SupvActionId.SET_MAX_RESTART_TRIES)
|
||||
+ struct.pack("!B", restart_tries)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "9":
|
||||
q.add_log_cmd("PLOC Supervisor: Reset MPSoC")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.RESET_MPSOC)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.RESET_MPSOC)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.SET_TIME_REF:
|
||||
q.add_log_cmd("PLOC Supervisor: Set time reference")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.SET_TIME_REF)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.SET_TIME_REF)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "11":
|
||||
q.add_log_cmd("PLOC Supervisor: Set boot timeout")
|
||||
boot_timeout = int(input("Specify boot timeout [ms]: "))
|
||||
command = (
|
||||
object_id.as_bytes
|
||||
+ struct.pack("!I", SupvActionIds.SET_BOOT_TIMEOUT)
|
||||
+ struct.pack("!I", SupvActionId.SET_BOOT_TIMEOUT)
|
||||
+ struct.pack("!I", boot_timeout)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "12":
|
||||
q.add_log_cmd("PLOC Supervisor: Disable HK")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.DISABLE_HK)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.DISABLE_HK)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.REQ_BOOT_STATUS_REPORT:
|
||||
q.add_log_cmd(f"{prefix}: {Info.REQ_BOOT_STATUS_REPORT}")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.GET_BOOT_STATUS_REPORT
|
||||
"!I", SupvActionId.GET_BOOT_STATUS_REPORT
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
q.add_wait_seconds(2.0)
|
||||
@ -352,13 +352,13 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
if op_code == "26":
|
||||
q.add_log_cmd("PLOC Supervisor: Request latchup status report")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.GET_LATCHUP_STATUS_REPORT
|
||||
"!I", SupvActionId.GET_LATCHUP_STATUS_REPORT
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "27":
|
||||
q.add_log_cmd("PLOC Supervisor: Copy ADC data to MRAM")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.COPY_ADC_DATA_TO_MRAM
|
||||
"!I", SupvActionId.COPY_ADC_DATA_TO_MRAM
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "30":
|
||||
@ -380,7 +380,7 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
if op_code == "37":
|
||||
q.add_log_cmd("PLOC Supervisor: Restart supervisor")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.RESTART_SUPERVISOR
|
||||
"!I", SupvActionId.RESTART_SUPERVISOR
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.START_UPDATE:
|
||||
@ -394,14 +394,12 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
if op_code == "43":
|
||||
q.add_log_cmd("PLOC Supervisor: Terminate supervisor process")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.TERMINATE_SUPV_HELPER
|
||||
"!I", SupvActionId.TERMINATE_SUPV_HELPER
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "44":
|
||||
q.add_log_cmd("PLOC Supervisor: Start MPSoC quiet")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.START_MPSOC_QUIET
|
||||
)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.START_MPSOC_QUIET)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "45":
|
||||
q.add_log_cmd("PLOC Supervisor: Set shutdown timeout")
|
||||
@ -409,15 +407,15 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.FACTORY_FLASH:
|
||||
q.add_log_cmd(f"{prefix}: {Info.FACTORY_FLASH}")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.FACTORY_FLASH)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.FACTORY_FLASH)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "47":
|
||||
q.add_log_cmd("PLOC Supervisor: Enable auto TM")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.ENABLE_AUTO_TM)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.ENABLE_AUTO_TM)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "48":
|
||||
q.add_log_cmd("PLOC Supervisor: Disable auto TM")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.DISABLE_AUTO_TM)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.DISABLE_AUTO_TM)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "51":
|
||||
q.add_log_cmd("PLOC Supervisor: Logging request event buffers")
|
||||
@ -426,7 +424,7 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
if op_code == "52":
|
||||
q.add_log_cmd("PLOC Supervisor: Logging clear counters")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.LOGGING_CLEAR_COUNTERS
|
||||
"!I", SupvActionId.LOGGING_CLEAR_COUNTERS
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "53":
|
||||
@ -436,18 +434,18 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
if op_code == "54":
|
||||
q.add_log_cmd("PLOC Supervisor: Logging request counters")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.LOGGING_REQUEST_COUNTERS
|
||||
"!I", SupvActionId.LOGGING_REQUEST_COUNTERS
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "55":
|
||||
q.add_log_cmd("PLOC Supervisor: Request ADC report")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.REQUEST_ADC_REPORT
|
||||
"!I", SupvActionId.REQUEST_ADC_REPORT
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "56":
|
||||
q.add_log_cmd("PLOC Supervisor: Reset PL")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.RESET_PL)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.RESET_PL)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "57":
|
||||
q.add_log_cmd("PLOC Supervisor: Enable NVMs")
|
||||
@ -455,14 +453,14 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
nvm3 = int(input("Enable (1) or disable(0) NVM 3: "))
|
||||
command = (
|
||||
object_id.as_bytes
|
||||
+ struct.pack("!I", SupvActionIds.ENABLE_NVMS)
|
||||
+ struct.pack("!I", SupvActionId.ENABLE_NVMS)
|
||||
+ struct.pack("B", nvm01)
|
||||
+ struct.pack("B", nvm3)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "58":
|
||||
q.add_log_cmd("PLOC Supervisor: Continue update")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.CONTINUE_UPDATE)
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.CONTINUE_UPDATE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.MEM_CHECK:
|
||||
custom_data = bytearray()
|
||||
@ -477,8 +475,8 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
f"{prefix}: {Info.MEM_CHECK} for file {update_file} at memory ID {memory_id} at start "
|
||||
f"address {start_address}"
|
||||
)
|
||||
command = create_fsfw_action_cmd(
|
||||
object_id.as_bytes, SupvActionIds.MEM_CHECK, custom_data
|
||||
command = create_action_cmd(
|
||||
object_id.as_bytes, SupvActionId.MEM_CHECK, custom_data
|
||||
)
|
||||
q.add_pus_tc(command)
|
||||
|
||||
@ -493,7 +491,7 @@ def pack_sel_boot_image_cmd(
|
||||
@param bp1 Partition pin 1
|
||||
@param bp2 Partition pin 2
|
||||
"""
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SEL_MPSOC_BOOT_IMAGE)
|
||||
command = object_id + struct.pack("!I", SupvActionId.SEL_MPSOC_BOOT_IMAGE)
|
||||
command = command + struct.pack("!B", mem)
|
||||
command = command + struct.pack("!B", bp0)
|
||||
command = command + struct.pack("!B", bp1)
|
||||
@ -511,7 +509,7 @@ def pack_update_available_cmd(object_id: bytes) -> bytearray:
|
||||
image_size = 222
|
||||
image_crc = 0x0
|
||||
number_of_packets = 150
|
||||
command = object_id + struct.pack("!I", SupvActionIds.UPDATE_AVAILABLE)
|
||||
command = object_id + struct.pack("!I", SupvActionId.UPDATE_AVAILABLE)
|
||||
command = command + struct.pack("!B", image_select)
|
||||
command = command + struct.pack("!B", image_partition)
|
||||
command = command + struct.pack("!I", image_size)
|
||||
@ -529,9 +527,9 @@ def pack_lachtup_alert_cmd(object_id: bytes, state: bool) -> bytearray:
|
||||
latchup_id = get_latchup_id()
|
||||
command = bytearray()
|
||||
if state:
|
||||
command = object_id + struct.pack("!I", SupvActionIds.ENABLE_LATCHUP_ALERT)
|
||||
command = object_id + struct.pack("!I", SupvActionId.ENABLE_LATCHUP_ALERT)
|
||||
else:
|
||||
command = object_id + struct.pack("!I", SupvActionIds.DISABLE_LATCHUP_ALERT)
|
||||
command = object_id + struct.pack("!I", SupvActionId.DISABLE_LATCHUP_ALERT)
|
||||
command = command + struct.pack("!B", latchup_id)
|
||||
return bytearray(command)
|
||||
|
||||
@ -560,7 +558,7 @@ def pack_set_alert_limit_cmd(object_id: bytes) -> bytearray:
|
||||
latchup_id = get_latchup_id()
|
||||
dutycycle = int(input("Specify dutycycle: "))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_ALERT_LIMIT)
|
||||
command = object_id + struct.pack("!I", SupvActionId.SET_ALERT_LIMIT)
|
||||
command = command + struct.pack("!B", latchup_id)
|
||||
command = command + struct.pack("!I", dutycycle)
|
||||
return bytearray(command)
|
||||
@ -572,7 +570,7 @@ def pack_set_adc_enabled_channels_cmd(object_id: bytes) -> bytearray:
|
||||
@param object_id The object id of the PLOC supervisor handler.
|
||||
"""
|
||||
ch = int(input("Specify ch: 0x"), 16)
|
||||
cmd = object_id + struct.pack("!I", SupvActionIds.SET_ADC_ENABLED_CHANNELS)
|
||||
cmd = object_id + struct.pack("!I", SupvActionId.SET_ADC_ENABLED_CHANNELS)
|
||||
cmd = cmd + struct.pack("!H", ch)
|
||||
return bytearray(cmd)
|
||||
|
||||
@ -580,7 +578,7 @@ def pack_set_adc_enabled_channels_cmd(object_id: bytes) -> bytearray:
|
||||
def pack_set_adc_window_and_stride_cmd(object_id: bytes) -> bytearray:
|
||||
window_size = int(input("Specify window size: "))
|
||||
striding_step_size = int(input("Specify striding step size: "))
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_WINDOW_AND_STRIDE)
|
||||
command = object_id + struct.pack("!I", SupvActionId.SET_ADC_WINDOW_AND_STRIDE)
|
||||
command = command + struct.pack("!H", window_size)
|
||||
command = command + struct.pack("!H", striding_step_size)
|
||||
return bytearray(command)
|
||||
@ -588,21 +586,21 @@ def pack_set_adc_window_and_stride_cmd(object_id: bytes) -> bytearray:
|
||||
|
||||
def pack_set_adc_threshold_cmd(object_id: bytes) -> bytearray:
|
||||
threshold = int(input("Specify threshold: "))
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_THRESHOLD)
|
||||
command = object_id + struct.pack("!I", SupvActionId.SET_ADC_THRESHOLD)
|
||||
command = command + struct.pack("!I", threshold)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def pack_select_nvm_cmd(object_id: bytes) -> bytearray:
|
||||
mem = int(input("Specify NVM (0 - NVM0, 1 - MVM1): "))
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SELECT_NVM)
|
||||
command = object_id + struct.pack("!I", SupvActionId.SELECT_NVM)
|
||||
command = command + struct.pack("!B", mem)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def pack_auto_em_tests_cmd(object_id: bytes) -> bytearray:
|
||||
test = int(input("Specify test (1 - complete, 2 - short): "))
|
||||
command = object_id + struct.pack("!I", SupvActionIds.RUN_AUTO_EM_TESTS)
|
||||
command = object_id + struct.pack("!I", SupvActionId.RUN_AUTO_EM_TESTS)
|
||||
command = command + struct.pack("!B", test)
|
||||
return bytearray(command)
|
||||
|
||||
@ -610,7 +608,7 @@ def pack_auto_em_tests_cmd(object_id: bytes) -> bytearray:
|
||||
def pack_mram_wipe_cmd(object_id: bytes) -> bytearray:
|
||||
start = int(input("Start address: 0x"), 16)
|
||||
stop = int(input("Stop address: 0x"), 16)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.WIPE_MRAM)
|
||||
command = object_id + struct.pack("!I", SupvActionId.WIPE_MRAM)
|
||||
command = command + struct.pack("!I", start)
|
||||
command = command + struct.pack("!I", stop)
|
||||
return bytearray(command)
|
||||
@ -642,7 +640,7 @@ def pack_update_command(object_id: bytes, new_update: bool) -> bytearray:
|
||||
else:
|
||||
raise ValueError("Invalid input, use y or n")
|
||||
command += object_id
|
||||
command += struct.pack("!I", SupvActionIds.PERFORM_UPDATE)
|
||||
command += struct.pack("!I", SupvActionId.PERFORM_UPDATE)
|
||||
command += bytearray(update_file, "utf-8")
|
||||
# Adding null terminator
|
||||
command += struct.pack("!B", 0)
|
||||
@ -657,7 +655,7 @@ def pack_update_command(object_id: bytes, new_update: bool) -> bytearray:
|
||||
def pack_set_shutdown_timeout_command(object_id: bytes) -> bytearray:
|
||||
command = bytearray()
|
||||
command += object_id
|
||||
command += struct.pack("!I", SupvActionIds.SET_SHUTDOWN_TIMEOUT)
|
||||
command += struct.pack("!I", SupvActionId.SET_SHUTDOWN_TIMEOUT)
|
||||
timeout = int(input("Specify shutdown timeout (ms): "))
|
||||
command += struct.pack("!I", timeout)
|
||||
return command
|
||||
@ -666,7 +664,7 @@ def pack_set_shutdown_timeout_command(object_id: bytes) -> bytearray:
|
||||
def pack_logging_buffer_request(object_id: bytes) -> bytearray:
|
||||
command = bytearray()
|
||||
command += object_id
|
||||
command += struct.pack("!I", SupvActionIds.LOGGING_REQUEST_EVENT_BUFFERS)
|
||||
command += struct.pack("!I", SupvActionId.LOGGING_REQUEST_EVENT_BUFFERS)
|
||||
path = get_event_buffer_path()
|
||||
command += bytearray(path, "utf-8")
|
||||
return command
|
||||
@ -676,7 +674,7 @@ def pack_set_gpio_cmd(object_id: bytes) -> bytearray:
|
||||
port = int(input("Specify port: 0x"), 16)
|
||||
pin = int(input("Specify pin: 0x"), 16)
|
||||
val = int(input("Specify val: 0x"), 16)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_GPIO)
|
||||
command = object_id + struct.pack("!I", SupvActionId.SET_GPIO)
|
||||
command = command + struct.pack("!B", port)
|
||||
command = command + struct.pack("!B", pin)
|
||||
command = command + struct.pack("!B", val)
|
||||
@ -686,14 +684,14 @@ def pack_set_gpio_cmd(object_id: bytes) -> bytearray:
|
||||
def pack_read_gpio_cmd(object_id: bytes) -> bytearray:
|
||||
port = int(input("Specify port: 0x"), 16)
|
||||
pin = int(input("Specify pin: 0x"), 16)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.READ_GPIO)
|
||||
command = object_id + struct.pack("!I", SupvActionId.READ_GPIO)
|
||||
command = command + struct.pack("!B", port)
|
||||
command = command + struct.pack("!B", pin)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def pack_logging_set_topic(object_id: bytes) -> bytearray:
|
||||
command = object_id + struct.pack("!I", SupvActionIds.LOGGING_SET_TOPIC)
|
||||
command = object_id + struct.pack("!I", SupvActionId.LOGGING_SET_TOPIC)
|
||||
tpc = int(input("Specify logging topic: "))
|
||||
command += struct.pack("!B", tpc)
|
||||
return bytearray(command)
|
||||
|
Reference in New Issue
Block a user