Skip to content
Snippets Groups Projects
Commit b42617e0 authored by Robin.Mueller's avatar Robin.Mueller
Browse files

leds commandable

parent 53ca3fcc
Branches
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ DUMMY_DEVICE_ID = bytearray([0x44, 0x00, 0xAF, 0xFE]) ...@@ -29,6 +29,7 @@ DUMMY_DEVICE_ID = bytearray([0x44, 0x00, 0xAF, 0xFE])
THERMAL_SENSOR_DEVICE_ID = bytearray([0x44, 0x11, 0x54, 0x00]) THERMAL_SENSOR_DEVICE_ID = bytearray([0x44, 0x11, 0x54, 0x00])
GYRO_DEVICE_ID = bytearray([0x44, 0x11, 0x55, 0x00]) GYRO_DEVICE_ID = bytearray([0x44, 0x11, 0x55, 0x00])
TEST_TASK_ID = bytearray([0x42, 0x69, 0x42, 0x69]) TEST_TASK_ID = bytearray([0x42, 0x69, 0x42, 0x69])
LED_TASK_ID = bytearray([0x62, 0x00, 0x00, 0x01])
SD_CARD_HANDLER_ID = bytearray([0x4D, 0x00, 0x73, 0xAD]) SD_CARD_HANDLER_ID = bytearray([0x4D, 0x00, 0x73, 0xAD])
INTERNAL_ERROR_REPORTER_ID = bytearray([0x53, 0x04, 0x00, 0x00]) INTERNAL_ERROR_REPORTER_ID = bytearray([0x53, 0x04, 0x00, 0x00])
......
from typing import Union
from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand, Deque from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand, Deque
from tc.obsw_tc_service8 import make_action_id from tc.obsw_tc_service8 import make_action_id
from tc.obsw_tc_service20 import pack_boolean_parameter_setting from tc.obsw_tc_service20 import pack_boolean_parameter_setting
...@@ -30,7 +32,7 @@ def generate_param_packet_hamming_from_sdcard(enable: bool, ssc: int, ...@@ -30,7 +32,7 @@ def generate_param_packet_hamming_from_sdcard(enable: bool, ssc: int,
parameter=enable, ssc=ssc) parameter=enable, ssc=ssc)
def generate_img_handler_packet(service_queue: Deque, op_code: int): def generate_img_handler_packet(service_queue: Deque, op_code: Union[int, str]):
# Action ID 4 (Copy SDC to Flash, Software Update Image) # Action ID 4 (Copy SDC to Flash, Software Update Image)
if op_code == "A4U": if op_code == "A4U":
service_queue.appendleft(("print", "Generating command to copy SDC OBSW to flash.")) service_queue.appendleft(("print", "Generating command to copy SDC OBSW to flash."))
......
...@@ -16,6 +16,7 @@ from tc.obsw_tc_service8 import pack_service8_test_into ...@@ -16,6 +16,7 @@ from tc.obsw_tc_service8 import pack_service8_test_into
from tc.obsw_tc_service9 import pack_service9_test_into from tc.obsw_tc_service9 import pack_service9_test_into
from tc.obsw_tc_service23_sdcard import pack_service23_commands_into from tc.obsw_tc_service23_sdcard import pack_service23_commands_into
from tc.obsw_tc_service20 import pack_service20_test_into from tc.obsw_tc_service20 import pack_service20_test_into
from tc.obsw_tc_utility import pack_utility_command
from tc.obsw_tc_service200 import pack_mode_data, pack_service200_test_into from tc.obsw_tc_service200 import pack_mode_data, pack_service200_test_into
from tc.obsw_tc_service5_17 import pack_service5_test_into, pack_service17_test_into from tc.obsw_tc_service5_17 import pack_service5_test_into, pack_service17_test_into
from tc.obsw_image_handler import generate_img_handler_packet from tc.obsw_image_handler import generate_img_handler_packet
...@@ -60,6 +61,8 @@ class ServiceQueuePacker: ...@@ -60,6 +61,8 @@ class ServiceQueuePacker:
return generate_img_handler_packet(service_queue, op_code) return generate_img_handler_packet(service_queue, op_code)
if service.lower() == "core": if service.lower() == "core":
return pack_core_command(service_queue, op_code) return pack_core_command(service_queue, op_code)
if service.lower() == "led":
return pack_utility_command(service_queue, op_code)
if service.lower() == "gps0": if service.lower() == "gps0":
# Object ID: GPS Device # Object ID: GPS Device
object_id = g.GPS0_DEVICE_ID object_id = g.GPS0_DEVICE_ID
......
...@@ -65,5 +65,12 @@ def pack_service8_test_into(tc_queue: Deque, called_externally: bool = False) -> ...@@ -65,5 +65,12 @@ def pack_service8_test_into(tc_queue: Deque, called_externally: bool = False) ->
return tc_queue return tc_queue
def generate_action_command(object_id: bytearray, action_id: int, data: bytearray = bytearray([]),
ssc: int = 0):
data_to_pack = bytearray(object_id)
data_to_pack += make_action_id(action_id) + data
return PusTelecommand(service=8, subservice=128, ssc=ssc, app_data=data_to_pack)
def make_action_id(action_id: int) -> bytearray: def make_action_id(action_id: int) -> bytearray:
return bytearray(struct.pack('!I', action_id)) return bytearray(struct.pack('!I', action_id))
from typing import Union
from tmtc_core.tc.obsw_pus_tc_base import TcQueueT
from tc.obsw_tc_service8 import generate_action_command
from config.obsw_config import LED_TASK_ID
def pack_utility_command(service_queue: TcQueueT, op_code: Union[str, int]):
if op_code == "A0":
service_queue.appendleft(generate_action_command(LED_TASK_ID, 0x00).pack_command_tuple())
elif op_code == "A1":
service_queue.appendleft(generate_action_command(LED_TASK_ID, 0x01).pack_command_tuple())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment