Introduced "DEBUG" setting.

‘u’ and ‘e’ only when “DEBUG” enabled.
pull/30/head
Christopher Young 2015-09-03 23:35:26 -04:00
rodzic 12f35dbd2e
commit ef0aa5334a
2 zmienionych plików z 11 dodań i 5 usunięć

Wyświetl plik

@ -385,6 +385,7 @@ type settings struct {
GPS_Enabled bool
NetworkOutputs []networkConnection
AHRS_Enabled bool
DEBUG bool
}
type status struct {
@ -412,6 +413,7 @@ func defaultSettings() {
//FIXME: Need to change format below.
globalSettings.NetworkOutputs = []networkConnection{{nil, "", 4000, NETWORK_GDL90_STANDARD, false, nil}, {nil, "", 43211, NETWORK_GDL90_STANDARD | NETWORK_AHRS_GDL90, false, nil}, {nil, "", 49002, NETWORK_AHRS_FFSIM, false, nil}}
globalSettings.AHRS_Enabled = false
globalSettings.DEBUG = false
}
func readSettings() {

Wyświetl plik

@ -344,10 +344,12 @@ func parseDownlinkReport(s string) {
ti.tail = tail
}
if globalSettings.DEBUG {
// This is a hack to show the source of the traffic in ForeFlight.
if len(ti.tail) == 0 || (len(ti.tail) != 0 && len(ti.tail) < 8 && ti.tail[0] != 'U') {
ti.tail = "u" + ti.tail
}
}
traffic[ti.icao_addr] = ti
}
@ -494,9 +496,11 @@ func esListen() {
// This is a hack to show the source of the traffic in ForeFlight.
ti.tail = strings.Trim(ti.tail, " ")
if globalSettings.DEBUG {
if len(ti.tail) == 0 || (len(ti.tail) != 0 && len(ti.tail) < 8 && ti.tail[0] != 'E') {
ti.tail = "e" + ti.tail
}
}
traffic[icaoDec] = ti // Update information on this ICAO code.
trafficMutex.Unlock()