From 6aae99ff05e69da74d2ad979172a5c044310533d Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Mon, 8 Oct 2018 15:29:11 -0300 Subject: [PATCH] APMAutoPilotPlugin: update to use versionCompare() --- src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc index c0f218d9a..225433194 100644 --- a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc @@ -72,7 +72,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) } // No flight modes component for Sub versions 3.5 and up - if (!_vehicle->sub() || (_vehicle->firmwareMajorVersion() == 3 && _vehicle->firmwareMinorVersion() <= 4)) { + if (!_vehicle->sub() || (_vehicle->versionCompare(3, 5, 0) < 0)) { _flightModesComponent = new APMFlightModesComponent(_vehicle, this); _flightModesComponent->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_flightModesComponent)); @@ -86,8 +86,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) _powerComponent->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_powerComponent)); - int versionInt = _vehicle->firmwareMajorVersion() * 100 + _vehicle->firmwareMinorVersion() * 10 + _vehicle->firmwarePatchVersion(); - if (_vehicle->sub() && versionInt >= 353) { + if (_vehicle->sub() && _vehicle->versionCompare(3, 5, 3) >= 0) { _motorComponent = new APMMotorComponent(_vehicle, this); _motorComponent->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_motorComponent)); @@ -116,7 +115,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) _lightsComponent->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_lightsComponent)); - if(_vehicle->firmwareMajorVersion() > 3 || (_vehicle->firmwareMajorVersion() == 3 && _vehicle->firmwareMinorVersion() >= 5)) { + if(_vehicle->versionCompare(3, 5, 0) >= 0) { _subFrameComponent = new APMSubFrameComponent(_vehicle, this); _subFrameComponent->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_subFrameComponent)); -- 2.22.0