Emit integrity info, when it changes.
This commit is contained in:
parent
63d1b4b553
commit
571ea7ac41
28
net_io.c
28
net_io.c
|
@ -1991,6 +1991,16 @@ static const char *emergency_enum_string(emergency_t emergency)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *sil_type_enum_string(sil_type_t type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case SIL_UNKNOWN: return "unknown";
|
||||||
|
case SIL_PER_HOUR: return "perhour";
|
||||||
|
case SIL_PER_SAMPLE: return "persample";
|
||||||
|
default: return "invalid";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void writeFATSVBanner()
|
static void writeFATSVBanner()
|
||||||
{
|
{
|
||||||
char *p = prepareWrite(&Modes.fatsv_out, TSV_MAX_PACKET_SIZE);
|
char *p = prepareWrite(&Modes.fatsv_out, TSV_MAX_PACKET_SIZE);
|
||||||
|
@ -2130,6 +2140,18 @@ static void writeFATSV()
|
||||||
if (forceEmit || a->category != a->fatsv_emitted_category) {
|
if (forceEmit || a->category != a->fatsv_emitted_category) {
|
||||||
p = appendFATSV(p, end, "category", "%02X", a->category);
|
p = appendFATSV(p, end, "category", "%02X", a->category);
|
||||||
}
|
}
|
||||||
|
if (trackDataValid(&a->nac_p_valid) && (forceEmit || a->nac_p != a->fatsv_emitted_nac_p)) {
|
||||||
|
p = appendFATSVMeta(p, end, "nac_p", a, &a->nac_p_valid, "%u", a->nac_p);
|
||||||
|
}
|
||||||
|
if (trackDataValid(&a->nac_v_valid) && (forceEmit || a->nac_v != a->fatsv_emitted_nac_v)) {
|
||||||
|
p = appendFATSVMeta(p, end, "nac_v", a, &a->nac_v_valid, "%u", a->nac_v);
|
||||||
|
}
|
||||||
|
if (trackDataValid(&a->sil_valid) && (forceEmit || a->sil != a->fatsv_emitted_sil || a->sil_type != a->fatsv_emitted_sil_type)) {
|
||||||
|
p = appendFATSVMeta(p, end, "sil", a, &a->sil_valid, "{%u %s}", a->sil, sil_type_enum_string(a->sil_type));
|
||||||
|
}
|
||||||
|
if (trackDataValid(&a->nic_baro_valid) && (forceEmit || a->nic_baro != a->fatsv_emitted_nic_baro)) {
|
||||||
|
p = appendFATSVMeta(p, end, "nic_baro", a, &a->nic_baro_valid, "%u", a->nic_baro);
|
||||||
|
}
|
||||||
|
|
||||||
// only emit alt, speed, latlon, track etc if they have been received since the last time
|
// only emit alt, speed, latlon, track etc if they have been received since the last time
|
||||||
// and are not stale
|
// and are not stale
|
||||||
|
@ -2147,7 +2169,6 @@ static void writeFATSV()
|
||||||
p = appendFATSVMeta(p, end, "alt", a, &a->altitude_baro_valid, "%d", a->altitude_baro);
|
p = appendFATSVMeta(p, end, "alt", a, &a->altitude_baro_valid, "%d", a->altitude_baro);
|
||||||
if (positionValid) {
|
if (positionValid) {
|
||||||
p = appendFATSVMeta(p, end, "position", a, &a->position_valid, "{%.5f %.5f %u %u}", a->lat, a->lon, a->pos_nic, a->pos_rc);
|
p = appendFATSVMeta(p, end, "position", a, &a->position_valid, "{%.5f %.5f %u %u}", a->lat, a->lon, a->pos_nic, a->pos_rc);
|
||||||
p = appendFATSVMeta(p, end, "nac_p", a, &a->nac_p_valid, "%u", a->nac_p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p = appendFATSVMeta(p, end, "alt_gnss", a, &a->altitude_geom_valid, "%d", a->altitude_geom);
|
p = appendFATSVMeta(p, end, "alt_gnss", a, &a->altitude_geom_valid, "%d", a->altitude_geom);
|
||||||
|
@ -2205,6 +2226,11 @@ static void writeFATSV()
|
||||||
a->fatsv_emitted_adsb_version = a->adsb_version;
|
a->fatsv_emitted_adsb_version = a->adsb_version;
|
||||||
a->fatsv_emitted_category = a->category;
|
a->fatsv_emitted_category = a->category;
|
||||||
a->fatsv_emitted_squawk = a->squawk;
|
a->fatsv_emitted_squawk = a->squawk;
|
||||||
|
a->fatsv_emitted_nac_p = a->nac_p;
|
||||||
|
a->fatsv_emitted_nac_v = a->nac_v;
|
||||||
|
a->fatsv_emitted_sil = a->sil;
|
||||||
|
a->fatsv_emitted_sil_type = a->sil_type;
|
||||||
|
a->fatsv_emitted_nic_baro = a->nic_baro;
|
||||||
a->fatsv_last_emitted = now;
|
a->fatsv_last_emitted = now;
|
||||||
if (forceEmit) {
|
if (forceEmit) {
|
||||||
a->fatsv_last_force_emit = now;
|
a->fatsv_last_force_emit = now;
|
||||||
|
|
13
track.h
13
track.h
|
@ -197,11 +197,9 @@ struct aircraft {
|
||||||
unsigned nic_c : 1; // NIC supplement C from opstatus
|
unsigned nic_c : 1; // NIC supplement C from opstatus
|
||||||
unsigned nic_baro : 1; // NIC baro supplement from TSS or opstatus
|
unsigned nic_baro : 1; // NIC baro supplement from TSS or opstatus
|
||||||
unsigned nac_p : 4; // NACp from TSS or opstatus
|
unsigned nac_p : 4; // NACp from TSS or opstatus
|
||||||
unsigned nac_v : 3; // NACv from opstatus
|
unsigned nac_v : 3; // NACv from airborne velocity or opstatus
|
||||||
unsigned sil : 2; // SIL from TS or opstatus
|
unsigned sil : 2; // SIL from TSS or opstatus
|
||||||
sil_type_t sil_type; // SIL supplement from TS or opstatus
|
sil_type_t sil_type; // SIL supplement from TSS or opstatus
|
||||||
unsigned gva : 2; // GVA from opstatus
|
|
||||||
unsigned sda : 2; // SDA from opstatus
|
|
||||||
|
|
||||||
int modeA_hit; // did our squawk match a possible mode A reply in the last check period?
|
int modeA_hit; // did our squawk match a possible mode A reply in the last check period?
|
||||||
int modeC_hit; // did our altitude match a possible mode C reply in the last check period?
|
int modeC_hit; // did our altitude match a possible mode C reply in the last check period?
|
||||||
|
@ -233,6 +231,11 @@ struct aircraft {
|
||||||
int fatsv_emitted_adsb_version; // -"- ADS-B version (assumed non-ADS-B initially)
|
int fatsv_emitted_adsb_version; // -"- ADS-B version (assumed non-ADS-B initially)
|
||||||
unsigned fatsv_emitted_category; // -"- ADS-B emitter category (assumed A0 initially)
|
unsigned fatsv_emitted_category; // -"- ADS-B emitter category (assumed A0 initially)
|
||||||
unsigned fatsv_emitted_squawk; // -"- squawk
|
unsigned fatsv_emitted_squawk; // -"- squawk
|
||||||
|
unsigned fatsv_emitted_nac_p; // -"- NACp
|
||||||
|
unsigned fatsv_emitted_nac_v; // -"- NACv
|
||||||
|
unsigned fatsv_emitted_sil; // -"- SIL
|
||||||
|
sil_type_t fatsv_emitted_sil_type; // -"- SIL supplement
|
||||||
|
unsigned fatsv_emitted_nic_baro; // -"- NICbaro
|
||||||
|
|
||||||
uint64_t fatsv_last_emitted; // time (millis) aircraft was last FA emitted
|
uint64_t fatsv_last_emitted; // time (millis) aircraft was last FA emitted
|
||||||
uint64_t fatsv_last_force_emit; // time (millis) we last emitted only-on-change data
|
uint64_t fatsv_last_force_emit; // time (millis) we last emitted only-on-change data
|
||||||
|
|
Loading…
Reference in a new issue