m9n support

This commit is contained in:
Tony Cabello 2021-08-28 15:40:29 +01:00
parent 4b44378b4d
commit 2f89cf3cc4
2 changed files with 609 additions and 343 deletions

File diff suppressed because it is too large Load Diff

View File

@ -79,8 +79,7 @@ typedef enum {
UBLOX_ACK_IDLE = 0, UBLOX_ACK_IDLE = 0,
UBLOX_ACK_WAITING, UBLOX_ACK_WAITING,
UBLOX_ACK_GOT_ACK, UBLOX_ACK_GOT_ACK,
UBLOX_ACK_GOT_NACK, UBLOX_ACK_GOT_NACK
UBLOX_ACK_GOT_TIMEOUT
} ubloxAckState_e; } ubloxAckState_e;
#define GPS_BAUDRATE_MAX GPS_BAUDRATE_9600 #define GPS_BAUDRATE_MAX GPS_BAUDRATE_9600
@ -120,16 +119,6 @@ typedef struct gpsSolutionData_s {
uint8_t numSat; uint8_t numSat;
} gpsSolutionData_t; } gpsSolutionData_t;
typedef enum {
GPS_MESSAGE_STATE_IDLE = 0,
GPS_MESSAGE_STATE_INIT,
GPS_MESSAGE_STATE_SBAS,
GPS_MESSAGE_STATE_GNSS,
GPS_MESSAGE_STATE_INITIALIZED,
GPS_MESSAGE_STATE_PEDESTRIAN_TO_AIRBORNE,
GPS_MESSAGE_STATE_ENTRY_COUNT
} gpsMessageState_e;
typedef struct gpsData_s { typedef struct gpsData_s {
uint32_t errors; // gps error counter - crc error/lost of data/sync etc.. uint32_t errors; // gps error counter - crc error/lost of data/sync etc..
uint32_t timeouts; uint32_t timeouts;
@ -140,11 +129,12 @@ typedef struct gpsData_s {
uint32_t state_ts; // timestamp for last state_position increment uint32_t state_ts; // timestamp for last state_position increment
uint8_t state; // GPS thread state. Used for detecting cable disconnects and configuring attached devices uint8_t state; // GPS thread state. Used for detecting cable disconnects and configuring attached devices
uint8_t baudrateIndex; // index into auto-detecting or current baudrate uint8_t baudrateIndex; // index into auto-detecting or current baudrate
gpsMessageState_e messageState;
uint8_t ackWaitingMsgId; // Message id when waiting for ACK uint8_t ackWaitingMsgId; // Message id when waiting for ACK
uint8_t ackTimeoutCounter; // Ack timeout counter uint8_t ackTimeoutCounter; // Ack timeout counter
ubloxAckState_e ackState; ubloxAckState_e ackState;
bool ubloxUsePVT;
bool ubloxUseSAT;
} gpsData_t; } gpsData_t;
#define GPS_PACKET_LOG_ENTRY_COUNT 21 // To make this useful we should log as many packets as we can fit characters a single line of a OLED display. #define GPS_PACKET_LOG_ENTRY_COUNT 21 // To make this useful we should log as many packets as we can fit characters a single line of a OLED display.
@ -168,14 +158,39 @@ typedef enum {
extern gpsData_t gpsData; extern gpsData_t gpsData;
extern gpsSolutionData_t gpsSol; extern gpsSolutionData_t gpsSol;
#define GPS_SV_MAXSATS_LEGACY 16
#define GPS_SV_MAXSATS_M8N 32
#define GPS_SV_MAXSATS_M9N 42
extern uint8_t GPS_update; // toogle to distinct a GPS position update (directly or via MSP) extern uint8_t GPS_update; // toogle to distinct a GPS position update (directly or via MSP)
extern uint32_t GPS_packetCount; extern uint32_t GPS_packetCount;
extern uint32_t GPS_svInfoReceivedCount; extern uint32_t GPS_svInfoReceivedCount;
extern uint8_t GPS_numCh; // Number of channels extern uint8_t GPS_numCh; // Number of channels
extern uint8_t GPS_svinfo_chn[16]; // Channel number extern uint8_t GPS_svinfo_chn[GPS_SV_MAXSATS_M8N]; // When NumCh is 16 or less: Channel number
extern uint8_t GPS_svinfo_svid[16]; // Satellite ID // When NumCh is more than 16: GNSS Id
extern uint8_t GPS_svinfo_quality[16]; // Bitfield Qualtity // 0 = GPS, 1 = SBAS, 2 = Galileo, 3 = BeiDou
extern uint8_t GPS_svinfo_cno[16]; // Carrier to Noise Ratio (Signal Strength) // 4 = IMES, 5 = QZSS, 6 = Glonass
extern uint8_t GPS_svinfo_svid[GPS_SV_MAXSATS_M8N]; // Satellite ID
extern uint8_t GPS_svinfo_quality[GPS_SV_MAXSATS_M8N]; // When NumCh is 16 or less: Bitfield Qualtity
// When NumCh is more than 16: flags
// bits 2..0: signal quality indicator
// 0 = no signal
// 1 = searching signal
// 2 = signal acquired
// 3 = signal detected but unusable
// 4 = code locked and time synchronized
// 5,6,7 = code and carrier locked and time synchronized
// bit 3:
// 1 = signal currently being used for navigaion
// bits 5..4: signal health flag
// 0 = unknown
// 1 = healthy
// 2 = unhealthy
// bit 6:
// 1 = differential correction data available for this SV
// bit 7:
// 1 = carrier smoothed pseudorange used
extern uint8_t GPS_svinfo_cno[GPS_SV_MAXSATS_M8N]; // Carrier to Noise Ratio (Signal Strength)
#define GPS_DBHZ_MIN 0 #define GPS_DBHZ_MIN 0
#define GPS_DBHZ_MAX 55 #define GPS_DBHZ_MAX 55