From 79ab9423b44f19d4b3825222b4cc0c80554f61a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= Date: Sun, 21 Mar 2021 11:13:12 +0100 Subject: [PATCH] Add GR_SATELLITES_SUBMIT_TLM env variable to control tlm submit This reads the environment variable GR_SATELLITES_SUBMIT_TLM from the gr-satellites core flowgraph. If the variable exists and can be converted into an int, its truth value forces/disables telemetry submission, ignoring the value in the config file. This is used in the test.sh script to disable telemetry submission as suggested in #214 --- CHANGELOG.md | 1 + python/core/gr_satellites_flowgraph.py | 12 +++++++++++- test.sh | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bf6222e..1d6b882c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support for TAUSAT-1 and TSURU - 2k4 downlink for MEZNSAT - Support for SMOG-1 +- Env variable GR_SATELLITES_SUBMIT_TLM to force/disable telemetry submission ### Fixed - RS basis options swapped in CCSDS Reed-Solomon encoder GRC block diff --git a/python/core/gr_satellites_flowgraph.py b/python/core/gr_satellites_flowgraph.py index d062c261..bce7ca88 100644 --- a/python/core/gr_satellites_flowgraph.py +++ b/python/core/gr_satellites_flowgraph.py @@ -23,6 +23,7 @@ import yaml import argparse import itertools +import os import shlex def set_options(cl, *args, **kwargs): @@ -183,8 +184,17 @@ def _init_additional_datasinks(self): self.options.kiss_server)) if self.options is not None and self.options.zmq_pub: self._additional_datasinks.append(zeromq.pub_msg_sink(self.options.zmq_pub)) - if self.config.getboolean('Groundstation', 'submit_tlm'): + + # The GR_SATELLITES_SUBMIT_TLM environment variable takes precendence + # over the configuration to choose whether to enable telemetry submission + tlm_env = os.environ.get('GR_SATELLITES_SUBMIT_TLM') + if tlm_env is not None: + tlm_submit = bool(int(tlm_env)) + else: + tlm_submit = self.config.getboolean('Groundstation', 'submit_tlm') + if tlm_submit: self._additional_datasinks.extend(self.get_telemetry_submitters(self.satyaml, self.config, self.options)) + if self.options is not None and self.options.hexdump: self._additional_datasinks.append(datasinks.hexdump_sink()) diff --git a/test.sh b/test.sh index 3a95cbb3..30978ba0 100755 --- a/test.sh +++ b/test.sh @@ -1,5 +1,7 @@ #!/bin/sh +export GR_SATELLITES_SUBMIT_TLM=0 + echo 1KUNS-PF gr_satellites 1KUNS-PF --wavfile satellite-recordings/1kuns_pf.wav echo 3CAT-1