From b1ae2ee4ab4ab061f9b32114867e4cda760dcfb8 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 14 Sep 2017 07:27:43 -0700 Subject: [PATCH 01/13] Created openDB() and separated DB connections Worker and main Flask threads have separate connections to the database now. It's a bit messy but should work and does log to database now with my computer. Need to test on Raspberry Pi. --- faraday/telemetry.py | 121 +++++++++++++++++++++++++++---------------- 1 file changed, 75 insertions(+), 46 deletions(-) diff --git a/faraday/telemetry.py b/faraday/telemetry.py index 1eb3b364..83d52496 100644 --- a/faraday/telemetry.py +++ b/faraday/telemetry.py @@ -64,6 +64,28 @@ # Parse the arguments args = parser.parse_args() +def openDB(): + # Read in name of database + try: + dbFilename = telemetryConfig.get("DATABASE", "FILENAME") + dbPath = os.path.join(faradayHelper.userPath, 'lib', dbFilename) + logger.debug("Telemetry Database: " + dbPath) + dbFilename = os.path.join(dbPath) + + except ConfigParser.Error as e: + logger.error("ConfigParse.Error: " + str(e)) + return False + + # Connect to database, create SQL query, execute query, and close database + try: + conn = sqlite3.connect(dbFilename) + + except sqlite3.Error as e: + logger.error("Sqlite3.error: " + str(e)) + conn.close() + + return conn + def initializeTelemetryConfig(): ''' @@ -236,6 +258,10 @@ def telemetry_worker(config): # Initialize Faraday parser faradayParser = telemetryparser.TelemetryParse() # Add logger? + # open database + workerDB = openDB() + logger.info("TelemetryDB = {0}".format(workerDB)) + try: # Pragmatically create descriptors for each Faraday connected to Proxy count = config.getint("TELEMETRY", "UNITS") @@ -299,7 +325,7 @@ def telemetry_worker(config): logger.error("KeyError: " + str(e)) else: - sqlInsert(parsedTelemetry) + sqlInsert(workerDB, parsedTelemetry) telemetryDicts[str(callsign) + str(nodeid)].append(parsedTelemetry) time.sleep(1) # Slow down main while loop @@ -629,11 +655,12 @@ def initDB(): # after connecting. Close the database when complete. try: with open(dbSchema, 'rt') as f: - conn = sqlite3.connect(dbFilename) - cur = conn.cursor() + #conn = sqlite3.connect(dbFilename) + initConn = openDB() + cur = initConn.cursor() schema = f.read() cur.executescript(schema) - conn.close() + initConn.close() except sqlite3.Error as e: logger.error("Sqlite3.Error: " + str(e)) @@ -703,7 +730,7 @@ def createTelemetryList(data): return temp -def sqlInsert(data): +def sqlInsert(dbConn, data): """ Takes in a data tuple and inserts int into the telemetry SQLite table @@ -712,15 +739,15 @@ def sqlInsert(data): """ # Read in name of database - try: - dbFilename = telemetryConfig.get("DATABASE", "FILENAME") - dbPath = os.path.join(faradayHelper.userPath, 'lib', dbFilename) - logger.debug("Telemetry Database: " + dbPath) - db = os.path.join(dbPath) - - except ConfigParser.Error as e: - logger.error("ConfigParse.Error: " + str(e)) - return False + # try: + # dbFilename = telemetryConfig.get("DATABASE", "FILENAME") + # dbPath = os.path.join(faradayHelper.userPath, 'lib', dbFilename) + # logger.debug("Telemetry Database: " + dbPath) + # db = os.path.join(dbPath) + # + # except ConfigParser.Error as e: + # logger.error("ConfigParse.Error: " + str(e)) + # return False # Change dictionary into list with proper order telem = createTelemetryList(data) @@ -734,28 +761,28 @@ def sqlInsert(data): sql = "INSERT INTO TELEMETRY VALUES(" + paramSubs + ")" # Connect to database, create SQL query, execute query, and close database - try: - conn = sqlite3.connect(db) - - except sqlite3.Error as e: - logger.error("Sqlite3.Error: " + str(e)) - return False + # try: + # conn = sqlite3.connect(db) + # + # except sqlite3.Error as e: + # logger.error("Sqlite3.Error: " + str(e)) + # return False # Connect to database, create SQL query, execute query, and close database try: - conn = sqlite3.connect(db) + #conn = sqlite3.connect(db) # Use connection as context manager to rollback automatically if error - with conn: - conn.execute(sql, telem) + with dbConn: + dbConn.execute(sql, telem) except sqlite3.Error as e: logger.error("Sqlite3.Error: " + str(e)) - conn.rollback() - conn.close() + dbConn.rollback() + #dbConn.close() return False # Completed, close database and return True - conn.close() + #dbCconn.close() return True else: @@ -826,27 +853,28 @@ def queryDb(parameters): logger.debug(sql) # Read in name of database - try: - dbFilename = telemetryConfig.get("DATABASE", "FILENAME") - dbPath = os.path.join(faradayHelper.userPath, 'lib', dbFilename) - logger.debug("Telemetry Database: " + dbPath) - dbFilename = os.path.join(dbPath) - - except ConfigParser.Error as e: - logger.error("ConfigParse.Error: " + str(e)) - return False + # try: + # dbFilename = telemetryConfig.get("DATABASE", "FILENAME") + # dbPath = os.path.join(faradayHelper.userPath, 'lib', dbFilename) + # logger.debug("Telemetry Database: " + dbPath) + # dbFilename = os.path.join(dbPath) + # + # except ConfigParser.Error as e: + # logger.error("ConfigParse.Error: " + str(e)) + # return False # Connect to database, create SQL query, execute query, and close database try: - conn = sqlite3.connect(dbFilename) + #conn = sqlite3.connect(dbFilename) + queryConn = openDB() except sqlite3.Error as e: logger.error("Sqlite3.Error: " + str(e)) logger.error(paramTuple) return sqlData - conn.row_factory = sqlite3.Row # Row_factory returns column/values - cur = conn.cursor() + queryConn.row_factory = sqlite3.Row # Row_factory returns column/values + cur = queryConn.cursor() try: cur.execute(sql, paramTuple) @@ -854,7 +882,7 @@ def queryDb(parameters): except sqlite3.Error as e: logger.error("Sqlite3.Error: " + str(e)) logger.error(paramTuple) - conn.close() + queryConn.close() return sqlData # Iterate through resulting data and create a list of dictionaries for JSON @@ -868,11 +896,11 @@ def queryDb(parameters): except StandardError as e: logger.error("StandardError: " + str(e)) - conn.close() + queryConn.close() return sqlData # Completed query, close database, return sqlData list of dictionaries - conn.close() + queryConn.close() return sqlData @@ -945,7 +973,8 @@ def queryStationsDb(parameters): # Connect to database, create SQL query, execute query, and close database try: - conn = sqlite3.connect(dbFilename) + #conn = sqlite3.connect(dbFilename) + queryStationsDB = openDB() except sqlite3.Error as e: logger.error("Sqlite3.error: " + str(e)) @@ -953,7 +982,7 @@ def queryStationsDb(parameters): return sqlData conn.row_factory = sqlite3.Row # SQLite.Row returns columns,values - cur = conn.cursor() + cur = queryStationsDB.cursor() try: cur.execute(sql, paramTuple) @@ -961,7 +990,7 @@ def queryStationsDb(parameters): except sqlite3.Error as e: logger.error("Sqlite3.error: " + str(e)) logger.error(paramTuple) - conn.close() + queryStationsDB.close() return sqlData # Parse through rows and create key:value dictionaries for each row. @@ -976,11 +1005,11 @@ def queryStationsDb(parameters): except StandardError as e: logger.error("StandardError: " + str(e)) - conn.close() + queryStationsDB.close() return sqlData # Completed query, close database, return list of dictionary data for JSON - conn.close() + queryStationsDB.close() return sqlData From c4a93afbb88d1c0c4f025055b1845150f37b4896 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 14 Sep 2017 07:30:04 -0700 Subject: [PATCH 02/13] Fixed a stations/ error with Database Missed an old conn variable that needed to be updated to queryStationsConn. --- faraday/telemetry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faraday/telemetry.py b/faraday/telemetry.py index 83d52496..40f589ff 100644 --- a/faraday/telemetry.py +++ b/faraday/telemetry.py @@ -981,7 +981,7 @@ def queryStationsDb(parameters): logger.error(paramTuple) return sqlData - conn.row_factory = sqlite3.Row # SQLite.Row returns columns,values + queryStationsDB.row_factory = sqlite3.Row # SQLite.Row returns columns,values cur = queryStationsDB.cursor() try: From 946a83bddbb53009b384c39e9b35798371ea35d8 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 14 Sep 2017 07:45:19 -0700 Subject: [PATCH 03/13] Open and close database on sqlinsert, fixed error Open and close database on every sqlInsert() call. Also found I wasn't properly closing the database prior which might be why stations failed? --- faraday/telemetry.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/faraday/telemetry.py b/faraday/telemetry.py index 40f589ff..12b18670 100644 --- a/faraday/telemetry.py +++ b/faraday/telemetry.py @@ -258,10 +258,6 @@ def telemetry_worker(config): # Initialize Faraday parser faradayParser = telemetryparser.TelemetryParse() # Add logger? - # open database - workerDB = openDB() - logger.info("TelemetryDB = {0}".format(workerDB)) - try: # Pragmatically create descriptors for each Faraday connected to Proxy count = config.getint("TELEMETRY", "UNITS") @@ -325,6 +321,7 @@ def telemetry_worker(config): logger.error("KeyError: " + str(e)) else: + workerDB = openDB() sqlInsert(workerDB, parsedTelemetry) telemetryDicts[str(callsign) + str(nodeid)].append(parsedTelemetry) time.sleep(1) # Slow down main while loop @@ -778,11 +775,11 @@ def sqlInsert(dbConn, data): except sqlite3.Error as e: logger.error("Sqlite3.Error: " + str(e)) dbConn.rollback() - #dbConn.close() + dbConn.close() return False # Completed, close database and return True - #dbCconn.close() + dbConn.close() return True else: From 32e8c303ec7cfc2b15ae3b8ad81f9eb2835a3d70 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 14 Sep 2017 07:58:33 -0700 Subject: [PATCH 04/13] Added WAL mode on openDB() and in initial db. --- faraday/telemetry.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/faraday/telemetry.py b/faraday/telemetry.py index 12b18670..82525198 100644 --- a/faraday/telemetry.py +++ b/faraday/telemetry.py @@ -79,6 +79,8 @@ def openDB(): # Connect to database, create SQL query, execute query, and close database try: conn = sqlite3.connect(dbFilename) + conn.execute("PRAGMA journal_mode=WAL;") + conn.commit() except sqlite3.Error as e: logger.error("Sqlite3.error: " + str(e)) @@ -657,6 +659,8 @@ def initDB(): cur = initConn.cursor() schema = f.read() cur.executescript(schema) + cur.execute("PRAGMA journal_mode=WAL;") + initConn.commit() initConn.close() except sqlite3.Error as e: From c1bc60ce15e2591f99f342244c9561322b813da3 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 14 Sep 2017 21:48:04 -0700 Subject: [PATCH 05/13] Cleaned up openDB() Added documentation and removed unnecessary code. Cleaned up a few return False statements too. --- faraday/telemetry.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/faraday/telemetry.py b/faraday/telemetry.py index 82525198..8e405574 100644 --- a/faraday/telemetry.py +++ b/faraday/telemetry.py @@ -65,18 +65,22 @@ args = parser.parse_args() def openDB(): - # Read in name of database + ''' + Open telemetry database and return a SQLite3 connection + + :return: SQLite connection + ''' + # Read in name of database from configuration file try: dbFilename = telemetryConfig.get("DATABASE", "FILENAME") dbPath = os.path.join(faradayHelper.userPath, 'lib', dbFilename) - logger.debug("Telemetry Database: " + dbPath) dbFilename = os.path.join(dbPath) except ConfigParser.Error as e: logger.error("ConfigParse.Error: " + str(e)) return False - # Connect to database, create SQL query, execute query, and close database + # Connect to database, enter WAL mode, commit SQL try: conn = sqlite3.connect(dbFilename) conn.execute("PRAGMA journal_mode=WAL;") @@ -85,7 +89,9 @@ def openDB(): except sqlite3.Error as e: logger.error("Sqlite3.error: " + str(e)) conn.close() + return False + # Return SQLite3 connection return conn From 924d749f0628123b01e119ab9fb04e080f341c07 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 14 Sep 2017 21:59:12 -0700 Subject: [PATCH 06/13] Continued cleanup of openDB() and related uses Added telemetryWorker catching of False flag when error occurs. --- faraday/telemetry.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/faraday/telemetry.py b/faraday/telemetry.py index 8e405574..c03892ec 100644 --- a/faraday/telemetry.py +++ b/faraday/telemetry.py @@ -76,12 +76,14 @@ def openDB(): dbPath = os.path.join(faradayHelper.userPath, 'lib', dbFilename) dbFilename = os.path.join(dbPath) + except ConfigParser.Error as e: logger.error("ConfigParse.Error: " + str(e)) return False # Connect to database, enter WAL mode, commit SQL try: + conn = sqlite3.connect(dbFilename) conn.execute("PRAGMA journal_mode=WAL;") conn.commit() @@ -330,8 +332,14 @@ def telemetry_worker(config): else: workerDB = openDB() - sqlInsert(workerDB, parsedTelemetry) - telemetryDicts[str(callsign) + str(nodeid)].append(parsedTelemetry) + logger.info(workerDB) + if workerDB: + sqlInsert(workerDB, parsedTelemetry) + telemetryDicts[str(callsign) + str(nodeid)].append(parsedTelemetry) + else: + # An error has occured writing to database, break + logger.error("Telemetry worker database error") + break time.sleep(1) # Slow down main while loop From 4b3f7b1a0e5ef6390a3d10bd2cbd4aaf1b2657d2 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 14 Sep 2017 22:23:55 -0700 Subject: [PATCH 07/13] Reverted back to not returning False Instead just raise exceptions and let it run it's course. Seems more straightforward. --- faraday/telemetry.py | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/faraday/telemetry.py b/faraday/telemetry.py index c03892ec..2a3047de 100644 --- a/faraday/telemetry.py +++ b/faraday/telemetry.py @@ -79,7 +79,6 @@ def openDB(): except ConfigParser.Error as e: logger.error("ConfigParse.Error: " + str(e)) - return False # Connect to database, enter WAL mode, commit SQL try: @@ -91,7 +90,6 @@ def openDB(): except sqlite3.Error as e: logger.error("Sqlite3.error: " + str(e)) conn.close() - return False # Return SQLite3 connection return conn @@ -332,14 +330,8 @@ def telemetry_worker(config): else: workerDB = openDB() - logger.info(workerDB) - if workerDB: - sqlInsert(workerDB, parsedTelemetry) - telemetryDicts[str(callsign) + str(nodeid)].append(parsedTelemetry) - else: - # An error has occured writing to database, break - logger.error("Telemetry worker database error") - break + sqlInsert(workerDB, parsedTelemetry) + telemetryDicts[str(callsign) + str(nodeid)].append(parsedTelemetry) time.sleep(1) # Slow down main while loop @@ -668,7 +660,7 @@ def initDB(): # after connecting. Close the database when complete. try: with open(dbSchema, 'rt') as f: - #conn = sqlite3.connect(dbFilename) + # Open connection to database, create table and WAL mode, close initConn = openDB() cur = initConn.cursor() schema = f.read() @@ -867,18 +859,7 @@ def queryDb(parameters): sql = sqlBeg + sqlWhereCall + sqlWhereID + sqlEpoch + sqlEnd logger.debug(sql) - # Read in name of database - # try: - # dbFilename = telemetryConfig.get("DATABASE", "FILENAME") - # dbPath = os.path.join(faradayHelper.userPath, 'lib', dbFilename) - # logger.debug("Telemetry Database: " + dbPath) - # dbFilename = os.path.join(dbPath) - # - # except ConfigParser.Error as e: - # logger.error("ConfigParse.Error: " + str(e)) - # return False - - # Connect to database, create SQL query, execute query, and close database + # Connect to database, execute query, and close database try: #conn = sqlite3.connect(dbFilename) queryConn = openDB() From f0d51ab4f5be1b7c521434139f874605ecaea9cf Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 14 Sep 2017 22:33:29 -0700 Subject: [PATCH 08/13] Cleaned up commented out code and added comments Removed the rest of the code I commented out to move towards discrete DB connections per thread. I also cleaned up several areas with better/new comments. --- faraday/telemetry.py | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/faraday/telemetry.py b/faraday/telemetry.py index 2a3047de..4acefe95 100644 --- a/faraday/telemetry.py +++ b/faraday/telemetry.py @@ -329,6 +329,7 @@ def telemetry_worker(config): logger.error("KeyError: " + str(e)) else: + # Successful decode, open database and save telemetry workerDB = openDB() sqlInsert(workerDB, parsedTelemetry) telemetryDicts[str(callsign) + str(nodeid)].append(parsedTelemetry) @@ -744,18 +745,6 @@ def sqlInsert(dbConn, data): :param data: Telemetry dictionary :return: Status True or False on SQL insertion success """ - - # Read in name of database - # try: - # dbFilename = telemetryConfig.get("DATABASE", "FILENAME") - # dbPath = os.path.join(faradayHelper.userPath, 'lib', dbFilename) - # logger.debug("Telemetry Database: " + dbPath) - # db = os.path.join(dbPath) - # - # except ConfigParser.Error as e: - # logger.error("ConfigParse.Error: " + str(e)) - # return False - # Change dictionary into list with proper order telem = createTelemetryList(data) @@ -767,22 +756,14 @@ def sqlInsert(dbConn, data): paramSubs = ",".join(paramSubs) sql = "INSERT INTO TELEMETRY VALUES(" + paramSubs + ")" - # Connect to database, create SQL query, execute query, and close database - # try: - # conn = sqlite3.connect(db) - # - # except sqlite3.Error as e: - # logger.error("Sqlite3.Error: " + str(e)) - # return False - - # Connect to database, create SQL query, execute query, and close database + # Connect to database, execute query, and close database try: - #conn = sqlite3.connect(db) - # Use connection as context manager to rollback automatically if error + # Execute SQL with dbConn: dbConn.execute(sql, telem) except sqlite3.Error as e: + # An error occured, rollback and close connection, return False logger.error("Sqlite3.Error: " + str(e)) dbConn.rollback() dbConn.close() @@ -861,7 +842,6 @@ def queryDb(parameters): # Connect to database, execute query, and close database try: - #conn = sqlite3.connect(dbFilename) queryConn = openDB() except sqlite3.Error as e: @@ -967,9 +947,8 @@ def queryStationsDb(parameters): logger.error("ConfigParse.Error: " + str(e)) return False - # Connect to database, create SQL query, execute query, and close database + # Connect to database, execute query, and close database try: - #conn = sqlite3.connect(dbFilename) queryStationsDB = openDB() except sqlite3.Error as e: From eb8840924f24716e6f7ef048df063b9f27d692af Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Thu, 14 Sep 2017 22:37:26 -0700 Subject: [PATCH 09/13] Fixed Pytest errors --- faraday/telemetry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faraday/telemetry.py b/faraday/telemetry.py index 4acefe95..55d23b2d 100644 --- a/faraday/telemetry.py +++ b/faraday/telemetry.py @@ -64,6 +64,7 @@ # Parse the arguments args = parser.parse_args() + def openDB(): ''' Open telemetry database and return a SQLite3 connection @@ -76,7 +77,6 @@ def openDB(): dbPath = os.path.join(faradayHelper.userPath, 'lib', dbFilename) dbFilename = os.path.join(dbPath) - except ConfigParser.Error as e: logger.error("ConfigParse.Error: " + str(e)) From c5553e3f64c8ff3240217d7b412232077b759231 Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Fri, 15 Sep 2017 21:12:45 -0700 Subject: [PATCH 10/13] Moved line 960 into try statemenet Per an error with a locked database on line 960 cur = queryStationsDB.cursor() I moved this into the next try statement to see if it catches better. --- faraday/telemetry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faraday/telemetry.py b/faraday/telemetry.py index 55d23b2d..703f1bbc 100644 --- a/faraday/telemetry.py +++ b/faraday/telemetry.py @@ -957,9 +957,9 @@ def queryStationsDb(parameters): return sqlData queryStationsDB.row_factory = sqlite3.Row # SQLite.Row returns columns,values - cur = queryStationsDB.cursor() try: + cur = queryStationsDB.cursor() cur.execute(sql, paramTuple) except sqlite3.Error as e: From 35053743b84a19752c5b1935b721071fd934884f Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Sat, 16 Sep 2017 10:19:55 -0700 Subject: [PATCH 11/13] Added try/except statement to getStations() Needed to catch a JSON decode error if faraday-telemetry returns bad JSON data on one particular instance. This allows faraday-aprs to continue and obtain new data on next call of getStations(). --- faraday/aprs.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index 1d1336c6..d6bc8168 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -166,7 +166,14 @@ def getStations(): logger.debug(url) r = requests.get(url) - results = r.json() + + try: + results = r.json() + + except ValueError as e: + # JSON ValueError error, just return a blank value + logger.error(e) + results = '' # Return extracted JSON data return results From cfdee3a9da35808b5a263ee7ffc104ce0d668d3d Mon Sep 17 00:00:00 2001 From: kb1lqc Date: Wed, 20 Sep 2017 22:21:25 -0700 Subject: [PATCH 12/13] Fixed Telemetry sequence counting bug I never stopped the counter from incrementing and once the value reached 8280 and incremented to 8281 the telemetry suddenly was rejected/ignored by aprs.fi. This led to realizing the counter is limited to this value and I should just reset. Therefore this fix just implements a for loop counting in the infinite while loop which resets to zero after counting to 8179. Yes I stayed one count away from the maximum just incase there is misunderstanding about zero indexing. --- faraday/aprs.py | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/faraday/aprs.py b/faraday/aprs.py index d6bc8168..faae92ea 100644 --- a/faraday/aprs.py +++ b/faraday/aprs.py @@ -102,37 +102,37 @@ def aprs_worker(config): rate = config.getint("APRSIS", "RATE") # Local variable initialization - telemSequence = 0 conn = False # Start infinite loop to send station data to APRS-IS while True: - # Query telemetry database for station data - stations = getStations() - stationData = getStationData(stations) - - # Indicate number of stations tracking - str = "Tracking {0} Faraday stations..." - logger.info(str.format(len(stations))) - - # Iterate through all stations sending telemetry and position data - if not conn: - sock = connectAPRSIS() - try: - conn = sendPositions(telemSequence, stationData, sock) + # Count through 8280 telemetry sequences (BASE91 limit) + for sequence in range(8280): + # Query telemetry database for station data + stations = getStations() + stationData = getStationData(stations) + + # Indicate number of stations tracking + str = "Tracking {0} Faraday stations..." + logger.info(str.format(len(stations))) + + # Iterate through all stations sending telemetry and position data + if not conn: + sock = connectAPRSIS() + try: + conn = sendPositions(sequence, stationData, sock) - # Just send labels, Parameters, and Equations every 10th loop - if telemSequence % 10 == 0: - sendTelemLabels(stationData, sock) - sendParameters(stationData, sock) - sendEquations(stationData, sock) - telemSequence += 1 + # Just send labels, Parameters, and Equations every 10th loop + if sequence % 10 == 0: + sendTelemLabels(stationData, sock) + sendParameters(stationData, sock) + sendEquations(stationData, sock) - except StandardError as e: - logger.error(e) + except StandardError as e: + logger.error(e) - # Sleep for intended update rate (seconds) - sleep(rate) + # Sleep for intended update rate (seconds) + sleep(rate) # Now act upon the command line arguments From 0c05ec2ec39fc09e410a356577adcf1006c1657c Mon Sep 17 00:00:00 2001 From: Bryce Salmi Date: Wed, 27 Sep 2017 22:14:30 -0700 Subject: [PATCH 13/13] Added aprslib to requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index aef09f8a..036a5949 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,3 +20,4 @@ pytest-flake8==0.8.1 requests==2.12.5 six==1.10.0 Werkzeug==0.11.15 +aprslib>=0.6.46