Compare commits

...

9 Commits

Author SHA1 Message Date
Robin Mueller
2c96b9ed4c Merge remote-tracking branch 'origin/develop' into mueller/master 2022-03-01 17:33:02 +01:00
c58e9e6ce2 Merge pull request 'meier/startracker' (#38) from meier/startracker into develop
Reviewed-on: #38
2022-03-01 17:32:30 +01:00
Robin Mueller
a408a3caec Merge remote-tracking branch 'origin/develop' into mueller/master 2022-03-01 17:31:49 +01:00
Robin Mueller
ec27380f16 finsihed first param cmd definition 2022-03-01 17:31:36 +01:00
Robin Mueller
fd01098345 spacepackets and tmtc update 2022-03-01 17:25:50 +01:00
Jakob Meier
79d912fc80 adaptions for windows in lint script 2022-03-01 17:13:20 +01:00
Jakob Meier
bd551984ad Merge branch 'develop' of https://egit.irs.uni-stuttgart.de/eive/eive-tmtc into meier/startracker 2022-03-01 16:58:21 +01:00
Jakob Meier
e64913bb52 star tracker firmware files 2022-03-01 16:58:06 +01:00
Robin Mueller
9efb347aa2 update lint.py 2022-03-01 16:57:40 +01:00
6 changed files with 66 additions and 12 deletions

View File

@@ -6,9 +6,9 @@
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="C:\Users\EIVE_Reinraumrechner\EIVE-Software-Q7S\eive-obsw\tmtc\Scripts\python.exe" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="false" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />

34
lint.py
View File

@@ -4,18 +4,36 @@ import sys
def main():
# Ignore folder created by venv
exclude_dirs_flag = "--exclude bin,lib"
exclude_dirs_flag = ""
if not os.path.exists("setup.cfg"):
exclude_dirs_flag = (
"--exclude .git,__pycache__,docs/conf.py,old,build,dist,venv"
)
additional_flags_both_steps = "--count --statistics"
additional_flags_first_step = "--select=E9,F63,F7,F82 --show-source"
flake8_first_step_cmd = f"flake8 . {additional_flags_both_steps} {additional_flags_first_step} {exclude_dirs_flag}"
python_exe = ""
if os.name == "nt":
python_exe = "py -m"
flake8_first_step_cmd = (
f"{python_exe} flake8 . {additional_flags_both_steps} "
f"{additional_flags_first_step} {exclude_dirs_flag}"
)
status = os.system(flake8_first_step_cmd)
if os.WEXITSTATUS(status) != 0:
print("Flake8 linter errors")
sys.exit(0)
if os.name == "nt":
if status != 0:
print(f"Flake8 linter errors with status {status}")
else:
if os.WEXITSTATUS(status) != 0:
print(f"Flake8 linter errors with status {status}")
sys.exit(0)
additional_flags_second_step = (
'--exit-zero --max-complexity=10 --per-file-ignores="__init__.py:F401"'
)
if not os.path.exists("setup.cfg"):
additional_flags_second_step += " --max-line-length=100"
flake8_second_step_cmd = (
f"flake8 . {additional_flags_both_steps} --exit-zero --max-complexity=10 "
f"--max-line-length=127 {exclude_dirs_flag}"
f"{python_exe} flake8 . {additional_flags_both_steps} {additional_flags_second_step}"
f" {exclude_dirs_flag}"
)
os.system(flake8_second_step_cmd)

View File

@@ -3,13 +3,20 @@ import enum
from tmtccmd.config import QueueCommands
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.service_200_mode import pack_mode_data, Modes, Subservices
from tmtccmd.tc.service_20_parameter import (
pack_scalar_double_param_app_data,
pack_fsfw_load_param_cmd
)
from tmtccmd.utility.logger import get_console_logger
from spacepackets.ecss.tc import PusTelecommand
from config.object_ids import PL_PCDU_ID
LOGGER = get_console_logger()
class OpCodes:
SWITCH_ADC_ON = ["0", "switch-adc-on"]
SWITCH_ALL_ON = ["1", "switch-all-on"]
UPDATE_DRO_TO_X8_WAIT = ["2", "dro-to-x8-wait"]
class Submodes(enum.IntEnum):
@@ -17,6 +24,10 @@ class Submodes(enum.IntEnum):
ALL_ON = 1
class ParamIds(enum.IntEnum):
DRO_TO_X8_WAIT_TIME = 17
def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str):
if op_code in OpCodes.SWITCH_ADC_ON:
tc_queue.appendleft((QueueCommands.PRINT, "Switching PL PCDU ADC module on"))
@@ -36,3 +47,25 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str):
service=200, subservice=Subservices.SWITCH_MODE, app_data=mode_data
)
tc_queue.appendleft(mode_cmd.pack_command_tuple())
if op_code in OpCodes.UPDATE_DRO_TO_X8_WAIT:
tc_queue.appendleft((QueueCommands.PRINT, "Updating DRO to X8 wait time"))
while True:
wait_time = input("Please enter DRO to X8 wait time in seconds, x to cancel")
if wait_time.lower() == "x":
return
if not wait_time.isnumeric():
LOGGER.warning("Invalid input")
continue
wait_time = float(wait_time)
if wait_time <= 0:
LOGGER.warning("Invalid input")
else:
break
param_data = pack_scalar_double_param_app_data(
object_id=PL_PCDU_ID,
domain_id=0,
unique_id=ParamIds.DRO_TO_X8_WAIT_TIME,
parameter=wait_time
)
cmd = pack_fsfw_load_param_cmd(ssc=0, app_data=param_data)
tc_queue.appendleft(cmd.pack_command_tuple())

View File

@@ -95,6 +95,9 @@ class FileDefs:
)
q7s_ground_config = "/mnt/sd0/startracker/json/ground-config.json"
q7s_flight_config = "/mnt/sd0/startracker/flight-config.json"
firmware2_1 = "/home/pi/arcsec/firmware/sagitta-2-1.bin"
firmware22_1 = "/home/pi/arcsec/firmware/sagitta-22-1.bin"
firmware_origin = "/home/pi/arcsec/firmware/sagitta-origin.bin"
json_dict = {

Submodule tmtccmd updated: f7bbf4bd9f...9af8340c02