mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 09:18:00 +01:00
fix empty gnss
This commit is contained in:
parent
bc7eb17c0b
commit
f2263e62bf
1 changed files with 3 additions and 3 deletions
|
@ -64,15 +64,15 @@ std::map<std::string, std::string> get_gnssinfo_tokens(const std::string &gnss_i
|
||||||
// for 7600 (16 tokens):
|
// for 7600 (16 tokens):
|
||||||
// +CGNSSINFO: 2,04,03,00,4836.989133,N,00433.611595,W,060824,102247.0,-13.8,0.0,70.4,1.7,1.4,1.0
|
// +CGNSSINFO: 2,04,03,00,4836.989133,N,00433.611595,W,060824,102247.0,-13.8,0.0,70.4,1.7,1.4,1.0
|
||||||
|
|
||||||
std::string data = gnss_info.substr(12);
|
|
||||||
|
|
||||||
std::map<std::string, std::string> gnss_data;
|
std::map<std::string, std::string> gnss_data;
|
||||||
|
|
||||||
if (data.find(",,,,,,") != std::string::npos) {
|
if (gnss_info.find(",,,,,,") != std::string::npos) {
|
||||||
ESP_LOGW(TAG, "No GNSS location available");
|
ESP_LOGW(TAG, "No GNSS location available");
|
||||||
return gnss_data; // empty
|
return gnss_data; // empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string data = gnss_info.substr(12);
|
||||||
|
|
||||||
std::vector<std::string> parts;
|
std::vector<std::string> parts;
|
||||||
char delimiter = ',';
|
char delimiter = ',';
|
||||||
std::istringstream token_stream(data);
|
std::istringstream token_stream(data);
|
||||||
|
|
Loading…
Reference in a new issue