diff --git a/Source/gps.c b/Source/gps.c --- a/Source/gps.c +++ b/Source/gps.c @@ -5,6 +5,7 @@ #include "stm32f0xx_hal.h" #include "config.h" +#include "error.h" #include "system/gpio.h" #include "system/uart.h" #include "gps.h" @@ -13,6 +14,7 @@ volatile gps_data_t position; uint8_t gpson = 0; + // Private methods static void gps_ubx_checksum(uint8_t* data, uint8_t len, uint8_t* cka, uint8_t* ckb); static uint8_t _gps_verify_checksum(uint8_t* data, uint8_t len); @@ -24,7 +26,7 @@ void gps_update_data(void) // Error! if(!gpson) { -// led_blink(5); + error_assert(ERR_GPS_OFF); return; } @@ -54,9 +56,10 @@ void gps_update_data(void) volatile HAL_StatusTypeDef res = HAL_UART_Receive(uart_gethandle(), buf, 100, 3000); // Check 60 bytes minus SYNC and CHECKSUM (4 bytes) -// if( !_gps_verify_checksum(&buf[2], 96) ) -// led_blink(2); - + if( !_gps_verify_checksum(&buf[2], 96) ) + { + error_assert(ERR_GPS_CHECKSUM); + } //volatile uint32_t gpstime_ms = (buf[6+0] << 24) | (buf[6+1] << 16) | buf[6+2] << 8) | (buf[6+3]); @@ -179,9 +182,6 @@ void gps_poweron(void) // HAL_Delay(100); // // - - - // Begin DMA reception //HAL_UART_Receive_DMA(uart_gethandle(), nmeaBuffer, NMEABUFFER_SIZE);