Skip to content

Commit d20e8e5

Browse files
committed
Initial implementation of U4B tracker
1 parent b94a27e commit d20e8e5

File tree

7 files changed

+377
-55
lines changed

7 files changed

+377
-55
lines changed

BalloonCfg.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ def getBalloonCfg():
4141
#==============================================================================================================#
4242

4343
def checkCfg(bCallsign):
44+
if 'tracker' not in bCallsign.keys():
45+
logging.error(f" *** Item 'tracker' was NOT found in CFG file" )
46+
sys.exit( "\n*** Missing CFG item, check log file ***" )
4447
if 'uploadcallsign' not in bCallsign.keys():
4548
logging.error(f" *** Item 'uploadcallsign' was NOT found in CFG file" )
4649
sys.exit( "\n*** Missing CFG item, check log file ***" )
@@ -53,9 +56,6 @@ def checkCfg(bCallsign):
5356
if 'timeslot' not in bCallsign.keys():
5457
logging.error(f" *** Item 'timeslot' was NOT found in CFG file" )
5558
sys.exit( "\n*** Missing CFG item, check log file ***" )
56-
if 'tracker' not in bCallsign.keys():
57-
logging.error(f" *** Item 'tracker' was NOT found in CFG file" )
58-
sys.exit( "\n*** Missing CFG item, check log file ***" )
5959
if 'comment' not in bCallsign.keys():
6060
logging.error(f" *** Item 'comment' was NOT found in CFG file" )
6161
sys.exit( "\n*** Missing CFG item, check log file ***" )
@@ -68,6 +68,12 @@ def checkCfg(bCallsign):
6868
if 'ldatetime' not in bCallsign.keys():
6969
logging.error(f" *** Item 'ldatetime' was NOT found in CFG file" )
7070
sys.exit( "\n*** Missing CFG item, check log file ***" )
71+
if bCallsign['tracker'] == 'U' and 'channel' not in bCallsign.keys():
72+
logging.error(f" *** Item 'channel' was NOT found in CFG file" )
73+
sys.exit( "\n*** Missing CFG item, check log file ***" )
74+
if bCallsign['tracker'] == 'U' and 'band' not in bCallsign.keys():
75+
logging.error(f" *** Item 'band' was NOT found in CFG file" )
76+
sys.exit( "\n*** Missing CFG item, check log file ***" )
7177
return
7278

7379
#==============================================================================================================#

BalloonTelemetry.cfg

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
# BALLOON parms
2-
# tracker = Z (Zachtek), A (AB5SS), Q (QRP-Labs), U (U4B)
3-
# timeslot = 0, 2, 4, 6, 8 (last digit of the minute for xmit)
2+
# tracker = Z (Zachtek), A (AB5SS), Q (QRP-Labs), U (U4B/Tranquito)
43
# uploadsite = A (APRS-IS), S (SondeHub) or T (no upload, used for testing)
4+
# band = integer of frequency in Mhz
5+
# timeslot = 0, 2, 4, 6, 8 (last digit of the minute for xmit)
6+
# channel = xx (this value is required for all trackers except Zachtek)
57
# telemetryfile = Y or N (this will output telemetry data to a file named callsign-ssd.txt)
68
# ldatetime = last date/time of successful upload of telemetry data
79
#
810

11+
[WA1DVR-8]
12+
tracker = U
13+
uploadcallsign = K5MAP
14+
wsprcallsign = WA1DVR
15+
ballooncallsign = WA1DVR-8
16+
band = 14
17+
channel = 01
18+
timeslot = 0
19+
comment = This is for testing
20+
uploadsite = T
21+
telemetryfile = Y
22+
# launched = 2023-08-13 @ 17:50
23+
ldatetime = 2023-08-13 00:00:00
24+
925
[W5MAB-123]
1026
tracker = A
1127
uploadcallsign = W5MOM
@@ -53,6 +69,7 @@ timeslot = 6
5369
comment = BLT-100 WSPR, South Tx Balloon Launch Team 3
5470
uploadsite = T
5571
telemetryfile = Y
72+
# launched = 2023-06-29 @ 13:00
5673
#ldatetime = 2023-06-29 00:00:00
5774
ldatetime = 2023-06-29 00:00:00
5875

BalloonTelemetry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
from BalloonCfg import *
4242
from getZachtek import *
4343
from getAB5SS import *
44+
from getU4B import *
4445
from putSondeHub import *
4546
from putAprsIS import *
4647
from miscFunctions import *
@@ -133,8 +134,7 @@
133134
case "U":
134135
# U4B tracker selected
135136
logging.info(f" Tracker selected = {tracker} (U4B)" )
136-
# call function
137-
rCode = 0 #!!!!!!!!!!!!!!!!!!!!!!!!!!
137+
rCode, jUploadData, lastDateTime = getU4B(BalloonCfg, strLastTime)
138138
if rCode == -1 : # some sort of exception occured, check log
139139
sys.exit( 1 )
140140

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This script is currently under development and is not ready for use. The initia
1010
* Zachtek
1111
* AB5SS pico
1212
* QRP-Labs LightAPRS-W - future release
13-
* QRP-Labs U4B - future release
13+
* QRP-Labs U4B/Tranquito - in development
1414

