From f2251311a8523b6c24839ccd1e6834ef065c679f Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Mon, 16 Mar 2026 16:48:34 +0100 Subject: Imaging (m/n) commands: start/stop, masks, image count, n reply --- src/Xpl2Client.cpp | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) (limited to 'src/Xpl2Client.cpp') diff --git a/src/Xpl2Client.cpp b/src/Xpl2Client.cpp index ac7079f..d3a6da2 100644 --- a/src/Xpl2Client.cpp +++ b/src/Xpl2Client.cpp @@ -558,6 +558,52 @@ Xpl2Client::phSaveSettings (int printheadId) sendCommand (m_commandSocket, "CF_PH_SAVE_SETTINGS", { printheadId }); } +/* ------------------------------------------------------------------ */ +/* Imaging (m/n) commands */ +/* ------------------------------------------------------------------ */ + +void +Xpl2Client::imagingStart (double speed) +{ + sendCommand (m_imagingSocket, "m2", { speed }); +} + +void +Xpl2Client::imagingStop () +{ + sendCommand (m_imagingSocket, "m4"); +} + +void +Xpl2Client::imageMaskStart (const QString &mask) +{ + sendCommand (m_imagingSocket, "m0", { mask }); +} + +void +Xpl2Client::imageMaskEnd (const QString &tail) +{ + sendCommand (m_imagingSocket, "m1", { tail }); +} + +void +Xpl2Client::dutyCycleMaskStart (const QString &mask) +{ + sendCommand (m_imagingSocket, "m5", { mask }); +} + +void +Xpl2Client::dutyCycleMaskEnd (const QString &tail) +{ + sendCommand (m_imagingSocket, "m6", { tail }); +} + +void +Xpl2Client::imageCount () +{ + sendCommand (m_imagingSocket, "m3"); +} + /* ------------------------------------------------------------------ */ /* Send / dispatch */ /* ------------------------------------------------------------------ */ @@ -605,7 +651,25 @@ Xpl2Client::dispatchImagingMessage (const Xpl2Protocol::ParsedMessage &msg) handleKaPing (m_imagingSocket); else if (msg.command == "EV_SHUTTING_DOWN") emit shuttingDown (); - else + else if (msg.command == "n") + { + int lines = 0; + if (!msg.params.isEmpty ()) + lines = msg.params[0].toString ().toInt (nullptr, 16); + qDebug ("%s n imageLines=%d", qPrintable (logTag (&m_imagingSocket)), + lines); + emit statusMessage (QStringLiteral ("RX n: imageLines=%1").arg (lines)); + emit imagingReply (lines); + } + else if (msg.command == "m4") + { + bool ok = !msg.params.isEmpty () && msg.params[0].toInt () == 1; + qDebug ("%s m4 success=%d", qPrintable (logTag (&m_imagingSocket)), + ok); + emit statusMessage (QStringLiteral ("RX m4: success=%1").arg (ok)); + emit imagingStopResult (ok); + } + else if (!dispatchResponse (msg.command, msg.params, &m_imagingSocket)) qWarning ("%s Unknown command: %s", qPrintable (logTag (&m_imagingSocket)), msg.command.constData ()); } -- cgit v1.2.3