port und so
This commit is contained in:
@@ -38,7 +38,6 @@ class FluidNCClient extends EventEmitter {
|
||||
});
|
||||
}
|
||||
|
||||
// --- BASIC COMMANDS ---
|
||||
sendLine(cmd) {
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
||||
this.ws.send(cmd + "\n");
|
||||
@@ -58,10 +57,6 @@ class FluidNCClient extends EventEmitter {
|
||||
this.sendLine(cmd);
|
||||
}
|
||||
|
||||
setZero() {
|
||||
this.sendLine("G92 X0 Y0 Z0");
|
||||
}
|
||||
|
||||
onMessage(fn) {
|
||||
this.on("message", fn);
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
class StatusParser {
|
||||
|
||||
static parse(line){
|
||||
|
||||
if(!line.startsWith("<")) return null;
|
||||
|
||||
const stateMatch = line.match(/^<([^|]+)/);
|
||||
const posMatch = line.match(/MPos:([^|]+)/);
|
||||
|
||||
if(!posMatch) return null;
|
||||
|
||||
const parts = posMatch[1].split(",");
|
||||
|
||||
return {
|
||||
type: "status",
|
||||
state: stateMatch ? stateMatch[1] : "unknown",
|
||||
x: parseFloat(parts[0]),
|
||||
y: parseFloat(parts[1]),
|
||||
z: parseFloat(parts[2])
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = StatusParser;
|
||||
Reference in New Issue
Block a user