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

UI: Add 'Stop Execution' button #399

Open
jekhor opened this issue Jan 5, 2017 · 8 comments
Open

UI: Add 'Stop Execution' button #399

jekhor opened this issue Jan 5, 2017 · 8 comments

Comments

@jekhor
Copy link

jekhor commented Jan 5, 2017

There is no way for now to stop job execution if it started, need to disconnect cutter physically which is very annoying.

@darkjavi
Copy link

Yes, Please add big red STOP button!

@t-oster
Copy link
Owner

t-oster commented Oct 22, 2018

Which driver? Which device? On the Epilog devies e.g. the job is just sent to the cutter and has to be started there manually, which also works if the cable is disconnected, so there is no way to stop or start a job from VisiCut.
What are the proper commands for your device/driver to stop a running job?

@darkjavi
Copy link

I understand that this is not a problem in every scenario, only tried grbl and smoothie boards but as far as I've seen there are to different workflows, in Epilog/smoothie(in html mode) the job is sent to the machine as a whole and then you can start/stop/pause the job with the machine interface, this makes perfect sense.

On grbl/smoothie( ip or serial mode) visicut acts as a host and streams the job to the machine, problem there is that once you press execute you lose control over the proccess so if you need to stop you have to close visicut || pull usb || kill switch. Main thing is the annoyance of having to set it up again for the smallest mistake like realizing that you need 10% more laser in the first 5 seconds.

For those cases would be great to be able to pause/stop the stream, maybe a little trickier cos you need to make sure laser goes off.

@t-oster
Copy link
Owner

t-oster commented Oct 24, 2018

Yes, I understand the issue. Currently I am not using any streaming Lasercutter so pull-requests are appreciated. I'd suggest an Interface StoppableLasercutter which those drivers should implement which provides the stop method. Additionally there should be a config value, because some drivers allow both modes.

@mgmax
Copy link
Collaborator

mgmax commented Oct 24, 2018

AFAIK all of the streaming drivers are blocking, e.g. sendJob() in GenericGCodeDriver does not return until the whole job is sent.
https://github.com/t-oster/LibLaserCut/blob/d07e53259a96912dbf435bc045a8695eef08d8ce/src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java#L790

My suggestion would be to

  1. call sendJob from a Thread (this is already done!)
  2. add a cancel button that uses Thread.interrupt() to signal the thread that sending should stop
  3. use Thread.interrupted() to check for that inside the loop in writeVectorGCode(). From there, throw InterruptedException to get back out. Catch it in sendJob, make sure to send some end-of-job commands (switch off laser etc.) and close the output device.

Just to be clear, same as @t-oster I won't be the one who implements this, I can just help you do it.

For inspiration, something similar is in the engrave dithering code to abort calculating the preview:
https://github.com/t-oster/LibLaserCut/blob/d07e53259a96912dbf435bc045a8695eef08d8ce/src/com/t_oster/liblasercut/dithering/Ordered.java#L88-L90

private void cancelAsynchronously() {
// cancel this thread as soon as possible in the future.
// NOTE: memory is not freed immediately!
logger.log(Level.FINE, "Canceling Thread asynchronously");
this.interrupt();
}

And the best thing is that the first step is already done: sendJob is called here, and this is already inside a thread.

MainView.this.visicutModel1.sendJob(jobname, pl, cuttingSettings, warnings);

But now it's up to you @darkjavi .

@tatarize
Copy link

The K40 can do this. The job streams to the device without the entire queue posted, but even when the queue is in there it can be sent a IS1P command mid cut and will clear the queue. It also possesses a few other things that are common for moving the laserhead around before starting the project. So you can be absolutely sure where you're going to cut. And generally just call that start point the origin point. Also a couple other helpful commands like unlocking the rail so you can move the head around yourself, firing the laser without anything moving (this one actually scares me but it'll do the same as a test button). There were no clear places to tie these elements in, but they are functionality possessed by the devices.

@mgmax
Copy link
Collaborator

mgmax commented Aug 16, 2020

Related: t-oster/LibLaserCut#158

@TheAssassin
Copy link
Contributor

Related: #706

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

6 participants