Horrible G91 G90 mistake

This commit is contained in:
ChK
2026-04-23 20:22:10 +02:00
parent d801e19ad0
commit a16eb53aeb
7 changed files with 1678 additions and 322 deletions

View File

@@ -337,7 +337,7 @@ class Robot{
this.calculateSpeeds(this.motorPositionOld, this.motorPosition);
this.motorPosition.speeds = {...this.motorSpeeds};
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));
console.log("Robot.sendCommand: ", cmd.toString(), " 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.execCommand(cmd,this.motorPositionOld, this.motorPosition);

View File

@@ -57,7 +57,7 @@ module.exports = class TelnetSenderGRBL{
});
}
console.log("🤖 TelnetSenderGRBL initialized with URL: " + urlGRBL);
console.log("🤖 TelnetSenderGRBL initialized: " + urlGRBL);
}
moveTo(mOld, mNew){
@@ -106,7 +106,7 @@ module.exports = class TelnetSenderGRBL{
if(this.yAxisGrbl == "x" && mNew.xMotorChanged && Number.isFinite(mNew.x)){
if(this.yAxisGrbl == "x" && mNew.xMotorChanged && Number.isFinite(mNew.x)){
data += " y" + (mNew.x ).toFixed(2).toString();
}
if(this.yAxisGrbl == "y" && mNew.yMotorChanged && Number.isFinite(mNew.y)){
@@ -203,7 +203,7 @@ if(this.yAxisGrbl == "x" && mNew.xMotorChanged && Number.isFinite(mNew.x)){
data += " b" + (mNew.e * 180 / Math.PI).toFixed(2).toString();
}
if(this.tSocket && data.toString("utf-8").length > 3){
if(this.tSocket && data.length > 3){
if(strCommand == "G1" && mNew){
const DEFAULT_FEEDRATE = process.env.ROBOT_DEFAULT_FEEDRATE ?
@@ -215,9 +215,15 @@ if(this.yAxisGrbl == "x" && mNew.xMotorChanged && Number.isFinite(mNew.x)){
// hier bin ich unsicher, ob das nicht in den Sender rein sollte, da es eventuell
// abhngig vom FluidNC und dessen speed interpretation ist.
}
if(data.indexOf("G90") == -1){
data = "G90 " + data;
}
if(!this.isTestMode){ console.log("" + this.urlGRBLstr + " gets the message: " + data.toString("utf-8"))}
this.tSocket.write( data.toString("utf-8") + "\r\n");
console.log("Driver send to 🤖 " + this.urlGRBLstr + " the message: " + data)
this.tSocket.write( data + "\r\n");
}
}
}

View File

@@ -331,11 +331,16 @@ module.exports = class TelnetSenderGRBL{
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"))
//}
dataStr = data.toString("utf-8");
if(this.tSocket && dataStr.length > 3){
// Ensure that the command starts with G90 (absolute positioning) if it's not already included
if(dataStr.indexOf("G90") == -1){
dataStr = "G90 " + dataStr;
}
console.log("Driver send to 🤖 " + this.urlGRBLstr + " the message: " + data.toString("utf-8"))
this.tSocket.write( data.toString("utf-8") + "\r\n");
}
}