diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8aac25c..9f09db9 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -2,7 +2,9 @@ v1.0.377: - Fixed Grbl Settings Description for $14, $486 - Fixed USB descriptor for Pico - Removed remaining Smoothieware leftovers -- Re-Enabled DTR toggle for native USB support +- Fixed issue #360: Clear queue on port.disconnect +- Fixed issue #359 +- Fixed issue #330: Re-Enabled DTR toggle for native USB support v1.0.376: - Updated installer End User License Agreement diff --git a/index.js b/index.js index 1734e25..380df6a 100644 --- a/index.js +++ b/index.js @@ -2354,9 +2354,14 @@ function stopPort() { // port.drain(port.close()); if (status.comms.interfaces.type == "usb") { - port.drain(port.close()); + if (port.isOpen) { + port.drain(port.close()); + } } else if (status.comms.interfaces.type == "telnet") { - port.destroy(); + if (port.isOpen) { + port.destroy(); + port.isOpen = false; + } } }