Add support for --no-resize option and --keep-awake functionality#79
Add support for --no-resize option and --keep-awake functionality#79sofiaferro wants to merge 7 commits intorbaron:mainfrom
Conversation
rbaron
left a comment
There was a problem hiding this comment.
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.
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.
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.
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; doneSo 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-resizeoption:Usage:
--keep-awakefunctionality: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-awakeargument. 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.