G92 ohne Senden
This commit is contained in:
@@ -39,6 +39,7 @@ class GCode{
|
||||
if(s.indexOf('G') !== 0){return false;}
|
||||
if(s.indexOf('G90') == 0){return true;}
|
||||
if(s.indexOf('G91') == 0){return true;}
|
||||
if(s.indexOf('G92') == 0){return true;} // G92 - Set Position
|
||||
if(s.indexOf('G28') !== -1){return true;}
|
||||
if(s.indexOf('G1 ') !== -1){return true;}
|
||||
return false;
|
||||
@@ -89,7 +90,7 @@ class GCode{
|
||||
|
||||
if(g == undefined) return;
|
||||
|
||||
console.log("GCode: Empfange GCode: " + g);
|
||||
//console.log("GCode: Empfange GCode: " + g);
|
||||
|
||||
var multipleCommands = g.split(" G");
|
||||
var doProcessRest = false;
|
||||
@@ -202,7 +203,32 @@ class GCode{
|
||||
if(s.includes("e")){ robot.e = Number(s.substring(1, s.length));}
|
||||
});
|
||||
}
|
||||
|
||||
if(g[0] == "G92"){ // G92 - Set Position
|
||||
g.forEach((s) => {
|
||||
if(s.includes("X")){ robot.xMotor = Number(s.substring(1, s.length));}
|
||||
if(s.includes("x")){ robot.xMotor = Number(s.substring(1, s.length));}
|
||||
if(s.includes("Y")){ robot.alpha = Number(s.substring(1, s.length));}
|
||||
if(s.includes("y")){ robot.alpha = Number(s.substring(1, s.length));}
|
||||
if(s.includes("Z")){ robot.beta = Number(s.substring(1, s.length));}
|
||||
if(s.includes("z")){ robot.beta = Number(s.substring(1, s.length));}
|
||||
|
||||
if(s.includes("A")){ robot.a = Number(s.substring(1, s.length));}
|
||||
if(s.includes("a")){ robot.a = Number(s.substring(1, s.length));}
|
||||
if(s.includes("B")){ robot.b = Number(s.substring(1, s.length));}
|
||||
if(s.includes("b")){ robot.b = Number(s.substring(1, s.length));}
|
||||
if(s.includes("C")){ robot.c = Number(s.substring(1, s.length));}
|
||||
if(s.includes("c")){ robot.c = Number(s.substring(1, s.length));}
|
||||
|
||||
if(s.includes("E")){ robot.e = Number(s.substring(1, s.length));}
|
||||
if(s.includes("e")){ robot.e = Number(s.substring(1, s.length));}
|
||||
});
|
||||
robot.calculatePositionFromMotorAngles();
|
||||
calculateNew = false;
|
||||
|
||||
// ToDo: Send Command to update Position of Robot, because G92 should
|
||||
// set the current Position to the given Coordinates without moving the Robot.
|
||||
}
|
||||
|
||||
if(calculateNew && !calculateFromMotorCoordinates){
|
||||
robot.calculateAngles3D();
|
||||
|
||||
Reference in New Issue
Block a user