mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
Merge pull request #8758 from TonyBlit/fix_ttff
BugFix: time to first fix was sometimes abnormally high due to improp…
This commit is contained in:
commit
2cb3191d8a
2 changed files with 35 additions and 17 deletions
|
@ -127,27 +127,11 @@ static const gpsInitData_t gpsInitData[] = {
|
||||||
#ifdef USE_GPS_UBLOX
|
#ifdef USE_GPS_UBLOX
|
||||||
static const uint8_t ubloxInit[] = {
|
static const uint8_t ubloxInit[] = {
|
||||||
//Preprocessor Pedestrian Dynamic Platform Model Option
|
//Preprocessor Pedestrian Dynamic Platform Model Option
|
||||||
#if defined(GPS_UBLOX_MODE_PEDESTRIAN)
|
|
||||||
0xB5, 0x62, 0x06, 0x24, 0x24, 0x00, 0xFF, 0xFF, 0x03, 0x03, 0x00, // CFG-NAV5 - Set engine settings
|
0xB5, 0x62, 0x06, 0x24, 0x24, 0x00, 0xFF, 0xFF, 0x03, 0x03, 0x00, // CFG-NAV5 - Set engine settings
|
||||||
0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00, 0x05, 0x00, 0xFA, 0x00, // Collected by resetting a GPS unit to defaults. Changing mode to Pedistrian and
|
0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00, 0x05, 0x00, 0xFA, 0x00, // Collected by resetting a GPS unit to defaults. Changing mode to Pedistrian and
|
||||||
0xFA, 0x00, 0x64, 0x00, 0x2C, 0x01, 0x00, 0x3C, 0x00, 0x00, 0x00, // capturing the data from the U-Center binary console.
|
0xFA, 0x00, 0x64, 0x00, 0x2C, 0x01, 0x00, 0x3C, 0x00, 0x00, 0x00, // capturing the data from the U-Center binary console.
|
||||||
0x00, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xC2,
|
0x00, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xC2,
|
||||||
|
|
||||||
//Preprocessor Airborne_1g Dynamic Platform Model Option
|
|
||||||
#elif defined(GPS_UBLOX_MODE_AIRBORNE_1G)
|
|
||||||
0xB5, 0x62, 0x06, 0x24, 0x24, 0x00, 0xFF, 0xFF, 0x06, 0x03, 0x00, // CFG-NAV5 - Set engine settings
|
|
||||||
0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00, 0x05, 0x00, 0xFA, 0x00, // Collected by resetting a GPS unit to defaults. Changing mode to Airborne with
|
|
||||||
0xFA, 0x00, 0x64, 0x00, 0x2C, 0x01, 0x00, 0x3C, 0x00, 0x00, 0x00, // <1g acceleration and capturing the data from the U-Center binary console.
|
|
||||||
0x00, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x28,
|
|
||||||
|
|
||||||
//Default Airborne_4g Dynamic Platform Model
|
|
||||||
#else
|
|
||||||
0xB5, 0x62, 0x06, 0x24, 0x24, 0x00, 0xFF, 0xFF, 0x08, 0x03, 0x00, // CFG-NAV5 - Set engine settings
|
|
||||||
0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00, 0x05, 0x00, 0xFA, 0x00, // Collected by resetting a GPS unit to defaults. Changing mode to Airborne with
|
|
||||||
0xFA, 0x00, 0x64, 0x00, 0x2C, 0x01, 0x00, 0x3C, 0x00, 0x00, 0x00, // <4g acceleration and capturing the data from the U-Center binary console.
|
|
||||||
0x00, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x6C,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// DISABLE NMEA messages
|
// DISABLE NMEA messages
|
||||||
0xB5, 0x62, 0x06, 0x01, 0x03, 0x00, 0xF0, 0x05, 0x00, 0xFF, 0x19, // VGS: Course over ground and Ground speed
|
0xB5, 0x62, 0x06, 0x01, 0x03, 0x00, 0xF0, 0x05, 0x00, 0xFF, 0x19, // VGS: Course over ground and Ground speed
|
||||||
0xB5, 0x62, 0x06, 0x01, 0x03, 0x00, 0xF0, 0x03, 0x00, 0xFD, 0x15, // GSV: GNSS Satellites in View
|
0xB5, 0x62, 0x06, 0x01, 0x03, 0x00, 0xF0, 0x03, 0x00, 0xFD, 0x15, // GSV: GNSS Satellites in View
|
||||||
|
@ -167,6 +151,23 @@ static const uint8_t ubloxInit[] = {
|
||||||
0xB5, 0x62, 0x06, 0x08, 0x06, 0x00, 0xC8, 0x00, 0x01, 0x00, 0x01, 0x00, 0xDE, 0x6A, // set rate to 5Hz (measurement period: 200ms, navigation rate: 1 cycle)
|
0xB5, 0x62, 0x06, 0x08, 0x06, 0x00, 0xC8, 0x00, 0x01, 0x00, 0x01, 0x00, 0xDE, 0x6A, // set rate to 5Hz (measurement period: 200ms, navigation rate: 1 cycle)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const uint8_t ubloxAirborne[] = {
|
||||||
|
//Preprocessor Airborne_1g Dynamic Platform Model Option
|
||||||
|
#if defined(GPS_UBLOX_MODE_AIRBORNE_1G)
|
||||||
|
0xB5, 0x62, 0x06, 0x24, 0x24, 0x00, 0xFF, 0xFF, 0x06, 0x03, 0x00, // CFG-NAV5 - Set engine settings
|
||||||
|
0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00, 0x05, 0x00, 0xFA, 0x00, // Collected by resetting a GPS unit to defaults. Changing mode to Airborne with
|
||||||
|
0xFA, 0x00, 0x64, 0x00, 0x2C, 0x01, 0x00, 0x3C, 0x00, 0x00, 0x00, // <1g acceleration and capturing the data from the U-Center binary console.
|
||||||
|
0x00, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x28,
|
||||||
|
|
||||||
|
//Default Airborne_4g Dynamic Platform Model
|
||||||
|
#else
|
||||||
|
0xB5, 0x62, 0x06, 0x24, 0x24, 0x00, 0xFF, 0xFF, 0x08, 0x03, 0x00, // CFG-NAV5 - Set engine settings
|
||||||
|
0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00, 0x05, 0x00, 0xFA, 0x00, // Collected by resetting a GPS unit to defaults. Changing mode to Airborne with
|
||||||
|
0xFA, 0x00, 0x64, 0x00, 0x2C, 0x01, 0x00, 0x3C, 0x00, 0x00, 0x00, // <4g acceleration and capturing the data from the U-Center binary console.
|
||||||
|
0x00, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x6C,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
// UBlox 6 Protocol documentation - GPS.G6-SW-10018-F
|
// UBlox 6 Protocol documentation - GPS.G6-SW-10018-F
|
||||||
// SBAS Configuration Settings Desciption, Page 4/210
|
// SBAS Configuration Settings Desciption, Page 4/210
|
||||||
// 31.21 CFG-SBAS (0x06 0x16), Page 142/210
|
// 31.21 CFG-SBAS (0x06 0x16), Page 142/210
|
||||||
|
@ -447,7 +448,7 @@ void gpsInitUblox(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpsData.messageState >= GPS_MESSAGE_STATE_ENTRY_COUNT) {
|
if (gpsData.messageState >= GPS_MESSAGE_STATE_INITIALIZED) {
|
||||||
// ublox should be initialised, try receiving
|
// ublox should be initialised, try receiving
|
||||||
gpsSetState(GPS_RECEIVING_DATA);
|
gpsSetState(GPS_RECEIVING_DATA);
|
||||||
}
|
}
|
||||||
|
@ -528,6 +529,21 @@ void gpsUpdate(timeUs_t currentTimeUs)
|
||||||
// remove GPS from capability
|
// remove GPS from capability
|
||||||
sensorsClear(SENSOR_GPS);
|
sensorsClear(SENSOR_GPS);
|
||||||
gpsSetState(GPS_LOST_COMMUNICATION);
|
gpsSetState(GPS_LOST_COMMUNICATION);
|
||||||
|
#if !defined(GPS_UBLOX_MODE_PEDESTRIAN)
|
||||||
|
} else {
|
||||||
|
if ((gpsData.messageState == GPS_MESSAGE_STATE_IDLE) && STATE(GPS_FIX)) {
|
||||||
|
gpsData.messageState = GPS_MESSAGE_STATE_AIRBORNE;
|
||||||
|
gpsData.state_position = 0;
|
||||||
|
}
|
||||||
|
if (gpsData.messageState == GPS_MESSAGE_STATE_AIRBORNE) {
|
||||||
|
if (gpsData.state_position < sizeof(ubloxAirborne)) {
|
||||||
|
serialWrite(gpsPort, ubloxAirborne[gpsData.state_position]);
|
||||||
|
gpsData.state_position++;
|
||||||
|
} else {
|
||||||
|
gpsData.messageState = GPS_MESSAGE_STATE_ENTRY_COUNT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,8 @@ typedef enum {
|
||||||
GPS_MESSAGE_STATE_INIT,
|
GPS_MESSAGE_STATE_INIT,
|
||||||
GPS_MESSAGE_STATE_SBAS,
|
GPS_MESSAGE_STATE_SBAS,
|
||||||
GPS_MESSAGE_STATE_GALILEO,
|
GPS_MESSAGE_STATE_GALILEO,
|
||||||
|
GPS_MESSAGE_STATE_INITIALIZED,
|
||||||
|
GPS_MESSAGE_STATE_AIRBORNE,
|
||||||
GPS_MESSAGE_STATE_ENTRY_COUNT
|
GPS_MESSAGE_STATE_ENTRY_COUNT
|
||||||
} gpsMessageState_e;
|
} gpsMessageState_e;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue