Skip to content

Commit

Permalink
bugfixes for srv3
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Jun 12, 2021
1 parent 3f39a1f commit 39697ed
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
12 changes: 11 additions & 1 deletion src/tmtccmd/pus_tm/service_3_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@ class Service3Base(PusTelemetry):
"""
def __init__(self, raw_telemetry: bytearray):
super().__init__(raw_telemetry)
self.object_id = bytearray()
self._object_id_bytes = bytearray()
self._object_id = 0
self.set_id = 0
self.hk_header = []
self.hk_content = []
self.number_of_parameters = 0
self.validity_buffer = bytearray()

def get_object_id(self):
return self._object_id

def get_object_id_bytes(self) -> bytes:
return self._object_id_bytes

def get_set_id(self) -> int:
return self.set_id
16 changes: 8 additions & 8 deletions src/tmtccmd/pus_tm/service_3_housekeeping.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def __init__(self, byte_array: bytearray, custom_hk_handling: bool = False,
self.min_hk_reply_size = minimum_reply_size
self.custom_hk_handling = custom_hk_handling
self.hk_structure_report_header_size = minimum_structure_report_header_size
self.object_id_bytes = self._tm_data[0:4]
self.object_id = struct.unpack('!I', self.object_id_bytes)[0]
self.set_id = struct.unpack('!I', self._tm_data[4:8])[0]
self._object_id_bytes = self._tm_data[0:4]
self._object_id = struct.unpack('!I', self.object_id_bytes)[0]
self._set_id = struct.unpack('!I', self._tm_data[4:8])[0]

self.specify_packet_info("Housekeeping Packet")
self.param_length = 0
Expand All @@ -62,8 +62,8 @@ def __init__(self, byte_array: bytearray, custom_hk_handling: bool = False,

def append_telemetry_content(self, content_list: list):
super().append_telemetry_content(content_list=content_list)
content_list.append(hex(self.object_id))
content_list.append(hex(self.set_id))
content_list.append(hex(self._object_id))
content_list.append(hex(self._set_id))
content_list.append(int(self.param_length))

def append_telemetry_column_headers(self, header_list: list):
Expand All @@ -76,7 +76,7 @@ def handle_filling_definition_arrays(self):
if len(self._tm_data) < self.hk_structure_report_header_size:
LOGGER.warning(
f"Service3TM: handle_filling_definition_arrays: Invalid structure report "
f"from {hex(self.object_id)}, is shorter "
f"from {hex(self._object_id)}, is shorter "
f"than {self.hk_structure_report_header_size}"
)
return
Expand Down Expand Up @@ -112,7 +112,7 @@ def handle_filling_definition_arrays(self):
valid_string = "Yes"
else:
valid_string = "No"
self.hk_content = [hex(self.object_id), self.set_id, status_string, valid_string,
self.hk_content = [hex(self.object_id), self._set_id, status_string, valid_string,
collection_interval_seconds, num_params]
self.hk_content.extend(parameters)

Expand All @@ -130,7 +130,7 @@ def handle_filling_hk_arrays(self):
(self.hk_header, self.hk_content, self.validity_buffer,
self.number_of_parameters) = \
hook_obj.handle_service_3_housekeeping(
object_id=self.object_id_bytes, set_id=self.set_id, hk_data=self._tm_data[8:],
object_id=self._object_id_bytes, set_id=self._set_id, hk_data=self._tm_data[8:],
service3_packet=self
)
except ImportError:
Expand Down
4 changes: 2 additions & 2 deletions src/tmtccmd/utility/tmtc_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def __handle_hk_print(self, tm_packet: Service3Base):
from tmtccmd.config.definitions import CoreGlobalIds
print_hk = get_global(CoreGlobalIds.PRINT_HK)
if print_hk:
self.__print_buffer = f"HK Data from Object ID {tm_packet.object_id:#010x} and " \
self.__print_buffer = f"HK Data from Object ID {tm_packet.get_object_id():#010x} and " \
f"set ID {tm_packet.set_id}:"
self.__print_hk(tm_packet)
self.__print_validity_buffer(tm_packet)
Expand All @@ -165,7 +165,7 @@ def __handle_hk_definition_print(self, tm_packet: Service3Base):
from tmtccmd.config.definitions import CoreGlobalIds
print_hk = get_global(CoreGlobalIds.PRINT_HK)
if print_hk:
self.__print_buffer = f"HK Definition from Object ID {tm_packet.object_id:#010x} " \
self.__print_buffer = f"HK Definition from Object ID {tm_packet._object_id:#010x} " \
f"and set ID {tm_packet.set_id}:"
self.__print_hk(tm_packet)

Expand Down

0 comments on commit 39697ed

Please sign in to comment.