skaarj1989 / mWebSockets

WebSockets for microcontrollers
https://skaarj1989.github.io/mWebSockets/autobahn-testsuite/servers/
MIT License
108 stars 23 forks source link

randomSeed calls always start at 0 on esp32 #73

Closed henkelis closed 6 months ago

henkelis commented 6 months ago

Describe the bug On a Feather esp32s3, calling analogRead(0) results in an error and returns zero. That call is used for random seeds in the code.

Environment info

Expected behavior A valid random value is required.

Failure log

[esp32-hal-adc.c:158] __analogReadRaw(): Pin 0 is not ADC pin!

Additional context

skaarj1989 commented 6 months ago

Thank you for reporting the issue.

You can work around this problem by heading into: https://github.com/skaarj1989/mWebSockets/blob/a4458add6b2e157581c298901a9f9a9a26f3090e/src/WebSocket.cpp#L47 and replacing 0 with a correct ADC pin.

I don't have a Feather esp32s3 board to test this. Could you check something like A0...A5?

henkelis commented 6 months ago

Thanks. I can confirm that using A0 works. I changed the same setting in WebSocketClient.cpp too.