Skip to content

Commit

Permalink
Reset GRBL on open, to get version string
Browse files Browse the repository at this point in the history
  • Loading branch information
ushakov committed Aug 20, 2013
1 parent 0c1df69 commit d054216
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/com/willwinder/universalgcodesender/AbstractController.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ public abstract class AbstractController implements SerialCommunicatorListener {
abstract protected void closeCommBeforeEvent();
abstract protected void closeCommAfterEvent();

/**
* Called after comm opening allowing device specific behavior.
* @throws IOException
*/
protected void openCommAfterEvent() throws IOException {
// Empty default implementation.
}

/**
* Called before and after a send cancel allowing device specific behavior.
*/
Expand Down Expand Up @@ -247,6 +255,8 @@ public Boolean openCommPort(String port, int portRate) throws Exception {
"**** Connected to " + port + " @ " + portRate + " baud ****\n");
}

this.openCommAfterEvent();

return this.commOpen;
}

Expand Down
5 changes: 5 additions & 0 deletions src/com/willwinder/universalgcodesender/GrblController.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ protected void closeCommAfterEvent() {
this.grblVersionLetter = null;
}

@Override
protected void openCommAfterEvent() throws IOException {
this.comm.sendByteImmediately(GrblUtils.GRBL_RESET_COMMAND);
}

@Override
protected void isReadyToStreamFileEvent() throws Exception {
if (this.isReady == false) {
Expand Down

0 comments on commit d054216

Please sign in to comment.