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: