From dad1f900e5740a1f8727716ded1c8af436fca48e Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Mon, 4 Sep 2017 17:52:10 -0700 Subject: [PATCH 01/28] Initial addition of APRS BASE91 Code Using aprslib with a simple import of base91 function to help create position comments that will send highly accurate data (up to 16 bits). Therefor this will help with using all 12 bits of the ADC on Faraday!. --- faraday/aprs.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 568f584d..4bf41485 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -17,6 +17,7 @@ from time import sleep import sys import argparse +from aprslib import base91 from classes import helper @@ -273,9 +274,17 @@ def sendPositions(stations, socket): node = sourceCallsign + "-" + str(sourceID) destNode = destinationCallsign + "-" + str(destinationID) + # Generate BASE91 telemetry + b91a = base91.from_decimal(station["ADC0"]) + logger.info("ADC0 - {0}".format(b91a)) + # Convert position to APRS-IS compliant string latString, lonString = nmeaToDegDecMin(latitude, longitude) + #dev + latString = '3359.00' + lonString = '11825.00' + # Convert altitude and speed to APRS compliant values try: rawaltitude = str(round(altitude, 0)).split('.') @@ -416,11 +425,11 @@ def sendtelemetry(stations, telemSequence, socket): node, destAddress, str(telemSequence).zfill(3), - str(station["ADC0"] / 16).zfill(3), - str(station["ADC1"] / 16).zfill(3), - str(station["ADC3"] / 16).zfill(3), - str(station["ADC6"] / 16).zfill(3), - str(station["BOARDTEMP"] / 16).zfill(3), + str(4095), + str(4095), + str(4095), + str(4095), + str(4095), ioList) logger.debug(telemetry) From 62263c500938f64e06fa22ff146b96eb53d3280c Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Mon, 4 Sep 2017 17:58:42 -0700 Subject: [PATCH 02/28] ADC0, ADC1, ADC3, ADC6, and BOARDTEMP BASE91 all channels previously sent with telemetry packet are now encoded into BASE91 format. They are however not used yet. --- faraday/aprs.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/faraday/aprs.py b/faraday/aprs.py index 4bf41485..810136ba 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -276,7 +276,15 @@ def sendPositions(stations, socket): # Generate BASE91 telemetry b91a = base91.from_decimal(station["ADC0"]) + b91b = base91.from_decimal(station["ADC1"]) + b91c = base91.from_decimal(station["ADC3"]) + b91d = base91.from_decimal(station["ADC6"]) + b91e = base91.from_decimal(station["BOARDTEMP"]) logger.info("ADC0 - {0}".format(b91a)) + logger.info("ADC1 - {0}".format(b91b)) + logger.info("ADC3 - {0}".format(b91c)) + logger.info("ADC6 - {0}".format(b91d)) + logger.info("BOARDTEMP - {0}".format(b91e)) # Convert position to APRS-IS compliant string latString, lonString = nmeaToDegDecMin(latitude, longitude) From 5ccd19ac48fd10352dc4855f42037b0fc25f7d10 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Mon, 4 Sep 2017 18:05:20 -0700 Subject: [PATCH 03/28] Added telemetry sequence to sendPosition Needed it for BASE91 APRS transmissions. Also commented out sendTelemetry. --- faraday/aprs.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 810136ba..7273a907 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -115,8 +115,9 @@ def aprs_worker(config, sock): logger.info(str.format(len(stations))) # Iterate through all stations sending telemetry and position data - sendPositions(stationData, sock) - telemSequence = sendtelemetry(stationData, telemSequence, sock) + # TODO update sequencer with 0x1FFF wrapper per BASE91 APRS spec + sendPositions(telemSequence, stationData, sock) + #telemSequence = sendtelemetry(stationData, telemSequence, sock) sendTelemLabels(stationData, sock) sendParameters(stationData, sock) sendEquations(stationData, sock) @@ -232,7 +233,7 @@ def nmeaToDegDecMin(latitude, longitude): return [latString, lonString] -def sendPositions(stations, socket): +def sendPositions(telemSequence, stations, socket): """ Constructs an APRS position string for station and sends to a socket @@ -275,11 +276,13 @@ def sendPositions(stations, socket): destNode = destinationCallsign + "-" + str(destinationID) # Generate BASE91 telemetry + b91seq = base91.from_decimal(telemSequence) b91a = base91.from_decimal(station["ADC0"]) b91b = base91.from_decimal(station["ADC1"]) b91c = base91.from_decimal(station["ADC3"]) b91d = base91.from_decimal(station["ADC6"]) b91e = base91.from_decimal(station["BOARDTEMP"]) + logger.info("sequence - {0}".format(b91seq)) logger.info("ADC0 - {0}".format(b91a)) logger.info("ADC1 - {0}".format(b91b)) logger.info("ADC3 - {0}".format(b91c)) From 74212a3db597fb8b858b9f25b4ee0b3e2dca9bba Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Mon, 4 Sep 2017 22:50:23 -0700 Subject: [PATCH 04/28] Working telemetry and some hacked in telemetry seq I had to change up how the telemetry sequence counter worked. Also, we actually can count higher than 255 with BASE91 telemetry so we will do that. Also, this has a lot of development code but I will clean it up later as I let it run for a while. --- faraday/aprs.py | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 7273a907..87152ea3 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -117,6 +117,7 @@ def aprs_worker(config, sock): # Iterate through all stations sending telemetry and position data # TODO update sequencer with 0x1FFF wrapper per BASE91 APRS spec sendPositions(telemSequence, stationData, sock) + telemSequence += 1 #telemSequence = sendtelemetry(stationData, telemSequence, sock) sendTelemLabels(stationData, sock) sendParameters(stationData, sock) @@ -276,12 +277,17 @@ def sendPositions(telemSequence, stations, socket): destNode = destinationCallsign + "-" + str(destinationID) # Generate BASE91 telemetry - b91seq = base91.from_decimal(telemSequence) - b91a = base91.from_decimal(station["ADC0"]) - b91b = base91.from_decimal(station["ADC1"]) - b91c = base91.from_decimal(station["ADC3"]) - b91d = base91.from_decimal(station["ADC6"]) - b91e = base91.from_decimal(station["BOARDTEMP"]) + # station["ADC0"] = 1472 + # station["ADC1"] = 1564 + # station["ADC3"] = 1656 + # station["ADC6"] = 1748 + # station["BOARDTEMP"] = 1840 + b91seq = base91.from_decimal(telemSequence).rjust(2,"!") + b91a = base91.from_decimal(station["ADC0"]).rjust(2,"!") + b91b = base91.from_decimal(station["ADC1"]).rjust(2,"!") + b91c = base91.from_decimal(station["ADC3"]).rjust(2,"!") + b91d = base91.from_decimal(station["ADC6"]).rjust(2,"!") + b91e = base91.from_decimal(station["BOARDTEMP"]).rjust(2,"!") logger.info("sequence - {0}".format(b91seq)) logger.info("ADC0 - {0}".format(b91a)) logger.info("ADC1 - {0}".format(b91b)) @@ -289,6 +295,10 @@ def sendPositions(telemSequence, stations, socket): logger.info("ADC6 - {0}".format(b91d)) logger.info("BOARDTEMP - {0}".format(b91e)) + altComment = "|{0}{1}{2}{3}{4}{5}|".format(b91seq,b91a,b91b,b91c,b91d,b91e) + #altComment = "|{0}{1}{2}|".format(b91seq,b91a,b91b) + logger.info(altComment) + # Convert position to APRS-IS compliant string latString, lonString = nmeaToDegDecMin(latitude, longitude) @@ -325,14 +335,23 @@ def sendPositions(telemSequence, stations, socket): longitudeDir, symbol]) - positionString = '{}>{},{},{}:{}.../{}/A={}{}\r'.format( + # positionString = '{}>{},{},{}:{}.../{}/A={}{}\r'.format( + # node, + # destAddress, + # qConstruct, + # destNode, + # aprsPosition, + # speed, + # altitude, + # comment) + + positionString = '{}>{},{},{}:{}.../{}/{}\r'.format( node, destAddress, qConstruct, destNode, aprsPosition, speed, - altitude, comment) logger.debug(positionString) From eb55358238437c5ff0bff77dc9a11b3144af0451 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Mon, 4 Sep 2017 23:03:45 -0700 Subject: [PATCH 05/28] Per @rossengeorgiev there is a width for BASE91 He pointed out that I missed the width setting in his implementation of BASE91. It appears to be working! My bad... --- faraday/aprs.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 87152ea3..2daf9a25 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -282,12 +282,12 @@ def sendPositions(telemSequence, stations, socket): # station["ADC3"] = 1656 # station["ADC6"] = 1748 # station["BOARDTEMP"] = 1840 - b91seq = base91.from_decimal(telemSequence).rjust(2,"!") - b91a = base91.from_decimal(station["ADC0"]).rjust(2,"!") - b91b = base91.from_decimal(station["ADC1"]).rjust(2,"!") - b91c = base91.from_decimal(station["ADC3"]).rjust(2,"!") - b91d = base91.from_decimal(station["ADC6"]).rjust(2,"!") - b91e = base91.from_decimal(station["BOARDTEMP"]).rjust(2,"!") + b91seq = base91.from_decimal(telemSequence, 2) + b91a = base91.from_decimal(station["ADC0"], 2) + b91b = base91.from_decimal(station["ADC1"], 2) + b91c = base91.from_decimal(station["ADC3"], 2) + b91d = base91.from_decimal(station["ADC6"], 2) + b91e = base91.from_decimal(station["BOARDTEMP"], 2) logger.info("sequence - {0}".format(b91seq)) logger.info("ADC0 - {0}".format(b91a)) logger.info("ADC1 - {0}".format(b91b)) From d132474465b38b6c57af13f95329aee3b22ab1a7 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Tue, 5 Sep 2017 06:53:32 -0700 Subject: [PATCH 06/28] Cleaned up APRS Position Telemetry Code Removed a bunch of dev code and added normal comments back in. --- faraday/aprs.py | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 2daf9a25..a95f6fb3 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -276,36 +276,23 @@ def sendPositions(telemSequence, stations, socket): node = sourceCallsign + "-" + str(sourceID) destNode = destinationCallsign + "-" + str(destinationID) - # Generate BASE91 telemetry - # station["ADC0"] = 1472 - # station["ADC1"] = 1564 - # station["ADC3"] = 1656 - # station["ADC6"] = 1748 - # station["BOARDTEMP"] = 1840 + # Generate BASE91 telemetry with aprslib using a width of 2 b91seq = base91.from_decimal(telemSequence, 2) b91a = base91.from_decimal(station["ADC0"], 2) b91b = base91.from_decimal(station["ADC1"], 2) b91c = base91.from_decimal(station["ADC3"], 2) b91d = base91.from_decimal(station["ADC6"], 2) b91e = base91.from_decimal(station["BOARDTEMP"], 2) - logger.info("sequence - {0}".format(b91seq)) - logger.info("ADC0 - {0}".format(b91a)) - logger.info("ADC1 - {0}".format(b91b)) - logger.info("ADC3 - {0}".format(b91c)) - logger.info("ADC6 - {0}".format(b91d)) - logger.info("BOARDTEMP - {0}".format(b91e)) - altComment = "|{0}{1}{2}{3}{4}{5}|".format(b91seq,b91a,b91b,b91c,b91d,b91e) - #altComment = "|{0}{1}{2}|".format(b91seq,b91a,b91b) - logger.info(altComment) + b91Tlm = "|{0}{1}{2}{3}{4}{5}|".format(b91seq,b91a,b91b,b91c,b91d,b91e) + + # add telemetry to comments + comment = comment + b91Tlm + altComment = altComment + b91Tlm # Convert position to APRS-IS compliant string latString, lonString = nmeaToDegDecMin(latitude, longitude) - #dev - latString = '3359.00' - lonString = '11825.00' - # Convert altitude and speed to APRS compliant values try: rawaltitude = str(round(altitude, 0)).split('.') @@ -335,23 +322,14 @@ def sendPositions(telemSequence, stations, socket): longitudeDir, symbol]) - # positionString = '{}>{},{},{}:{}.../{}/A={}{}\r'.format( - # node, - # destAddress, - # qConstruct, - # destNode, - # aprsPosition, - # speed, - # altitude, - # comment) - - positionString = '{}>{},{},{}:{}.../{}/{}\r'.format( + positionString = '{}>{},{},{}:{}.../{}/A={}{}\r'.format( node, destAddress, qConstruct, destNode, aprsPosition, speed, + altitude, comment) logger.debug(positionString) From 0a57a3b712bc2f3b5e28b4dbdb2bfeff6a558807 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 00:06:33 -0700 Subject: [PATCH 07/28] Added IO to position comment data using integers encoded into BASE91 format I now also send IO data to APRS-IS with each position! --- faraday/aprs.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index a95f6fb3..999245b4 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -271,11 +271,22 @@ def sendPositions(telemSequence, stations, socket): altSymbol = aprsConfig.get('APRS', 'ALTSYMBOL') comment = aprsConfig.get('APRS', 'COMMENT') altComment = aprsConfig.get('APRS', 'ALTCOMMENT') + ioSource = aprsConfig.get('APRS', 'IOSOURCE').upper() # Create nodes from GPS data node = sourceCallsign + "-" + str(sourceID) destNode = destinationCallsign + "-" + str(destinationID) + #Obtain GPIO data + gpioValues = station["GPIOSTATE"] + rfValues = station["RFSTATE"] + + # Extract IO data + if ioSource == 'GPIO': + ioList = gpioValues + elif ioSource == 'RF': + ioList = rfValues + # Generate BASE91 telemetry with aprslib using a width of 2 b91seq = base91.from_decimal(telemSequence, 2) b91a = base91.from_decimal(station["ADC0"], 2) @@ -283,8 +294,9 @@ def sendPositions(telemSequence, stations, socket): b91c = base91.from_decimal(station["ADC3"], 2) b91d = base91.from_decimal(station["ADC6"], 2) b91e = base91.from_decimal(station["BOARDTEMP"], 2) + b91f = base91.from_decimal(ioList, 2) - b91Tlm = "|{0}{1}{2}{3}{4}{5}|".format(b91seq,b91a,b91b,b91c,b91d,b91e) + b91Tlm = "|{0}{1}{2}{3}{4}{5}{6}|".format(b91seq,b91a,b91b,b91c,b91d,b91e,b91f) # add telemetry to comments comment = comment + b91Tlm From 7ead5f3d1dd6650bda748d410a4030c23cc93c5c Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 00:16:17 -0700 Subject: [PATCH 08/28] Only send Parameters, Labels, and Equations once Decided to only send them once right now during initial loop through sending. This will hopefully reduce the number of times I have APRS.fi tell me I'm abusing the network :) --- faraday/aprs.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 999245b4..e74b6a8f 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -115,13 +115,14 @@ def aprs_worker(config, sock): logger.info(str.format(len(stations))) # Iterate through all stations sending telemetry and position data - # TODO update sequencer with 0x1FFF wrapper per BASE91 APRS spec sendPositions(telemSequence, stationData, sock) + + # Just send labels, Parameters, and Equations during first sequence + if telemSequence == 0: + sendTelemLabels(stationData, sock) + sendParameters(stationData, sock) + sendEquations(stationData, sock) telemSequence += 1 - #telemSequence = sendtelemetry(stationData, telemSequence, sock) - sendTelemLabels(stationData, sock) - sendParameters(stationData, sock) - sendEquations(stationData, sock) # Sleep for intended update rate (seconds) sleep(rate) From b82e2fdbd67bf9b5acac4d6733fdf9d48adcab89 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 21:54:52 -0700 Subject: [PATCH 09/28] Fixed up pytest PEP8 Failures --- faraday/aprs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index e74b6a8f..dd24a132 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -297,7 +297,7 @@ def sendPositions(telemSequence, stations, socket): b91e = base91.from_decimal(station["BOARDTEMP"], 2) b91f = base91.from_decimal(ioList, 2) - b91Tlm = "|{0}{1}{2}{3}{4}{5}{6}|".format(b91seq,b91a,b91b,b91c,b91d,b91e,b91f) + b91Tlm = "|{0}{1}{2}{3}{4}{5}{6}|".format(b91seq, b91a, b91b, b91c, b91d, b91e, b91f) # add telemetry to comments comment = comment + b91Tlm From 161145ce59c9579e865d88a66cc84c742d37d246 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 21:59:39 -0700 Subject: [PATCH 10/28] Updated comments for sendPosition() function --- faraday/aprs.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index dd24a132..c2351aa7 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -237,8 +237,10 @@ def nmeaToDegDecMin(latitude, longitude): def sendPositions(telemSequence, stations, socket): """ - Constructs an APRS position string for station and sends to a socket + Constructs an APRS position string for station and sends to a socket. + Includes BASE91 comment telemetry functionality as well. + :param telemSequence: Telemetry sequence number :param stations: List of dictionary organized station data :param socket: APRS-IS server internet socket :return: None From 541f10c55c2a5f5bca8138887e4243b2b5327b89 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 22:21:20 -0700 Subject: [PATCH 11/28] Reversed 4095 hardcoded values in sendTelemetry I changed them for development testing and never changed them back. This function is currently unused as it is. --- faraday/aprs.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index c2351aa7..c93a992b 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -448,11 +448,11 @@ def sendtelemetry(stations, telemSequence, socket): node, destAddress, str(telemSequence).zfill(3), - str(4095), - str(4095), - str(4095), - str(4095), - str(4095), + str(station["ADC0"] / 16).zfill(3), + str(station["ADC1"] / 16).zfill(3), + str(station["ADC3"] / 16).zfill(3), + str(station["ADC6"] / 16).zfill(3), + str(station["BOARDTEMP"] / 16).zfill(3), ioList) logger.debug(telemetry) From e68b4081814403358f45238cd0f68c326b02df5d Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 23:27:24 -0700 Subject: [PATCH 12/28] Just got reconnection working! Lots of development code in here but I can close down the aprs-is server (aprsc) and start it back up after indication of an error by faraday-aprs. The program just keeps on going after server starts back up. --- faraday/aprs.py | 65 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 18 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index c93a992b..731530a5 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -104,6 +104,11 @@ def aprs_worker(config, sock): # Local variable initialization telemSequence = 0 + #dev + sock = '' + sock = connectAPRSIS() + conn = True + # Start infinite loop to send station data to APRS-IS while True: # Query telemetry database for station data @@ -115,14 +120,21 @@ def aprs_worker(config, sock): logger.info(str.format(len(stations))) # Iterate through all stations sending telemetry and position data - sendPositions(telemSequence, stationData, sock) + if not conn: + sock = connectAPRSIS() + try: + conn = sendPositions(telemSequence, stationData, sock) + + # Just send labels, Parameters, and Equations during first sequence + # if telemSequence == 0: + # + # sendTelemLabels(stationData, sock) + # sendParameters(stationData, sock) + # sendEquations(stationData, sock) + telemSequence += 1 - # Just send labels, Parameters, and Equations during first sequence - if telemSequence == 0: - sendTelemLabels(stationData, sock) - sendParameters(stationData, sock) - sendEquations(stationData, sock) - telemSequence += 1 + except StandardError as e: + logger.error(e) # Sleep for intended update rate (seconds) sleep(rate) @@ -351,9 +363,13 @@ def sendPositions(telemSequence, stations, socket): try: socket.sendall(positionString) + return True except IOError as e: + logger.info("'test sendPositions'") logger.error(e) + socket.close() + return False elif node == destNode: # APRS string is for local node @@ -376,10 +392,12 @@ def sendPositions(telemSequence, stations, socket): try: socket.sendall(positionString) + return True except IOError as e: - logger.error("SendPosition") logger.error(e) + socket.close() + return False def sendtelemetry(stations, telemSequence, socket): @@ -439,8 +457,9 @@ def sendtelemetry(stations, telemSequence, socket): socket.sendall(telemetry) except IOError as e: - logger.error("SendTelemetry") - logger.error(e) + logger.error(e) + socket.close() + sock = connectAPRSIS() elif node == destNode: # APRS string is for local node @@ -461,8 +480,9 @@ def sendtelemetry(stations, telemSequence, socket): socket.sendall(telemetry) except IOError as e: - logger.error("Sendtelemetry") logger.error(e) + socket.close() + sock = connectAPRSIS() # Check for telemetry sequence rollover if telemSequence >= 999: @@ -529,8 +549,9 @@ def sendTelemLabels(stations, socket): socket.sendall(labels) except IOError as e: - logger.error("SendTelemLabels") logger.error(e) + socket.close() + sock = connectAPRSIS() elif node == destNode: # APRS string is for local node @@ -542,8 +563,9 @@ def sendTelemLabels(stations, socket): socket.sendall(labels) except IOError as e: - logger.error("SendTelemLabels") logger.error(e) + socket.close() + sock = connectAPRSIS() def sendParameters(stations, socket): @@ -601,8 +623,9 @@ def sendParameters(stations, socket): socket.sendall(parameters) except IOError as e: - logger.error("SendParameters") logger.error(e) + socket.close() + sock = connectAPRSIS() elif node == destNode: # APRS string is for local node @@ -614,8 +637,9 @@ def sendParameters(stations, socket): socket.sendall(parameters) except IOError as e: - logger.error("SendParameters") logger.error(e) + socket.close() + sock = connectAPRSIS() def sendEquations(stations, socket): @@ -673,8 +697,9 @@ def sendEquations(stations, socket): socket.sendall(equations) except IOError as e: - logger.error("SendEquations") logger.error(e) + socket.close() + sock = connectAPRSIS() elif node == destNode: # APRS string is for local node @@ -686,8 +711,9 @@ def sendEquations(stations, socket): socket.sendall(equations) except IOError as e: - logger.error("SendEquations") logger.error(e) + socket.close() + sock = connectAPRSIS() def connectAPRSIS(): @@ -726,6 +752,8 @@ def connectAPRSIS(): except IOError as e: logger.error(e) + logger.error("testconnect") + aprssock.close() else: logger.info("Connection successful!") @@ -794,7 +822,8 @@ def main(): """ logger.info('Starting Faraday APRS-IS application') - sock = connectAPRSIS() + #sock = connectAPRSIS() + sock = '' # Initialize local variables threads = [] From 4db85fb06fdde5f5d53ae5ab4738501fb6296eec Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 23:32:07 -0700 Subject: [PATCH 13/28] Removed unnecessary comment in sendPositions --- faraday/aprs.py | 1 - 1 file changed, 1 deletion(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 731530a5..d88c0cc2 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -366,7 +366,6 @@ def sendPositions(telemSequence, stations, socket): return True except IOError as e: - logger.info("'test sendPositions'") logger.error(e) socket.close() return False From 8eafdf5b715fbd042d447709e23051423daa4ffd Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 23:36:12 -0700 Subject: [PATCH 14/28] Simplified packet sending with sendAPRSPacket Created a function that could be commong to all packet types. This prevents me from having to duplicate the same code a bunch in aprs.py --- faraday/aprs.py | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index d88c0cc2..23695b90 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -246,6 +246,16 @@ def nmeaToDegDecMin(latitude, longitude): return [latString, lonString] +def sendAPRSPacket(socket, packet): + try: + socket.sendall(packet) + return True + + except IOError as e: + logger.error(e) + socket.close() + return False + def sendPositions(telemSequence, stations, socket): """ @@ -361,14 +371,17 @@ def sendPositions(telemSequence, stations, socket): logger.debug(positionString) - try: - socket.sendall(positionString) - return True + status = sendAPRSPacket(socket,positionString) + return status - except IOError as e: - logger.error(e) - socket.close() - return False + # try: + # socket.sendall(positionString) + # return True + # + # except IOError as e: + # logger.error(e) + # socket.close() + # return False elif node == destNode: # APRS string is for local node @@ -389,14 +402,18 @@ def sendPositions(telemSequence, stations, socket): altComment) logger.debug(positionString) - try: - socket.sendall(positionString) - return True - except IOError as e: - logger.error(e) - socket.close() - return False + status = sendAPRSPacket(socket,positionString) + return status + + # try: + # socket.sendall(positionString) + # return True + # + # except IOError as e: + # logger.error(e) + # socket.close() + # return False def sendtelemetry(stations, telemSequence, socket): From 041a9224241c63eadb4e563b01450dd9cc60d0bb Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 23:38:58 -0700 Subject: [PATCH 15/28] Removed commented out code and added documentation Removed old commented out code while also adding documentation for sendAPRSPacket. --- faraday/aprs.py | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 23695b90..3d18840a 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -247,6 +247,16 @@ def nmeaToDegDecMin(latitude, longitude): return [latString, lonString] def sendAPRSPacket(socket, packet): + """ + Sends an APRS packet (just a string) to the socket specified. If an + error occurs a False is returned while a True is returned if successful. + On an error, the socket is closed as it is no longer useful. + + :param telemSequence: Telemetry sequence number + :param stations: List of dictionary organized station data + :param socket: APRS-IS server internet socket + :return: None + """ try: socket.sendall(packet) return True @@ -374,14 +384,6 @@ def sendPositions(telemSequence, stations, socket): status = sendAPRSPacket(socket,positionString) return status - # try: - # socket.sendall(positionString) - # return True - # - # except IOError as e: - # logger.error(e) - # socket.close() - # return False elif node == destNode: # APRS string is for local node @@ -406,15 +408,6 @@ def sendPositions(telemSequence, stations, socket): status = sendAPRSPacket(socket,positionString) return status - # try: - # socket.sendall(positionString) - # return True - # - # except IOError as e: - # logger.error(e) - # socket.close() - # return False - def sendtelemetry(stations, telemSequence, socket): """ From bf2a6f103dacf6cc28fa7ef673f3d695379e644b Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 23:43:01 -0700 Subject: [PATCH 16/28] Send all packets on 10th loop While still commented out, the labels, parameters, and equations packets are now send on every 10th loop. --- faraday/aprs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 3d18840a..614d1903 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -125,8 +125,8 @@ def aprs_worker(config, sock): try: conn = sendPositions(telemSequence, stationData, sock) - # Just send labels, Parameters, and Equations during first sequence - # if telemSequence == 0: + # Just send labels, Parameters, and Equations every 10th loop + # if telemSequence % 10 == 0: # # sendTelemLabels(stationData, sock) # sendParameters(stationData, sock) From 05653406bfd9833e00de8ceaf7d95e80cf96bbb9 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 23:52:41 -0700 Subject: [PATCH 17/28] Implemented sendAPRSPacket() on all packets Went through all packets being sent and made them all use the sendAPRSPacket function. This helps clarify the design as well as provide fault detection and reconnection. --- faraday/aprs.py | 108 ++++++++++++++---------------------------------- 1 file changed, 32 insertions(+), 76 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 614d1903..17339d3b 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -126,11 +126,11 @@ def aprs_worker(config, sock): conn = sendPositions(telemSequence, stationData, sock) # Just send labels, Parameters, and Equations every 10th loop - # if telemSequence % 10 == 0: - # - # sendTelemLabels(stationData, sock) - # sendParameters(stationData, sock) - # sendEquations(stationData, sock) + if telemSequence % 10 == 0: + + sendTelemLabels(stationData, sock) + sendParameters(stationData, sock) + sendEquations(stationData, sock) telemSequence += 1 except StandardError as e: @@ -247,16 +247,17 @@ def nmeaToDegDecMin(latitude, longitude): return [latString, lonString] def sendAPRSPacket(socket, packet): - """ - Sends an APRS packet (just a string) to the socket specified. If an - error occurs a False is returned while a True is returned if successful. - On an error, the socket is closed as it is no longer useful. - - :param telemSequence: Telemetry sequence number - :param stations: List of dictionary organized station data - :param socket: APRS-IS server internet socket - :return: None - """ + """ + Sends an APRS packet (just a string) to the socket specified. If an + error occurs a False is returned while a True is returned if successful. + On an error, the socket is closed as it is no longer useful. + + :param telemSequence: Telemetry sequence number + :param stations: List of dictionary organized station data + :param socket: APRS-IS server internet socket + :return: None + """ + try: socket.sendall(packet) return True @@ -462,13 +463,8 @@ def sendtelemetry(stations, telemSequence, socket): logger.debug(telemetry) - try: - socket.sendall(telemetry) - - except IOError as e: - logger.error(e) - socket.close() - sock = connectAPRSIS() + status = sendAPRSPacket(socket, telemetry) + return status elif node == destNode: # APRS string is for local node @@ -485,13 +481,8 @@ def sendtelemetry(stations, telemSequence, socket): logger.debug(telemetry) - try: - socket.sendall(telemetry) - - except IOError as e: - logger.error(e) - socket.close() - sock = connectAPRSIS() + status = sendAPRSPacket(socket, telemetry) + return status # Check for telemetry sequence rollover if telemSequence >= 999: @@ -554,27 +545,16 @@ def sendTelemLabels(stations, socket): node, destAddress, qConstruct, destNode, node, unitsAndLabels) logger.debug(labels) - try: - socket.sendall(labels) - - except IOError as e: - logger.error(e) - socket.close() - sock = connectAPRSIS() + status = sendAPRSPacket(socket, labels) + return status elif node == destNode: # APRS string is for local node labels = '{}>{}::{} :UNIT.{}\r'.format( node, destAddress, node, unitsAndLabels) - logger.debug(labels) - try: - socket.sendall(labels) - - except IOError as e: - logger.error(e) - socket.close() - sock = connectAPRSIS() + status = sendAPRSPacket(socket, labels) + return status def sendParameters(stations, socket): @@ -627,28 +607,16 @@ def sendParameters(stations, socket): parameters = '{}>{},{},{}::{} :PARM.{}\r'.format( node, destAddress, qConstruct, destNode, node, adcAndIoParams) - logger.debug(parameters) - try: - socket.sendall(parameters) - - except IOError as e: - logger.error(e) - socket.close() - sock = connectAPRSIS() + status = sendAPRSPacket(socket, parameters) + return status elif node == destNode: # APRS string is for local node parameters = '{}>{}::{} :PARM.{}\r'.format( node, destAddress, node, adcAndIoParams) - logger.debug(parameters) - try: - socket.sendall(parameters) - - except IOError as e: - logger.error(e) - socket.close() - sock = connectAPRSIS() + status = sendAPRSPacket(socket, parameters) + return status def sendEquations(stations, socket): @@ -701,28 +669,16 @@ def sendEquations(stations, socket): equations = '{}>{},{},{}::{} :EQNS.{}\r'.format( node, destAddress, qConstruct, destNode, node, equationConfig) - logger.debug(equations) - try: - socket.sendall(equations) - - except IOError as e: - logger.error(e) - socket.close() - sock = connectAPRSIS() + status = sendAPRSPacket(socket, equations) + return status elif node == destNode: # APRS string is for local node equations = '{}>{}::{} :EQNS.{}\r'.format( node, destAddress, node, equationConfig) - logger.debug(equations) - try: - socket.sendall(equations) - - except IOError as e: - logger.error(e) - socket.close() - sock = connectAPRSIS() + status = sendAPRSPacket(socket, equations) + return status def connectAPRSIS(): From 982b169967d6b172ef87b48c1d125d1e157c2b65 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 23:54:51 -0700 Subject: [PATCH 18/28] Updated sendAPRSPacket documenation Fixed some errors in the docstring. --- faraday/aprs.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 17339d3b..b196d9dd 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -252,10 +252,9 @@ def sendAPRSPacket(socket, packet): error occurs a False is returned while a True is returned if successful. On an error, the socket is closed as it is no longer useful. - :param telemSequence: Telemetry sequence number - :param stations: List of dictionary organized station data :param socket: APRS-IS server internet socket - :return: None + :param packet: String to be sent to APRS-IS + :return: Boolean """ try: From ffe768dd0c248e2296e88a1eb72f71beadf39666 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 23:56:21 -0700 Subject: [PATCH 19/28] Fixed pytest errors/warnings --- faraday/aprs.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index b196d9dd..9996268d 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -246,6 +246,7 @@ def nmeaToDegDecMin(latitude, longitude): return [latString, lonString] + def sendAPRSPacket(socket, packet): """ Sends an APRS packet (just a string) to the socket specified. If an @@ -381,10 +382,9 @@ def sendPositions(telemSequence, stations, socket): logger.debug(positionString) - status = sendAPRSPacket(socket,positionString) + status = sendAPRSPacket(socket, positionString) return status - elif node == destNode: # APRS string is for local node aprsPosition = ''.join([ @@ -404,8 +404,7 @@ def sendPositions(telemSequence, stations, socket): altComment) logger.debug(positionString) - - status = sendAPRSPacket(socket,positionString) + status = sendAPRSPacket(socket, positionString) return status From 5c476074e46c152b45019d40114e36309d05d51f Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 7 Sep 2017 23:59:05 -0700 Subject: [PATCH 20/28] Updated parameter names ADC names were wrong and I made them not wrong. --- etc/faraday/aprs.sample.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/faraday/aprs.sample.ini b/etc/faraday/aprs.sample.ini index b74dee85..0b85a131 100644 --- a/etc/faraday/aprs.sample.ini +++ b/etc/faraday/aprs.sample.ini @@ -39,9 +39,9 @@ BLABEL7=IO ADC0PARAM=ADC0 ADC1PARAM=ADC1 -ADC2PARAM=ADC2 -ADC3PARAM=ADC7 -ADC4PARAM=ADC8 +ADC2PARAM=ADC3 +ADC3PARAM=ADC6 +ADC4PARAM=TEMP IO0PARAM=IO IO1PARAM=IO IO2PARAM=IO @@ -65,4 +65,4 @@ EQ3B=1 EQ3C=0 EQ4A=0 EQ4B=1 -EQ4C=0 \ No newline at end of file +EQ4C=0 From 83ae953c7e2df8de302d937b9ff86e3ffd47e630 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Fri, 8 Sep 2017 22:12:06 -0700 Subject: [PATCH 21/28] Fixed reconnection issue on extended network loss Running tests over the day I observed from a local aprsc server that network connectivity was lost for a few minutes at the same time that my APRS telemetry stopped. Investigating by disableing my own network connection for several faraday-aprs loops I observed the ERRNO 10054, ERRNO 11004, and ERRNO 9 errors. I found that while I closed the socket aprsSock in the connection code on an IOError I did not recreate a new socket for aprsSock which resulted in an indefinitely bad file descriptor (because it didn't exist) whenever I tried to reconnect. This should be fixed now as I added the automatic aprsSock creation in. --- faraday/aprs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 9996268d..84ee9066 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -714,16 +714,17 @@ def connectAPRSIS(): aprssock.sendall(logon_string) except IOError as e: + # Close socket and setup for next connection attempt logger.error(e) - logger.error("testconnect") aprssock.close() + aprssock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) else: logger.info("Connection successful!") return aprssock break - sleep(10) # Try to reconnect every 10 seconds + sleep(2) # Try to reconnect every 10 seconds return aprssock else: while True: From 799b61f91b26c5b18e447093fdc6c2752d8c89a6 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Sun, 10 Sep 2017 14:25:05 -0700 Subject: [PATCH 22/28] Removed development code/comments Removed the #dev comment as well as manual setting of sock to a string. Instead I changed conn=False to force it to always initialize inside the loop. --- faraday/aprs.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 84ee9066..b72850c3 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -103,11 +103,7 @@ def aprs_worker(config, sock): # Local variable initialization telemSequence = 0 - - #dev - sock = '' - sock = connectAPRSIS() - conn = True + conn = False # Start infinite loop to send station data to APRS-IS while True: From ac65bd6b73bfa237f11a555a22122cab522cff7a Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Sun, 10 Sep 2017 14:27:41 -0700 Subject: [PATCH 23/28] Removed extra line under if statement --- faraday/aprs.py | 1 - 1 file changed, 1 deletion(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index b72850c3..8ff23138 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -123,7 +123,6 @@ def aprs_worker(config, sock): # Just send labels, Parameters, and Equations every 10th loop if telemSequence % 10 == 0: - sendTelemLabels(stationData, sock) sendParameters(stationData, sock) sendEquations(stationData, sock) From b354512563f8fad47646e6dc83c22b829d52d946 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Sun, 10 Sep 2017 14:31:46 -0700 Subject: [PATCH 24/28] Replaced return status with reture sendAPRSPacket Removing unnecessary use of status variable by directly returning output of sendAPRSPacket. --- faraday/aprs.py | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 8ff23138..e4d250d6 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -377,8 +377,7 @@ def sendPositions(telemSequence, stations, socket): logger.debug(positionString) - status = sendAPRSPacket(socket, positionString) - return status + return sendAPRSPacket(socket, positionString) elif node == destNode: # APRS string is for local node @@ -399,8 +398,7 @@ def sendPositions(telemSequence, stations, socket): altComment) logger.debug(positionString) - status = sendAPRSPacket(socket, positionString) - return status + return sendAPRSPacket(socket, positionString) def sendtelemetry(stations, telemSequence, socket): @@ -456,8 +454,7 @@ def sendtelemetry(stations, telemSequence, socket): logger.debug(telemetry) - status = sendAPRSPacket(socket, telemetry) - return status + return sendAPRSPacket(socket, telemetry) elif node == destNode: # APRS string is for local node @@ -474,8 +471,7 @@ def sendtelemetry(stations, telemSequence, socket): logger.debug(telemetry) - status = sendAPRSPacket(socket, telemetry) - return status + return sendAPRSPacket(socket, telemetry) # Check for telemetry sequence rollover if telemSequence >= 999: @@ -538,16 +534,14 @@ def sendTelemLabels(stations, socket): node, destAddress, qConstruct, destNode, node, unitsAndLabels) logger.debug(labels) - status = sendAPRSPacket(socket, labels) - return status + return sendAPRSPacket(socket, labels) elif node == destNode: # APRS string is for local node labels = '{}>{}::{} :UNIT.{}\r'.format( node, destAddress, node, unitsAndLabels) - status = sendAPRSPacket(socket, labels) - return status + return sendAPRSPacket(socket, labels) def sendParameters(stations, socket): @@ -600,16 +594,14 @@ def sendParameters(stations, socket): parameters = '{}>{},{},{}::{} :PARM.{}\r'.format( node, destAddress, qConstruct, destNode, node, adcAndIoParams) - status = sendAPRSPacket(socket, parameters) - return status + return sendAPRSPacket(socket, parameters) elif node == destNode: # APRS string is for local node parameters = '{}>{}::{} :PARM.{}\r'.format( node, destAddress, node, adcAndIoParams) - status = sendAPRSPacket(socket, parameters) - return status + return sendAPRSPacket(socket, parameters) def sendEquations(stations, socket): @@ -662,16 +654,14 @@ def sendEquations(stations, socket): equations = '{}>{},{},{}::{} :EQNS.{}\r'.format( node, destAddress, qConstruct, destNode, node, equationConfig) - status = sendAPRSPacket(socket, equations) - return status + return sendAPRSPacket(socket, equations) elif node == destNode: # APRS string is for local node equations = '{}>{}::{} :EQNS.{}\r'.format( node, destAddress, node, equationConfig) - status = sendAPRSPacket(socket, equations) - return status + return sendAPRSPacket(socket, equations) def connectAPRSIS(): From a0e6d7311b008d01e17e307d1e81e535e5f260fb Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Sun, 10 Sep 2017 14:33:20 -0700 Subject: [PATCH 25/28] Removed useless break statement after return --- faraday/aprs.py | 1 - 1 file changed, 1 deletion(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index e4d250d6..374a0b3f 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -707,7 +707,6 @@ def connectAPRSIS(): else: logger.info("Connection successful!") return aprssock - break sleep(2) # Try to reconnect every 10 seconds return aprssock From ddcb2ff4b778bfff18ff35b878640a6bc524ac54 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Sun, 10 Sep 2017 14:34:32 -0700 Subject: [PATCH 26/28] Cleaned up commented code and sock initialization --- faraday/aprs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 374a0b3f..7d413b44 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -770,11 +770,11 @@ def main(): """ logger.info('Starting Faraday APRS-IS application') - #sock = connectAPRSIS() - sock = '' # Initialize local variables threads = [] + sock = '' + t = threading.Thread(target=aprs_worker, args=(aprsConfig, sock)) threads.append(t) From 75d69305a6e9b53d3625e034f8dc3c43cb8c1410 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Sun, 10 Sep 2017 14:37:05 -0700 Subject: [PATCH 27/28] Removed passing of sock variable to threads aprs_worker creates it's own socket connection so it's unnecessary to pass any reference to a socket file descriptor when starting up the thread! --- faraday/aprs.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 7d413b44..d5732fae 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -90,7 +90,7 @@ def configureAPRS(args): config.write(configfile) -def aprs_worker(config, sock): +def aprs_worker(config): """ Obtains telemetry with infinite loop, forwards to APRS-IS server @@ -773,10 +773,8 @@ def main(): # Initialize local variables threads = [] - sock = '' - - t = threading.Thread(target=aprs_worker, args=(aprsConfig, sock)) + t = threading.Thread(target=aprs_worker, args=(aprsConfig,)) threads.append(t) t.start() From f529c01983a39a86c0e515c2320a13d45baacf6e Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Sun, 10 Sep 2017 16:03:45 -0700 Subject: [PATCH 28/28] Updated reconnect comment and BASE91 comment add Per @reillyeon a += b is more efficient than a = a + b. Therefore I changed it. --- faraday/aprs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index d5732fae..1d1336c6 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -330,8 +330,8 @@ def sendPositions(telemSequence, stations, socket): b91Tlm = "|{0}{1}{2}{3}{4}{5}{6}|".format(b91seq, b91a, b91b, b91c, b91d, b91e, b91f) # add telemetry to comments - comment = comment + b91Tlm - altComment = altComment + b91Tlm + comment += b91Tlm + altComment += b91Tlm # Convert position to APRS-IS compliant string latString, lonString = nmeaToDegDecMin(latitude, longitude) @@ -708,7 +708,7 @@ def connectAPRSIS(): logger.info("Connection successful!") return aprssock - sleep(2) # Try to reconnect every 10 seconds + sleep(2) # Try to reconnect every 2 seconds return aprssock else: while True: