From 7eff5e7bcb2084499b723c5e3846c15ee089e36d Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Wed, 20 Sep 2023 19:34:45 -0500 Subject: [PATCH] Fix for Pi Pico hang (#2817) * Fix for Pi Pico hang * Pi Pico fix part 2: Electric Boogaloo --- src/gps/GPS.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 43869a72e..519da24e6 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -252,7 +252,7 @@ bool GPS::setup() { int msglen = 0; - if (_serial_gps && !didSerialInit) { + if (!didSerialInit) { #if !defined(GPS_UC6580) if (tx_gpio) { LOG_DEBUG("Probing for GPS at %d \n", serialSpeeds[speedSelect]); @@ -548,6 +548,8 @@ void GPS::publishUpdate() int32_t GPS::runOnce() { if (!GPSInitFinished) { + if (!_serial_gps) + return disable(); if (!setup()) return 2000; // Setup failed, re-run in two seconds @@ -850,7 +852,7 @@ GPS *GPS::createGps() if (!_tx_gpio) _tx_gpio = GPS_TX_PIN; #endif - if (!_rx_gpio) // Configured to have no GPS at all + if (!_rx_gpio || !_serial_gps) // Configured to have no GPS at all return nullptr; GPS *new_gps = new GPS;