sparks-baird / self-driving-lab-demo

Software and instructions for setting up and running a self-driving lab (autonomous experimentation) demo using dimmable RGB LEDs, an 8-channel spectrophotometer, a microcontroller, and an adaptive design algorithm, as well as extensions to liquid- and solid-based color matching demos.
https://self-driving-lab-demo.readthedocs.io/
MIT License
72 stars 8 forks source link

use of reset() increases robustness but obscures debugging #161

Open sgbaird opened 1 year ago

sgbaird commented 1 year ago

Mainly because it renders the following after any error in the try block is raised:

PROBLEM IN THONNY'S BACK-END: Exception while handling 'Run' (ConnectionError: EOF).
You may need to press "Stop/Restart" or hard-reset your MicroPython device and try again.

See Thonny's backend.log for more info.

Process ended with exit code 1.

Commenting reset() while debugging is one option: https://github.com/sparks-baird/self-driving-lab-demo/blob/bbf2b109edbc3d0eb27d73a04883324b057fb0af/src/public_mqtt_sdl_demo/main.py#L288

There could also be a debug flag that gets set at the beginning, where if it's True, then it doesn't run the reset line. Similarly, there could be a num_hard_reset_tries variable or similar.

sgbaird commented 1 year ago

Maybe doing a soft reset via sys.exit() before doing reset() would make sense here.