diff --git a/src/dali_comm.cpp b/src/dali_comm.cpp index f2f5b30..09c5d27 100644 --- a/src/dali_comm.cpp +++ b/src/dali_comm.cpp @@ -169,8 +169,10 @@ int DaliComm::checkGatewayType(int gateway) const { const std::vector usbProbe{0x01, 0x00, 0x00}; const std::vector legacyProbe{0x28, 0x01, static_cast(gateway), 0x11, 0x00, 0x00, 0xFF}; - const std::vector newProbe{0x28, 0x01, static_cast(gateway), 0x11, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xFF}; + const auto newProbe = checksum({0x28, 0x01, static_cast(gateway), 0x11, 0x00, + 0x00, 0x00, 0x00, 0x00}); + const std::vector newProbeLegacyTail{0x28, 0x01, static_cast(gateway), 0x11, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xFF}; prepareForQuery(); const auto usbResp = transact_(usbProbe.data(), usbProbe.size()); @@ -180,9 +182,11 @@ int DaliComm::checkGatewayType(int gateway) const { const auto legacyResp = transact_(legacyProbe.data(), legacyProbe.size()); if (legacyResp.size() >= 2 && legacyResp[0] == gateway) return 2; - prepareForQuery(); - const auto newResp = transact_(newProbe.data(), newProbe.size()); - if (newResp.size() >= 2 && newResp[0] == gateway) return 3; + for (const auto& probe : {newProbe, newProbeLegacyTail}) { + prepareForQuery(); + const auto newResp = transact_(probe.data(), probe.size()); + if (newResp.size() >= 2 && newResp[0] == gateway) return 3; + } return 0; }