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

@@ -12,7 +12,6 @@ module.exports = class TelnetSenderGRBL{
* zAxisGrbl: ...
*/
constructor(urlGRBL = "grblesp.local", maxSpeedF = 5000, xAxisGrbl = "x", yAxisGrbl = "y", zAxisGrbl = "z", aAxisGrbl = null, bAxisGrbl = null, cAxisGrbl = null, eAxisGrbl = null){
var socket = null;
this.tSocket = null;
this.receiver = null;
@@ -26,6 +25,12 @@ module.exports = class TelnetSenderGRBL{
this.cAxisGrbl = cAxisGrbl;
this.eAxisGrbl = eAxisGrbl;
if (urlGRBL === "test.test") {
this.tSocket = { written: "", write(txt){ this.written = txt; } };
this.isTestMode = true;
return;
}
new Promise((resolve, reject) => {
@@ -53,10 +58,10 @@ module.exports = class TelnetSenderGRBL{
}
moveTo(mOld, mNew){
this.translateAxisNames(mOld, mNew, "G1")
this.execCommand("G1", mOld, mNew)
}
translateAxisNames(mOld, mNew, strCommand = "G1"){
execCommand(strCommand = "G1", mOld, mNew ){
// The Hand-Turn is not 1:1 to the Hand-Lift °
var factorTurnLift = 1.2;
@@ -67,7 +72,7 @@ module.exports = class TelnetSenderGRBL{
// Hand-Open in mm
var handOpenInMM = 1.0
var data = strCommand;
var data = strCommand.toString("utf-8");
if(this.xAxisGrbl == "x"){
data += " x" + (mNew.x).toFixed(2).toString();
@@ -200,10 +205,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");
}
}