From 9ec30997e31b019879d100c1feabeae154968af8 Mon Sep 17 00:00:00 2001 From: KF7EEL Date: Mon, 21 Feb 2022 18:06:22 -0800 Subject: [PATCH] fix APRS settings page, initial commit of 24 hour timer for APRS ACK --- data_gateway.py | 11 +++++++---- web/app.py | 7 ++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/data_gateway.py b/data_gateway.py index cb5a740..ed5ab36 100644 --- a/data_gateway.py +++ b/data_gateway.py @@ -1423,9 +1423,12 @@ def aprs_process(packet): ## print(UNIT_MAP) # Write function to check UNIT_MAP and see if X amount of time has passed, if time passed, no ACK. This will prevent multiple gateways from # ACKing. time of 24hrs? - logger.info(str(aprslib.parse(packet)['addresse']) + '>APHBL3,TCPIP*:' + ':' + str(aprslib.parse(packet)['from'].ljust(9)) +':ack' + str(aprslib.parse(packet)['msgNo'])) - aprs_send(str(aprslib.parse(packet)['addresse']) + '>APHBL3,TCPIP*:' + ':' + str(aprslib.parse(packet)['from'].ljust(9)) +':ack' + str(aprslib.parse(packet)['msgNo'])) - logger.info('Send ACK') + if bytes_3(sms_id) in UNIT_MAP: + logger.info(str(aprslib.parse(packet)['addresse']) + '>APHBL3,TCPIP*:' + ':' + str(aprslib.parse(packet)['from'].ljust(9)) +':ack' + str(aprslib.parse(packet)['msgNo'])) + aprs_send(str(aprslib.parse(packet)['addresse']) + '>APHBL3,TCPIP*:' + ':' + str(aprslib.parse(packet)['from'].ljust(9)) +':ack' + str(aprslib.parse(packet)['msgNo'])) + logger.info('Send ACK') + else: + logger.info('Station not seen in 24 hours, not acknowledging') except Exception as e: logger.info(e) except Exception as e: @@ -1761,7 +1764,7 @@ def rule_timer_loop(): global UNIT_MAP logger.debug('(ROUTER) routerHBP Rule timer loop started') _now = time() - _then = _now - 3600 + _then = _now - (3600 *24) remove_list = [] for unit in UNIT_MAP: if UNIT_MAP[unit][1] < (_then): diff --git a/web/app.py b/web/app.py index 62fc7f5..fb9fc29 100644 --- a/web/app.py +++ b/web/app.py @@ -2626,6 +2626,7 @@ FLOOD_TIMEOUT = ''' + str(s.unit_time) ''' show_form = True for i in settings.items(): + print(type(i[1])) content = content + '''
@@ -6614,10 +6615,10 @@ Name: ''' + p.name + '''  -  Port: ''' + str( del aprs_settings[i[0]] misc_edit_field_1('unregistered_aprs', str(aprs_settings), '', '', 0, 0, 0, 0, False, False) elif i[0] not in aprs_settings: - aprs_dict[i[0]] = """[{'call': '""" + str(request.form.get('username')).upper() + """'}, {'ssid': ''}, {'icon': ''}, {'comment': ''}, {'pin': ''}, {'APRS': False}]""" + aprs_dict[i[0]] = [{'call': str(request.form.get('username')).upper()}, {'ssid': ''}, {'icon': ''}, {'comment': ''}, {'pin': ''}, {'APRS': False}] except Exception as e: - aprs_dict[i[0]] = """[{'call': '""" + str(request.form.get('username')).upper() + """'}, {'ssid': ''}, {'icon': ''}, {'comment': ''}, {'pin': ''}, {'APRS': False}]""" + aprs_dict[i[0]] = [{'call': str(request.form.get('username')).upper()}, {'ssid': ''}, {'icon': ''}, {'comment': ''}, {'pin': ''}, {'APRS': False}] print(e) new_aprs = aprs_dict.copy() for s in aprs_dict: @@ -6625,7 +6626,7 @@ Name: ''' + p.name + '''  -  Port: ''' + str( if i[0] == s: pass elif i[0] != s: - new_aprs[i[0]] = """[{'call': '""" + str(request.form.get('username')).upper() + """'}, {'ssid': ''}, {'icon': ''}, {'comment': ''}, {'pin': ''}, {'APRS': False}]""" + new_aprs[i[0]] = [{'call': str(request.form.get('username')).upper()}, {'ssid': ''}, {'icon': ''}, {'comment': ''}, {'pin': ''}, {'APRS': False}] user = User( username=request.form.get('username'), email=request.form.get('email'),