Closed prutschman-iv closed 9 months ago
Connecting to the serial port usually resets the device, so the board is reset before the RPC call takes place.
You could test this by leaving the serial connection open between calls, e.g.,
>>> from simple_rpc import Interface
>>> interface = Interface('COM6')
>>> interface.uptime()
1234
>>> interface.uptime()
2345
It was indeed related to the serial connection, thank you! Persisting the connection, as you suggested, prevents the reboots, so I'm good to go. (Although weirdly, it was definitely closing the serial connection that caused the reboot, rather than connecting the serial. I can get the first call to uptime to return an arbitrarily high value by waiting a long time after a reboot before I open the connection, then issuing the first call.)
Hmm, maybe that is an ESP specific thing then.
I've used simpleRPC successfully on an Arduino and a Teensy 4. I'm now trying it on an ESP32 (Adafruit Huzzah32 feather) and running into a crash. Specifically, the board resets after completing any RPC call, including requesting a command list.
Here's a minimal reproduction:
If I reset the board, wait 5 seconds, and then call
simple_rpc call -b 115200 COM6
I get a response like7427
. If I issue the command back-to-back, I get responses like2450
,2427
,2475
indicating a reset has taken place. (Probably flashing an LED on reset would be a more obvious way of indicating the reset, now that I think about it.)Software Versions: simpleRPC 3.2.0 Arduino IDE 2.2.1 esp32 BSP (Espressif's) 2.0.11