If --hae is passed, report altitudes as HAE where available, with a H suffix.
This affects interactive mode and SBS output.
This commit is contained in:
parent
c99e4d9aed
commit
9479a5c9be
|
@ -709,6 +709,7 @@ void showHelp(void) {
|
||||||
"--stats-every <seconds> Show and reset stats every <seconds> seconds\n"
|
"--stats-every <seconds> Show and reset stats every <seconds> seconds\n"
|
||||||
"--onlyaddr Show only ICAO addresses (testing purposes)\n"
|
"--onlyaddr Show only ICAO addresses (testing purposes)\n"
|
||||||
"--metric Use metric units (meters, km/h, ...)\n"
|
"--metric Use metric units (meters, km/h, ...)\n"
|
||||||
|
"--hae Show altitudes as HAE (with H suffix) when available\n"
|
||||||
"--snip <level> Strip IQ file removing samples < level\n"
|
"--snip <level> Strip IQ file removing samples < level\n"
|
||||||
"--debug <flags> Debug mode (verbose), see README for details\n"
|
"--debug <flags> Debug mode (verbose), see README for details\n"
|
||||||
"--quiet Disable output to stdout. Use for daemon applications\n"
|
"--quiet Disable output to stdout. Use for daemon applications\n"
|
||||||
|
@ -1006,6 +1007,8 @@ int main(int argc, char **argv) {
|
||||||
Modes.onlyaddr = 1;
|
Modes.onlyaddr = 1;
|
||||||
} else if (!strcmp(argv[j],"--metric")) {
|
} else if (!strcmp(argv[j],"--metric")) {
|
||||||
Modes.metric = 1;
|
Modes.metric = 1;
|
||||||
|
} else if (!strcmp(argv[j],"--hae")) {
|
||||||
|
Modes.use_hae = 1;
|
||||||
} else if (!strcmp(argv[j],"--aggressive")) {
|
} else if (!strcmp(argv[j],"--aggressive")) {
|
||||||
Modes.nfix_crc = MODES_MAX_BITERRORS;
|
Modes.nfix_crc = MODES_MAX_BITERRORS;
|
||||||
} else if (!strcmp(argv[j],"--interactive")) {
|
} else if (!strcmp(argv[j],"--interactive")) {
|
||||||
|
|
|
@ -323,6 +323,7 @@ struct { // Internal state
|
||||||
int stats_range_histo; // Collect/show a range histogram?
|
int stats_range_histo; // Collect/show a range histogram?
|
||||||
int onlyaddr; // Print only ICAO addresses
|
int onlyaddr; // Print only ICAO addresses
|
||||||
int metric; // Use metric units
|
int metric; // Use metric units
|
||||||
|
int use_hae; // Use HAE altitudes with H suffix when available
|
||||||
int mlat; // Use Beast ascii format for raw data output, i.e. @...; iso *...;
|
int mlat; // Use Beast ascii format for raw data output, i.e. @...; iso *...;
|
||||||
int interactive_rtl1090; // flight table in interactive mode is formatted like RTL1090
|
int interactive_rtl1090; // flight table in interactive mode is formatted like RTL1090
|
||||||
char *json_dir; // Path to json base directory, or NULL not to write json.
|
char *json_dir; // Path to json base directory, or NULL not to write json.
|
||||||
|
|
|
@ -118,7 +118,7 @@ void interactiveShowData(void) {
|
||||||
|| (((flags & (MODEAC_MSG_MODES_HIT | MODEAC_MSG_MODEC_OLD )) == 0 ) && (msgs > 127) )
|
|| (((flags & (MODEAC_MSG_MODES_HIT | MODEAC_MSG_MODEC_OLD )) == 0 ) && (msgs > 127) )
|
||||||
) {
|
) {
|
||||||
char strSquawk[5] = " ";
|
char strSquawk[5] = " ";
|
||||||
char strFl[6] = " ";
|
char strFl[7] = " ";
|
||||||
char strTt[5] = " ";
|
char strTt[5] = " ";
|
||||||
char strGs[5] = " ";
|
char strGs[5] = " ";
|
||||||
|
|
||||||
|
@ -164,12 +164,14 @@ void interactiveShowData(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a->bFlags & MODES_ACFLAGS_AOG) {
|
if (a->bFlags & MODES_ACFLAGS_AOG) {
|
||||||
snprintf(strFl, 6," grnd");
|
snprintf(strFl, 7," grnd");
|
||||||
|
} else if (Modes.use_hae && (a->bFlags & MODES_ACFLAGS_ALTITUDE_HAE_VALID)) {
|
||||||
|
snprintf(strFl, 7, "%5dH", convert_altitude(a->altitude_hae));
|
||||||
} else if (a->bFlags & MODES_ACFLAGS_ALTITUDE_VALID) {
|
} else if (a->bFlags & MODES_ACFLAGS_ALTITUDE_VALID) {
|
||||||
snprintf(strFl, 6, "%5d", convert_altitude(a->altitude));
|
snprintf(strFl, 7, "%5d ", convert_altitude(a->altitude));
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s%06X %-4s %-4s %-8s %5s %3s %3s %7s %8s %5.1f %5d %2.0f\n",
|
printf("%s%06X %-4s %-4s %-8s %6s %3s %3s %7s %8s %5.1f %5d %2.0f\n",
|
||||||
(a->addr & MODES_NON_ICAO_ADDRESS) ? "~" : " ", (a->addr & 0xffffff),
|
(a->addr & MODES_NON_ICAO_ADDRESS) ? "~" : " ", (a->addr & 0xffffff),
|
||||||
strMode, strSquawk, a->flight, strFl, strGs, strTt,
|
strMode, strSquawk, a->flight, strFl, strGs, strTt,
|
||||||
strLat, strLon, 10 * log10(signalAverage), msgs, (now - a->seen)/1000.0);
|
strLat, strLon, 10 * log10(signalAverage), msgs, (now - a->seen)/1000.0);
|
||||||
|
|
6
mode_s.c
6
mode_s.c
|
@ -1261,15 +1261,15 @@ void useModesMessage(struct modesMessage *mm) {
|
||||||
if (Modes.net) {
|
if (Modes.net) {
|
||||||
if (Modes.net_verbatim || mm->msgtype == 32) {
|
if (Modes.net_verbatim || mm->msgtype == 32) {
|
||||||
// Unconditionally send
|
// Unconditionally send
|
||||||
modesQueueOutput(mm);
|
modesQueueOutput(mm, a);
|
||||||
} else if (a->messages > 1) {
|
} else if (a->messages > 1) {
|
||||||
// If this is the second message, and we
|
// If this is the second message, and we
|
||||||
// squelched the first message, then re-emit the
|
// squelched the first message, then re-emit the
|
||||||
// first message now.
|
// first message now.
|
||||||
if (!Modes.net_verbatim && a->messages == 2) {
|
if (!Modes.net_verbatim && a->messages == 2) {
|
||||||
modesQueueOutput(&a->first_message);
|
modesQueueOutput(&a->first_message, a);
|
||||||
}
|
}
|
||||||
modesQueueOutput(mm);
|
modesQueueOutput(mm, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
14
net_io.c
14
net_io.c
|
@ -460,7 +460,7 @@ static void send_raw_heartbeat(struct net_service *service)
|
||||||
// Write SBS output to TCP clients
|
// Write SBS output to TCP clients
|
||||||
// The message structure mm->bFlags tells us what has been updated by this message
|
// The message structure mm->bFlags tells us what has been updated by this message
|
||||||
//
|
//
|
||||||
static void modesSendSBSOutput(struct modesMessage *mm) {
|
static void modesSendSBSOutput(struct modesMessage *mm, struct aircraft *a) {
|
||||||
char *p;
|
char *p;
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
struct tm stTime_receive, stTime_now;
|
struct tm stTime_receive, stTime_now;
|
||||||
|
@ -535,8 +535,14 @@ static void modesSendSBSOutput(struct modesMessage *mm) {
|
||||||
// Field 12 is the altitude (if we have it) - force to zero if we're on the ground
|
// Field 12 is the altitude (if we have it) - force to zero if we're on the ground
|
||||||
if ((mm->bFlags & MODES_ACFLAGS_AOG_GROUND) == MODES_ACFLAGS_AOG_GROUND) {
|
if ((mm->bFlags & MODES_ACFLAGS_AOG_GROUND) == MODES_ACFLAGS_AOG_GROUND) {
|
||||||
p += sprintf(p, ",0");
|
p += sprintf(p, ",0");
|
||||||
|
} else if (Modes.use_hae && (mm->bFlags & MODES_ACFLAGS_ALTITUDE_HAE_VALID)) {
|
||||||
|
p += sprintf(p, ",%dH", mm->altitude_hae);
|
||||||
} else if (mm->bFlags & MODES_ACFLAGS_ALTITUDE_VALID) {
|
} else if (mm->bFlags & MODES_ACFLAGS_ALTITUDE_VALID) {
|
||||||
p += sprintf(p, ",%d", mm->altitude);
|
if (Modes.use_hae && (a->bFlags & MODES_ACFLAGS_HAE_DELTA_VALID)) {
|
||||||
|
p += sprintf(p, ",%dH", mm->altitude + a->hae_delta);
|
||||||
|
} else {
|
||||||
|
p += sprintf(p, ",%d", mm->altitude);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
p += sprintf(p, ",");
|
p += sprintf(p, ",");
|
||||||
}
|
}
|
||||||
|
@ -636,11 +642,11 @@ static void send_sbs_heartbeat(struct net_service *service)
|
||||||
//
|
//
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
//
|
//
|
||||||
void modesQueueOutput(struct modesMessage *mm) {
|
void modesQueueOutput(struct modesMessage *mm, struct aircraft *a) {
|
||||||
if ((mm->bFlags & MODES_ACFLAGS_FROM_MLAT) && !Modes.forward_mlat)
|
if ((mm->bFlags & MODES_ACFLAGS_FROM_MLAT) && !Modes.forward_mlat)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
modesSendSBSOutput(mm);
|
modesSendSBSOutput(mm, a);
|
||||||
modesSendBeastOutput(mm);
|
modesSendBeastOutput(mm);
|
||||||
modesSendRawOutput(mm);
|
modesSendRawOutput(mm);
|
||||||
}
|
}
|
||||||
|
|
3
net_io.h
3
net_io.h
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
// Describes a networking service (group of connections)
|
// Describes a networking service (group of connections)
|
||||||
|
|
||||||
|
struct aircraft;
|
||||||
struct modesMessage;
|
struct modesMessage;
|
||||||
struct client;
|
struct client;
|
||||||
struct net_service;
|
struct net_service;
|
||||||
|
@ -71,7 +72,7 @@ struct net_service *makeBeastInputService(void);
|
||||||
struct net_service *makeFatsvOutputService(void);
|
struct net_service *makeFatsvOutputService(void);
|
||||||
|
|
||||||
void modesInitNet(void);
|
void modesInitNet(void);
|
||||||
void modesQueueOutput(struct modesMessage *mm);
|
void modesQueueOutput(struct modesMessage *mm, struct aircraft *a);
|
||||||
void modesNetPeriodicWork(void);
|
void modesNetPeriodicWork(void);
|
||||||
|
|
||||||
// TODO: move these somewhere else
|
// TODO: move these somewhere else
|
||||||
|
|
Loading…
Reference in a new issue