mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-26 01:35:35 +03:00
UBLOX8 did not support new message and used old configuratoin interface.
Provide alternative way of setting message rates in case firmware is too old. Try to enable NAV_SIG but fallback to NAV_SAT. TODO: fill nav sat info into satelites Current status of GPS debug counters 0: NAV_SIG count 1: MSG_PVT count 2: MSG_SAT count 3: 4: 5: flags.pvt 6: flags.sat 7: flags.sig
This commit is contained in:
parent
19a4fc3cdc
commit
bab841c83d
3 changed files with 79 additions and 15 deletions
|
@ -4386,8 +4386,8 @@ static const char *_ubloxGetQuality(uint8_t quality)
|
||||||
static void cliUbloxPrintSatelites(char *arg)
|
static void cliUbloxPrintSatelites(char *arg)
|
||||||
{
|
{
|
||||||
UNUSED(arg);
|
UNUSED(arg);
|
||||||
if(!isGpsUblox()) {
|
if(!isGpsUblox() /*|| !(gpsState.flags.sig || gpsState.flags.sat)*/) {
|
||||||
cliPrint("GPS is not UBLOX");
|
cliPrint("GPS is not UBLOX or does not report satelites.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,12 @@ typedef struct {
|
||||||
gpsBaudRate_e baudrateIndex;
|
gpsBaudRate_e baudrateIndex;
|
||||||
gpsBaudRate_e autoBaudrateIndex; // Driver internal use (for autoBaud)
|
gpsBaudRate_e autoBaudrateIndex; // Driver internal use (for autoBaud)
|
||||||
uint8_t autoConfigStep; // Driver internal use (for autoConfig)
|
uint8_t autoConfigStep; // Driver internal use (for autoConfig)
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint8_t pvt : 1;
|
||||||
|
uint8_t sig : 1;
|
||||||
|
uint8_t sat : 1;
|
||||||
|
} flags;
|
||||||
|
|
||||||
timeMs_t lastStateSwitchMs;
|
timeMs_t lastStateSwitchMs;
|
||||||
timeMs_t lastLastMessageMs;
|
timeMs_t lastLastMessageMs;
|
||||||
|
|
|
@ -696,7 +696,10 @@ static bool gpsParseFrameUBLOX(void)
|
||||||
if (_class == CLASS_NAV) {
|
if (_class == CLASS_NAV) {
|
||||||
static int satInfoCount = 0;
|
static int satInfoCount = 0;
|
||||||
DEBUG_SET(DEBUG_GPS, 2, satInfoCount++);
|
DEBUG_SET(DEBUG_GPS, 2, satInfoCount++);
|
||||||
gpsSolDRV.numSat = _buffer.svinfo.numCh;
|
if (!gpsState.flags.pvt) { // PVT is the prefered source
|
||||||
|
gpsSolDRV.numSat = _buffer.svinfo.numCh;
|
||||||
|
}
|
||||||
|
// TODO: populate satelites[] with sat info
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSG_SIG_INFO:
|
case MSG_SIG_INFO:
|
||||||
|
@ -888,19 +891,59 @@ STATIC_PROTOTHREAD(gpsConfigure)
|
||||||
gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT);
|
gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT);
|
||||||
|
|
||||||
// M9N & M10 does not support some of the UBX 6/7/8 messages, so we have to configure it using special sequence
|
// M9N & M10 does not support some of the UBX 6/7/8 messages, so we have to configure it using special sequence
|
||||||
if (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX9 || gpsState.swVersionMajor > 23 || (gpsState.swVersionMajor == 23 && gpsState.swVersionMinor >=1)) { // > 23.01, don't use configureMSG
|
if (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX9) {
|
||||||
ubx_config_data8_payload_t rateValues[] = {
|
// > 23.01, don't use configureMSG
|
||||||
{UBLOX_CFG_MSGOUT_NAV_POSLLH_UART1, 0},
|
if (gpsState.swVersionMajor > 23 || (gpsState.swVersionMajor == 23 && gpsState.swVersionMinor >= 1)) {
|
||||||
{UBLOX_CFG_MSGOUT_NAV_STATUS_UART1, 0},
|
ubx_config_data8_payload_t rateValues[] = {
|
||||||
{UBLOX_CFG_MSGOUT_NAV_VELNED_UART1, 0},
|
{UBLOX_CFG_MSGOUT_NAV_POSLLH_UART1, 0},
|
||||||
{UBLOX_CFG_MSGOUT_NAV_TIMEUTC_UART1, 0},
|
{UBLOX_CFG_MSGOUT_NAV_STATUS_UART1, 0},
|
||||||
{UBLOX_CFG_MSGOUT_NAV_PVT_UART1, 1},
|
{UBLOX_CFG_MSGOUT_NAV_VELNED_UART1, 0},
|
||||||
{UBLOX_CFG_MSGOUT_NAV_SAT_UART1, 0},
|
{UBLOX_CFG_MSGOUT_NAV_TIMEUTC_UART1, 0},
|
||||||
{UBLOX_CFG_MSGOUT_NAV_SIG_UART1, 1},
|
{UBLOX_CFG_MSGOUT_NAV_PVT_UART1, 1},
|
||||||
};
|
{UBLOX_CFG_MSGOUT_NAV_SIG_UART1, 1},
|
||||||
|
{UBLOX_CFG_MSGOUT_NAV_SAT_UART1, 0},
|
||||||
|
};
|
||||||
|
|
||||||
ubloxSendSetCfgBytes(rateValues, 7);
|
ubloxSendSetCfgBytes(rateValues, 5);
|
||||||
ptWait(_ack_state == UBX_ACK_GOT_ACK);
|
ptWait(_ack_state == UBX_ACK_GOT_ACK);
|
||||||
|
gpsState.flags.pvt = _ack_state == UBX_ACK_GOT_ACK;
|
||||||
|
|
||||||
|
// Try to enable SIG
|
||||||
|
ubloxSendSetCfgBytes(rateValues+5, 1);
|
||||||
|
ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK);
|
||||||
|
gpsState.flags.sig = _ack_state == UBX_ACK_GOT_ACK;
|
||||||
|
|
||||||
|
// Try to enable SAT if SIG fails
|
||||||
|
rateValues[6].value = gpsState.flags.sig ? 0 : 1;
|
||||||
|
ubloxSendSetCfgBytes(rateValues+6, 1);
|
||||||
|
ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK);
|
||||||
|
gpsState.flags.sat = _ack_state == UBX_ACK_GOT_ACK ? rateValues[6].value : 0;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
configureMSG(MSG_CLASS_UBX, MSG_POSLLH, 0);
|
||||||
|
ptWait(_ack_state == UBX_ACK_GOT_ACK);
|
||||||
|
|
||||||
|
configureMSG(MSG_CLASS_UBX, MSG_STATUS, 0);
|
||||||
|
ptWait(_ack_state == UBX_ACK_GOT_ACK);
|
||||||
|
|
||||||
|
configureMSG(MSG_CLASS_UBX, MSG_VELNED, 0);
|
||||||
|
ptWait(_ack_state == UBX_ACK_GOT_ACK);
|
||||||
|
|
||||||
|
configureMSG(MSG_CLASS_UBX, MSG_TIMEUTC, 0);
|
||||||
|
ptWait(_ack_state == UBX_ACK_GOT_ACK);
|
||||||
|
|
||||||
|
configureMSG(MSG_CLASS_UBX, MSG_PVT, 1);
|
||||||
|
ptWait(_ack_state == UBX_ACK_GOT_ACK);
|
||||||
|
gpsState.flags.pvt = _ack_state == UBX_ACK_GOT_ACK;
|
||||||
|
|
||||||
|
configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, 0);
|
||||||
|
ptWait(_ack_state == UBX_ACK_GOT_ACK);
|
||||||
|
gpsState.flags.sat = 0;
|
||||||
|
|
||||||
|
configureMSG(MSG_CLASS_UBX, MSG_SIG_INFO, 1);
|
||||||
|
ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK);
|
||||||
|
gpsState.flags.sig = _ack_state == UBX_ACK_GOT_ACK;
|
||||||
|
}
|
||||||
|
|
||||||
if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) {
|
if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) {
|
||||||
configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz
|
configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz
|
||||||
|
@ -936,10 +979,21 @@ STATIC_PROTOTHREAD(gpsConfigure)
|
||||||
|
|
||||||
configureMSG(MSG_CLASS_UBX, MSG_PVT, 1);
|
configureMSG(MSG_CLASS_UBX, MSG_PVT, 1);
|
||||||
ptWait(_ack_state == UBX_ACK_GOT_ACK);
|
ptWait(_ack_state == UBX_ACK_GOT_ACK);
|
||||||
|
gpsState.flags.pvt = _ack_state == UBX_ACK_GOT_ACK;
|
||||||
|
|
||||||
configureMSG(MSG_CLASS_UBX, MSG_SVINFO, 0);
|
configureMSG(MSG_CLASS_UBX, MSG_SVINFO, 0);
|
||||||
ptWait(_ack_state == UBX_ACK_GOT_ACK);
|
ptWait(_ack_state == UBX_ACK_GOT_ACK);
|
||||||
|
|
||||||
|
// Needed for satelite information on older devices
|
||||||
|
configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, 1);
|
||||||
|
ptWait(_ack_state == UBX_ACK_GOT_ACK ||
|
||||||
|
_ack_state == UBX_ACK_GOT_NAK);
|
||||||
|
if (_ack_state == UBX_ACK_GOT_ACK) {
|
||||||
|
gpsState.flags.sat = 1;
|
||||||
|
} else {
|
||||||
|
gpsState.flags.sat = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) {
|
if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) {
|
||||||
configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz
|
configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz
|
||||||
}
|
}
|
||||||
|
@ -984,6 +1038,10 @@ STATIC_PROTOTHREAD(gpsConfigure)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG_SET(DEBUG_GPS, 5, gpsState.flags.pvt);
|
||||||
|
DEBUG_SET(DEBUG_GPS, 6, gpsState.flags.sat);
|
||||||
|
DEBUG_SET(DEBUG_GPS, 7, gpsState.flags.sig);
|
||||||
|
|
||||||
// Configure SBAS
|
// Configure SBAS
|
||||||
// If particular SBAS setting is not supported by the hardware we'll get a NAK,
|
// If particular SBAS setting is not supported by the hardware we'll get a NAK,
|
||||||
// however GPS would be functional. We are waiting for any response - ACK/NACK
|
// however GPS would be functional. We are waiting for any response - ACK/NACK
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue