1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-26 15:54:15 +01:00

Merged in f5soh/librepilot/laurent/LP-120_Wizard_I2C_mag (pull request #110)

LP-120 Add GPS+I2c mag to wizard
This commit is contained in:
Lalanne Laurent 2015-11-05 18:13:51 +01:00
commit 8d6b89818f
8 changed files with 2192 additions and 933 deletions

View File

@ -234,6 +234,9 @@ void ConnectionDiagram::setupGraphicsScene()
case VehicleConfigurationSource::GPS_UBX:
elementsToShow << QString("%1OPGPS-v8-ublox").arg(prefix);
break;
case VehicleConfigurationSource::GPS_UBX_FLEXI_I2CMAG:
elementsToShow << QString("%1generic-ublox-mag").arg(prefix);
break;
default:
break;
}

View File

@ -40,8 +40,10 @@ void AirSpeedPage::initializePage(VehicleConfigurationSource *settings)
// Enable all
setItemDisabled(-1, false);
if (settings->getInputType() == VehicleConfigurationSource::INPUT_SBUS ||
settings->getInputType() == VehicleConfigurationSource::INPUT_DSM) {
// Disable non estimated sensors if ports are taken by receivers
settings->getInputType() == VehicleConfigurationSource::INPUT_DSM ||
settings->getInputType() == VehicleConfigurationSource::INPUT_SRXL ||
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);
setItemDisabled(VehicleConfigurationSource::AIRSPEED_MS4525, true);
if (getSelectedItem()->id() == VehicleConfigurationSource::AIRSPEED_EAGLETREE ||

View File

@ -37,7 +37,18 @@ GpsPage::~GpsPage()
void GpsPage::initializePage(VehicleConfigurationSource *settings)
{
Q_UNUSED(settings);
// Enable all
setItemDisabled(-1, false);
if (settings->getInputType() == VehicleConfigurationSource::INPUT_SBUS ||
settings->getInputType() == VehicleConfigurationSource::INPUT_DSM ||
settings->getInputType() == VehicleConfigurationSource::INPUT_SRXL) {
// Disable GPS+I2C Mag
setItemDisabled(VehicleConfigurationSource::GPS_UBX_FLEXI_I2CMAG, true);
if (getSelectedItem()->id() == VehicleConfigurationSource::GPS_UBX_FLEXI_I2CMAG) {
// If previously selected invalid GPS, reset to no GPS
setSelectedItem(VehicleConfigurationSource::GPS_DISABLED);
}
}
}
bool GpsPage::validatePage(SelectionItem *selectedItem)
@ -70,6 +81,12 @@ void GpsPage::setupSelection(Selection *selection)
"OPGPS-v9",
SetupWizard::GPS_PLATINUM);
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."),
"generic-ublox-mag",
SetupWizard::GPS_UBX_FLEXI_I2CMAG);
selection->addItem(tr("U-Blox Based"),
tr("Select this option for the OpenPilot V8 GPS or generic U-Blox chipset based GPS."),
"OPGPS-v8-ublox",

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 3.0 MiB

After

Width:  |  Height:  |  Size: 3.0 MiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 424 KiB

After

Width:  |  Height:  |  Size: 485 KiB

View File

@ -377,6 +377,9 @@ QString SetupWizard::getSummaryText()
case INPUT_DSM:
summary.append(tr("Spektrum Satellite"));
break;
case INPUT_SRXL:
summary.append(tr("Multiplex SRXL"));
break;
default:
summary.append(tr("Unknown"));
}
@ -425,6 +428,9 @@ QString SetupWizard::getSummaryText()
case GPS_PLATINUM:
summary.append(tr("OpenPilot Platinum"));
break;
case GPS_UBX_FLEXI_I2CMAG:
summary.append(tr("Generic UBLOX + I2C Magnetometer"));
break;
case GPS_UBX:
summary.append(tr("OpenPilot v8 or Generic UBLOX GPS"));
break;

View File

@ -159,13 +159,16 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
}
break;
case VehicleConfigurationSource::INPUT_SBUS:
// We have to set teletry on flexport since s.bus needs the mainport.
// We have to set teletry on flexiport since s.bus needs the mainport.
data.CC_MainPort = HwSettings::CC_MAINPORT_SBUS;
data.CC_FlexiPort = HwSettings::CC_FLEXIPORT_TELEMETRY;
break;
case VehicleConfigurationSource::INPUT_DSM:
data.CC_FlexiPort = HwSettings::CC_FLEXIPORT_DSM;
break;
case VehicleConfigurationSource::INPUT_SRXL:
data.CC_FlexiPort = HwSettings::CC_FLEXIPORT_SRXL;
break;
default:
break;
}
@ -193,7 +196,7 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
break;
case VehicleConfigurationSource::INPUT_SBUS:
data.RM_MainPort = HwSettings::RM_MAINPORT_SBUS;
// We have to set telemetry on flexport since s.bus needs the mainport on all but Revo.
// We have to set telemetry on flexiport since s.bus needs the mainport on all but Revo.
if (m_configSource->getControllerType() != VehicleConfigurationSource::CONTROLLER_REVO) {
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_TELEMETRY;
}
@ -238,11 +241,26 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
AuxMagSettings *magSettings = AuxMagSettings::GetInstance(m_uavoManager);
Q_ASSERT(magSettings);
AuxMagSettings::DataFields magsData = magSettings->getData();
magsData.Type = AuxMagSettings::TYPE_GPSV9;
magsData.Usage = AuxMagSettings::USAGE_AUXONLY;
magSettings->setData(magsData);
addModifiedObject(magSettings, tr("Writing External Mag sensor settings"));
break;
}
case VehicleConfigurationSource::GPS_UBX_FLEXI_I2CMAG:
{
gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_UBX;
gpsData.UbxAutoConfig = GPSSettings::UBXAUTOCONFIG_AUTOBAUDANDCONFIGURE;
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_I2C;
AuxMagSettings *magSettings = AuxMagSettings::GetInstance(m_uavoManager);
Q_ASSERT(magSettings);
AuxMagSettings::DataFields magsData = magSettings->getData();
magsData.Type = AuxMagSettings::TYPE_FLEXI;
magsData.Usage = AuxMagSettings::USAGE_AUXONLY;
magSettings->setData(magsData);
addModifiedObject(magSettings, tr("Writing I2C Mag sensor settings"));
}
case VehicleConfigurationSource::GPS_DISABLED:
// Should not be able to reach here
break;

View File

@ -68,7 +68,7 @@ public:
enum SERVO_TYPE { SERVO_ANALOG, SERVO_DIGITAL, SERVO_UNKNOWN };
enum INPUT_TYPE { INPUT_PWM, INPUT_PPM, INPUT_SBUS, INPUT_DSM, INPUT_SRXL, INPUT_UNKNOWN };
enum AIRSPEED_TYPE { AIRSPEED_ESTIMATE, AIRSPEED_EAGLETREE, AIRSPEED_MS4525, AIRSPEED_DISABLED };
enum GPS_TYPE { GPS_PLATINUM, GPS_UBX, GPS_NMEA, GPS_DISABLED };
enum GPS_TYPE { GPS_PLATINUM, GPS_UBX_FLEXI_I2CMAG, GPS_UBX, GPS_NMEA, GPS_DISABLED };
enum RADIO_SETTING { RADIO_TELEMETRY, RADIO_DISABLED };
virtual VehicleConfigurationSource::CONTROLLER_TYPE getControllerType() const = 0;