G92 ohne Senden

This commit is contained in:
ChK
2026-03-29 21:20:37 +02:00
parent a361d96802
commit ff96dfd8f1
8 changed files with 212 additions and 14 deletions

View File

@@ -26,6 +26,12 @@ module.exports = class TelnetSenderGRBL{
this.bAxisGrbl = bAxisGrbl;
this.cAxisGrbl = cAxisGrbl;
this.eAxisGrbl = eAxisGrbl;
if (urlGRBL === "test.test") {
this.tSocket = { written: "", write(txt){ this.written = txt; } };
this.isTestMode = true;
return;
}
var fluidConfig = { host: urlGRBL, port: 80, reconnectDelay: 30000}
@@ -36,6 +42,12 @@ module.exports = class TelnetSenderGRBL{
moveTo(mOld, mNew){
this.execCommand("G1", mOld, mNew)
}
execCommand(strCommand = "G1", mOld, mNew){
var data = strCommand.toString("utf-8");
// The Hand-Turn is not 1:1 to the Hand-Lift °
var factorTurnLift = 1.2;
@@ -46,7 +58,7 @@ module.exports = class TelnetSenderGRBL{
// Hand-Open in mm
var handOpenInMM = 1.0
var data = "G1"
if(this.xAxisGrbl == "x"){
data += " x" + (mNew.x).toFixed(2).toString();
@@ -179,10 +191,9 @@ module.exports = class TelnetSenderGRBL{
data += " f"+(maxSpeedF.toFixed(2).toString())
console.log("" + this.urlGRBLstr + " receives: " + data.toString("utf-8"))
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");
}
}