Skip to content

Commit b94a27e

Browse files
committed
Bug fix for lat, lon of AB5SS tracker
1 parent d5f79d7 commit b94a27e

7 files changed

Lines changed: 68 additions & 111 deletions

File tree

AB5SS-12.txt

Lines changed: 0 additions & 76 deletions
This file was deleted.

BalloonCfg.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def getBalloonCfg():
3333
parser.add_argument("bCallSign", help="Enter Balloon Callsign with SSID")
3434
args = parser.parse_args()
3535

36-
3736
cfgUpdater = ConfigUpdater()
3837
cfgUpdater.read(CFG_FILE)
3938
cfg = cfgUpdater.to_dict()
@@ -80,13 +79,3 @@ def putBalloonCfg(Balloon, lDateTime):
8079
cfgUpdater[Balloon]['ldatetime'].value = lDateTime
8180
cfgUpdater.update_file()
8281
return
83-
84-
"""
85-
config_obj = configparser.ConfigParser()
86-
config_obj.read(CFG_FILE)
87-
cSection = config_obj[Balloon]
88-
cSection["lDateTime"] = lDateTime
89-
with open(CFG_FILE, 'w') as configfile:
90-
config_obj.write(configfile)
91-
logging.info(' lDateTime has been updated in the config file')
92-
"""

BalloonTelemetry.cfg

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@
66
# ldatetime = last date/time of successful upload of telemetry data
77
#
88

9+
[W5MAB-123]
10+
tracker = A
11+
uploadcallsign = W5MOM
12+
wsprcallsign = W5MAB
13+
ballooncallsign = W5MAB-12
14+
band = 24
15+
channel = 12
16+
timeslot = 2
17+
comment = BLT-123 South Texas Balloon Launch Team pre-flight testing
18+
uploadsite = T
19+
telemetryfile = Y
20+
#ldatetime = 2023-06-29 00:00:00
21+
ldatetime = 2023-08-13 00:00:00
22+
923
[K5WH-117]
1024
uploadcallsign = W5MOM
1125
wsprcallsign = K5WH/B

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.2'
14+
__version__ = '0.2.5'
1515

1616
SOFTWARE_NAME = "k5map-python"
1717

getAB5SS.py

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def matchAB5SSRecords(jWSPRRec1, jWSPRRec2):
7272
aMatch.append(jWSPRRec1[i])
7373
aMatch.append(jWSPRRec2[j])
7474
logging.debug(f" Found 1st record to process = {jWSPRRec1[i]['tx_sign']}, {jWSPRRec1[i]['time']}, {jWSPRRec1[i]['tx_loc']}, {jWSPRRec1[i]['band']}")
75-
logging.debug(f" Found 2nd record to process = {jWSPRRec2[j]['tx_sign']}, {jWSPRRec2[j]['time']}, {jWSPRRec2[j]['tx_loc']}, {jWSPRRec1[j]['band']}")
75+
logging.debug(f" Found 2nd record to process = {jWSPRRec2[j]['tx_sign']}, {jWSPRRec2[j]['time']}, {jWSPRRec2[j]['tx_loc']}, {jWSPRRec2[j]['band']}")
7676
else:
7777
logging.debug(f" Found 1st record to process but no match = {jWSPRRec1[i]['tx_sign']}, {jWSPRRec1[i]['time']}, {jWSPRRec1[i]['tx_loc']}, {jWSPRRec1[i]['band']}")
7878

@@ -186,15 +186,15 @@ def decodeRecords(Packet1, Packet2):
186186
#print(f"azimuth = {azimuth}, elevation = {elevation}")
187187

188188
logging.debug(f" Telemetry data: callsign1 = {Packet1['tx_sign']}, callsign2 = {Packet2['tx_sign']}, time = {Packet1['time']}, " +
189-
f"channel = {Channel}, Grid = {Grid}, Sat = {Sat}, Speed = {Speed}, Alt(m) = {Altitude}, Temp(c) = {Temp}, azimuth = {azimuth}, elevation = {elevation}")
189+
f"channel = {Channel}, grid = {Grid}, sats = {Sat}, speed = {Speed}, alt(m) = {Altitude}, temp(c) = {Temp}, azimuth = {azimuth}, elevation = {elevation}")
190190

