Hi, I attached an SN30 Pro gamepad to an OFM and followed the instructions (https://bityl.co/Eulh) to install the SNES client. All the controls are working except the autofocus button (see the error message attached). Any suggestions to fix the problem?
Running autofocus
Traceback (most recent call last):
File “main.py”, line 140, in
main()
File “main.py”, line 122, in main
do_autofocus()
File “main.py”, line 34, in do_autofocus
ret.raise_for_status()
File “/home/pi/.local/lib/python3.7/site-packages/requests/models.py”, line 851, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: UNPROCESSABLE ENTITY
I don’t know, but that sounds as though the autofocus request being sent is different from the requests expected by the current server.
in the SNES client main.py
line 32 is
ret = requests.post(BASE_URI + "/extensions/org.openflexure.autofocus/fast_autofocus", json={'dz':1000, 'backlash':250})
Comparing this with the autofocus request in the Blockly extension, which is more recent, the 'backlash'
is not present in the Blockly version. I would try whether changing to json={'dz':1000})
makes a difference.
I also think that the autofocus scan range is now usually set at 2000 in the web app and other modules rather than 1000, to make it more likely to find the best focus, at the expense of being slightly slower.
It works now by removing: ‘backlash’:250. Thank you very much for your help.
I found the gamepad very useful especially when the objective is far from best focus.
1 Like
Great that that works. If you are on Gitlab, could you put in an issue
under the SNES client so that we remember.
To complete the thread, this issue should now be resolved in today’s update to the main repository for SNES client OpenFlexure / openflexure-microscope-snesclient · GitLab. Thank you @JohemianKnapsody and @r.w.bowman