Kleine Arbeiten

This commit is contained in:
chk
2026-06-14 10:32:31 +02:00
parent 87cbd51bd2
commit 319fae944a
25 changed files with 1631 additions and 504 deletions

View File

@@ -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
};
});

View File

@@ -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;
}