Commit 6aae99ff authored by Willian Galvani's avatar Willian Galvani

APMAutoPilotPlugin: update to use versionCompare()

parent 158fd4e5
...@@ -72,7 +72,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) ...@@ -72,7 +72,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void)
} }
// No flight modes component for Sub versions 3.5 and up // 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 = new APMFlightModesComponent(_vehicle, this);
_flightModesComponent->setupTriggerSignals(); _flightModesComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_flightModesComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_flightModesComponent));
...@@ -86,8 +86,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) ...@@ -86,8 +86,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void)
_powerComponent->setupTriggerSignals(); _powerComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_powerComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_powerComponent));
int versionInt = _vehicle->firmwareMajorVersion() * 100 + _vehicle->firmwareMinorVersion() * 10 + _vehicle->firmwarePatchVersion(); if (_vehicle->sub() && _vehicle->versionCompare(3, 5, 3) >= 0) {
if (_vehicle->sub() && versionInt >= 353) {
_motorComponent = new APMMotorComponent(_vehicle, this); _motorComponent = new APMMotorComponent(_vehicle, this);
_motorComponent->setupTriggerSignals(); _motorComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_motorComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_motorComponent));
...@@ -116,7 +115,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) ...@@ -116,7 +115,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void)
_lightsComponent->setupTriggerSignals(); _lightsComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_lightsComponent)); _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 = new APMSubFrameComponent(_vehicle, this);
_subFrameComponent->setupTriggerSignals(); _subFrameComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_subFrameComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_subFrameComponent));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment