Commit 97ed7877 authored by Eric Duminil's avatar Eric Duminil
Browse files

LoRa: Dont try to send until connected

parent b511a1ab
...@@ -184,7 +184,7 @@ namespace lorawan { ...@@ -184,7 +184,7 @@ namespace lorawan {
void preparePayloadIfTimeHasCome(const int16_t &co2, const float &temperature, const float &humidity) { void preparePayloadIfTimeHasCome(const int16_t &co2, const float &temperature, const float &humidity) {
static unsigned long last_sent_at = 0; static unsigned long last_sent_at = 0;
unsigned long now = seconds(); unsigned long now = seconds();
if (now - last_sent_at > config::lorawan_sending_interval) { if (connected && (now > last_sent_at + config::lorawan_sending_interval)) {
last_sent_at = now; last_sent_at = now;
preparePayload(co2, temperature, humidity); preparePayload(co2, temperature, humidity);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment