Use of .split to create an array of strings which is sent to
OctoPrint.control.sendGcode instead of a single string. This allows multiple-line Gcode to be interpreted properly.
This commit is contained in:
parent
f00ea284cb
commit
5aa5400c2f
|
@ -58,7 +58,9 @@ $(function() {
|
|||
|
||||
if (macro.macro().match(paramObjRegex) == null) {
|
||||
OctoPrint.control.sendGcode(
|
||||
macro.macro().replace(/(?:\r\n|\r|\n)/g, " ")
|
||||
// Use .split to create an array of strings which is sent to
|
||||
// OctoPrint.control.sendGcode instead of a single string.
|
||||
macro.macro().split(/\r\n|\r|\n/)
|
||||
);
|
||||
} else {
|
||||
self.paramMacroViewModel.process(macro);
|
||||
|
|
|
@ -60,11 +60,9 @@ $(function() {
|
|||
i++;
|
||||
return self.parameters()[i]["value"];
|
||||
}
|
||||
|
||||
// Use .split to create an array of strings which is sent to
|
||||
// OctoPrint.control.sendGcode instead of a single string.
|
||||
expanded = self.macro.replace(paramObjRegex, replaceParams)
|
||||
// expanded = "[\"" + expanded + "\"]"
|
||||
// expanded = expanded.replace(/(?:\r\n|\r|\n)/g, "\",\"");
|
||||
// Split using RegEx - cleaner
|
||||
expanded = expanded.split(/\r\n|\r|\n/);
|
||||
|
||||
OctoPrint.control.sendGcode(expanded);
|
||||
|
|
Loading…
Reference in New Issue