From 62f9e1abaa457de0663b76a549b11f56dbb5f377 Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Sat, 9 Apr 2022 22:34:56 -0400 Subject: [PATCH] //WIP v3 GQRX Changes - Ensure AGC is enabled whenever the bot starts --- gqrxHandler.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gqrxHandler.py b/gqrxHandler.py index 6fc75ec..a17f60c 100644 --- a/gqrxHandler.py +++ b/gqrxHandler.py @@ -18,11 +18,20 @@ def reset_crashed(_config_path): with open(_config_path, 'w') as config_file: config.write(config_file) return True - else: return False +def enable_agc(_config_path): + config = configparser.SafeConfigParser() + config.read(_config_path) + if config.has_option('receiver', 'agc_off'): + config.remove_option('receiver', 'agc_off') + with open(_config_path, 'w') as config_file: + config.write(config_file) + return True + + class GQRXHandler(threading.Thread): def __init__(self): super().__init__() @@ -206,6 +215,9 @@ class GQRXHandler(threading.Thread): def reset_or_create_config(self): if self.GQRX_Config_Path.is_file(): + self.logger.debug(f"Enabling AGC in the GQRX config") + enable_agc(_config_path=self.GQRX_Config_Path) + self.logger.debug(f"GQRX Config exists, resetting 'crashed' setting") reset_crashed(_config_path=self.GQRX_Config_Path) else: