Skip to content

Commit 87b23a4

Browse files
committed
fix #907 use corect random source for newer ESP32 models
1 parent bd011d8 commit 87b23a4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/WebSocketsServer.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
#include "WebSockets.h"
2626
#include "WebSocketsServer.h"
2727

28+
#ifdef ESP32
29+
#if defined __has_include
30+
#if __has_include("soc/wdev_reg.h")
31+
#include "soc/wdev_reg.h"
32+
#endif // __has_include
33+
#endif // defined __has_include
34+
#endif
35+
2836
WebSocketsServerCore::WebSocketsServerCore(const String & origin, const String & protocol) {
2937
_origin = origin;
3038
_protocol = protocol;
@@ -87,6 +95,8 @@ void WebSocketsServerCore::begin(void) {
8795

8896
#ifdef ESP8266
8997
randomSeed(RANDOM_REG32);
98+
#elif defined(ESP32) && defined(WDEV_RND_REG)
99+
randomSeed(REG_READ(WDEV_RND_REG));
90100
#elif defined(ESP32)
91101
#define DR_REG_RNG_BASE 0x3ff75144
92102
randomSeed(READ_PERI_REG(DR_REG_RNG_BASE));

0 commit comments

Comments
 (0)