-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add support for --no-resize option and --keep-awake functionality #79
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sofiaferro. I was very happy to see catprinter used in your art installation!
@@ -0,0 +1,64 @@ | |||
import asyncio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dummy-print.py
shares a lot of code with print.py
. I would suggest adding a --send-keepalive
to print.py
instead. It will make maintenance easier.
Maybe we can also mention it in the README.md instead of the nodejs application there. Something like "To prevent the printer from sleeping, call print.py --send-keepalive
every x seconds". I think that would be helpful to others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right that dummy-print.py
shares a lot of code with ble.py
. The keep-alive functionality currently requires a parent process to keep the printer awake between prints, which isn't something handled directly by print.py
or ble.py
.
Alternatively, we could move this functionality to ble.py
to avoid duplication, or let dummy-print.py
exist in a fork if it's too specific for the main branch. This way, the main codebase stays clean while supporting this use case. Let me know your thoughts!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about something like adding a --send-keepalive
"dummy switch" to print.py
that only pings the printer with the functionality you already implemented. I think this would be great already.
Then users can choose if/how to periodically run the keepalive loop. For example, some may be happy with a quick and dirty bash loop like:
$ while true; do python3 print.py --send-keep-alive; sleep 30; done
So I think we could get rid of dummy-print.py
and use the same print.py
with an additional if-else send_keepalive
. In your manager, I think it would be enough to change this line to print.py --send-keepalive
here.
I would still link your catprinter-manager in the README because it has nice features for advanced users (queue, better keepalive etc), and we get to keep this one very simple. What do you think?
This pull request introduces two new features to enhance the functionality of the printer script:
--no-resize
option:Usage:
--keep-awake
functionality:Adds a process to prevent the printer from entering sleep mode by sending periodic "keep-alive" commands.
This can be activated via the Node.js server by including the
--keep-awake
argument. Here’s the implementation I worked on: sofiaferro/catprinter-manager.Usage:
Both changes include the necessary updates to the CLI and documentation. These features improve flexibility and address edge cases for printing workflows.