UnitTest aktualisieren

This commit is contained in:
ChK
2026-04-23 20:45:49 +02:00
parent a16eb53aeb
commit 355925ebb4
8 changed files with 1660 additions and 16 deletions

View File

@@ -85,7 +85,7 @@ class GCode{
if(g == undefined) return;
if(g.length == 0) return;
console.log("🔵 GCode.receiveGCode: Incoming command: " + g);
// console.log("🔵 GCode.receiveGCode: Incoming command: " + g); // Moved to InputWS
g = g.toString("utf8");
@@ -129,7 +129,7 @@ class GCode{
if(s.toUpperCase().includes("B")){ robot.theta += Number(s.substring(1, s.length)); robot.bMotorChanged = true;}
if(s.toUpperCase().includes("C")){ robot.psi += Number(s.substring(1, s.length)); robot.cMotorChanged = true;}
if(s.toUpperCase().includes("E")){ robot.e += Number(s.substring(1, s.length)); robot.eMotorChanged = true;}
if(s.toUpperCase().includes("F")){ robot.feedrate = Number(s.substring(1, s.length)); console.log(" 📌 Feedrate set to: " + robot.feedrate); }
if(s.toUpperCase().includes("F")){ robot.feedrate = Number(s.substring(1, s.length));}
});
}
else if(g[0] == "M1" && robot.moveRelative){
@@ -156,7 +156,7 @@ class GCode{
if(s.toUpperCase().includes("B")){ robot.theta = Number(s.substring(1, s.length)); robot.bMotorChanged = true;}
if(s.toUpperCase().includes("C")){ robot.psi = Number(s.substring(1, s.length)); robot.cMotorChanged = true;}
if(s.toUpperCase().includes("E")){ robot.e = Number(s.substring(1, s.length)); robot.eMotorChanged = true;}
if(s.toUpperCase().includes("F")){ robot.feedrate = Number(s.substring(1, s.length)); console.log(" 📌 Feedrate set to: " + robot.feedrate); }
if(s.toUpperCase().includes("F")){ robot.feedrate = Number(s.substring(1, s.length)); }
});
}
else if(g[0] == "M1" && !robot.moveRelative){

View File

@@ -216,7 +216,7 @@ module.exports = class TelnetSenderGRBL{
// abhngig vom FluidNC und dessen speed interpretation ist.
}
if(data.indexOf("G90") == -1){
if(data.indexOf("G90") == -1 && data.indexOf("G1 ") > 0){
data = "G90 " + data;
}

View File

@@ -331,17 +331,16 @@ module.exports = class TelnetSenderGRBL{
data += " f"+(maxSpeedF.toFixed(2).toString())
dataStr = data.toString("utf-8");
if(this.tSocket && dataStr.length > 3){
if(this.tSocket && data.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;
if(data.indexOf("G90") == -1){
data = "G90 " + data;
}
console.log("Driver send to 🤖 " + this.urlGRBLstr + " the message: " + data.toString("utf-8"))
console.log("Driver send to 🤖 " + this.urlGRBLstr + " the message: " + data)
this.tSocket.write( data.toString("utf-8") + "\r\n");
this.tSocket.write( data + "\r\n");
}
}
}