Update lora.cpp

This commit is contained in:
Daniël Koek 2024-02-20 15:45:11 +00:00
parent b43cb981d1
commit 113ed8d48f

View file

@ -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