improvement for syrlinks code

This commit is contained in:
Robin Müller 2023-03-26 20:09:19 +02:00
parent 4b5c4fecc7
commit f6fcb2fb28
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 9 additions and 1 deletions

View File

@ -15,6 +15,10 @@ list yields a list of all related PRs for each release.
- COM `Submode` enum moved from subsystem module to separate definitions module and renamed
to `Mode`. Added re-imports with the name `ComMode` in the subsystem and syrlinks module.
## Fixed
- Eb to N0 calculation: Improve robustness against division by zero.
# [v2.19.4] 2023-03-24
## Fixed

View File

@ -304,7 +304,11 @@ def handle_syrlinks_rx_registers_dataset(printer: FsfwTmTcPrinter, hk_data: byte
rx_agc = rx_agc_value & 0xFFF
rx_demod_eb = struct.unpack("!I", hk_data[13:17])[0] & 0xFFFFFF
rx_demod_n0 = struct.unpack("!I", hk_data[17:21])[0] & 0xFFFFFF
eb_to_n0 = 20 * math.log10(rx_demod_eb / rx_demod_n0) - 3
if rx_demod_n0 > 0:
eb_to_n0 = 20 * math.log10(rx_demod_eb / rx_demod_n0) - 3
else:
logging.getLogger(__name__).warning("RX Demod N0 is 0, can not calculate Eb to N0")
eb_to_n0 = 0
rx_data_rate_raw = hk_data[21]
rx_data_rate = -1
if rx_data_rate_raw == 0: