Compare commits

..

56 Commits

Author SHA1 Message Date
1724a90a26 add release checklist 2023-06-10 14:46:00 +02:00
7b21070363 linter fixes, version bump 2023-06-10 14:42:28 +02:00
d390168829 Merge pull request 'v4.0.0-dev' (#197) from v4.0.0-dev into main
Reviewed-on: #197
2023-06-10 14:10:42 +02:00
a969481698 imtq parsing fixes 2023-06-09 18:53:11 +02:00
8bdba71dc3 Merge pull request 'Rework logging handling' (#194) from rework_logging_handling into v4.0.0-dev
Reviewed-on: #194
2023-06-09 12:44:00 +02:00
e3800ac0c9 Merge branch 'v4.0.0-dev' into rework_logging_handling 2023-06-09 12:43:21 +02:00
8804a4e8e9 bump tmtccmd to v5.0.0rc0 2023-06-09 12:43:08 +02:00
1548278ad6 Merge remote-tracking branch 'origin/v4.0.0-dev' into rework_logging_handling 2023-06-09 12:42:26 +02:00
148a52a69a Merge remote-tracking branch 'origin/main' into rework_logging_handling 2023-06-09 12:42:16 +02:00
ac140aeb2c Merge pull request 'moved 2 parameters' (#196) from move-pdu-datavar into v4.0.0-dev
Reviewed-on: #196
2023-06-09 12:41:55 +02:00
a5a30d37eb tweak changelog 2023-06-09 12:41:49 +02:00
d9194207a4 Merge remote-tracking branch 'origin/v4.0.0-dev' into move-pdu-datavar 2023-06-09 12:39:38 +02:00
14d14f12c0 Merge branch 'v3.2.0-dev' into move-pdu-datavar 2023-06-07 17:27:52 +02:00
17dd9de51e moved 2 parameters 2023-06-07 17:25:51 +02:00
238bbd5843 Merge pull request 'better exception handling' (#195) from better-exception-handling into v3.2.0-dev
Reviewed-on: #195
2023-06-07 17:16:37 +02:00
de02d81e1d better exception handling 2023-06-07 16:56:43 +02:00
e45072c38d import replacement 2023-05-25 11:31:06 +02:00
fe96f115d5 that should be all 2023-05-24 13:50:37 +02:00
e9e43f03d2 more stuff 2023-05-24 13:44:45 +02:00
aab093cc0a rework it 2023-05-23 09:54:51 +02:00
c6c4b9a995 Merge pull request 'Bugfix CFDP' (#191) from bugfix-cfdp into v4.0.0-dev
Reviewed-on: #191
2023-05-22 10:42:49 +02:00
6182369e4f Merge pull request 'generic systemctl' (#193) from generic_systemctl into main
Reviewed-on: #193
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
2023-05-22 10:41:54 +02:00
620360c8e8 Merge branch 'main' into generic_systemctl 2023-05-19 11:02:35 +02:00
49dde29847 generic systemctl 2023-05-19 11:01:06 +02:00
d23c0c20fc Merge pull request 'new MPSoC events and retvals' (#192) from mpsoc_new_events_retvals into main
Reviewed-on: #192
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
2023-05-19 10:44:01 +02:00
ef1da1e882 changelog 2023-05-17 19:00:17 +02:00
6ec0ce20fa new event 2023-05-17 17:15:43 +02:00
5f379bf2bb changelog 2023-05-15 16:43:40 +02:00
7c1e7226e0 bugfix CFDP: bump tmtccmd 2023-05-15 16:42:56 +02:00
b8e1c7afe9 new MPSoC events and retvals 2023-05-15 15:20:56 +02:00
280c72439e bugfix MPSoC command 2023-05-15 14:18:18 +02:00
14c42a91ff rework read and write prompts for MPSoC 2023-05-15 13:43:26 +02:00
dd3e4c649b Merge pull request 'MPSoC flash content reporter' (#190) from mpsoc_action_reply_handler into main
Reviewed-on: #190
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
2023-05-15 09:10:41 +02:00
3b16717ce2 Merge pull request 'fixfixfix' (#189) from ploc_pwr_switching_fix into main
Reviewed-on: #189
2023-05-12 16:27:39 +02:00
f1a0334d3d Merge branch 'main' into ploc_pwr_switching_fix 2023-05-12 16:27:33 +02:00
0c1bfc6fd3 bump changelog 2023-05-12 16:27:16 +02:00
04bbe057e7 flash c ontent report works now 2023-05-12 16:24:45 +02:00
e05a54b076 somethings wrong with the format 2023-05-12 16:08:57 +02:00
ef0adef04a start adding action reply handler for MPSoC 2023-05-12 15:51:17 +02:00
377e98b5c2 bugfix MPSoC HK parsing 2023-05-12 13:22:58 +02:00
87e5abe8eb add missing command list of PLOC MPSoC commands 2023-05-12 11:51:47 +02:00
f090c3af66 fixfixfix 2023-05-11 17:55:15 +02:00
13fd9a7d84 Merge pull request 'impl MPSoC HK parsing' (#188) from mpsoc_commands into main
Reviewed-on: #188
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
2023-05-04 15:30:49 +02:00
bbcc0f9de7 Merge branch 'mpsoc_commands' of https://egit.irs.uni-stuttgart.de/eive/eive-tmtc into mpsoc_commands 2023-05-04 15:17:12 +02:00
a0aa6525e4 fix 2023-05-04 15:17:00 +02:00
1ab8710040 Merge branch 'main' into mpsoc_commands 2023-05-04 14:51:13 +02:00
f480d86fbd impl MPSoC HK parsing 2023-05-04 14:50:38 +02:00
4d921e01af Merge pull request 'MPSoC module update' (#187) from mpsoc_commands into main
Reviewed-on: #187
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
2023-05-04 12:01:43 +02:00
b505524e0b Merge branch 'main' into mpsoc_commands 2023-05-04 12:01:33 +02:00
e0e9a310b9 add command to get flash dir content 2023-05-04 11:51:50 +02:00
0e9ebefc87 new mpsoc commands 2023-05-04 11:27:12 +02:00
e85d1a1966 Merge pull request 'most important bugfix' (#186) from most-important-bugfix into main
Reviewed-on: #186
2023-05-03 13:36:31 +02:00
4ff50b6559 bub 2023-05-03 13:34:14 +02:00
60fba8b6d9 Merge pull request 'more system modes' (#185) from more-system-modes into main
Reviewed-on: #185
2023-04-28 10:25:35 +02:00
1707f24612 more system modes 2023-04-19 15:10:44 +02:00
5fbd19bb6c Merge branch 'main' of https://egit.irs.uni-stuttgart.de/eive/eive-tmtc 2023-04-17 18:41:08 +02:00
19 changed files with 82 additions and 280 deletions

View File

@ -10,19 +10,7 @@ list yields a list of all related PRs for each release.
# [unreleased]
# [v5.0.0]
## Changed
- Force flag for copy helper.
# [v4.1.0] 2023-06-14
## Added
- Some BPX battery commands
# [v4.0.0] 2023-06-10
# [v4.0.0] to be released
`tmtccmd` version: v5.0.0rc0
@ -37,12 +25,6 @@ list yields a list of all related PRs for each release.
- Fix for PLOC power switching.
- Bump `tmtccmd` to v5.0.0rc0 for important bugfix in CFDP header.
# [v3.1.2] 2023-06-19
## Fixed
- Pin `tmtccmd` to v4.1.3 to enforce correct `spacepackets` version on install
# [v3.1.1] 2023-04-17
## Added

View File

@ -1,9 +0,0 @@
FROM python:3
RUN apt-get update
RUN apt-get --yes upgrade
#tzdata is a dependency, won't install otherwise
ARG DEBIAN_FRONTEND=noninteractive
#pip needs a valid user to work
RUN adduser --uid 114 jenkins

View File

@ -1,14 +0,0 @@
pipeline {
agent {
docker {
image 'eive-tmtc-ci:d2'
}
}
stages {
stage('Package') {
steps {
sh 'pip install .'
}
}
}
}

View File

@ -1,10 +1,10 @@
__version__ = "5.0.0"
__version__ = "4.0.0"
import logging
from pathlib import Path
SW_NAME = "eive-tmtc"
VERSION_MAJOR = 5
VERSION_MAJOR = 4
VERSION_MINOR = 0
VERSION_REVISION = 0

View File

@ -70,7 +70,7 @@ class CustomServiceList(str, enum.Enum):
TIME = "time"
PROCEDURE = "proc"
RTD = "rtd"
TMP1075 = "tmp1075"
TMP1075 = "tcs_tmp"
TVTTESTPROCEDURE = "tvtestproc"
SCEX = "scex"
TM_STORE = "tm_store"

View File

@ -271,7 +271,6 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
14010;0x36ba;TRYING_I2C_RECOVERY;HIGH;I2C is unavailable. Trying recovery of I2C bus by power cycling all I2C devices.;mission/sysDefs.h
14011;0x36bb;I2C_REBOOT;HIGH;I2C is unavailable. Recovery did not work, performing full reboot.;mission/sysDefs.h
14012;0x36bc;PDEC_REBOOT;HIGH;PDEC recovery through reset was not possible, performing full reboot.;mission/sysDefs.h
14013;0x36bd;FIRMWARE_INFO;INFO;Version information of the firmware (not OBSW). P1: Byte 0: Major, Byte 1: Minor, Byte 2: Patch, Byte 3: Has Git Hash P2: First four letters of Git SHA is the last byte of P1 is set.;mission/sysDefs.h
14100;0x3714;NO_VALID_SENSOR_TEMPERATURE;MEDIUM;No description;mission/controller/tcsDefs.h
14101;0x3715;NO_HEALTHY_HEATER_AVAILABLE;MEDIUM;No description;mission/controller/tcsDefs.h
14102;0x3716;SYRLINKS_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
271 14010 0x36ba TRYING_I2C_RECOVERY HIGH I2C is unavailable. Trying recovery of I2C bus by power cycling all I2C devices. mission/sysDefs.h
272 14011 0x36bb I2C_REBOOT HIGH I2C is unavailable. Recovery did not work, performing full reboot. mission/sysDefs.h
273 14012 0x36bc PDEC_REBOOT HIGH PDEC recovery through reset was not possible, performing full reboot. mission/sysDefs.h
14013 0x36bd FIRMWARE_INFO INFO Version information of the firmware (not OBSW). P1: Byte 0: Major, Byte 1: Minor, Byte 2: Patch, Byte 3: Has Git Hash P2: First four letters of Git SHA is the last byte of P1 is set. mission/sysDefs.h
274 14100 0x3714 NO_VALID_SENSOR_TEMPERATURE MEDIUM No description mission/controller/tcsDefs.h
275 14101 0x3715 NO_HEALTHY_HEATER_AVAILABLE MEDIUM No description mission/controller/tcsDefs.h
276 14102 0x3716 SYRLINKS_OVERHEATING HIGH No description mission/controller/tcsDefs.h

View File

@ -34,7 +34,6 @@ HEATER_CONTROLLER_ID = bytes([0x44, 0x41, 0x00, 0xA4])
TMP1075_HANDLER_TCS_BRD_0_ID = bytes([0x44, 0x42, 0x00, 0x04])
TMP1075_HANDLER_TCS_BRD_1_ID = bytes([0x44, 0x42, 0x00, 0x05])
TMP1075_HANDLER_PLPCDU_0_ID = bytes([0x44, 0x42, 0x00, 0x06])
TMP1075_HANDLER_PLPCDU_1_ID = bytes([0x44, 0x42, 0x00, 0x07])
TMP1075_HANDLER_IF_BRD_ID = bytes([0x44, 0x42, 0x00, 0x08])
# Communication Object IDs

View File

@ -106,7 +106,6 @@ def handle_default_procedure( # noqa C901: Complexity okay here.
"0": ("TMP1075 TCS Board 0", TMP1075_HANDLER_TCS_BRD_0_ID),
"1": ("TMP1075 TCS Board 1", TMP1075_HANDLER_TCS_BRD_1_ID),
"2": ("TMP1075 PL PCDU 0", TMP1075_HANDLER_PLPCDU_0_ID),
"3": ("TMP1075 PL PCDU 1", oids.TMP1075_HANDLER_PLPCDU_1_ID),
"4": ("TMP1075 IF Board", TMP1075_HANDLER_IF_BRD_ID),
}
input_helper = InputHelper(menu_dict)

View File

@ -13,7 +13,6 @@ from eive_tmtc.tmtc.payload.ploc_supervisor import handle_supv_hk_data
from eive_tmtc.tmtc.acs.reaction_wheels import handle_rw_hk_data
from eive_tmtc.tmtc.com.syrlinks_handler import handle_syrlinks_hk_data
from eive_tmtc.tmtc.tcs import handle_thermal_controller_hk_data
from eive_tmtc.tmtc.tcs.tmp1075 import handle_tmp_1075_hk_data
from spacepackets.ecss import PusTelemetry
from tmtccmd.tm.pus_3_fsfw_hk import (
Service3Base,
@ -44,8 +43,6 @@ _LOGGER = logging.getLogger(__name__)
FORWARD_SENSOR_TEMPS = False
# TODO: Transform this into a CLI argument
HK_OUTPUT_LEVEL = 1
def handle_hk_packet(
@ -72,7 +69,6 @@ def handle_hk_packet(
hk_data=hk_data,
)
try:
if HK_OUTPUT_LEVEL > 0:
handle_regular_hk_print(
printer=printer,
object_id=named_obj_id,
@ -175,14 +171,6 @@ def handle_regular_hk_print( # noqa C901: Complexity okay here
return handle_str_hk_data(set_id=set_id, hk_data=hk_data, pw=pw)
elif objb == obj_ids.PLOC_SUPV_ID:
return handle_supv_hk_data(set_id=set_id, hk_data=hk_data, pw=pw)
elif objb in [
obj_ids.TMP1075_HANDLER_TCS_BRD_0_ID,
obj_ids.TMP1075_HANDLER_TCS_BRD_1_ID,
obj_ids.TMP1075_HANDLER_IF_BRD_ID,
obj_ids.TMP1075_HANDLER_PLPCDU_0_ID,
obj_ids.TMP1075_HANDLER_PLPCDU_1_ID,
]:
return handle_tmp_1075_hk_data(set_id=set_id, hk_data=hk_data, pw=pw)
elif objb == obj_ids.ACS_CONTROLLER:
return handle_acs_ctrl_hk_data(
pw=pw, set_id=set_id, hk_data=hk_data, packet_time=packet_dt

View File

@ -5,4 +5,3 @@ from .time import add_time_cmds
from .health import add_health_cmd_defs
from .system import add_system_cmd_defs
from .tm_store import add_persistent_tm_store_cmd_defs
from .tcs import add_tmp_sens_cmds

View File

@ -32,7 +32,6 @@ class ActionId(enum.IntEnum):
RESET_REBOOT_COUNTER = 6
SWITCH_IMG_LOCK = 7
SET_MAX_REBOOT_CNT = 8
READ_REBOOT_MECHANISM_INFO = 9
UPDATE_OBSW_FROM_SD_0 = 10
UPDATE_OBSW_FROM_SD_1 = 11
UPDATE_OBSW_FROM_TMP = 12
@ -88,14 +87,13 @@ class OpCode:
SWITCH_TO_SD_0 = ["switch_to_sd_0"]
SWITCH_TO_SD_1 = ["switch_to_sd_1"]
SWITCH_TO_BOTH_SD_CARDS = ["switch_to_both_sd_cards"]
READ_REBOOT_MECHANISM_INFO = "rbh_info"
ENABLE_REBOOT_FILE_HANDLING = "rbh_off"
DISABLE_REBOOT_FILE_HANDLING = "rbh_on"
RESET_ALL_REBOOT_COUNTERS = "rbh_reset_a"
RESET_REBOOT_COUNTER_00 = "rbh_reset_00"
RESET_REBOOT_COUNTER_01 = "rbh_reset_01"
RESET_REBOOT_COUNTER_10 = "rbh_reset_10"
RESET_REBOOT_COUNTER_11 = "rbh_reset_11"
ENABLE_REBOOT_FILE_HANDLING = ["rbh_off"]
DISABLE_REBOOT_FILE_HANDLING = ["rbh_on"]
RESET_ALL_REBOOT_COUNTERS = ["rbh_reset_a"]
RESET_REBOOT_COUNTER_00 = ["rbh_reset_00"]
RESET_REBOOT_COUNTER_01 = ["rbh_reset_01"]
RESET_REBOOT_COUNTER_10 = ["rbh_reset_10"]
RESET_REBOOT_COUNTER_11 = ["rbh_reset_11"]
SET_MAX_REBOOT_CNT = ["rbh_max_cnt"]
@ -112,7 +110,6 @@ class Info:
OBSW_UPDATE_FROM_SD_0 = "Update OBSW from SD Card 0"
OBSW_UPDATE_FROM_SD_1 = "Update OBSW from SD Card 1"
OBSW_UPDATE_FROM_TMP = "Update OBSW from tmp folder"
READ_REBOOT_MECHANISM_INFO = "Read reboot mechansm information"
SWITCH_TO_SD_0 = "Switch to SD card 0"
SWITCH_TO_SD_1 = "Switch to SD card 1"
SWITCH_TO_BOTH_SD_CARDS = "Switch to both SD cards with specified active card"
@ -157,9 +154,6 @@ def add_core_controller_definitions(defs: TmtcDefinitionWrapper):
oce.add(keys=OpCode.XSC_REBOOT_1_0, info="Reboot 1 0")
oce.add(keys=OpCode.XSC_REBOOT_1_1, info="Reboot 1 1")
oce.add(keys=OpCode.SET_PREF_SD, info=Info.SET_PREF_SD)
oce.add(
keys=OpCode.READ_REBOOT_MECHANISM_INFO, info=Info.READ_REBOOT_MECHANISM_INFO
)
oce.add(keys=OpCode.OBSW_UPDATE_FROM_TMP, info=Info.OBSW_UPDATE_FROM_TMP)
oce.add(keys=OpCode.OBSW_UPDATE_FROM_SD_0, info=Info.OBSW_UPDATE_FROM_SD_0)
oce.add(keys=OpCode.OBSW_UPDATE_FROM_SD_1, info=Info.OBSW_UPDATE_FROM_SD_1)
@ -300,15 +294,7 @@ def pack_core_commands( # noqa C901
chip=Chip.CHIP_1,
copy=Copy.COPY_1_GOLD,
)
elif op_code == OpCode.READ_REBOOT_MECHANISM_INFO:
q.add_log_cmd(Info.READ_REBOOT_MECHANISM_INFO)
q.add_pus_tc(
create_action_cmd(
object_id=CORE_CONTROLLER_ID,
action_id=ActionId.READ_REBOOT_MECHANISM_INFO,
)
)
elif op_code == OpCode.DISABLE_REBOOT_FILE_HANDLING:
elif op_code in OpCode.DISABLE_REBOOT_FILE_HANDLING:
q.add_log_cmd("Disabling reboot file handling")
user_data = bytearray([0])
q.add_pus_tc(
@ -318,7 +304,7 @@ def pack_core_commands( # noqa C901
user_data=user_data,
)
)
elif op_code == OpCode.ENABLE_REBOOT_FILE_HANDLING:
elif op_code in OpCode.ENABLE_REBOOT_FILE_HANDLING:
q.add_log_cmd("Enabling reboot file handling")
user_data = bytearray([1])
q.add_pus_tc(
@ -328,7 +314,7 @@ def pack_core_commands( # noqa C901
user_data=user_data,
)
)
elif op_code == OpCode.RESET_ALL_REBOOT_COUNTERS:
elif op_code in OpCode.RESET_ALL_REBOOT_COUNTERS:
q.add_log_cmd("Resetting all reboot counters")
q.add_pus_tc(
create_action_cmd(
@ -336,13 +322,13 @@ def pack_core_commands( # noqa C901
action_id=ActionId.RESET_REBOOT_COUNTER,
)
)
elif op_code == OpCode.RESET_REBOOT_COUNTER_00:
elif op_code in OpCode.RESET_REBOOT_COUNTER_00:
reset_specific_boot_counter(q, 0, 0)
elif op_code == OpCode.RESET_REBOOT_COUNTER_01:
elif op_code in OpCode.RESET_REBOOT_COUNTER_01:
reset_specific_boot_counter(q, 0, 1)
elif op_code == OpCode.RESET_REBOOT_COUNTER_10:
elif op_code in OpCode.RESET_REBOOT_COUNTER_10:
reset_specific_boot_counter(q, 1, 0)
elif op_code == OpCode.RESET_REBOOT_COUNTER_11:
elif op_code in OpCode.RESET_REBOOT_COUNTER_11:
reset_specific_boot_counter(q, 1, 1)
elif op_code in OpCode.OBSW_UPDATE_FROM_SD_0:
q.add_log_cmd(Info.OBSW_UPDATE_FROM_SD_0)
@ -399,17 +385,14 @@ def pack_core_commands( # noqa C901
domain_id=0,
unique_id=ParamId.PREF_SD,
parameter=pref_sd,
)
).pack()
)
)
elif op_code == OpCode.CP_HELPER:
cp_recursive = int(input("Copy recursively (0/1) ?: "))
if cp_recursive not in [0, 1]:
raise ValueError("Invalid value, only 0 or 1 allowed")
cp_force = int(input("Copy with force option(0/1) ?: "))
if cp_force not in [0, 1]:
raise ValueError("Invalid value, only 0 or 1 allowed")
user_data = bytearray([cp_recursive, cp_force])
user_data = bytearray([cp_recursive])
user_data.extend(packet_source_dest_path("Copy"))
q.add_log_cmd(Info.CP_HELPER)
q.add_pus_tc(
@ -620,51 +603,7 @@ def handle_core_hk_data(pw: PrintWrapper, set_id: int, hk_data: bytes):
def handle_core_ctrl_action_replies(
action_id: int, pw: PrintWrapper, custom_data: bytes
):
if action_id == ActionId.READ_REBOOT_MECHANISM_INFO:
handle_reboot_mechanism_info_reply(pw, custom_data)
elif action_id == ActionId.LIST_DIR_DUMP_DIRECTLY:
handle_list_dir_dump_reply(pw, custom_data)
def handle_reboot_mechanism_info_reply(pw: PrintWrapper, custom_data: bytes):
pw.dlog("Received reboot mechansm information")
fmt_str = "!BIIIIIBBBBBBBB"
inc_len = struct.calcsize(fmt_str)
if len(custom_data) < inc_len:
raise ValueError(f"Received custom data shorter than expected {inc_len}")
(
enabled,
max_count,
img00_count,
img01_count,
img10_count,
img11_count,
img00_lock,
img01_lock,
img10_lock,
img11_lock,
last_chip,
last_copy,
next_chip,
next_copy,
) = struct.unpack(fmt_str, custom_data[:inc_len])
pw.dlog(f"Enabled: {enabled}")
pw.dlog(f"Max Count: {max_count}")
pw.dlog(f"Count 00: {img00_count}")
pw.dlog(f"Count 01: {img01_count}")
pw.dlog(f"Count 10: {img10_count}")
pw.dlog(f"Count 11: {img11_count}")
pw.dlog(f"Lock 00: {img00_lock}")
pw.dlog(f"Lock 01: {img01_lock}")
pw.dlog(f"Lock 10: {img10_lock}")
pw.dlog(f"Lock 11: {img11_lock}")
pw.dlog(f"Last Chip: {last_chip}")
pw.dlog(f"Last Copy: {last_copy}")
pw.dlog(f"Next Chip: {next_chip}")
pw.dlog(f"Next Copy: {next_copy}")
def handle_list_dir_dump_reply(pw: PrintWrapper, custom_data: bytes):
if action_id == ActionId.LIST_DIR_DUMP_DIRECTLY:
if len(custom_data) < 4:
_LOGGER.warning("Data unexpectedly small")
return
@ -694,7 +633,9 @@ def handle_list_dir_dump_reply(pw: PrintWrapper, custom_data: bytes):
else:
path = Path("dir_listing.txt")
remove_if_exists_and_new(seq_idx, path)
pw.dlog(f"Compression option: {compressed}. Dumping file into dir_listing.txt")
pw.dlog(
f"Compression option: {compressed}. Dumping file into dir_listing.txt"
)
with open(path, "a") as listing_file:
listing_file_str = custom_data[file_data_offset:].decode()
listing_file.write(listing_file_str)

View File

@ -28,30 +28,18 @@ class BpxSetId(enum.IntEnum):
class BpxActionId:
REBOOT = 2
RESET_COUNTERS = 3
CONFIG_CMD = 4
SET_CFG = 4
GET_CFG = 5
SET_CFG = 6
MAN_HEATER_ON = 10
MAN_HEATER_OFF = 11
class BpxHeaterModeSelect(enum.IntEnum):
OFF = 0
AUTO = 1
class BpxOpCode:
HK = "hk"
OFF = "off"
ON = "on"
RST_CFG = "reset_cfg"
SET_CFG = "set_cfg"
MAN_HEATER_ON = "man_heater_on"
MAN_HEATER_OFF = "man_heater_off"
RST_BOOT_CNT = "rst_boot_cnt"
REQUEST_CFG = "cfg"
REQUEST_CFG_HK = "cfg_hk"
REBOOT = "reboot"
HK = ["0", "hk"]
OFF = ["off"]
ON = ["on"]
RST_BOOT_CNT = ["1", "rst_boot_cnt"]
REQUEST_CFG = ["2", "cfg"]
REQUEST_CFG_HK = ["3", "cfg_hk"]
REBOOT = ["4", "reboot"]
@tmtc_definitions_provider
@ -61,10 +49,6 @@ def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
oce.add(keys=BpxOpCode.OFF, info="Off command")
oce.add(keys=BpxOpCode.HK, info="Request BPX HK")
oce.add(keys=BpxOpCode.RST_BOOT_CNT, info="Reset Boot Count")
oce.add(keys=BpxOpCode.RST_CFG, info="Reset Config to stored default settings")
oce.add(keys=BpxOpCode.SET_CFG, info="Set BPX configuration")
oce.add(keys=BpxOpCode.MAN_HEATER_ON, info="Manual heater on")
oce.add(keys=BpxOpCode.MAN_HEATER_OFF, info="Manual heater off")
oce.add(keys=BpxOpCode.REQUEST_CFG, info="Request Configuration Struct (Step 1)")
oce.add(
keys=BpxOpCode.REQUEST_CFG_HK, info="Request Configuration Struct HK (Step 2)"
@ -78,14 +62,14 @@ def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
@service_provider(CustomServiceList.BPX_BATTERY.value)
def pack_bpx_commands(p: ServiceProviderParams): # noqa C901: Complexity is okay here.
def pack_bpx_commands(p: ServiceProviderParams):
op_code = p.op_code
q = p.queue_helper
if op_code == BpxOpCode.HK:
if op_code in BpxOpCode.HK:
q.add_log_cmd("Requesting BPX battery HK set")
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetId.GET_HK_SET)
q.add_pus_tc(generate_one_hk_command(sid=sid))
if op_code == BpxOpCode.OFF:
if op_code in BpxOpCode.OFF:
q.add_log_cmd("Off mode")
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Mode.OFF, 0)
q.add_pus_tc(
@ -95,7 +79,7 @@ def pack_bpx_commands(p: ServiceProviderParams): # noqa C901: Complexity is oka
app_data=mode_cmd,
)
)
if op_code == BpxOpCode.ON:
if op_code in BpxOpCode.ON:
q.add_log_cmd("On mode")
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Mode.ON, 0)
q.add_pus_tc(
@ -105,71 +89,27 @@ def pack_bpx_commands(p: ServiceProviderParams): # noqa C901: Complexity is oka
app_data=mode_cmd,
)
)
if op_code == BpxOpCode.RST_BOOT_CNT:
if op_code in BpxOpCode.RST_BOOT_CNT:
q.add_log_cmd("Resetting reboot counters")
q.add_pus_tc(
create_action_cmd(
object_id=BPX_HANDLER_ID, action_id=BpxActionId.RESET_COUNTERS
)
)
if op_code == BpxOpCode.RST_CFG:
q.add_log_cmd("Reset BPX configuration")
q.add_pus_tc(
create_action_cmd(
object_id=BPX_HANDLER_ID, action_id=BpxActionId.CONFIG_CMD
)
)
if op_code == BpxOpCode.SET_CFG:
q.add_log_cmd("Setting BPX configuration")
user_data = bytearray()
batt_mode = BpxHeaterModeSelect(
int(input("BPX heater mode select, 0 for OFF 1 for AUTO: "))
)
user_data.append(batt_mode)
lower_limit = int(input("Lower heater limit (-2 default): "))
user_data.append(struct.pack("!b", lower_limit)[0])
upper_limit = int(input("Upper heater limit (3 default): "))
user_data.append(struct.pack("!b", upper_limit)[0])
q.add_pus_tc(
create_action_cmd(
object_id=BPX_HANDLER_ID,
action_id=BpxActionId.SET_CFG,
user_data=user_data,
)
)
if op_code == BpxOpCode.REQUEST_CFG:
if op_code in BpxOpCode.REQUEST_CFG:
q.add_log_cmd("Requesting configuration struct")
q.add_pus_tc(
create_action_cmd(object_id=BPX_HANDLER_ID, action_id=BpxActionId.GET_CFG)
)
if op_code == BpxOpCode.REQUEST_CFG_HK:
if op_code in BpxOpCode.REQUEST_CFG_HK:
q.add_log_cmd("Requesting configuration struct HK")
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetId.GET_CFG_SET)
q.add_pus_tc(generate_one_hk_command(sid=sid))
if op_code == BpxOpCode.REBOOT:
if op_code in BpxOpCode.REBOOT:
q.add_log_cmd("Rebooting BPX battery")
q.add_pus_tc(
create_action_cmd(object_id=BPX_HANDLER_ID, action_id=BpxActionId.REBOOT)
)
if op_code == BpxOpCode.MAN_HEATER_ON:
q.add_log_cmd("BPX manual heater on with seconds burntime")
burn_time = int(input("BPX heater burn time in seconds [1-65535]: "))
if burn_time < 1 or burn_time > 65535:
raise ValueError("Invalid burntime, smaller than 0 or larger than 65535")
q.add_pus_tc(
create_action_cmd(
object_id=BPX_HANDLER_ID,
action_id=BpxActionId.MAN_HEATER_ON,
user_data=struct.pack("!H", burn_time),
)
)
if op_code == BpxOpCode.MAN_HEATER_OFF:
q.add_log_cmd("BPX manual heater off")
q.add_pus_tc(
create_action_cmd(
object_id=BPX_HANDLER_ID, action_id=BpxActionId.MAN_HEATER_OFF
)
)
HEADER_LIST = [

View File

@ -1,2 +1 @@
from .tm import * # noqa
from .tmp1075 import add_tmp_sens_cmds

View File

@ -13,7 +13,6 @@ from tmtccmd.tc.pus_200_fsfw_mode import Mode, create_announce_mode_recursive_co
from tmtccmd.tc.pus_3_fsfw_hk import (
make_sid,
generate_one_hk_command,
create_enable_periodic_hk_command_with_interval,
create_request_one_diag_command,
)
@ -22,7 +21,6 @@ class OpCodeSys:
OFF = ["off"]
NML = ["nml"]
REQUEST_PRIMARY_TEMP_SET = ["temp"]
ENABLE_TEMP_SET = "enable_temp_set"
REQUEST_DEVICE_TEMP_SET = ["temp_devs"]
REQUEST_DEVICE_SUS_SET = ["temp_sus"]
REQUEST_HEATER_INFO = "heater_info"
@ -32,7 +30,6 @@ class OpCodeSys:
class InfoSys:
OFF = "Switch TCS subsystem OFF"
NML = "Switch TCS subsystem NORMAL (nominal)"
ENABLE_TEMP_SET = "Enable Primary Temperature Set"
REQUEST_PRIMARY_TEMP_SET = "Request HK set of primary sensor temperatures"
REQUEST_DEVICE_TEMP_SET = "Request HK set of device sensor temperatures"
REQUEST_DEVICE_SUS_SET = "Request HK set of the SUS temperatures"
@ -70,13 +67,6 @@ def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
if op_code in OpCodeSys.NML:
q.add_log_cmd(InfoSys.NML)
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.NORMAL, 0, q, InfoSys.OFF)
if op_code == OpCodeSys.ENABLE_TEMP_SET:
interval_seconds = float(input("Please specify interval in seconds: "))
cmds = create_enable_periodic_hk_command_with_interval(
False, make_sid(TCS_CONTROLLER, CtrlSetId.PRIMARY_SENSORS), interval_seconds
)
for cmd in cmds:
q.add_pus_tc(cmd)
if op_code == OpCodeSys.ANNOUNCE_MODES:
q.add_log_cmd(InfoSys.ANNOUNCE_MODES)
q.add_pus_tc(create_announce_mode_recursive_command(TCS_SUBSYSTEM_ID))
@ -97,9 +87,8 @@ def add_tcs_subsystem_cmds(defs: TmtcDefinitionWrapper):
oce.add(keys=OpCodeSys.REQUEST_DEVICE_SUS_SET, info=InfoSys.REQUEST_DEVICE_SUS_SET)
oce.add(keys=OpCodeSys.REQUEST_HEATER_INFO, info=InfoSys.REQUEST_HEATER_INFO)
oce.add(keys=OpCodeSys.ANNOUNCE_MODES, info=InfoSys.ANNOUNCE_MODES)
oce.add(keys=OpCodeSys.ENABLE_TEMP_SET, info=InfoSys.ENABLE_TEMP_SET)
defs.add_service(
name=CustomServiceList.TCS,
info="TCS",
info="TCS Board",
op_code_entry=oce,
)

View File

@ -6,17 +6,14 @@
@date 06.01.2021
"""
import enum
import struct
from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.pus_tm.defs import PrintWrapper
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.config.tmtc import (
tmtc_definitions_provider,
TmtcDefinitionWrapper,
OpCodeEntry,
)
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data
from tmtccmd.tc.pus_3_fsfw_hk import create_request_one_hk_command, make_sid
@ -79,10 +76,3 @@ def add_tmp_sens_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCode.NML, Info.NML)
oce.add(OpCode.HK, Info.HK)
defs.add_service(CustomServiceList.TMP1075.value, "TMP1075 Temperature Sensor", oce)
def handle_tmp_1075_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper):
if set_id == SetId.TEMPERATURE:
temp = struct.unpack("!f", hk_data[0:4])[0]
pw.dlog(f"TMP1075 Temperature: {temp}")
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[4:], 1))

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.