From 9d53b68ab8614345468e2d421559eb1ae0d89698 Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Sun, 7 Apr 2013 11:52:33 +0200 Subject: [PATCH] OP-816 Added settings enums for GPS and Revolution Radio modem. Added basic hardware settings implementation for Revolution board. --- .../src/plugins/setupwizard/setupwizard.h | 9 +++++ .../vehicleconfigurationhelper.cpp | 33 ++++++++++++++++++- .../setupwizard/vehicleconfigurationsource.h | 6 ++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h index 3f3c93f46..5fe791522 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h @@ -58,6 +58,12 @@ public: void setESCType(SetupWizard::ESC_TYPE type) { m_escType = type; } SetupWizard::ESC_TYPE getESCType() const { return m_escType; } + void setGPSSetting(SetupWizard::GPS_SETTING setting) { m_gpsSetting = setting; } + SetupWizard::GPS_SETTING getGPSSetting() const {return m_gpsSetting;} + + void setRadioSetting(SetupWizard::RADIO_SETTING setting) { m_radioSetting = setting; } + SetupWizard::RADIO_SETTING getRadioSetting() const {return m_radioSetting;} + void setLevellingBias(accelGyroBias bias) { m_levellingBias = bias; m_levellingPerformed = true; } bool isLevellingPerformed() const { return m_levellingPerformed; } accelGyroBias getLevellingBias() const { return m_levellingBias; } @@ -96,6 +102,9 @@ private: INPUT_TYPE m_inputType; ESC_TYPE m_escType; + GPS_SETTING m_gpsSetting; + RADIO_SETTING m_radioSetting; + bool m_levellingPerformed; accelGyroBias m_levellingBias; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp index d62fdd1e3..a4d51294a 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp @@ -141,7 +141,38 @@ void VehicleConfigurationHelper::applyHardwareConfiguration() } break; case VehicleConfigurationSource::CONTROLLER_REVO: - // TODO: Implement Revo settings + // Reset all ports + data.RM_RcvrPort = HwSettings::RM_RCVRPORT_DISABLED; + + //Default mainport to be active telemetry link + data.RM_MainPort = HwSettings::RM_MAINPORT_TELEMETRY; + + data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DISABLED; + switch(m_configSource->getInputType()) + { + case VehicleConfigurationSource::INPUT_PWM: + data.RM_RcvrPort = HwSettings::RM_RCVRPORT_PWM; + break; + case VehicleConfigurationSource::INPUT_PPM: + data.RM_RcvrPort = HwSettings::RM_RCVRPORT_PPM; + break; + case VehicleConfigurationSource::INPUT_SBUS: + // We have to set teletry on flexport since s.bus needs the mainport. + data.RM_MainPort = HwSettings::RM_MAINPORT_SBUS; + data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_TELEMETRY; + break; + case VehicleConfigurationSource::INPUT_DSMX10: + data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DSMX10BIT; + break; + case VehicleConfigurationSource::INPUT_DSMX11: + data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DSMX11BIT; + break; + case VehicleConfigurationSource::INPUT_DSM2: + data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DSM2; + break; + default: + break; + } break; default: break; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationsource.h b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationsource.h index 5bb15ceb0..ebe23a33f 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationsource.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationsource.h @@ -65,12 +65,18 @@ public: enum ESC_TYPE {ESC_RAPID, ESC_LEGACY, ESC_UNKNOWN}; enum INPUT_TYPE {INPUT_PWM, INPUT_PPM, INPUT_SBUS, INPUT_DSMX10, INPUT_DSMX11, INPUT_DSM2, INPUT_UNKNOWN}; + enum GPS_SETTING {GPS_UBX, GPS_NMEA, GPS_DISABLED}; + enum RADIO_SETTING {RADIO_TELEMETRY, RADIO_DISABLED}; + virtual VehicleConfigurationSource::CONTROLLER_TYPE getControllerType() const = 0; virtual VehicleConfigurationSource::VEHICLE_TYPE getVehicleType() const = 0; virtual VehicleConfigurationSource::VEHICLE_SUB_TYPE getVehicleSubType() const = 0; virtual VehicleConfigurationSource::INPUT_TYPE getInputType() const = 0; virtual VehicleConfigurationSource::ESC_TYPE getESCType() const = 0; + virtual VehicleConfigurationSource::GPS_SETTING getGPSSetting() const = 0; + virtual VehicleConfigurationSource::RADIO_SETTING getRadioSetting() const = 0; + virtual bool isLevellingPerformed() const = 0; virtual accelGyroBias getLevellingBias() const = 0;