Fixed GPS initialisation

This commit is contained in:
Mark Qvist 2019-11-08 16:36:01 +01:00
parent 07f4b198bc
commit 98d2093485
3 changed files with 28 additions and 15 deletions

View File

@ -43,7 +43,9 @@ void gps_init(Serial *ser) {
if (gps_detect()) {
gps_installed = true;
GPS_DDR |= _BV(GPS_EN_PIN);
if (config_gps_mode == CONFIG_GPS_AUTODETECT || config_gps_mode == CONFIG_GPS_REQUIRED) {
serial_setbaudrate_9600(1);
delay_ms(100);
@ -56,8 +58,12 @@ void gps_init(Serial *ser) {
gps_send_command(PMTK_API_SET_FIX_CTL_1HZ);
gps_send_command(PMTK_SET_NMEA_OUTPUT_RMCGGA);
GPS_DDR |= _BV(GPS_EN_PIN);
if (gps_enabled()) { gps_powerup(); } else { gps_powerdown(); }
gps_power = true;
gps_powerup();
} else {
gps_power = false;
gps_powerdown();
}
} else {
gps_installed = false;

View File

@ -83,6 +83,8 @@ ISR(USART0_RX_vect) {
if (!fifo_isfull(&uart0FIFO)) {
char c = uart0_getchar_nowait();
fifo_push(&uart0FIFO, c);
} else {
uart1_getchar_nowait();
}
}
}
@ -92,6 +94,8 @@ ISR(USART1_RX_vect) {
if (!fifo_isfull(&uart1FIFO)) {
char c = uart1_getchar_nowait();
fifo_push(&uart1FIFO, c);
} else {
uart1_getchar_nowait();
}
}
}

3
main.c
View File

@ -65,6 +65,9 @@ void system_check(void) {
}
}
// TODO: Check GPS_REQUIRED and BLUETOOTH_REQUIRED
// here before giving green light.
// Give the green light if everything checks out
LED_STATUS_ON();
}