From 578c7955808d05670b5ab658bb8564f26a383402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Wed, 29 Nov 2023 07:38:05 -0300 Subject: [PATCH] sensor: ping360: Improve test to check for firmware version over 3.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The newer firmwares come with async mode Signed-off-by: Patrick José Pereira --- src/sensor/ping360.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/sensor/ping360.cpp b/src/sensor/ping360.cpp index e428182b6..cd1bbff08 100644 --- a/src/sensor/ping360.cpp +++ b/src/sensor/ping360.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include "hexvalidator.h" #include "link/seriallink.h" @@ -99,19 +100,17 @@ Ping360::Ping360() }); connect(this, &Ping360::firmwareVersionMinorChanged, this, [this] { - qCDebug(PING_PROTOCOL_PING360) << "Firmware version:" - << _commonVariables.deviceInformation.firmware_version_major - << _commonVariables.deviceInformation.firmware_version_minor - << _commonVariables.deviceInformation.firmware_version_patch; + QVersionNumber version(_commonVariables.deviceInformation.firmware_version_major, + _commonVariables.deviceInformation.firmware_version_minor, + _commonVariables.deviceInformation.firmware_version_patch); + qCDebug(PING_PROTOCOL_PING360) << "Firmware version:" << version; // Wait for firmware information to be available before looking for new versions static bool once = false; if (!once && _commonVariables.deviceInformation.initialized) { once = true; - if (_commonVariables.deviceInformation.firmware_version_major == 3 - && _commonVariables.deviceInformation.firmware_version_minor == 3 - && _commonVariables.deviceInformation.firmware_version_patch == 1) { + if (version > QVersionNumber(3, 3, 0)) { _profileRequestLogic.type = Ping360RequestStateStruct::Type::AutoTransmitAsync; } else { _profileRequestLogic.type = Ping360RequestStateStruct::Type::Legacy;