Skip to content

Commit 60bca42

Browse files
NicolasdejeanFokkeZB
authored andcommitted
fixed trackairtime (fixes #112)
1 parent aa1e0ed commit 60bca42

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/TheThingsNetwork.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,14 @@ int TheThingsNetwork::sendBytes(const byte* payload, size_t length, port_t port,
197197
String response = readLine();
198198
float i = this->airtime;
199199
trackAirtime(length);
200-
debugPrint(F("Airtime added: "));
201-
debugPrint(this->airtime - i);
202-
debugPrintLn(F(" s"));
203-
debugPrint(F("Total airtime: "));
204-
debugPrint(this->airtime);
205-
debugPrintLn(F(" s"));
200+
if (!isnan(i) && !isinf(i) && !isnan(this->airtime) && !isinf(this->airtime)) {
201+
debugPrint(F("Airtime added: "));
202+
debugPrint(this->airtime - i);
203+
debugPrintLn(F(" s"));
204+
debugPrint(F("Total airtime: "));
205+
debugPrint(this->airtime);
206+
debugPrintLn(F(" s"));
207+
}
206208
if (response == F("mac_tx_ok")) {
207209
debugPrintLn(F("Successful transmission"));
208210
return 1;

0 commit comments

Comments
 (0)