Kleine Arbeiten
This commit is contained in:
@@ -52,7 +52,14 @@ function createInfoServer(httpsOptions, sharedState, robot, GCode, senders, opti
|
||||
reconnectAttempt: status.reconnectAttempt || 0,
|
||||
reconnectTimer: !!status.reconnectTimer,
|
||||
health,
|
||||
reason
|
||||
reason,
|
||||
// Hardware-Feedback (ToDo_9 Paket 1/3): GRBL-Zustand aus dem Sender.
|
||||
grblState: status.grblState ?? null,
|
||||
machinePosition: status.machinePosition ?? null,
|
||||
plannerBlocksFree: status.plannerBlocksFree ?? null,
|
||||
rxBytesFree: status.rxBytesFree ?? null,
|
||||
lastError: status.lastError ?? null,
|
||||
lastReportAt: status.lastReportAt ?? null
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -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