Skip to content

Commit

Permalink
sensor: ping360: Improve test to check for firmware version over 3.3.0
Browse files Browse the repository at this point in the history
The newer firmwares come with async mode

Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric authored and joaoantoniocardoso committed Nov 29, 2023
1 parent 640c148 commit 578c795
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/sensor/ping360.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <QStringList>
#include <QThread>
#include <QUrl>
#include <QVersionNumber>

#include "hexvalidator.h"
#include "link/seriallink.h"
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 578c795

Please sign in to comment.