commands to set and get pcdu parameters
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
@date 17.12.2020
|
||||
"""
|
||||
import enum
|
||||
import struct
|
||||
|
||||
from tmtccmd.tc.pus_8_funccmd import generate_action_command
|
||||
from tmtccmd.tc.definitions import PusTelecommand
|
||||
@ -30,11 +31,15 @@ class GomspaceOpCodes:
|
||||
REQUEST_AUX_HK_ONCE = ["hk-aux", "129"]
|
||||
PRINT_SWITCH_V_I = ["print-switch-vi", "130"]
|
||||
PRINT_LATCHUPS = ["print-latchups", "131"]
|
||||
GET_PARAM = ["get-param", "132"]
|
||||
SET_PARAM = ["set-param", "133"]
|
||||
|
||||
|
||||
class Info:
|
||||
REQUEST_CORE_HK_ONCE = "Requesting Core HK once"
|
||||
REQUEST_AUX_HK_ONCE = "Requesting Aux HK once"
|
||||
GET_PARAMETER = "Get parameter"
|
||||
SET_PARAMETER = "Set parameter"
|
||||
|
||||
|
||||
class SetIds:
|
||||
@ -78,10 +83,9 @@ def pack_get_param_command(
|
||||
@param parameter_size: Size of the value to read. E.g. temperature is uint16_t and thus parameter_size is 2
|
||||
@return: The command as bytearray.
|
||||
"""
|
||||
app_data = bytearray()
|
||||
app_data.append(table_id)
|
||||
app_data.extend(memory_address)
|
||||
app_data.append(parameter_size)
|
||||
app_data = struct.pack('!B', table_id)
|
||||
app_data += struct.pack('!H', memory_address)
|
||||
app_data += struct.pack('!B', parameter_size)
|
||||
return generate_action_command(
|
||||
object_id=object_id,
|
||||
action_id=GomspaceDeviceActionIds.PARAM_GET,
|
||||
@ -112,10 +116,7 @@ def pack_set_param_command(
|
||||
if parameter_size == 1:
|
||||
app_data.append(parameter)
|
||||
elif parameter_size == 2:
|
||||
byte_one = 0xFF00 & parameter >> 8
|
||||
byte_two = 0xFF & parameter
|
||||
app_data.append(byte_one)
|
||||
app_data.append(byte_two)
|
||||
app_data += struct.pack('!H', parameter)
|
||||
elif parameter_size == 4:
|
||||
byte_one = 0xFF000000 & parameter >> 24
|
||||
byte_two = 0xFF0000 & parameter >> 16
|
||||
|
Reference in New Issue
Block a user