Merge branch 'testing'

pull/141/head
Mark Jessop 2019-03-16 15:22:55 +10:30
commit 19f12d0699
5 zmienionych plików z 50 dodań i 12 usunięć

Wyświetl plik

@ -84,6 +84,8 @@ def telemetry_to_aprs_position(sonde_data, object_name="<id>", aprs_comment="BOM
_aprs_comment = _aprs_comment.replace("<vel_v>", "%.1fm/s" % sonde_data['vel_v'])
_aprs_comment = _aprs_comment.replace("<type>", sonde_data['type'])
# TODO: RS41 Burst Timer
# Convert float latitude to APRS format (DDMM.MM)
lat = float(sonde_data["lat"])
lat_degree = abs(int(lat))

Wyświetl plik

@ -85,6 +85,11 @@ def sonde_telemetry_to_sentence(telemetry, payload_callsign=None, comment=None):
# Add in a comment field, containing the sonde type, serial number, and frequency.
_sentence += ",%s %s %s" % (telemetry['type'], telemetry['id'], telemetry['freq'])
# Check for Burst/Kill timer data, and add in.
if 'bt' in telemetry:
if (telemetry['bt'] != -1) and (telemetry['bt'] != 65535):
_sentence += " BT %s" % time.strftime("%H:%M:%S", time.gmtime(telemetry['bt']))
# Add on any custom comment data if provided.
if comment != None:
comment = comment.replace(',','_')

Wyświetl plik

@ -116,7 +116,7 @@ class TelemetryLogger(object):
Args:
telemetry (dict): Telemetry dictionary to process.
"""
_log_line = "%s,%s,%d,%.5f,%.5f,%.1f,%.1f,%s,%.3f\n" % (
_log_line = "%s,%s,%d,%.5f,%.5f,%.1f,%.1f,%s,%.3f" % (
telemetry['datetime'],
telemetry['id'],
telemetry['frame'],
@ -127,7 +127,18 @@ class TelemetryLogger(object):
telemetry['type'],
telemetry['freq_float'])
# TODO: Add Aux data, if it exists.
# Check for Burst/Kill timer data, and add in.
if 'bt' in telemetry:
if (telemetry['bt'] != -1) and (telemetry['bt'] != 65535):
_log_line += ",BT %s" % time.strftime("%H:%M:%S", time.gmtime(telemetry['bt']))
# Add Aux data, if it exists.
if 'aux' in telemetry:
_log_line += ",AUX %s" % telemetry['aux'].strip()
# Terminate the log line.
_log_line += "\n"
return _log_line

Wyświetl plik

@ -177,8 +177,8 @@
{title:"Temp (°C)", field:"temp", headerSort:false},
{title:"Az (°)", field:"azimuth", headerSort:false},
{title:"El (°)", field:"elevation", headerSort:false},
{title:"Range (km)", field:"range", headerSort:false}
// TODO: Azimuth, elevation, Range calculations.
{title:"Range (km)", field:"range", headerSort:false},
{title:"Other", field:"other", headerSort:false}
]
});
@ -228,6 +228,15 @@
}
}
// Add data into the 'other' field.
sonde_id_data.other = "";
// Burst timer for RS41s
if (sonde_id_data.hasOwnProperty('bt')){
if ((sonde_id_data.bt >= 0) && (sonde_id_data.bt < 65535)) {
sonde_id_data.other += "BT " + new Date(sonde_id_data.bt*1000).toISOString().substr(11, 8) + " ";
}
}
telem_data.push(sonde_id_data);
}
}

Wyświetl plik

@ -73,6 +73,7 @@ int option_verbose = 0, // ausfuehrliche Anzeige
option_json = 0, // JSON output (auto_rx)
wavloaded = 0;
int wav_channel = 0; // audio channel: left
int burst_timer = -1;
#define BITS 8
@ -870,12 +871,12 @@ int get_Calconf(int out) {
fprintf(stdout, ": fw 0x%04x ", fw);
}
if (calfr == 0x02 && option_verbose /*== 2*/) {
if (calfr == 0x02) {
byte = framebyte(pos_Calburst);
burst = byte; // fw >= 0x4ef5, BK irrelevant? (burst-killtimer in 0x31?)
fprintf(stdout, ": BK %02X ", burst);
if (option_verbose == 3) { // killtimer
int kt = frame[0x5A] + (frame[0x5B] << 8); // short?
int kt = frame[0x5A] + (frame[0x5B] << 8); // short?
if (option_verbose == 3){
fprintf(stdout, ": BK %02X ", burst);
if ( kt != 0xFFFF ) fprintf(stdout, ": kt 0x%04x = %dsec = %.1fmin ", kt, kt, kt/60.0);
}
}
@ -889,10 +890,20 @@ int get_Calconf(int out) {
fprintf(stdout, ": fq %d ", freq);
}
if (calfr == 0x31 && option_verbose == 3) {
if (calfr == 0x31) {
int bt = frame[0x59] + (frame[0x5A] << 8); // short?
// fw >= 0x4ef5: default=[88 77]=0x7788sec=510min
if ( bt != 0x0000 ) fprintf(stdout, ": bt 0x%04x = %dsec = %.1fmin ", bt, bt, bt/60.0);
if (option_verbose == 3){
if ( bt != 0x0000 ) fprintf(stdout, ": bt 0x%04x = %dsec = %.1fmin ", bt, bt, bt/60.0);
}
}
if (calfr == 0x32) {
int bt = frame[pos_CalData+1] + (frame[pos_CalData+2] << 8); // short?
burst_timer = bt;
if (option_verbose == 3){
if ( bt != 0xFFFF ) fprintf(stdout, ": countdown timer 0x%04x = %dsec = %.1fmin ", bt, bt, bt/60.0);
}
}
if (calfr == 0x21 && option_verbose /*== 2*/) { // eventuell noch zwei bytes in 0x22
@ -1121,9 +1132,9 @@ int print_position(int ec) {
strcpy( auxbuffer+strlen(aux_data)+9, "\"\0" );
}
if (option_ptu && !err0 && gpx.T > -273.0) {
printf("{ \"frame\": %d, \"id\": \"%s\", \"datetime\": \"%04d-%02d-%02dT%02d:%02d:%06.3fZ\", \"lat\": %.5f, \"lon\": %.5f, \"alt\": %.5f, \"vel_h\": %.5f, \"heading\": %.5f, \"vel_v\": %.5f, \"sats\": %d, \"temp\":%.1f %s}\n", gpx.frnr, gpx.id, gpx.jahr, gpx.monat, gpx.tag, gpx.std, gpx.min, gpx.sek, gpx.lat, gpx.lon, gpx.alt, gpx.vH, gpx.vD, gpx.vU, gpx.numSV, gpx.T, auxbuffer);
printf("{ \"frame\": %d, \"id\": \"%s\", \"datetime\": \"%04d-%02d-%02dT%02d:%02d:%06.3fZ\", \"lat\": %.5f, \"lon\": %.5f, \"alt\": %.5f, \"vel_h\": %.5f, \"heading\": %.5f, \"vel_v\": %.5f, \"sats\": %d, \"bt\": %d, \"temp\":%.1f %s}\n", gpx.frnr, gpx.id, gpx.jahr, gpx.monat, gpx.tag, gpx.std, gpx.min, gpx.sek, gpx.lat, gpx.lon, gpx.alt, gpx.vH, gpx.vD, gpx.vU, gpx.numSV, burst_timer, gpx.T, auxbuffer);
} else {
printf("{ \"frame\": %d, \"id\": \"%s\", \"datetime\": \"%04d-%02d-%02dT%02d:%02d:%06.3fZ\", \"lat\": %.5f, \"lon\": %.5f, \"alt\": %.5f, \"vel_h\": %.5f, \"heading\": %.5f, \"vel_v\": %.5f, \"sats\": %d %s}\n", gpx.frnr, gpx.id, gpx.jahr, gpx.monat, gpx.tag, gpx.std, gpx.min, gpx.sek, gpx.lat, gpx.lon, gpx.alt, gpx.vH, gpx.vD, gpx.vU, gpx.numSV, auxbuffer);
printf("{ \"frame\": %d, \"id\": \"%s\", \"datetime\": \"%04d-%02d-%02dT%02d:%02d:%06.3fZ\", \"lat\": %.5f, \"lon\": %.5f, \"alt\": %.5f, \"vel_h\": %.5f, \"heading\": %.5f, \"vel_v\": %.5f, \"sats\": %d, \"bt\": %d, %s}\n", gpx.frnr, gpx.id, gpx.jahr, gpx.monat, gpx.tag, gpx.std, gpx.min, gpx.sek, gpx.lat, gpx.lon, gpx.alt, gpx.vH, gpx.vD, gpx.vU, gpx.numSV, burst_timer, auxbuffer);
}
printf("\n");
}