Add auto support for VTG, RMC and ZDA, Add support for jamming / interference information

This commit is contained in:
PaulZC
2022-03-02 13:13:28 +00:00
parent fa501247e6
commit 28bb48d177
7 changed files with 2130 additions and 0 deletions
File diff suppressed because it is too large Load Diff
@@ -901,6 +901,16 @@ public:
bool getTimePulseParameters(UBX_CFG_TP5_data_t *data = NULL, uint16_t maxWait = defaultMaxWait); // Get the time pulse parameters using UBX_CFG_TP5
bool setTimePulseParameters(UBX_CFG_TP5_data_t *data = NULL, uint16_t maxWait = defaultMaxWait); // Set the time pulse parameters using UBX_CFG_TP5
// Jamming/interference monitor configuration
bool getJammingConfiguration(UBX_CFG_ITFM_data_t *data = NULL, uint16_t maxWait = defaultMaxWait); // Get the jamming/interference monitor configuration using UBX_CFG_ITFM
bool setJammingConfiguration(UBX_CFG_ITFM_data_t *data = NULL, uint16_t maxWait = defaultMaxWait); // Set the jamming/interference monitor configuration using UBX_CFG_ITFM
// RF Information (including jamming) - ZED-F9 only
bool getRFinformation(UBX_MON_RF_data_t *data = NULL, uint16_t maxWait = defaultMaxWait); // Get the RF information using UBX_MON_RF
// Hardware status (including jamming)
bool getHWstatus(UBX_MON_HW_data_t *data = NULL, uint16_t maxWait = defaultMaxWait); // Get the hardware status using UBX_MON_HW
// UBX-CFG-NAVX5 - get/set the ackAiding byte. If ackAiding is 1, UBX-MGA-ACK messages will be sent by the module to acknowledge the MGA data
uint8_t getAckAiding(uint16_t maxWait = defaultMaxWait); // Get the ackAiding byte - returns 255 if the sendCommand fails
bool setAckAiding(uint8_t ackAiding, uint16_t maxWait = defaultMaxWait); // Set the ackAiding byte
@@ -1428,6 +1438,24 @@ public:
uint8_t getLatestNMEAGNGGA(NMEA_GGA_data_t *data); // Return the most recent GNGGA: 0 = no data, 1 = stale data, 2 = fresh data
bool setNMEAGNGGAcallback(void (*callbackPointer)(NMEA_GGA_data_t)); // Enable a callback on the arrival of a GNGGA message
bool setNMEAGNGGAcallbackPtr(void (*callbackPointerPtr)(NMEA_GGA_data_t *)); // Enable a callback on the arrival of a GNGGA message
uint8_t getLatestNMEAGPVTG(NMEA_VTG_data_t *data); // Return the most recent GPVTG: 0 = no data, 1 = stale data, 2 = fresh data
bool setNMEAGPVTGcallback(void (*callbackPointer)(NMEA_VTG_data_t)); // Enable a callback on the arrival of a GPVTG message
bool setNMEAGPVTGcallbackPtr(void (*callbackPointerPtr)(NMEA_VTG_data_t *)); // Enable a callback on the arrival of a GPVTG message
uint8_t getLatestNMEAGNVTG(NMEA_VTG_data_t *data); // Return the most recent GNVTG: 0 = no data, 1 = stale data, 2 = fresh data
bool setNMEAGNVTGcallback(void (*callbackPointer)(NMEA_VTG_data_t)); // Enable a callback on the arrival of a GNVTG message
bool setNMEAGNVTGcallbackPtr(void (*callbackPointerPtr)(NMEA_VTG_data_t *)); // Enable a callback on the arrival of a GNVTG message
uint8_t getLatestNMEAGPRMC(NMEA_RMC_data_t *data); // Return the most recent GPRMC: 0 = no data, 1 = stale data, 2 = fresh data
bool setNMEAGPRMCcallback(void (*callbackPointer)(NMEA_RMC_data_t)); // Enable a callback on the arrival of a GPRMC message
bool setNMEAGPRMCcallbackPtr(void (*callbackPointerPtr)(NMEA_RMC_data_t *)); // Enable a callback on the arrival of a GPRMC message
uint8_t getLatestNMEAGNRMC(NMEA_RMC_data_t *data); // Return the most recent GNRMC: 0 = no data, 1 = stale data, 2 = fresh data
bool setNMEAGNRMCcallback(void (*callbackPointer)(NMEA_RMC_data_t)); // Enable a callback on the arrival of a GNRMC message
bool setNMEAGNRMCcallbackPtr(void (*callbackPointerPtr)(NMEA_RMC_data_t *)); // Enable a callback on the arrival of a GNRMC message
uint8_t getLatestNMEAGPZDA(NMEA_ZDA_data_t *data); // Return the most recent GPZDA: 0 = no data, 1 = stale data, 2 = fresh data
bool setNMEAGPZDAcallback(void (*callbackPointer)(NMEA_ZDA_data_t)); // Enable a callback on the arrival of a GPZDA message
bool setNMEAGPZDAcallbackPtr(void (*callbackPointerPtr)(NMEA_ZDA_data_t *)); // Enable a callback on the arrival of a GPZDA message
uint8_t getLatestNMEAGNZDA(NMEA_ZDA_data_t *data); // Return the most recent GNZDA: 0 = no data, 1 = stale data, 2 = fresh data
bool setNMEAGNZDAcallback(void (*callbackPointer)(NMEA_ZDA_data_t)); // Enable a callback on the arrival of a GNZDA message
bool setNMEAGNZDAcallbackPtr(void (*callbackPointerPtr)(NMEA_ZDA_data_t *)); // Enable a callback on the arrival of a GNZDA message
// Functions to extract signed and unsigned 8/16/32-bit data from a ubxPacket
// From v2.0: These are public. The user can call these to extract data from custom packets
@@ -1485,6 +1513,12 @@ public:
NMEA_GPGGA_t *storageNMEAGPGGA = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
NMEA_GNGGA_t *storageNMEAGNGGA = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
NMEA_GPVTG_t *storageNMEAGPVTG = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
NMEA_GNVTG_t *storageNMEAGNVTG = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
NMEA_GPRMC_t *storageNMEAGPRMC = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
NMEA_GNRMC_t *storageNMEAGNRMC = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
NMEA_GPZDA_t *storageNMEAGPZDA = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
NMEA_GNZDA_t *storageNMEAGNZDA = NULL; // Pointer to struct. RAM will be allocated for this if/when necessary
uint16_t rtcmFrameCounter = 0; // Tracks the type of incoming byte inside RTCM frame
@@ -1570,6 +1604,12 @@ private:
bool initStorageNMEAGPGGA(); // Allocate RAM for incoming NMEA GPGGA messages and initialize it
bool initStorageNMEAGNGGA(); // Allocate RAM for incoming NMEA GNGGA messages and initialize it
bool initStorageNMEAGPVTG(); // Allocate RAM for incoming NMEA GPVTG messages and initialize it
bool initStorageNMEAGNVTG(); // Allocate RAM for incoming NMEA GNVTG messages and initialize it
bool initStorageNMEAGPRMC(); // Allocate RAM for incoming NMEA GPRMC messages and initialize it
bool initStorageNMEAGNRMC(); // Allocate RAM for incoming NMEA GNRMC messages and initialize it
bool initStorageNMEAGPZDA(); // Allocate RAM for incoming NMEA GPZDA messages and initialize it
bool initStorageNMEAGNZDA(); // Allocate RAM for incoming NMEA GNZDA messages and initialize it
// Variables
TwoWire *_i2cPort; // The generic connection to user's chosen I2C hardware
+196
View File
@@ -1667,6 +1667,118 @@ typedef struct
} flags;
} UBX_CFG_TP5_data_t;
// UBX-CFG-ITFM (0x06 0x39): Jamming/interference monitor configuration
const uint16_t UBX_CFG_ITFM_LEN = 8;
typedef struct
{
union
{
uint32_t all;
struct
{
uint32_t bbThreshold : 4; // Broadband jamming detection threshold
uint32_t cwThreshold : 5; // CW jamming detection threshold
uint32_t algorithmBits : 22; // Reserved algorithm settings - should be set to 0x16B156 in hex for correct settings
uint32_t enable : 1; // Enable interference detection
} bits;
} config;
union
{
uint32_t all;
struct
{
uint32_t generalBits : 12; // General settings - should be set to 0x31E in hex for correct setting
uint32_t antSetting : 2; // Antenna setting, 0=unknown, 1=passive, 2=active
uint32_t enable2 : 1; // Set to 1 to scan auxiliary bands (u-blox 8 / u-blox M8 only, otherwise ignored)
} bits;
} config2;
} UBX_CFG_ITFM_data_t;
// MON-specific structs
// UBX-MON-HW (0x0A 0x09): Hardware status
const uint16_t UBX_MON_HW_LEN = 60;
typedef struct
{
uint32_t pinSel; // Mask of pins set as peripheral/PIO
uint32_t pinBank; // Mask of pins set as bank A/B
uint32_t pinDir; // Mask of pins set as input/output
uint32_t pinVal; // Mask of pins value low/high
uint16_t noisePerMS; // Noise level as measured by the GPS core
uint16_t agcCnt; // AGC monitor (counts SIGHI xor SIGLO, range 0 to 8191)
uint8_t aStatus; // Status of the antenna supervisor state machine (0=INIT, 1=DONTKNOW, 2=OK, 3=SHORT, 4=OPEN)
uint8_t aPower; // Current power status of antenna (0=OFF, 1=ON, 2=DONTKNOW)
union
{
uint8_t all;
struct
{
uint8_t rtcCalib : 1; // RTC is calibrated
uint8_t safeBoot : 1; // Safeboot mode (0 = inactive, 1 = active)
uint8_t jammingState : 2; // Output from jamming/interference monitor (0 = unknown or feature disabled,
// 1 = ok - no significant jamming,
// 2 = warning - interference visible but fix OK,
// 3 = critical - interference visible and no fix)
uint8_t xtalAbsent : 1; // RTC xtal has been determined to be absent
} bits;
} flags;
uint8_t reserved1; // Reserved
uint32_t usedMask; // Mask of pins that are used by the virtual pin manager
uint8_t VP[17]; // Array of pin mappings for each of the 17 physical pins
uint8_t jamInd; // CW jamming indicator, scaled (0 = no CW jamming, 255 = strong CW jamming)
uint8_t reserved2[2]; // Reserved
uint32_t pinIrq; // Mask of pins value using the PIO Irq
uint32_t pullH; // Mask of pins value using the PIO pull high resistor
uint8_t pullL; // Mask of pins value using the PIO pull low resistor
} UBX_MON_HW_data_t;
// UBX-MON-RF (0x0a 0x38): RF information
const uint16_t UBX_MON_RF_MAX_BLOCKS = 2; // 0 = L1; 1 = L2 / L5
const uint16_t UBX_MON_RF_MAX_LEN = 4 + (24 * UBX_MON_RF_MAX_BLOCKS);
typedef struct
{
uint8_t version; // Message version (0x00 for this version)
uint8_t nBlocks; // The number of RF blocks included
uint8_t reserved0[2];
} UBX_MON_RF_header_t;
typedef struct
{
uint8_t blockId; // RF block ID (0 = L1 band, 1 = L2 or L5 band depending on product configuration)
union
{
uint8_t all;
struct
{
uint8_t jammingState : 2; // output from Jamming/Interference Monitor (0 = unknown or feature disabled,
// 1 = ok - no significant jamming,
// 2 = warning - interference visible but fix OK,
// 3 = critical - interference visible and no fix)
} bits;
} flags;
uint8_t antStatus; // Status of the antenna supervisor state machine (0x00=INIT, 0x01=DONTKNOW, 0x02=OK, 0x03=SHORT, 0x04=OPEN)
uint8_t antPower; // Current power status of antenna (0x00=OFF, 0x01=ON, 0x02=DONTKNOW)
uint32_t postStatus; // POST status word
uint8_t reserved1[4]; // Reserved
uint16_t noisePerMS; // Noise level as measured by the GPS core
uint16_t agcCnt; // AGC Monitor (counts SIGHI xor SIGLO, range 0 to 8191)
uint8_t jamInd; // CW jamming indicator, scaled (0=no CW jamming, 255 = strong CW jamming)
int8_t ofsI; // Imbalance of I-part of complex signal, scaled (-128 = max. negative imbalance, 127 = max. positive imbalance)
uint8_t magI; // Magnitude of I-part of complex signal, scaled (0 = no signal, 255 = max.magnitude)
int8_t ofsQ; // Imbalance of Q-part of complex signal, scaled (-128 = max. negative imbalance, 127 = max. positive imbalance)
uint8_t magQ; // Magnitude of Q-part of complex signal, scaled (0 = no signal, 255 = max.magnitude)
uint8_t reserved2[3]; // Reserved
} UBX_MON_RF_block_t;
typedef struct
{
UBX_MON_RF_header_t header;
UBX_MON_RF_block_t blocks[UBX_MON_RF_MAX_BLOCKS];
} UBX_MON_RF_data_t;
// TIM-specific structs
// UBX-TIM-TM2 (0x0D 0x03): Time mark data
@@ -2423,4 +2535,88 @@ typedef struct
NMEA_GGA_data_t *callbackCopy; // The callback gets its own preserved copy of the complete copy
} NMEA_GNGGA_t;
const uint8_t NMEA_VTG_MAX_LENGTH = 100;
typedef struct
{
uint8_t length; // The number of bytes in nmea
uint8_t nmea[NMEA_VTG_MAX_LENGTH];
} NMEA_VTG_data_t;
typedef struct
{
nmeaAutomaticFlags automaticFlags;
NMEA_VTG_data_t workingCopy; // Incoming data is added to the working copy
NMEA_VTG_data_t completeCopy; // The working copy is copied into the complete copy when all data has been received and the checksum is valid
void (*callbackPointer)(NMEA_VTG_data_t);
void (*callbackPointerPtr)(NMEA_VTG_data_t *);
NMEA_VTG_data_t *callbackCopy; // The callback gets its own preserved copy of the complete copy
} NMEA_GPVTG_t;
typedef struct
{
nmeaAutomaticFlags automaticFlags;
NMEA_VTG_data_t workingCopy; // Incoming data is added to the working copy
NMEA_VTG_data_t completeCopy; // The working copy is copied into the complete copy when all data has been received and the checksum is valid
void (*callbackPointer)(NMEA_VTG_data_t);
void (*callbackPointerPtr)(NMEA_VTG_data_t *);
NMEA_VTG_data_t *callbackCopy; // The callback gets its own preserved copy of the complete copy
} NMEA_GNVTG_t;
const uint8_t NMEA_RMC_MAX_LENGTH = 100;
typedef struct
{
uint8_t length; // The number of bytes in nmea
uint8_t nmea[NMEA_RMC_MAX_LENGTH];
} NMEA_RMC_data_t;
typedef struct
{
nmeaAutomaticFlags automaticFlags;
NMEA_RMC_data_t workingCopy; // Incoming data is added to the working copy
NMEA_RMC_data_t completeCopy; // The working copy is copied into the complete copy when all data has been received and the checksum is valid
void (*callbackPointer)(NMEA_RMC_data_t);
void (*callbackPointerPtr)(NMEA_RMC_data_t *);
NMEA_RMC_data_t *callbackCopy; // The callback gets its own preserved copy of the complete copy
} NMEA_GPRMC_t;
typedef struct
{
nmeaAutomaticFlags automaticFlags;
NMEA_RMC_data_t workingCopy; // Incoming data is added to the working copy
NMEA_RMC_data_t completeCopy; // The working copy is copied into the complete copy when all data has been received and the checksum is valid
void (*callbackPointer)(NMEA_RMC_data_t);
void (*callbackPointerPtr)(NMEA_RMC_data_t *);
NMEA_RMC_data_t *callbackCopy; // The callback gets its own preserved copy of the complete copy
} NMEA_GNRMC_t;
const uint8_t NMEA_ZDA_MAX_LENGTH = 50;
typedef struct
{
uint8_t length; // The number of bytes in nmea
uint8_t nmea[NMEA_ZDA_MAX_LENGTH];
} NMEA_ZDA_data_t;
typedef struct
{
nmeaAutomaticFlags automaticFlags;
NMEA_ZDA_data_t workingCopy; // Incoming data is added to the working copy
NMEA_ZDA_data_t completeCopy; // The working copy is copied into the complete copy when all data has been received and the checksum is valid
void (*callbackPointer)(NMEA_ZDA_data_t);
void (*callbackPointerPtr)(NMEA_ZDA_data_t *);
NMEA_ZDA_data_t *callbackCopy; // The callback gets its own preserved copy of the complete copy
} NMEA_GPZDA_t;
typedef struct
{
nmeaAutomaticFlags automaticFlags;
NMEA_ZDA_data_t workingCopy; // Incoming data is added to the working copy
NMEA_ZDA_data_t completeCopy; // The working copy is copied into the complete copy when all data has been received and the checksum is valid
void (*callbackPointer)(NMEA_ZDA_data_t);
void (*callbackPointerPtr)(NMEA_ZDA_data_t *);
NMEA_ZDA_data_t *callbackCopy; // The callback gets its own preserved copy of the complete copy
} NMEA_GNZDA_t;
#endif