pull/292/head
Christopher Young 2016-02-26 12:08:01 -05:00
rodzic c85f3a0787
commit 1cee936266
2 zmienionych plików z 108 dodań i 109 usunięć

Wyświetl plik

@ -873,7 +873,6 @@ func parseInput(buf string) ([]byte, uint16) {
parseDownlinkReport(s, int32(thisSignalStrength))
}
s = s[1:]
msglen := len(s) / 2

Wyświetl plik

@ -152,14 +152,14 @@ func sendTrafficUpdates() {
defer trafficMutex.Unlock()
cleanupOldEntries()
var msg []byte
if ((stratuxClock.Time.Second() % 10) == 0) {
if (stratuxClock.Time.Second() % 10) == 0 {
log.Printf("List of all aircraft being tracked:\n")
log.Printf("==================================================================\n")
}
for icao, ti := range traffic { // TO-DO: Limit number of aircraft in traffic message. ForeFlight 7.5 chokes at ~1000-2000 messages depending on iDevice RAM. Practical limit likely around ~500 aircraft without filtering.
// DEBUG: Print the list of all tracked targets (with data) to the log every ten seconds
if ((stratuxClock.Time.Second() % 10) == 0) {
if (stratuxClock.Time.Second() % 10) == 0 {
s_out, err := json.Marshal(ti)
if err != nil {
log.Printf("Error generating output: %s\n", err.Error())
@ -266,7 +266,7 @@ func makeTrafficReportMsg(ti TrafficInfo) []byte {
}
// Position containment / navigational accuracy
msg[13] = ((byte(ti.NIC) << 4) & 0xF0) | ((byte(ti.NACp) & 0x0F))
msg[13] = ((byte(ti.NIC) << 4) & 0xF0) | (byte(ti.NACp) & 0x0F)
// Horizontal velocity (speed).
@ -363,7 +363,7 @@ func parseDownlinkReport(s string, signalLevel int32) {
ti.NIC = int(frame[11] & 0x0F)
if ((msg_type == 1) || (msg_type == 3)) { // Since NACp is passed with normal UATreports, no need to use our ES hack.
if (msg_type == 1) || (msg_type == 3) { // Since NACp is passed with normal UATreports, no need to use our ES hack.
ti.NACp = int((frame[25] >> 4) & 0x0F)
}
@ -377,7 +377,7 @@ func parseDownlinkReport(s string, signalLevel int32) {
ti.TargetType = TARGET_TYPE_ADSR
} else if ti.Addr_type == 2 {
ti.TargetType = TARGET_TYPE_TISB_S
if ((ti.NIC >= 7) && (ti.Emitter_category > 0)) { // If NIC is sufficiently and emitter type is transmitted, we'll assume it's ADS-R.
if (ti.NIC >= 7) && (ti.Emitter_category > 0) { // If NIC is sufficiently and emitter type is transmitted, we'll assume it's ADS-R.
ti.TargetType = TARGET_TYPE_ADSR
}
}
@ -692,7 +692,7 @@ func esListen() {
ti.Speed_valid = true
ti.Last_speed = stratuxClock.Time // only update "last seen" data on position updates
}
} else if (((newTi.DF == 17) || (newTi.DF == 18)) && (newTi.TypeCode == 19)) { // invalid speed on velocity message only
} else if ((newTi.DF == 17) || (newTi.DF == 18)) && (newTi.TypeCode == 19) { // invalid speed on velocity message only
ti.Speed_valid = false
}
@ -731,7 +731,7 @@ func esListen() {
}
ti.NIC = nic
if ((ti.NACp < 7) && (ti.NACp < ti.NIC)) {
if (ti.NACp < 7) && (ti.NACp < ti.NIC) {
ti.NACp = ti.NIC // initialize to NIC, since NIC is sent with every position report, and not all emitters report NACp.
}
}
@ -753,10 +753,10 @@ func esListen() {
if newTi.CA == 6 {
ti.TargetType = TARGET_TYPE_ADSR
ti.Addr_type = 2
} else if (newTi.CA == 2) { // 2 = TIS-B with ICAO address, 5 = TIS-B without ICAO address
} else if newTi.CA == 2 { // 2 = TIS-B with ICAO address, 5 = TIS-B without ICAO address
ti.TargetType = TARGET_TYPE_TISB
ti.Addr_type = 2
} else if (newTi.CA == 5) {
} else if newTi.CA == 5 {
ti.TargetType = TARGET_TYPE_TISB
ti.Addr_type = 3
}