fix APRS settings page, initial commit of 24 hour timer for APRS ACK

This commit is contained in:
KF7EEL 2022-02-21 18:06:22 -08:00
parent 763d3f4470
commit 9ec30997e3
2 changed files with 11 additions and 7 deletions

View File

@ -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):

View File

@ -2626,6 +2626,7 @@ FLOOD_TIMEOUT = ''' + str(s.unit_time)
'''
show_form = True
for i in settings.items():
print(type(i[1]))
content = content + '''
<form action="aprs_settings?save_id=''' + str(i[0]) + '''" method="post">
<tr>
@ -6614,10 +6615,10 @@ Name: <strong>''' + p.name + '''</strong>&nbsp; -&nbsp; Port: <strong>''' + 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: <strong>''' + p.name + '''</strong>&nbsp; -&nbsp; Port: <strong>''' + 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'),