diff --git a/src/gps.c b/src/gps.c --- a/src/gps.c +++ b/src/gps.c @@ -63,6 +63,7 @@ void gps_update_position() uint8_t request[8] = {0xB5, 0x62, 0x01, 0x02, 0x00, 0x00, 0x03, 0x0A}; //_gps_send_msg(request, 8); + uint8_t flushed = uart_gethandle()->Instance->RDR; HAL_UART_Transmit(uart_gethandle(), request, 8, 100); uint8_t buf[36]; @@ -89,7 +90,8 @@ void gps_update_position() position.altitude = (int32_t)buf[22] | (int32_t)buf[23] << 8 | (int32_t)buf[24] << 16 | (int32_t)buf[25] << 24; - //if( !_gps_verify_checksum(&buf[2], 32) ) led_set(LED_RED, 1); + if( !_gps_verify_checksum(&buf[2], 32) ) + led_blink(2); } @@ -98,6 +100,7 @@ void gps_update_time(uint8_t* hour, uint // Send a NAV-TIMEUTC message to the receiver uint8_t request[8] = {0xB5, 0x62, 0x01, 0x21, 0x00, 0x00, 0x22, 0x67}; + uint8_t flushed = uart_gethandle()->Instance->RDR; HAL_UART_Transmit(uart_gethandle(), request, 8, 100); // Get the message back from the GPS @@ -126,6 +129,7 @@ void gps_check_lock(uint8_t* lock, uint8 // Construct the request to the GPS uint8_t request[8] = {0xB5, 0x62, 0x01, 0x06, 0x00, 0x00, 0x07, 0x16}; + uint8_t flushed = uart_gethandle()->Instance->RDR; HAL_UART_Transmit(uart_gethandle(), request, 8, 100); // Get the message back from the GPS @@ -158,6 +162,7 @@ uint8_t gps_check_nav(void) { uint8_t request[8] = {0xB5, 0x62, 0x06, 0x24, 0x00, 0x00, 0x2A, 0x84}; + uint8_t flushed = uart_gethandle()->Instance->RDR; HAL_UART_Transmit(uart_gethandle(), request, 8, 100); // Get the message back from the GPS