From 860077c428f5955ca1b95e79fb2d7f32125c76dd Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Thu, 11 Apr 2013 21:25:38 +0200 Subject: [PATCH] OP-816 Added Revolution specific configuration code to Setup Wizard. --- .../plugins/setupwizard/pages/inputpage.cpp | 50 ++++++++++++++----- .../src/plugins/setupwizard/setupwizard.cpp | 2 +- .../vehicleconfigurationhelper.cpp | 6 +++ 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/inputpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/inputpage.cpp index 607df838a..bfa83ba7e 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/inputpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/inputpage.cpp @@ -74,18 +74,42 @@ bool InputPage::restartNeeded(VehicleConfigurationSource::INPUT_TYPE selectedTyp Q_ASSERT(uavoManager); HwSettings* hwSettings = HwSettings::GetInstance(uavoManager); HwSettings::DataFields data = hwSettings->getData(); - switch(selectedType) - { - case VehicleConfigurationSource::INPUT_PWM: - return data.CC_RcvrPort != HwSettings::CC_RCVRPORT_PWM; - case VehicleConfigurationSource::INPUT_PPM: - return data.CC_RcvrPort != HwSettings::CC_RCVRPORT_PPM; - case VehicleConfigurationSource::INPUT_SBUS: - return data.CC_MainPort != HwSettings::CC_MAINPORT_SBUS; - case VehicleConfigurationSource::INPUT_DSM2: - // TODO: Handle all of the DSM types ?? Which is most common? - return data.CC_MainPort != HwSettings::CC_MAINPORT_DSM2; - default: - return true; + switch(getWizard()->getControllerType()) { + case SetupWizard::CONTROLLER_CC: + case SetupWizard::CONTROLLER_CC3D: + { + switch(selectedType) + { + case VehicleConfigurationSource::INPUT_PWM: + return data.CC_RcvrPort != HwSettings::CC_RCVRPORT_PWM; + case VehicleConfigurationSource::INPUT_PPM: + return data.CC_RcvrPort != HwSettings::CC_RCVRPORT_PPM; + case VehicleConfigurationSource::INPUT_SBUS: + return data.CC_MainPort != HwSettings::CC_MAINPORT_SBUS; + case VehicleConfigurationSource::INPUT_DSM2: + // TODO: Handle all of the DSM types ?? Which is most common? + return data.CC_MainPort != HwSettings::CC_MAINPORT_DSM2; + default: return true; + } + break; + } + case SetupWizard::CONTROLLER_REVO: + { + switch(selectedType) + { + case VehicleConfigurationSource::INPUT_PWM: + return data.RM_RcvrPort != HwSettings::CC_RCVRPORT_PWM; + case VehicleConfigurationSource::INPUT_PPM: + return data.RM_RcvrPort != HwSettings::CC_RCVRPORT_PPM; + case VehicleConfigurationSource::INPUT_SBUS: + return data.RM_MainPort != HwSettings::CC_MAINPORT_SBUS; + case VehicleConfigurationSource::INPUT_DSM2: + // TODO: Handle all of the DSM types ?? Which is most common? + return data.RM_MainPort != HwSettings::CC_MAINPORT_DSM2; + default: return true; + } + break; + } + default: return true; } } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp index d6b6bb86b..e3061f8ad 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp @@ -81,8 +81,8 @@ int SetupWizard::nextId() const { case CONTROLLER_CC: case CONTROLLER_CC3D: - return PAGE_INPUT; case CONTROLLER_REVO: + return PAGE_INPUT; case CONTROLLER_OPLINK: default: return PAGE_NOTYETIMPLEMENTED; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp index a4d51294a..82b09200f 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp @@ -260,11 +260,17 @@ void VehicleConfigurationHelper::applyActuatorConfiguration() switch(m_configSource->getVehicleSubType()) { case VehicleConfigurationSource::MULTI_ROTOR_TRI_Y: data.ChannelUpdateFreq[0] = updateFrequence; + if(m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) { + data.ChannelUpdateFreq[1] = updateFrequence; + } break; case VehicleConfigurationSource::MULTI_ROTOR_QUAD_X: case VehicleConfigurationSource::MULTI_ROTOR_QUAD_PLUS: data.ChannelUpdateFreq[0] = updateFrequence; data.ChannelUpdateFreq[1] = updateFrequence; + if(m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) { + data.ChannelUpdateFreq[2] = updateFrequence; + } break; case VehicleConfigurationSource::MULTI_ROTOR_HEXA: case VehicleConfigurationSource::MULTI_ROTOR_HEXA_COAX_Y: