SNES client error

Hi, I attached an SN30 Pro gamepad to an OFM and followed the instructions ( 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 “”, line 140, in
File “”, line 122, in main
File “”, line 34, in do_autofocus
File “/home/pi/.local/lib/python3.7/site-packages/requests/”, 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 line 32 is
ret = + "/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