Start Canadian regs with "C-". Formatting.

#442.
pull/446/head
Christopher Young 2016-06-21 12:28:49 -04:00
rodzic ec3c5a6ab9
commit e180f79855
2 zmienionych plików z 22 dodań i 26 usunięć

Wyświetl plik

@ -1082,7 +1082,7 @@ func icao2reg(icao_addr uint32) (string, bool) {
b_str := "FGI" b_str := "FGI"
//fmt.Printf("B = %d, C = %d, D = %d, E = %d\n",b,c,d,e) //fmt.Printf("B = %d, C = %d, D = %d, E = %d\n",b,c,d,e)
tail = fmt.Sprintf("C%c%c%c%c", b_str[b], c+65, d+65, e+65) tail = fmt.Sprintf("C-%c%c%c%c", b_str[b], c+65, d+65, e+65)
} }
if nation == "US" { // FAA decoding if nation == "US" { // FAA decoding

Wyświetl plik

@ -64,7 +64,6 @@ func icao2reg(icao_addr uint32) (string, bool) {
tail := "" tail := ""
nation := "" nation := ""
// Determine nationality // Determine nationality
if (icao_addr >= 0xA00001) && (icao_addr <= 0xAFFFFF) { if (icao_addr >= 0xA00001) && (icao_addr <= 0xAFFFFF) {
nation = "US" nation = "US"
@ -75,7 +74,7 @@ func icao2reg(icao_addr uint32) (string, bool) {
return "NON-NA", false return "NON-NA", false
} }
if (nation =="CA") { // Canada decoding if nation == "CA" { // Canada decoding
// First, discard addresses that are not assigned to aircraft on the civil registry // First, discard addresses that are not assigned to aircraft on the civil registry
if icao_addr > 0xC0CDF8 { if icao_addr > 0xC0CDF8 {
//fmt.Printf("%X is a Canada aircraft, but not a CF-, CG-, or CI- registration.\n", icao_addr) //fmt.Printf("%X is a Canada aircraft, but not a CF-, CG-, or CI- registration.\n", icao_addr)
@ -100,17 +99,16 @@ func icao2reg(icao_addr uint32) (string, bool) {
b_str := "FGI" b_str := "FGI"
fmt.Printf("B = %d, C = %d, D = %d, E = %d\n", b, c, d, e) fmt.Printf("B = %d, C = %d, D = %d, E = %d\n", b, c, d, e)
tail = fmt.Sprintf("C%c%c%c%c",b_str[b],c+65,d+65,e+65) tail = fmt.Sprintf("C-%c%c%c%c", b_str[b], c+65, d+65, e+65)
} }
if (nation == "US") { // FAA decoding if nation == "US" { // FAA decoding
// First, discard addresses that are not assigned to aircraft on the civil registry // First, discard addresses that are not assigned to aircraft on the civil registry
if icao_addr > 0xADF7C7 { if icao_addr > 0xADF7C7 {
//fmt.Printf("%X is a US aircraft, but not on the civil registry.\n", icao_addr) //fmt.Printf("%X is a US aircraft, but not on the civil registry.\n", icao_addr)
return "US-MIL", false return "US-MIL", false
} }
serial := int32(icao_addr - nationalOffset) serial := int32(icao_addr - nationalOffset)
// First digit // First digit
a := (serial / 101711) + 1 a := (serial / 101711) + 1
@ -167,11 +165,9 @@ func icao2reg(icao_addr uint32) (string, bool) {
} }
} }
tail = "N" + a_char + b_char + c_char + d_char + e_char tail = "N" + a_char + b_char + c_char + d_char + e_char
} }
return tail, true return tail, true
} }