Kleine Arbeiten
This commit is contained in:
@@ -52,11 +52,20 @@ function initInputWS(server, robot, GCode, sharedState) {
|
||||
if (GCode.containsCommand(message)) {
|
||||
console.log("🔵 GCode.receiveGCode: Incoming command: " + message);
|
||||
logCommand(sharedState, clientIP, message);
|
||||
let result;
|
||||
try {
|
||||
GCode.receiveGCode(robot, message);
|
||||
result = GCode.receiveGCode(robot, message);
|
||||
} catch (err) {
|
||||
return sendError(ws, 'GCODE_ERROR', err.message, message);
|
||||
}
|
||||
// Asynchroner Befehl (z. B. Hardware-Sync M114 R, ToDo_9 Paket 4): erst nach
|
||||
// Abschluss antworten; Fehler maschinenlesbar an den Anfrager zurückgeben.
|
||||
if (result && typeof result.then === 'function') {
|
||||
result
|
||||
.then(() => broadcast(wss, GCode.getM114(robot)))
|
||||
.catch(err => sendError(ws, 'GCODE_ERROR', err.message, message));
|
||||
return;
|
||||
}
|
||||
broadcast(wss, GCode.getM114(robot));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user