1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00

LP-72 Wizard fixes for inputs, GPS and i2c devices

This commit is contained in:
Laurent Lalanne 2016-05-21 18:50:15 +02:00
parent c7f450f82e
commit b98452a374
7 changed files with 105 additions and 53 deletions

View File

@ -231,7 +231,8 @@ void ConnectionDiagram::setupGraphicsScene()
}
}
if (m_configSource->getInputType() == VehicleConfigurationSource::INPUT_SBUS) {
if ((m_configSource->getInputType() == VehicleConfigurationSource::INPUT_SBUS) &&
(m_configSource->getControllerType() != VehicleConfigurationSource::CONTROLLER_SPARKY2)) {
prefix = QString("flexi-%1").arg(prefix);
}
switch (m_configSource->getGpsType()) {

View File

@ -39,11 +39,14 @@ void AirSpeedPage::initializePage(VehicleConfigurationSource *settings)
{
// Enable all
setItemDisabled(-1, false);
if (settings->getInputType() == VehicleConfigurationSource::INPUT_SBUS ||
settings->getInputType() == VehicleConfigurationSource::INPUT_DSM ||
settings->getInputType() == VehicleConfigurationSource::INPUT_SRXL ||
settings->getInputType() == VehicleConfigurationSource::INPUT_HOTT_SUMD ||
settings->getInputType() == VehicleConfigurationSource::INPUT_EXBUS ||
bool isSparky = (getWizard()->getControllerType() == SetupWizard::CONTROLLER_SPARKY2);
if ((!isSparky && (settings->getInputType() == VehicleConfigurationSource::INPUT_SBUS ||
settings->getInputType() == VehicleConfigurationSource::INPUT_DSM ||
settings->getInputType() == VehicleConfigurationSource::INPUT_SRXL ||
settings->getInputType() == VehicleConfigurationSource::INPUT_HOTT_SUMD ||
settings->getInputType() == VehicleConfigurationSource::INPUT_EXBUS)) ||
settings->getGpsType() == VehicleConfigurationSource::GPS_UBX_FLEXI_I2CMAG) {
// Disable non estimated sensors if ports are taken by receivers or I2C Mag
setItemDisabled(VehicleConfigurationSource::AIRSPEED_EAGLETREE, true);
@ -64,12 +67,20 @@ bool AirSpeedPage::validatePage(SelectionItem *selectedItem)
void AirSpeedPage::setupSelection(Selection *selection)
{
QString i2cPortWarning = tr("Note: if previously selected input combinations use the Flexi-port for input, "
"only estimated airspeed will be available.\n\n");
QString i2cPortText = tr("Selecting this option will set your board's Flexi-Port in to I2C mode.");
if (getWizard()->getControllerType() == SetupWizard::CONTROLLER_SPARKY2) {
i2cPortWarning = tr("Note: if previously selected GPS with I2C auxMag, only estimated airspeed will be available.\n\n");
i2cPortText = tr("Selecting this option will enable your board's I2C-Port.");
}
selection->setTitle(tr("Airspeed Sensor Selection"));
selection->setText(tr("This part of the wizard will help you select and configure a way to obtain "
"airspeed data. Current firmware supports three methods to achieve this, one is a "
"software estimation technique and the other two utilize hardware sensors.\n\n"
"Note: if previously selected input combinations use the Flexi-port for input, "
"only estimated airspeed will be available.\n\n"));
"software estimation technique and the other two utilize hardware sensors.\n\n") + i2cPortWarning);
selection->addItem(tr("Estimated"),
tr("This option uses an intelligent estimation algorithm which utilizes the INS/GPS "
"to estimate wind speed and subtract it from ground speed obtained from the GPS.\n\n"
@ -80,15 +91,13 @@ void AirSpeedPage::setupSelection(Selection *selection)
selection->addItem(tr("EagleTree"),
tr("Select this option to use the Airspeed MicroSensor V3 from EagleTree, this is an accurate "
"airspeed sensor that includes on-board Temperature Compensation.\n\n"
"Selecting this option will set your board's Flexi-Port in to I2C mode."),
"airspeed sensor that includes on-board Temperature Compensation.\n\n") + i2cPortText,
"eagletree-speed-sensor",
SetupWizard::AIRSPEED_EAGLETREE);
selection->addItem(tr("MS4525 Based"),
tr("Select this option to use an airspeed sensor based on the MS4525DO pressure transducer "
"from Measurement Specialties. This includes the PixHawk sensor and their clones.\n\n"
"Selecting this option will set your board's Flexi-Port in to I2C mode."),
"from Measurement Specialties. This includes the PixHawk sensor and their clones.\n\n") + i2cPortText,
"ms4525-speed-sensor",
SetupWizard::AIRSPEED_MS4525);
}

View File

@ -41,8 +41,9 @@ void GpsPage::initializePage(VehicleConfigurationSource *settings)
setItemDisabled(-1, false);
// sbus is on rcvrport for sparky2, that leaves mainport/flexiport available for gps/auxmag
// it is not even possible to put sbus on mainport on sparky2 because hardware inverter is on rcvrport
// for sparky2: ppm, sbus, and dsm all attach to rcvrport by default
if ((settings->getInputType() == VehicleConfigurationSource::INPUT_SBUS && settings->getControllerType() != VehicleConfigurationSource::CONTROLLER_SPARKY2) ||
settings->getInputType() == VehicleConfigurationSource::INPUT_DSM ||
(settings->getInputType() == VehicleConfigurationSource::INPUT_DSM && settings->getControllerType() != VehicleConfigurationSource::CONTROLLER_SPARKY2) ||
settings->getInputType() == VehicleConfigurationSource::INPUT_HOTT_SUMD ||
settings->getInputType() == VehicleConfigurationSource::INPUT_EXBUS ||
settings->getInputType() == VehicleConfigurationSource::INPUT_SRXL) {
@ -66,6 +67,12 @@ bool GpsPage::validatePage(SelectionItem *selectedItem)
void GpsPage::setupSelection(Selection *selection)
{
QString i2cPortName = "FlexiPort.";
if (getWizard()->getControllerType() == SetupWizard::CONTROLLER_SPARKY2) {
i2cPortName = tr("I2C Port (under).");
}
selection->setTitle(tr("GPS Selection"));
selection->setText(tr("Please select the type of GPS you wish to use. As well as OpenPilot hardware, "
"3rd party GPSs are supported also, although please note that performance could "
@ -92,7 +99,7 @@ void GpsPage::setupSelection(Selection *selection)
selection->addItem(tr("U-Blox Based + Magnetometer"),
tr("Select this option for the generic U-Blox chipset based GPS + I2C Magnetometer.\n\n"
"GPS is connected to MainPort and two wires I2C to FlexiPort."),
"GPS is connected to MainPort and two wires I2C to ") + i2cPortName,
"generic-ublox-mag",
SetupWizard::GPS_UBX_FLEXI_I2CMAG);

View File

@ -70,6 +70,17 @@ bool InputPage::validatePage()
return true;
}
void InputPage::initializePage()
{
bool isSparky2 = (getWizard()->getControllerType() == SetupWizard::CONTROLLER_SPARKY2);
ui->pwmButton->setEnabled(!isSparky2);
if (ui->pwmButton->isChecked() && isSparky2) {
ui->pwmButton->setChecked(false);
ui->ppmButton->setChecked(true);
}
}
bool InputPage::restartNeeded(VehicleConfigurationSource::INPUT_TYPE selectedType)
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
@ -149,18 +160,19 @@ bool InputPage::restartNeeded(VehicleConfigurationSource::INPUT_TYPE selectedTyp
case VehicleConfigurationSource::INPUT_SBUS:
return data.SPK2_RcvrPort != HwSettings::SPK2_RCVRPORT_SBUS;
case VehicleConfigurationSource::INPUT_HOTT_SUMD:
return data.SPK2_FlexiPort != HwSettings::SPK2_FLEXIPORT_HOTTSUMD;
case VehicleConfigurationSource::INPUT_EXBUS:
return data.SPK2_FlexiPort != HwSettings::SPK2_FLEXIPORT_EXBUS;
case VehicleConfigurationSource::INPUT_SRXL:
return data.SPK2_FlexiPort != HwSettings::SPK2_FLEXIPORT_SRXL;
case VehicleConfigurationSource::INPUT_DSM:
// TODO: Handle all of the DSM types ?? Which is most common?
return data.SPK2_MainPort != HwSettings::SPK2_MAINPORT_DSM;
return data.SPK2_MainPort != HwSettings::SPK2_RCVRPORT_DSM;
// TODO, Sparky2: Move Hott and Exbus to Receiver port.
case VehicleConfigurationSource::INPUT_HOTT_SUMD:
return data.RM_FlexiPort != HwSettings::RM_FLEXIPORT_HOTTSUMD;
case VehicleConfigurationSource::INPUT_EXBUS:
return data.RM_FlexiPort != HwSettings::RM_FLEXIPORT_EXBUS;
default: return true;
}

View File

@ -41,6 +41,7 @@ public:
explicit InputPage(SetupWizard *wizard, QWidget *parent = 0);
~InputPage();
bool validatePage();
void initializePage();
private:
bool restartNeeded(VehicleConfigurationSource::INPUT_TYPE selectedType);

View File

@ -469,10 +469,10 @@ QString SetupWizard::getSummaryText()
summary.append(tr("Software Estimated"));
break;
case AIRSPEED_EAGLETREE:
summary.append(tr("EagleTree on Flexi-Port"));
(getControllerType() == CONTROLLER_SPARKY2) ? summary.append(tr("EagleTree on I2C-Port")) : summary.append(tr("EagleTree on Flexi-Port"));
break;
case AIRSPEED_MS4525:
summary.append(tr("MS4525 based on Flexi-Port"));
(getControllerType() == CONTROLLER_SPARKY2) ? summary.append(tr("MS4525 based on I2C-Port")) : summary.append(tr("MS4525 based on Flexi-Port"));
break;
default:
summary.append(tr("Unknown"));

View File

@ -189,29 +189,32 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
case VehicleConfigurationSource::CONTROLLER_SPARKY2:
case VehicleConfigurationSource::CONTROLLER_DISCOVERYF4:
// Reset all ports to their defaults
data.RM_RcvrPort = HwSettings::RM_RCVRPORT_DISABLED;
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DISABLED;
data.RM_RcvrPort = HwSettings::RM_RCVRPORT_DISABLED;
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DISABLED;
data.SPK2_RcvrPort = HwSettings::SPK2_RCVRPORT_DISABLED;
data.SPK2_FlexiPort = HwSettings::SPK2_FLEXIPORT_DISABLED;
// Revo/Sparky2 uses inbuilt Modem do not set mainport to be active telemetry link for Revo/Sparky2
if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO
|| m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_SPARKY2) {
if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) {
data.RM_MainPort = HwSettings::RM_MAINPORT_DISABLED;
data.RM_MainPort = HwSettings::SPK2_MAINPORT_DISABLED;
} else if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_SPARKY2) {
data.SPK2_MainPort = HwSettings::SPK2_MAINPORT_DISABLED;
} else {
data.RM_MainPort = HwSettings::RM_MAINPORT_TELEMETRY;
}
switch (m_configSource->getInputType()) {
case VehicleConfigurationSource::INPUT_PWM:
data.RM_RcvrPort = HwSettings::RM_RCVRPORT_PWM;
data.RM_RcvrPort = HwSettings::RM_RCVRPORT_PWM;
// this should not happen, sparky2 does not allow pwm
data.SPK2_RcvrPort = HwSettings::SPK2_RCVRPORT_DISABLED;
break;
case VehicleConfigurationSource::INPUT_PPM:
data.RM_RcvrPort = HwSettings::RM_RCVRPORT_PPM;
data.SPK2_RcvrPort = HwSettings::SPK2_RCVRPORT_PPM;
if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_SPARKY2) {
data.SPK2_RcvrPort = HwSettings::SPK2_RCVRPORT_PPM;
} else {
data.RM_RcvrPort = HwSettings::RM_RCVRPORT_PPM;
}
break;
case VehicleConfigurationSource::INPUT_SBUS:
if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_SPARKY2) {
@ -225,19 +228,25 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
}
break;
case VehicleConfigurationSource::INPUT_DSM:
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DSM;
data.SPK2_FlexiPort = HwSettings::SPK2_FLEXIPORT_DSM;
if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_SPARKY2) {
data.SPK2_RcvrPort = HwSettings::SPK2_RCVRPORT_DSM;
} else {
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DSM;
}
break;
case VehicleConfigurationSource::INPUT_SRXL:
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_SRXL;
data.SPK2_FlexiPort = HwSettings::SPK2_FLEXIPORT_SRXL;
if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_SPARKY2) {
data.SPK2_RcvrPort = HwSettings::SPK2_RCVRPORT_SRXL;
} else {
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_SRXL;
}
break;
case VehicleConfigurationSource::INPUT_HOTT_SUMD:
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_HOTTSUMD;
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_HOTTSUMD;
data.SPK2_FlexiPort = HwSettings::SPK2_FLEXIPORT_HOTTSUMD;
break;
case VehicleConfigurationSource::INPUT_EXBUS:
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_EXBUS;
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_EXBUS;
data.SPK2_FlexiPort = HwSettings::SPK2_FLEXIPORT_EXBUS;
break;
default:
@ -250,11 +259,13 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
// if using GPS and SBUS on Revo or Nano, we must use FlexiPort for GPS
// since we must use MainPort for SBUS
if (m_configSource->getInputType() == VehicleConfigurationSource::INPUT_SBUS
&& m_configSource->getControllerType() != VehicleConfigurationSource::CONTROLLER_SPARKY2) {
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_GPS;
if (m_configSource->getControllerType() != VehicleConfigurationSource::CONTROLLER_SPARKY2) {
if (m_configSource->getInputType() == VehicleConfigurationSource::INPUT_SBUS) {
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_GPS;
} else {
data.RM_MainPort = HwSettings::RM_MAINPORT_GPS;
}
} else {
data.RM_MainPort = HwSettings::RM_MAINPORT_GPS;
data.SPK2_MainPort = HwSettings::SPK2_MAINPORT_GPS;
}
@ -299,14 +310,19 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
}
case VehicleConfigurationSource::GPS_UBX_FLEXI_I2CMAG:
{
gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_UBX;
gpsData.UbxAutoConfig = GPSSettings::UBXAUTOCONFIG_AUTOBAUDANDCONFIGURE;
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_I2C;
data.SPK2_FlexiPort = HwSettings::SPK2_FLEXIPORT_I2C;
AuxMagSettings *magSettings = AuxMagSettings::GetInstance(m_uavoManager);
Q_ASSERT(magSettings);
AuxMagSettings::DataFields magsData = magSettings->getData();
magsData.Type = AuxMagSettings::TYPE_FLEXI;
gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_UBX;
gpsData.UbxAutoConfig = GPSSettings::UBXAUTOCONFIG_AUTOBAUDANDCONFIGURE;
if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_SPARKY2) {
data.SPK2_I2CPort = HwSettings::SPK2_I2CPORT_I2C;
magsData.Type = AuxMagSettings::TYPE_EXT;
} else {
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_I2C;
magsData.Type = AuxMagSettings::TYPE_FLEXI;
}
magsData.Usage = AuxMagSettings::USAGE_AUXONLY;
magSettings->setData(magsData);
addModifiedObject(magSettings, tr("Writing I2C Mag sensor settings"));
@ -336,16 +352,22 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
break;
case VehicleConfigurationSource::AIRSPEED_EAGLETREE:
data.OptionalModules[HwSettings::OPTIONALMODULES_AIRSPEED] = 1;
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_I2C;
// sparky2: put I2C airspeed on flexiport, but it could be put on i2cport
data.SPK2_FlexiPort = HwSettings::SPK2_FLEXIPORT_I2C;
if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_SPARKY2) {
// sparky2: put I2C airspeed on flexiport, but it could be put on i2cport
data.SPK2_FlexiPort = HwSettings::SPK2_FLEXIPORT_I2C;
} else {
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_I2C;
}
airspeedData.AirspeedSensorType = AirspeedSettings::AIRSPEEDSENSORTYPE_EAGLETREEAIRSPEEDV3;
break;
case VehicleConfigurationSource::AIRSPEED_MS4525:
data.OptionalModules[HwSettings::OPTIONALMODULES_AIRSPEED] = 1;
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_I2C;
// sparky2: put I2C airspeed on flexiport, but it could be put on i2cport
data.SPK2_FlexiPort = HwSettings::SPK2_FLEXIPORT_I2C;
if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_SPARKY2) {
// sparky2: put I2C airspeed on flexiport, but it could be put on i2cport
data.SPK2_FlexiPort = HwSettings::SPK2_FLEXIPORT_I2C;
} else {
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_I2C;
}
airspeedData.AirspeedSensorType = AirspeedSettings::AIRSPEEDSENSORTYPE_PIXHAWKAIRSPEEDMS4525DO;
break;
default: