G92 > send-to-ESP

This commit is contained in:
ChK
2026-04-06 05:24:41 +02:00
parent 3e874e70c9
commit 3d33ecd747
12 changed files with 3337 additions and 20 deletions

View File

@@ -202,7 +202,8 @@ class GCode{
if(s.includes("e")){ robot.e = Number(s.substring(1, s.length));}
});
}
else if(g[0] == "G92"){ // G92 - Set Position
else if(g[0] == "M92"){ // G92 - Set Position --- M92 in Radiant
robot.createMotorPosition();
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));}
@@ -226,6 +227,7 @@ class GCode{
// ToDo: Send Command to update Position of Robot, because G92 should
// set the current Position to the given Coordinates without moving the Robot.
robot.sendCommand("G92");
}
if(calculateNew && !calculateFromMotorCoordinates){

View File

@@ -180,7 +180,7 @@ class Robot{
while(this.theta < -Math.PI){this.theta += 2*Math.PI}
}
sendCommand(){
sendCommand(cmd="G1"){
if(this.motorPosition == null){this.createMotorPosition() }
this.motorPositionOld = this.motorPosition;
this.createMotorPosition()
@@ -188,7 +188,12 @@ class Robot{
console.log("Robot.sendCommand: Motor-Pos: x=", this.motorPosition.x.toFixed(3), "yMotor=",this.motorPosition.y.toFixed(3), "zMotor=",this.motorPosition.z.toFixed(3), "aM=", this.motorPosition.a.toFixed(3), "bM=", this.motorPosition.b.toFixed(3), "cM=", this.motorPosition.c.toFixed(3), " e=", this.motorPosition.e.toFixed(3));
this.cmdReceivers.forEach(receiver => {
receiver.moveTo(this.motorPositionOld, this.motorPosition);
if(cmd == "G1"){
receiver.moveTo(this.motorPositionOld, this.motorPosition);
}
else{
receiver.execCommand(cmd,this.motorPositionOld, this.motorPosition);
}
});
}
}

View File

@@ -204,9 +204,10 @@ module.exports = class TelnetSenderGRBL{
data += " b" + (mNew.e * 180 / Math.PI).toFixed(2).toString();
}
data += " f"+(maxSpeedF.toFixed(2).toString())
if(strCommand == "G1"){
data += " f"+(maxSpeedF.toFixed(2).toString())
}
if(this.tSocket && data.toString("utf-8").length > 3){
if(!this.isTestMode){ console.log("" + this.urlGRBLstr + " gets the message: " + data.toString("utf-8"))}
this.tSocket.write( data.toString("utf-8") + "\r\n");