Wednesday, April 27, 2016

#1026 - sendCommand()

The request for this issue was to check the terminal command sent by the user against the blacklist and uppercase the input if it is not in the blacklist. To implement this request we first retrieved the blacklist from the front end in the settings.js file. The terminal.js file holds the sendCommand() function which, as one would imagine, sends the terminal command sent by the user. This function automatically uppercases the first g-code command, and leaves the following parameters the way they are.

For example, if the user types,

  m33 p0

into the terminal, the sendCommand function sends,

  M33 p0

to the printer. The problem with this, the heart of the #1026 issue, is that there are g-codes whose parameters need to be capitalized. This would be easy to fix if it weren't for the g-code commands whose parameters need to not be capitalized (which is of course where the blacklist comes in to play). Our solution was to keep the previous implementation of the sendCommand function, but add a conditional statement which uppercases the command and parameters if the command is in the black list.














 For example, if the user sends the command,

  m117 Hello world

with M117 in the blacklist, the printer will receive,

  M117 Hello world

and any command not in the blacklist will have capitalized parameters.

No comments:

Post a Comment