|
|
@ -60,8 +60,17 @@ void setup() { |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// Seed the PRNG
|
|
|
|
// Seed the PRNG for CSMA R-value selection
|
|
|
|
randomSeed(analogRead(0)); |
|
|
|
# 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
|
|
|
|
// Initialise serial communication
|
|
|
|
memset(serialBuffer, 0, sizeof(serialBuffer)); |
|
|
|
memset(serialBuffer, 0, sizeof(serialBuffer)); |
|
|
|