mirror of
https://github.com/liberatedsystems/RNode_Firmware_CE.git
synced 2024-07-02 14:34:13 +02:00
Use hardware RNG for CSMA r-value seed on ESP32
This commit is contained in:
parent
854b345e3d
commit
e63b5b6cdb
@ -60,8 +60,17 @@ void setup() {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Seed the PRNG
|
||||
randomSeed(analogRead(0));
|
||||
// Seed the PRNG for CSMA R-value selection
|
||||
# if MCU_VARIANT == MCU_ESP32
|
||||
// On ESP32, get the seed value from the
|
||||
// hardware RNG
|
||||
int seed_val = (int)esp_random();
|
||||
#else
|
||||
// Otherwise, get a pseudo-random seed
|
||||
// value from an unconnected analog pin
|
||||
int seed_val = analogRead(0);
|
||||
#endif
|
||||
randomSeed(seed_val);
|
||||
|
||||
// Initialise serial communication
|
||||
memset(serialBuffer, 0, sizeof(serialBuffer));
|
||||
|
Loading…
Reference in New Issue
Block a user