191191
TelemetryData = {
192192
"callsign1" : Packet1['tx_sign'],
193193
"callsign2" : Packet2['tx_sign'],
194194
"time" : Packet1['time'],
195195
"channel" : Channel,
196196
"grid" : Grid,
197-
"sat" : Sat,
197+
"sats" : Sat,
198198
"speed" : Speed,
199199
"altitude" : Altitude,
200200
"temp" : Temp,
@@ -313,7 +313,7 @@ def getAB5SS(bCfg, last_date):
313313
logging.warning(" Exit function, insufficient WSPR records to process" )
314314
return 0, None, None
315315

316-
#pprint.pp(jWsprData)
316+
pprint.pp(jWsprData)
317317
print("-"*40)
318318

319319
callsign = jWsprData[record_count-1]['tx_sign']
@@ -371,13 +371,14 @@ def getAB5SS(bCfg, last_date):
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 (voltage) " + str(jDecodedData[i]['altitude']) + "m OC " + jDecodedData[i]['grid'] + " " + jDecodedData[i]['callsign2']
375-
strComment += " " + jDecodedData[i]['callsign1'] + " " + bCfg['comment']
374+
strComment = str(jDecodedData[i]['channel']) + " Sats " + jDecodedData[i]['sats'] + " (voltage) " + str(jDecodedData[i]['altitude']) + "m "
375+
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
378+
lat, lon = GridtoLatLon(jDecodedData[i]['grid'])
378379
JSON = {"software_name" : SOFTWARE_NAME, "software_version" : __version__, "uploader_callsign" : bCfg['uploadcallsign'], "time_received" : datetime1,
379-
"payload_callsign" : BalloonCallsign, "datetime" : datetime2, "lat" : aMatch[i]['tx_lat'], "lon" : aMatch[i]['tx_lon'], "alt" : jDecodedData[i]['altitude'],
380-
"grid" : jDecodedData[i]['grid'], "comment" : strComment}
380+
"payload_callsign" : BalloonCallsign, "datetime" : datetime2, "lat" : round(lat,3), "lon" : round(lon,3), "alt" : jDecodedData[i]['altitude'],
381+
"sats" : jDecodedData[i]['sats'], "temp" : jDecodedData[i]['temp'], "grid" : jDecodedData[i]['grid'], "comment" : strComment}
381382
jUploadData.append(JSON)
382383

383384

@@ -388,19 +389,8 @@ def getAB5SS(bCfg, last_date):
388389
# create data file for John
389390
# !!!!!!!!!!!!!!!!!!!!!!!!!
390391
if bCfg['telemetryfile'] == 'Y':
391-
"""
392-
jDump = {}
393-
for index, element in enumerate(aMatch):
394-
jDump[index] = element
395-
print("="*40)
396-
pprint.pp(jDump)
397-
print(f"jDump record count = {len(jDump)}")
398-
json_object = json.dumps(jDump, indent=4)
399-
with open("AB5SS-dump.json", "w") as outfile:
400-
outfile.write(json_object)
401-
"""
402392
pprint.pp(jDecodedData, indent=2)
403-
outputFilename = BalloonCallsign + ".txt"
393+
outputFilename = BalloonCallsign + ".csv"
404394
with open(outputFilename, 'w') as file:
405395
csv_file = csv.writer(file)
406396
csv_file.writerow(jDecodedData[0].keys()) # write header from keys

miscFunctions.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,10 @@ def VerifyCallsign(strCallSign):
203203
"""
204204
if __name__ == "__main__":
205205
#logging.info("Current Log Level : {}\n".format(logging.getLevel()))
206-
sDateTime = '2023-08-02 23:58:00'
207-
x = adjDateTime(sDateTime)
208-
print(f" sDateTime = {sDateTime}, adjDateTime = {x}")
206+
#sDateTime = '2023-08-02 23:58:00'
207+
#x = adjDateTime(sDateTime)
208+
#print(f" sDateTime = {sDateTime}, adjDateTime = {x}")
209+
210+
lat, lon = GridtoLatLon('EL29fx')
211+
print(f"lat = {lat:.3f}, lon = {lon:.3f}")
209212
"""

putSondeHub.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,48 @@ def putSondeHub(aSondeData):
6767
return -1
6868

6969
#print("Response code = ", response.status_code) # 200 = data accepted and saved; 500 = data not accepted
70+
logging.debug(f" Data to be uploaded -- {aSondeData}")
7071
logging.info(f" Number of records uploaded to SondeData = {len(aSondeData)}")
7172

7273
return 0
7374

7475
"""
76+
Sample Upload to SondeHub:
77+
[
78+
{
79+
"dev": "string",
80+
"software_name": "string",
81+
"software_version": "string",
82+
"uploader_callsign": "string",
83+
"time_received": "2023-08-14T00:10:34.837Z",
84+
"payload_callsign": "string",
85+
"datetime": "2023-08-14T00:10:34.837Z",
86+
"lat": 0,
87+
"lon": 0,
88+
"alt": 0,
89+
"frequency": 0,
90+
"temp": 0,
91+
"humidity": 0,
92+
"vel_h": 0,
93+
"vel_v": 0,
94+
"pressure": 0,
95+
"heading": 0,
96+
"batt": 0,
97+
"sats": 0,
98+
"snr": 0,
99+
"rssi": 0,
100+
"uploader_position": [
101+
0,
102+
0,
103+
0
104+
],
105+
"uploader_antenna": "string",
106+
"telemetry_hidden": true,
107+
"historical": true,
108+
"upload_time": "Unknown Type: date-time"
109+
}
110+
]
111+
75112
import requests
76113
77114
headers = {

0 commit comments

Comments
 (0)