GPS init sequence fix

This commit is contained in:
Mark Qvist 2020-10-22 15:59:10 +02:00
parent b075bdd5a1
commit 6c9e0f1fb4
3 changed files with 6 additions and 3 deletions

View File

@ -8,7 +8,7 @@
#include <stdio.h>
#include "device.h"
#include "util/time.h"
#include "hardware/serial.h"
#include "hardware/Serial.h"
void bluetooth_init(void);
bool bluetooth_enabled(void);

View File

@ -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;

View File

@ -8,7 +8,7 @@
#include <stdio.h>
#include "device.h"
#include "util/time.h"
#include "hardware/serial.h"
#include "hardware/Serial.h"
#define NMEA_MAX_LENGTH 128