I am using an arudcam raspi motorized focus camera. I would really like to set the focus from the octoprint UI. Is there a way to do this with a plugin?
The focus is a trivial I2C interface where you send a value from 0 to 4095 in the first two data bytes to the camera at I2C address 0x0C. Right now I am setting it from a bash script that just runs ...
You would use that to define your bash script commands as gcode and then this one to add buttons to the UI if you don't want to use the terminal tab to send the command.
That is awesome. I wish I had know about custom controls before. I guess I should ratfm (read all the freaking manuals). I was happy to see I could even easily add a slider control. This would be great for focusing.
But, to add a slider I need a way to send a param with my system (bash) command. I don't see how I can do this with the GCODE Systems Commands plugin. Is there a way I can send a system command without that plugin? Or should I just ratfm.
If I'm not mistaken I think custom controls can be system commands, but would have to look at the docs again. BTW, the custom control plugin is just a front end to set those in config.yaml.
Passing arguments was intentionally left out for security reasons. That PR does seem to implement the support for arguments but it's not something I want to merge in its current state. I was actually looking at it a little today to brainstorm a way to sanitize arguments. Have some ideas but nothing concrete yet.
There are configurations out there that are multi-user where not everyone is an admin. Blindly passing arguments allows someone to easily execute whatever shellcode they want. Could it just be a tick box on the settings? Sure, but that's not really how I like to implement things.
Just made me think of a fairly simple solution though. I could pass the line as an environment variable which would then put the role of checks on the user. The downside is that users that would possibly need to make use of simple built in executable commands would need a wrapper. Not too bad though really.
Not quite sure what you mean. Plugins are mostly python, or at least require some python to at least install load the web/javascrpt stuff within the OctoPrint framework. Doing a quick search there appears to be some pretty easy interfacing for I2C interfaces from python using smbus module. If that truly is the case then adding buttons on the web interface to run commands on the python back-end is fairly trivial.
You probably know by now that there is a plug in for the motorized focus camera..
I tried to use it and all I get is an error - Unable to use SMBUS/i2c
I have a raspberry pi4 with Raspian buster firmware
connected to my WIFI and desktop computer to Octoprint... (desktop enviorment is not needed )
I also installed the Python Dependency Libraries..
Support at Arducam thinks that Octoprint might be using i2c for something else...
Anyway, can you tell me how to use your script..
i2cset -y 0 0x0c 0x01 0x00 # set focus to 100
I tried to enter it directly as is into my pi terminal - NG- bad command
I tried to enter it with a bash, sudo, ssh, in front... bad command
All I need is to adjust the focus for my Timelapse / Octolapse works fine but out of focus
Any help would sure go a long way.... Thank you......... LouRBK from CT.
adding the lines on the bottom of config.txt worked !!
the error "unable to use i2c " disappeared and the arrow keys increment the setting...
the only other mystery to me is I tried to paste the other commands
into pi and got -bash /boot/config.txt permission denied... don't know why...
Thanks.... LouRBK from CT.
Hi Moof, thanks for this plugin, I want to give you some feedback about it. So first when I try to edit the boot.txt file using your script I get a permission denied so I had to su as root. Then after I enabled i2c with raspi-config, I rebooted but the arrows to control the focus are still greyed out. My camera is a 8MP IMX21. I tried to test the focus using its python examples from here and everything works fine so at least I know that the focus actually works. BTW, with a i2cdetect command my camera is active on bus 0. I'm running Octoprin 1.4.2. Any advice? thanks again!