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

More elegantly handle smoothieware "reset" #44

Open
ghost opened this issue Jul 31, 2017 · 8 comments
Open

More elegantly handle smoothieware "reset" #44

ghost opened this issue Jul 31, 2017 · 8 comments

Comments

@ghost
Copy link

ghost commented Jul 31, 2017

resdet

Upon issueing the "reset" command, it will always happen that Smoothieware closes the port (since its USB stack is in software, not like with Grbl where mostly its on a seperate ftdi/ch340/silabs). However, now a) LW keeps trying to talk to the port, and b) sometimes keeps the port open in windows so the subsequent re-enumeration fails.

In this case, we now need to switch to comms tab, disconnect, then manually replug the USB to get enumeration after reset to work.

Resetting from software is convenient during that initial machine setup / after certain console commands

We can extend this functionality to a proper "reset" ws-event if you like? Then we can have:

  • A 'reset controller' button on comms tab, just like pronterface has always had
  • switch case to handle firmware differences
    ('reset' for smoothie + disconnect port immediately after sending (or after receiving "Smoothie out. Peace. Rebooting in 5 seconds")
    (ctrl+x (ascii \030 aka port.write("\030") for grbl and tiny)
@cprezzi
Copy link
Member

cprezzi commented Aug 2, 2017

I do already watch for the close event of a com port, which does a cleanup, but I don't know why this event doesn't fire when smoothie closes the port. Shure I can also watch for "Smoothie out" and close the port from my side.

There is already a resetMachine command in lw.comm-server which does the firmware specific reset, but at the moment it sends ctrl-x (0x18) to grbl, smoothie and tinyg (or M112 to marlinkimbra). I thought smoothie supports ctrl-x?

You can initiate the reset by pressing ctrl-x when you are on the jog tab.

@tbfleming
Copy link
Member

The USB CDC protocol doesn't define open and close; the OS provides those abstractions. Under Windows, only the application can close a port. If a device is unplugged (smoothie reset kind-of looks like this to the host), then the file handle enters an error state.

@cprezzi
Copy link
Member

cprezzi commented Aug 2, 2017

I do also catch error events, but not getting any.

@cprezzi
Copy link
Member

cprezzi commented Aug 2, 2017

@tbfleming But why does a software reset behave different than a hardware reset (button)? Smoothie should be able to handle that the same way, especially because the USB driver is part of the code.

@tbfleming
Copy link
Member

I don't know. ctrl-x in grbl just resets some, not all, state, which allowed me to make it so the PC sees no funny business on the USB bus.

@ghost
Copy link
Author

ghost commented Aug 3, 2017

I did some more testing... After sending reset, Smoothie does the 5 second countdown before resetting. If i do Disconnect from comms tab before it resets, i have not had a problem re-enumerating yet, did about 20-25 runs of this.

@cprezzi ""I do already watch for the close event of a com port" - is this event on WS or SerialPort? If its on SP, perhaps still react to the WS event too? Ie close the port from node (ie serialport port close) as soon as that "reset" (or Ctrl+X if that resets it too) has been sent if firmware==smoothie / or on the Smoothie out (may be even better)

@ghost
Copy link
Author

ghost commented Aug 3, 2017

resetMachine command in lw.comm-server - can we get a Reset button on the comms tab (;

@cprezzi
Copy link
Member

cprezzi commented Aug 4, 2017

I think the jog tab will get some rework anyways. Todd is already working on configurable forms. :)

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

No branches or pull requests

2 participants