1515
## Features
1616

constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# (at your option) any later version. #
1212
# #
1313
#==============================================================================================================#
14-
__version__ = '0.2.5'
14+
__version__ = '0.2.6'
1515

1616
SOFTWARE_NAME = "k5map-python"
1717

getAB5SS.py

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import json
3737
#import time
3838
#import datetime
39-
import math
39+
#import math
4040
import csv
4141
from socket import *
4242
import pprint
@@ -117,7 +117,7 @@ def matchAB5SSRecords(jWSPRRec1, jWSPRRec2):
117117
#
118118
# Sat status -
119119
#
120-
def decodeRecords(Packet1, Packet2):
120+
def decodeAB5SS(Packet1, Packet2):
121121
# use both packets to decode telemetry data
122122
PowerTable = {
123123
0: {'alt1' : 0, 'alt2' : 0},
@@ -363,15 +363,15 @@ def getAB5SS(bCfg, last_date):
363363
jDecodedData = {}
364364
jUploadData = []
365365
for i in range(0, len(aMatch), 2):
366-
jDecodedData[i] = decodeRecords(aMatch[i], aMatch[i+1])
366+
jDecodedData[i] = decodeAB5SS(aMatch[i], aMatch[i+1])
367367

368368
# reformat time from WSPR format to Zulu
369369
datetime1 = reformatDateTime(aMatch[i]['time'], 0)
370370
datetime2 = reformatDateTime(aMatch[i]['time'], 10)
371371

372372
# add telemetry data
373373
# build strComment channel, Sats?, voltage?, alt(m), 0C?, grid, callsign2, callsign1, comment
374-
strComment = str(jDecodedData[i]['channel']) + " Sats " + jDecodedData[i]['sats'] + " (voltage) " + str(jDecodedData[i]['altitude']) + "m "
374+
strComment = str(jDecodedData[i]['channel']) + " Sats " + jDecodedData[i]['sats'] + str(jDecodedData[i]['altitude']) + "m "
375375
strComment += str(jDecodedData[i]['temp']) + "C " + jDecodedData[i]['grid'] + " " + jDecodedData[i]['callsign2'] + " " + jDecodedData[i]['callsign1'] + " " + bCfg['comment']
376376

377377
# put data into jUploadData format for uploading
@@ -387,7 +387,6 @@ def getAB5SS(bCfg, last_date):
387387
logging.info(f" Number of records ready for upload = {len(jUploadData)}" )
388388

389389
# create data file for John
390-
# !!!!!!!!!!!!!!!!!!!!!!!!!
391390
if bCfg['telemetryfile'] == 'Y':
392391
pprint.pp(jDecodedData, indent=2)
393392
outputFilename = BalloonCallsign + ".csv"
@@ -398,44 +397,3 @@ def getAB5SS(bCfg, last_date):
398397
csv_file.writerow(jDecodedData[item].values())
399398

400399
return 1, jUploadData, aMatch[i]['time']
401-
402-
403-
"""
404-
Iterating Through a Nested Dictionary
405-
people = {1: {'Name': 'John', 'Age': '27', 'Sex': 'Male'},
406-
2: {'Name': 'Marie', 'Age': '22', 'Sex': 'Female'}}
407-
408-
for p_id, p_info in people.items():
409-
print("\nPerson ID:", p_id)
410-
411-
for key in p_info:
412-
print(key + ':', p_info[key])
413-
414-
#--------------------------------------------------------------------------------------------------------------#
415-
def delDupRecords(jData):
416-
# remove duplicae records in JSON structure
417-
jTemp = {}
418-
for i in range(len(jData)):
419-
result = next((item for item in jTemp if item["tx_band"] == jData[i]["band"] and item["tx_loc"] == jData[i]["tx_loc"]), None)
420-
if result == None:
421-
jTemp.append(jData[i])
422-
423-
print(f"Lenght of jTemp = {len(jTemp)}")
424-
return jTemp
425-
426-
#--------------------------------------------------------------------------------------------------------------#
427-
428-
names = ['Bruce', 'Clark', 'Peter']
429-
heros = ['Batman', 'Superman', 'Spiderman']
430-
my_dict = {}
431-
for name, value in zip(names, heros):
432-
mydict[name] = value
433-
print mydict
434-
435-
OR
436-
437-
my_dict = {name: hero for name, hero in zip(names, heros)}
438-
my_dict = {name: hero for name, hero in zip(names, heros) if name != 'Peter'}
439-
print my_dict
440-
441-
"""

0 commit comments

Comments
 (0)