Skip to content

Commit

Permalink
Ack response when sender.state.received is less than `sender.state.…
Browse files Browse the repository at this point in the history
…sent` when workflow is in paused state
  • Loading branch information
cheton committed Apr 24, 2017
1 parent 0e74737 commit 38c5524
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/controllers/Grbl/GrblController.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import logger from '../../lib/logger';
import Sender, { SP_TYPE_CHAR_COUNTING } from '../../lib/sender';
import Workflow, {
WORKFLOW_STATE_IDLE,
WORKFLOW_STATE_PAUSED,
WORKFLOW_STATE_RUNNING
} from '../../lib/workflow';
import config from '../../services/configstore';
Expand Down Expand Up @@ -286,6 +287,13 @@ class GrblController {
this.sender.next();
return;
}
if (this.workflow.state === WORKFLOW_STATE_PAUSED) {
const { sent, received } = this.sender.state;
if (sent > received) {
this.sender.ack();
return;
}
}

this.emitAll('serialport:read', res.raw);

Expand Down
8 changes: 8 additions & 0 deletions src/app/controllers/Smoothie/SmoothieController.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import logger from '../../lib/logger';
import Sender, { SP_TYPE_CHAR_COUNTING } from '../../lib/sender';
import Workflow, {
WORKFLOW_STATE_IDLE,
WORKFLOW_STATE_PAUSED,
WORKFLOW_STATE_RUNNING
} from '../../lib/workflow';
import config from '../../services/configstore';
Expand Down Expand Up @@ -284,6 +285,13 @@ class SmoothieController {
this.sender.next();
return;
}
if (this.workflow.state === WORKFLOW_STATE_PAUSED) {
const { sent, received } = this.sender.state;
if (sent > received) {
this.sender.ack();
return;
}
}

this.emitAll('serialport:read', res.raw);

Expand Down

0 comments on commit 38c5524

Please sign in to comment.