Problem
The GPS detection in EnvironmentSensorManager::initBasicGPS() uses a hardcoded 1-second delay before checking Serial1.available():
_location->begin();
_location->reset(); // 10ms reset pulse
delay(1000); // only 1 second
#ifdef ENV_SKIP_GPS_DETECT
gps_detected = true;
#else
gps_detected = (Serial1.available() > 0);
#endif
Cold-starting GPS modules often need 2-5 seconds before they begin outputting NMEA sentences. When detection fails, gps_detected is set to false, which hides all GPS CLI commands and prevents GPS time sync entirely.
Current workaround
The ENV_SKIP_GPS_DETECT=1 and PERSISTANT_GPS=1 build flags bypass detection and force GPS active. But only 3 out of ~20+ GPS-equipped variants have these flags in their repeater builds:
Plus Station G2 (PR #2255). All other GPS-equipped repeater variants (Heltec V4, Heltec Tracker/V2, T096, T114, TBeam SX1262, TBeam Supreme, TDeck, T-Echo, SenseCap Solar, ProMicro, Nano G2 Ultra, ThinkNode M3/M6, GAT562 variants, etc.) are susceptible to GPS detection failure on cold start.
Suggested fix
Instead of adding ENV_SKIP_GPS_DETECT to every variant, fix the detection itself. For example, a short retry loop:
_location->begin();
_location->reset();
#ifdef ENV_SKIP_GPS_DETECT
gps_detected = true;
#else
gps_detected = false;
for (int i = 0; i < 5 && !gps_detected; i++) {
delay(1000);
gps_detected = (Serial1.available() > 0);
}
#endif
This gives GPS modules up to 5 seconds to start sending NMEA data, returning early as soon as data is detected (no wasted boot time for fast modules). The reset pulse (currently 10ms) could also be extended to 50-100ms for broader module compatibility.
An even more robust approach would be to not permanently disable GPS on detection failure — allow users to manually enable it via settings even if auto-detection missed it.
Related
Problem
The GPS detection in
EnvironmentSensorManager::initBasicGPS()uses a hardcoded 1-second delay before checkingSerial1.available():Cold-starting GPS modules often need 2-5 seconds before they begin outputting NMEA sentences. When detection fails,
gps_detectedis set tofalse, which hides all GPS CLI commands and prevents GPS time sync entirely.Current workaround
The
ENV_SKIP_GPS_DETECT=1andPERSISTANT_GPS=1build flags bypass detection and force GPS active. But only 3 out of ~20+ GPS-equipped variants have these flags in their repeater builds:Plus Station G2 (PR #2255). All other GPS-equipped repeater variants (Heltec V4, Heltec Tracker/V2, T096, T114, TBeam SX1262, TBeam Supreme, TDeck, T-Echo, SenseCap Solar, ProMicro, Nano G2 Ultra, ThinkNode M3/M6, GAT562 variants, etc.) are susceptible to GPS detection failure on cold start.
Suggested fix
Instead of adding
ENV_SKIP_GPS_DETECTto every variant, fix the detection itself. For example, a short retry loop:This gives GPS modules up to 5 seconds to start sending NMEA data, returning early as soon as data is detected (no wasted boot time for fast modules). The reset pulse (currently 10ms) could also be extended to 50-100ms for broader module compatibility.
An even more robust approach would be to not permanently disable GPS on detection failure — allow users to manually enable it via settings even if auto-detection missed it.
Related