GergelyTuri / tFC-rig

trace fear conditioning rig
GNU General Public License v3.0
0 stars 0 forks source link

resetting arduinos before sessions #26

Closed GergelyTuri closed 1 month ago

GergelyTuri commented 9 months ago

Let's reset the arduino every time before the session starts to make sure everything is in a good state. See this which does not seem to work. I think I don't get the logic. It resets the Arduino but then it does not run the setup function again. I also tried an implementation based on watchdog timer but that did not work either. It resets the Arduino but then it does not run the setup function again. Maybe using the reset pin would work.

cpaynerogers commented 6 months ago

Some context from Slack:

Actually, I just read a bit about it. Doing a software reset requires:

So if we send the signal when we for example start the session ... the board will reset and we will have to press the session start again. And then the board will reset and we are stuck. What do you think instead about this logic:

  1. The board, when reset, starts waiting for a session start button press
  2. We also start a timer when the board starts
  3. If that timer counts above a certain amount of millis like 5min, we trigger a board reset

This way if the boards are sitting running with no session, they periodically get refreshed. But if we want to ensure they are refreshed right before a session we should instruct the researcher to press the reset button on all board.

Separately, after a session is over, do you recommend a similar situation, where we start a session ended timer, and after 5min we reset the board?

This was implemented here: https://github.com/GergelyTuri/tFC-rig/pull/17. Assigning this issue to @GergelyTuri to see if:

GergelyTuri commented 6 months ago

I like the periodic reset option. let's implement that.