mirror of
https://github.com/esphome/esphome.git
synced 2024-12-29 17:01:43 +01:00
Update lora.cpp
This commit is contained in:
parent
b43cb981d1
commit
113ed8d48f
1 changed files with 1 additions and 13 deletions
|
@ -150,23 +150,11 @@ void Lora::loop() {
|
|||
buffer += (char) c;
|
||||
}
|
||||
}
|
||||
ESP_LOGD(TAG, "Got %s", buffer);
|
||||
// set the rssi
|
||||
rssi_ = atoi(buffer.substr(buffer.length() - 1, 1).c_str());
|
||||
// set the raw message
|
||||
raw_message_ = buffer.substr(0, buffer.length() - 1);
|
||||
/*
|
||||
* Starting to process the raw message
|
||||
*/
|
||||
// found gps data in the raw message, lets parse it
|
||||
if (raw_message_.find("gps:") != std::string::npos) {
|
||||
int start = raw_message_.find(',');
|
||||
// minus gps
|
||||
latitude_ = atof(raw_message_.substr(4, start).c_str());
|
||||
latitude_ = atof(raw_message_.substr(start + 1, raw_message_.length()).c_str());
|
||||
ESP_LOGD(TAG, "Location:");
|
||||
ESP_LOGD(TAG, "Lat: %f", this->latitude_);
|
||||
ESP_LOGD(TAG, "Lon: %f", this->longitude_);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace lora
|
||||
|
|
Loading…
Reference in a new issue