Skip to content

Commit 77ea16d

Browse files
committed
NTPUtils use hardware random number generator for ESP boards
1 parent 3c06977 commit 77ea16d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/utility/time/NTPUtils.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,11 @@ void NTPUtils::sendNTPpacket(UDP & udp)
9292

9393
int NTPUtils::getRandomPort(int const min_port, int const max_port)
9494
{
95-
#ifdef BOARD_HAS_ECCX08
95+
#if defined (BOARD_HAS_ECCX08)
9696
return ECCX08.random(min_port, max_port);
97+
#elif defined (ARDUINO_ARCH_ESP8266) || (ARDUINO_ARCH_ESP32)
98+
/* Uses HW Random Number Generator */
99+
return random(min_port, max_port);
97100
#else
98101
randomSeed(analogRead(0));
99102
return random(min_port, max_port);

0 commit comments

Comments
 (0)