-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PSU sensing blocks OctoPrint #84
Comments
You may need to escape characters but I would suggest just putting it in a script file and calling that. |
Sorry if my original issue was unclear. The system command works as-is; the issue is that PSUControl seems to be blocking OctoPrint while waiting for the system command to complete. The command takes a couple of seconds to query the status of the switch and during that time, OctoPrint can't send G-code to the printer. This causes the printer to stop frequently mid-print, creating some nasty print artifacts. Not a Python guy, but I'm guessing that this line is responsible for the issue:
|
|
Scratch that. I read that as switching and not sensing. You are saying that using a script such as:
would hang OctoPrint? |
Yes. Ideally, Maybe include a configurable timeout option to the plugin as well? |
I've committed a fix to a temporary branch. Ended up using poll() and removing anything to do with stdout/stderr as it wasn't doing anything with it anyway. You can install the test branch with the URL (Remove the existing version first): |
OctoPrint-PSUControl/octoprint_psucontrol/__init__.py Lines 343 to 345 in 1f21071
This fix shouldn't work. |
Hmm yeah I mean't to use wait() but it worked in testing. 🤷♂️ Changed in 1df8998 |
Err nope. My head is broken today. Give me a bit. |
Interesting. Even using poll() is blocking even though check_psu_state() is in its own thread. See d3daa18 Edit: |
…solves blocking IO issues. (#84)
Okay I am fairly confident that this latest change should resolve the issue as well as unify how all system commands are executed. Give it a shot and let me know how you make out. PS: |
Confirmed working. Merged into devel with commit 36b1282 |
I've been using PSUControl with ouimeaux to toggle a smart plug connected to my printer. PSUControl works perfectly fine with internal sensing, but system command sensing is completely unusable.
After setting the sensing command to
~/oprint/local/bin/wemo switch "Printer" status | grep -q 1
, OctoPrint blocks while waiting for the command to complete, effectively pausing the printer after every few instructions.The text was updated successfully, but these errors were encountered: