fix : GNRMC format parse failed.
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
[中文版本使用说明](<https://github.com/Livox-SDK/Livox-SDK/blob/master/README_CN.md>)
|
|
||||||
# 1 Introduction
|
# 1 Introduction
|
||||||
|
|
||||||
Livox SDK is the software development kit designed for all Livox products. It is developed based on C/C++ following Livox SDK Communication Protocol, and provides easy-to-use C style API. With Livox SDK, users can quickly connect to Livox products and receive point cloud data.
|
Livox SDK is the software development kit designed for all Livox products. It is developed based on C/C++ following Livox SDK Communication Protocol, and provides easy-to-use C style API. With Livox SDK, users can quickly connect to Livox products and receive point cloud data.
|
||||||
|
|||||||
@@ -162,12 +162,22 @@ bool ParseRmcTime(const char* rmc, uint16_t rmc_len, LidarSetUtcSyncTimeRequest*
|
|||||||
|
|
||||||
memset(utc_time_req, 0, sizeof(LidarSetUtcSyncTimeRequest));
|
memset(utc_time_req, 0, sizeof(LidarSetUtcSyncTimeRequest));
|
||||||
|
|
||||||
if (4 != sscanf(rmc_begin,
|
int num = sscanf(rmc_begin,
|
||||||
"$G%*[NP]RMC,%[^,],%*C,%*f,%*C,%*f,%*C,%*f,%*f,%2hhu%2hhu%[^,],%*f,",
|
"$G%*[NP]RMC,%[^,],%*C,%*f,%*C,%*f,%*C,%*f,%*f,%2hhu%2hhu%[^,],%*f,",
|
||||||
&utc_hms_buff[0],
|
&utc_hms_buff[0],
|
||||||
&(utc_time_req->day),
|
&(utc_time_req->day),
|
||||||
&(utc_time_req->month),
|
&(utc_time_req->month),
|
||||||
&utc_yy_buff[0])) {
|
&utc_yy_buff[0]);
|
||||||
|
if (num != 4) {
|
||||||
|
num = sscanf(rmc_begin,
|
||||||
|
"$G%*[NP]RMC,%[^,],%*C,%*f,%*C,%*f,%*C,%*f,,%2hhu%2hhu%[^,],%*f,",
|
||||||
|
&utc_hms_buff[0],
|
||||||
|
&(utc_time_req->day),
|
||||||
|
&(utc_time_req->month),
|
||||||
|
&utc_yy_buff[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num != 4) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user