From 814d1045ba03f43e878911a2334f0a8c3c28adab Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sun, 24 Mar 2024 16:34:26 +0100 Subject: [PATCH] Z21: report the (unchanged) loco mode back after every attempted change --- Z21Throttle.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Z21Throttle.cpp b/Z21Throttle.cpp index e5aa7ea..7cc799e 100644 --- a/Z21Throttle.cpp +++ b/Z21Throttle.cpp @@ -852,15 +852,27 @@ bool Z21Throttle::parse(byte *networkPacket, int len) { done = true; break; case HEADER_LAN_GET_LOCOMODE: - if (Diag::Z21THROTTLEVERBOSE) DIAG(F("%d GET LOCOMODE"), this->clientid); - notifyLocoMode(Data[0], Data[1]); // big endian here, but resend the same as received, so no problem. + { + if (Diag::Z21THROTTLEVERBOSE) { + uint16_t addr = (Data[0] << 8) + Data[1]; + DIAG(F("%d GET LOCOMODE %d"), this->clientid, addr); + } + notifyLocoMode(Data[0], Data[1]); // big endian here, but resend the same as received, so no problem. done = true; - break; + } + break; case HEADER_LAN_SET_LOCOMODE: - if (Diag::Z21THROTTLEVERBOSE) DIAG(F("%d SET LOCOMODE"), this->clientid); + { + // as we currently can not change loco mode, nothing to do + if (Diag::Z21THROTTLEVERBOSE) { + uint16_t addr = (Data[0] << 8) + Data[1]; + DIAG(F("%d SET LOCOMODE %d"), this->clientid, addr); + } + notifyLocoMode(Data[0], Data[1]); // big endian here, but resend the same as received, so no problem. done = true; - break; + } + break; case HEADER_LAN_GET_HWINFO: if (Diag::Z21THROTTLEVERBOSE) DIAG(F("%d GET HWINFO"), this->clientid); notifyHWInfo(); // big endian here, but resend the same as received, so no problem.