-
Notifications
You must be signed in to change notification settings - Fork 46
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
Comments
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. |
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. |
I do also catch error events, but not getting any. |
@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. |
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. |
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) |
resetMachine command in lw.comm-server - can we get a Reset button on the comms tab (; |
I think the jog tab will get some rework anyways. Todd is already working on configurable forms. :) |
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:
('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)The text was updated successfully, but these errors were encountered: