generated from Template/H563ZI-HAL-CMake-Template
gps parse successful
This commit is contained in:
21
fun/gps.c
21
fun/gps.c
@@ -167,16 +167,25 @@ static uint16_t line_w = 0;
|
||||
|
||||
void GPS_LinePush(uint8_t ch)
|
||||
{
|
||||
if (ch == '\n') { /* һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
if (ch == '\n') { /* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><EFBFBD><EFBFBD> */
|
||||
line_buf[line_w] = '\0';
|
||||
strncpy(GPS.GPS_Buffer, line_buf, GPS_Buffer_Length);
|
||||
|
||||
|
||||
/* A. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '$' <20><>ͷ<EFBFBD><CDB7>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD> <20><> ֱ<><D6B1>ƴ<EFBFBD><C6B4> */
|
||||
if (line_buf[0] != '$' && GPS.isGetData == 0 && GPS.GPS_Buffer[0] == '$')
|
||||
{
|
||||
strncat(GPS.GPS_Buffer, line_buf, GPS_Buffer_Length - strlen(GPS.GPS_Buffer) - 1);
|
||||
}
|
||||
else /* B. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¾<EFBFBD> */
|
||||
{
|
||||
strncpy(GPS.GPS_Buffer, line_buf, GPS_Buffer_Length);
|
||||
}
|
||||
|
||||
line_w = 0;
|
||||
GPS.isGetData = 1;
|
||||
tx_event_flags_set(&system_events, EVENT_GPS_DATA_READY, TX_OR);
|
||||
return;
|
||||
}
|
||||
if (line_w < GPS_Buffer_Length - 1)
|
||||
line_buf[line_w++] = ch; /* <20><>ͨ<EFBFBD>ַ<EFBFBD> */
|
||||
}
|
||||
|
||||
/* === <20><> <20>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻҪ<D6BB><D2AA>γ<EFBFBD><CEB3> === */
|
||||
@@ -331,8 +340,8 @@ void gps_thread_entry(ULONG thread_input)
|
||||
tx_event_flags_get(&system_events, EVENT_GPS_DATA_READY, TX_OR_CLEAR, &events, TX_WAIT_FOREVER);
|
||||
|
||||
parseGpsBuffer();
|
||||
HCBle_SendData("[GPS] isGetData=%d, isParseData=%d, isUsefull=%d, Buffer=%s\r\n",
|
||||
GPS.isGetData, GPS.isParseData, GPS.isUsefull, GPS.GPS_Buffer);
|
||||
// HCBle_SendData("[GPS] isGetData=%d, isParseData=%d, isUsefull=%d, Buffer=%s\r\n",
|
||||
// GPS.isGetData, GPS.isParseData, GPS.isUsefull, GPS.GPS_Buffer);
|
||||
if (GPS.isParseData && GPS.isUsefull)
|
||||
{
|
||||
current_location.lat = Convert_to_degrees(GPS.latitude);
|
||||
|
||||
Reference in New Issue
Block a user