Skip to content

Commit 99731e9

Browse files
committed
Replace global bool variable with preprocessor directives
1 parent c835977 commit 99731e9

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/utility/time/NTPUtils.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
#include <Arduino.h>
2828
#ifdef BOARD_HAS_ECCX08
2929
#include <ArduinoECCX08.h>
30-
bool has_crypto = 1;
31-
#else
32-
bool has_crypto = 0;
3330
#endif
3431

3532
/**************************************************************************************
@@ -91,13 +88,14 @@ void NTPUtils::sendNTPpacket(UDP & udp)
9188
udp.endPacket();
9289
}
9390

94-
int NTPUtils::setRandomPort(int minValue, int maxValue) {
95-
if (has_crypto) {
96-
return ECCX08.random(minValue, maxValue);
97-
} else {
98-
randomSeed(analogRead(0));
99-
return random(minValue, maxValue);
100-
}
91+
int NTPUtils::setRandomPort(int minValue, int maxValue)
92+
{
93+
#ifdef BOARD_HAS_ECCX08
94+
return ECCX08.random(minValue, maxValue);
95+
#else
96+
randomSeed(analogRead(0));
97+
return random(minValue, maxValue);
98+
#endif
10199
}
102100

103101
#endif /* #ifndef HAS_LORA */

0 commit comments

Comments
 (0)