simplified add gcode

This commit is contained in:
casperlamboo 2016-03-29 15:56:32 +02:00
parent bd910a270c
commit 2b10f388f7

View File

@ -13,19 +13,21 @@ export default class {
} }
_addGCode (command) { _addGCode (command) {
var str = ''; let str = '';
var first = true; let first = true;
for (var i in command) { for (const action in command) {
const value = command[action];
const currentValue = this.current[action];
if (first) { if (first) {
str = i + command[i]; str = action + value;
first = false; first = false;
} }
else if (this.current[i] !== command[i]) { else if (currentValue !== value) {
str += ' ' + i + command[i]; str += ` ${action}${value}`;
this.current[i] = command[i]; this.current[action] = value;
} }
} }