Use INVALID_ALTITUDE in a few more places.
This commit is contained in:
parent
08c14484cd
commit
8b8f8d7a40
|
@ -167,6 +167,8 @@ typedef struct rtlsdr_dev rtlsdr_dev_t;
|
|||
#define MODES_ACFLAGS_LLBOTH_VALID (MODES_ACFLAGS_LLEVEN_VALID | MODES_ACFLAGS_LLODD_VALID)
|
||||
#define MODES_ACFLAGS_AOG_GROUND (MODES_ACFLAGS_AOG_VALID | MODES_ACFLAGS_AOG)
|
||||
|
||||
#define INVALID_ALTITUDE (-9999)
|
||||
|
||||
#define MODES_NON_ICAO_ADDRESS (1<<24) // Set on addresses to indicate they are not ICAO addresses
|
||||
|
||||
#define MODES_DEBUG_DEMOD (1<<0)
|
||||
|
|
12
mode_ac.c
12
mode_ac.c
|
@ -39,9 +39,10 @@ int ModeAToModeC(unsigned int ModeA)
|
|||
unsigned int FiveHundreds = 0;
|
||||
unsigned int OneHundreds = 0;
|
||||
|
||||
if ( (ModeA & 0xFFFF8889) // check zero bits are zero, D1 set is illegal
|
||||
|| ((ModeA & 0x000000F0) == 0) ) // C1,,C4 cannot be Zero
|
||||
{return -9999;}
|
||||
if ((ModeA & 0xFFFF8889) != 0 || // check zero bits are zero, D1 set is illegal
|
||||
(ModeA & 0x000000F0) == 0) { // C1,,C4 cannot be Zero
|
||||
return INVALID_ALTITUDE;
|
||||
}
|
||||
|
||||
if (ModeA & 0x0010) {OneHundreds ^= 0x007;} // C1
|
||||
if (ModeA & 0x0020) {OneHundreds ^= 0x003;} // C2
|
||||
|
@ -51,8 +52,9 @@ int ModeAToModeC(unsigned int ModeA)
|
|||
if ((OneHundreds & 5) == 5) {OneHundreds ^= 2;}
|
||||
|
||||
// Check for invalid codes, only 1 to 5 are valid
|
||||
if (OneHundreds > 5)
|
||||
{return -9999;}
|
||||
if (OneHundreds > 5) {
|
||||
return INVALID_ALTITUDE;
|
||||
}
|
||||
|
||||
//if (ModeA & 0x0001) {FiveHundreds ^= 0x1FF;} // D1 never used for altitude
|
||||
if (ModeA & 0x0002) {FiveHundreds ^= 0x0FF;} // D2
|
||||
|
|
Loading…
Reference in a new issue