diff --git a/lorawan.cpp b/lorawan.cpp index 9765c5f729f53070b6061328e64441f8acc93b19..2e6c4078fe24e89b96a2bf0e875430e7f12baa46 100644 --- a/lorawan.cpp +++ b/lorawan.cpp @@ -184,7 +184,7 @@ namespace lorawan { void preparePayloadIfTimeHasCome(const int16_t &co2, const float &temperature, const float &humidity) { static unsigned long last_sent_at = 0; 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; preparePayload(co2, temperature, humidity); }