From 6c9e0f1fb4f9199d833c369934dd1fc84af4341d Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 22 Oct 2020 15:59:10 +0200 Subject: [PATCH] GPS init sequence fix --- hardware/Bluetooth.h | 2 +- hardware/GPS.c | 5 ++++- hardware/GPS.h | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hardware/Bluetooth.h b/hardware/Bluetooth.h index 05841e2..a84c467 100644 --- a/hardware/Bluetooth.h +++ b/hardware/Bluetooth.h @@ -8,7 +8,7 @@ #include #include "device.h" #include "util/time.h" -#include "hardware/serial.h" +#include "hardware/Serial.h" void bluetooth_init(void); bool bluetooth_enabled(void); diff --git a/hardware/GPS.c b/hardware/GPS.c index 49f7d51..e85953c 100644 --- a/hardware/GPS.c +++ b/hardware/GPS.c @@ -39,6 +39,7 @@ void gps_init(Serial *ser) { gps_speed_kmh = 0; gps_bearing = 0; + gps_fix = false; gps_time_set = false; if (gps_detect()) { @@ -46,6 +47,8 @@ void gps_init(Serial *ser) { GPS_DDR |= _BV(GPS_EN_PIN); if (config_gps_mode == CONFIG_GPS_AUTODETECT || config_gps_mode == CONFIG_GPS_REQUIRED) { + gps_powerup(); + serial_setbaudrate_9600(1); delay_ms(100); @@ -59,7 +62,6 @@ void gps_init(Serial *ser) { gps_send_command(PMTK_SET_NMEA_OUTPUT_RMCGGA); gps_power = true; - gps_powerup(); } else { gps_power = false; gps_powerdown(); @@ -71,6 +73,7 @@ void gps_init(Serial *ser) { } } + void gps_update_rtc(void) { struct tm now; diff --git a/hardware/GPS.h b/hardware/GPS.h index 831d760..6886c93 100644 --- a/hardware/GPS.h +++ b/hardware/GPS.h @@ -8,7 +8,7 @@ #include #include "device.h" #include "util/time.h" -#include "hardware/serial.h" +#include "hardware/Serial.h" #define NMEA_MAX_LENGTH 128