Added flight mode build flag

This commit is contained in:
Benjamin Faershtein 2025-04-21 22:24:53 -07:00
parent f6ed10f329
commit b5ef680d78
4 changed files with 55 additions and 0 deletions

View File

@ -545,6 +545,12 @@ bool GPS::setup()
} else if (gnssModel == GNSS_MODEL_ATGM336H) {
// Set the intial configuration of the device - these _should_ work for most AT6558 devices
msglen = makeCASPacket(0x06, 0x07, sizeof(_message_CAS_CFG_NAVX_CONF), _message_CAS_CFG_NAVX_CONF);
#ifdef USERPREFS_GPS_FLIGHT_MODE
if (USERPREFS_GPS_FLIGHT_MODE) {
msglen = makeCASPacket(0x06, 0x07, sizeof(_message_CAS_CFG_NAVX_CONF_FLIGHT), _message_CAS_CFG_NAVX_CONF_FLIGHT);
}
#endif
_serial_gps->write(UBXscratch, msglen);
if (getACKCas(0x06, 0x07, 250) != GNSS_RESPONSE_OK) {
LOG_WARN("ATGM336H: Could not set Config");
@ -670,6 +676,11 @@ bool GPS::setup()
}
// Turn off unwanted NMEA messages, set update rate
SEND_UBX_PACKET(0x06, 0x08, _message_1HZ, "set GPS update rate", 500);
#ifdef USERPREFS_GPS_FLIGHT_MODE
if (USERPREFS_GPS_FLIGHT_MODE) {
SEND_UBX_PACKET(0x06, 0x24, _message_NAV5_FLIGHT, "enable flight mode", 500);
}
#endif
SEND_UBX_PACKET(0x06, 0x01, _message_GLL, "disable NMEA GLL", 500);
SEND_UBX_PACKET(0x06, 0x01, _message_GSA, "enable NMEA GSA", 500);
SEND_UBX_PACKET(0x06, 0x01, _message_GSV, "disable NMEA GSV", 500);

View File

@ -61,3 +61,26 @@ static const uint8_t _message_CAS_CFG_NAVX_CONF[] = {
0x00, 0x00, 0x00, 0x00, // Time Accuracy Max
0x00, 0x00, 0x00, 0x00 // Static Hold Threshold
};
static const uint8_t _message_CAS_CFG_NAVX_CONF_FLIGHT[] = {
0x03, 0x01, 0x00, 0x00, // Update Mask: Dynamic Mode, Fix Mode, Nav Settings
0x06, // Dynamic Mode: flight <2g
0x03, // Fix Mode: Auto 2D/3D
0x00, // Min SV
0x00, // Max SVs
0x00, // Min CNO
0x00, // Reserved1
0x00, // Init 3D fix
0x00, // Min Elevation
0x00, // Dr Limit
0x07, // Nav System: 2^0 = GPS, 2^1 = BDS 2^2 = GLONASS: 2^3
// 3=GPS+BDS, 7=GPS+BDS+GLONASS
0x00, 0x00, // Rollover Week
0x00, 0x00, 0x00, 0x00, // Fix Altitude
0x00, 0x00, 0x00, 0x00, // Fix Height Error
0x00, 0x00, 0x00, 0x00, // PDOP Maximum
0x00, 0x00, 0x00, 0x00, // TDOP Maximum
0x00, 0x00, 0x00, 0x00, // Position Accuracy Max
0x00, 0x00, 0x00, 0x00, // Time Accuracy Max
0x00, 0x00, 0x00, 0x00 // Static Hold Threshold
};

View File

@ -194,6 +194,26 @@ static const uint8_t _message_NAVX5_8[] = {
0x00 // useAdr
};
// Flight mode
static const uint8_t _message_NAV5_FLIGHT[] PROGMEM = {
0xFF, 0xFF, // mask
0x06, // dynModel
0x02, // fixMode
0x00, 0x00, 0x00, 0x00, // fixedAlt
0x00, 0x00, 0x00, 0x00, // fixedAltVar
0x05, // minElev
0x00, // drLimit
0xFA, 0x00, // pDop
0xFA, 0x00, // tDop
0x64, 0x00, // pAcc
0x2C, 0x01, // tAcc
0x00, // staticHoldThresh
0x00, // dgpsTimeOut
0x00, 0x00, 0x00, 0x00, // reserved2
0x00, 0x00, 0x00, 0x00, // reserved3
0x00, 0x00, 0x00, 0x00 // reserved4
};
// Set GPS update rate to 1Hz
// Lowering the update rate helps to save power.
// Additionally, for some new modules like the M9/M10, an update rate lower than 5Hz

View File

@ -29,6 +29,7 @@
// "USERPREFS_FIXED_GPS_LON": "2.294508368",
// "USERPREFS_CONFIG_SMART_POSITION_ENABLED": "false",
// "USERPREFS_CONFIG_GPS_UPDATE_INTERVAL": "600",
// "USERPREFS_GPS_FLIGHT_MODE": "true",
// "USERPREFS_CONFIG_POSITION_BROADCAST_INTERVAL": "1800",
// "USERPREFS_LORACONFIG_CHANNEL_NUM": "31",
// "USERPREFS_LORACONFIG_MODEM_PRESET": "meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST",