Skip to content
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

[Request] Start Print / Cancel Print toggle mode #149

Closed
CapnBry opened this issue Jun 15, 2018 · 6 comments
Closed

[Request] Start Print / Cancel Print toggle mode #149

CapnBry opened this issue Jun 15, 2018 · 6 comments

Comments

@CapnBry
Copy link
Contributor

CapnBry commented Jun 15, 2018

I thought it would be fun to add some big ole arcade-sized buttons to my printer for quick Start Print or Cancel buttons and was super pleased to find there was already a plugin for this and that it is so dang configurable it can do almost anything!

I was hoping to just have one button that both starts the print and cancels the print, a sort of start/stop button. There's a "Cancel" printer action and a "Toggle" action, but the toggle pauses/resumes and I was hoping for start / stop. Usually this is because the beginning of the print is messing up and I need to restart it. I notice there's no "Start Print" action, probably because there's no way to select what file to print, but that's fine by me because I just want to start the currently selected print. Is there a way to add "togglejob" mode or something to the other commands something like:

                    elif rpi_input['printer_action'] == 'toggle' or rpi_input['printer_action'] == 'togglejob' :
                        self._logger.info("Printer action " + rpi_input['printer_action'])
                        if self._printer.is_operational():
                            if self._printer.is_printing():
                                if rpi_input['printer_action'] == 'toggle':
                                    self._printer.pause_print()
                                else
                                    self._printer.cancel_print()
                            elif self._printer.is_paused():
                                self._printer.resume_print()
                            elif self._printer.is_ready():
                                self._printer.start_print()
                        else:
                            self._printer.connect()

or just a whole new code block instead of editing 'toggle'

                    elif rpi_input['printer_action'] == 'togglejob':
                        self._logger.info("Printer action togglejob.")
                        if self._printer.is_operational():
                            if self._printer.is_printing():
                                self._printer.cancel_print()
                            elif self._printer.is_ready():
                                self._printer.start_print()
                        else:
                            self._printer.connect()

Also I'm not sure if it was added after you wrote the toggle code, but printer also now has toggle_pause_print() which could reduce the is_printing/is_paused code of 'toggle' to just a single line.

@vitormhenrique
Copy link
Owner

Pretty easy to implement, But I don't think we need to create a new type togglejob, I can just test if it's printing, or not, it's ready or not and figure it out if should start / stop or pause a print job.
And yes, I haven't implemented the start because currently (from the plugin) there is no way to select the file, maybe someday when I implement LCD / OLED display I will have that sorted out...

@vitormhenrique
Copy link
Owner

But for now I can implement "if the file is loaded" start the print...

@CapnBry
Copy link
Contributor Author

CapnBry commented Jun 15, 2018

That would be great but how can it tell if you want to pause/resume vs cancel a print? I would think pause and cancel would have the same printer starting state, is_printing(). I'm not as familiar with the API though so I defer to your expertise 😃

I should say it would also be fine if everything stayed the same and a start_print() action was added separately like Cancel is. I can upload and select the file directly from the slicer program on my desktop, but I need to wait for the printer bed to get fully up to temperature before the print is started (not just the thermistor on the bottom) so really I am just looking for a "Start print" button in addition to the cancel. Either via a toggle or discrete action.

@vitormhenrique
Copy link
Owner

You were right, I do need to keep different toggles...
I made the changes on the dev branch and added a new FR that was here for a while, adding the possibility to execute any shell script as an output. I have not tested it yet because I don't even have a rpi with me right now, it might be possible (very likely) that the code won't even "compile"..
I'll test this weekend and if everything is alright I'll put it production...

@vitormhenrique
Copy link
Owner

Implemented on new release.

@CapnBry
Copy link
Contributor Author

CapnBry commented Jun 21, 2018

Confirmed, works like a champ. Now I just need to 3D print a little button enclosure... and might as well add an enclosure temperature sensor while I'm in there. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants