Companion Vario Sources were not in line with the firmware

This commit is contained in:
bsongis
2014-05-31 08:16:13 +02:00
parent 2c3866b6ef
commit 4acef445a3
7 changed files with 55 additions and 62 deletions
+19 -17
View File
@@ -589,24 +589,15 @@ void TelemetryPanel::setup()
ui->varioLimitMin_DSB->setValue(model.frsky.varioMin-10);
ui->varioLimitMax_DSB->setValue(model.frsky.varioMax+10);
ui->varioLimitCenterMax_DSB->setValue((model.frsky.varioCenterMax/10.0)+0.5);
ui->varioSourceCB->setCurrentIndex(model.frsky.varioSource);
if (model.frsky.varioCenterMin==-16) {
ui->varioLimitMinOff_ChkB->setChecked(true);
ui->varioLimitCenterMin_DSB->setValue(-2.0);
ui->varioLimitCenterMin_DSB->setDisabled(true);
} else {
}
else {
ui->varioLimitMinOff_ChkB->setChecked(false);
ui->varioLimitCenterMin_DSB->setValue((model.frsky.varioCenterMin/10.0)-0.5);
}
int mask=1;
for (int i=0; i< ui->varioSourceCB->count(); i++) {
if (!(varioCap&mask)) {
QModelIndex index = ui->varioSourceCB->model()->index(i, 0);
QVariant v(0);
ui->varioSourceCB->model()->setData(index, v, Qt::UserRole - 1);
}
mask <<=1;
}
}
if (!(firmware->getCapability(HasAltitudeSel)||firmware->getCapability(HasVario))) {
@@ -668,10 +659,27 @@ void TelemetryPanel::setup()
populateVoltsSource();
populateCurrentSource();
populateVarioSource();
lock = false;
}
void TelemetryPanel::populateVarioSource()
{
QUnsignedAutoComboBox * cb = ui->varioSourceCB;
cb->setField(&model.frsky.varioSource, this);
if (!IS_TARANIS(firmware->getBoard())) {
cb->addItem(tr("Alti"), TELEMETRY_VARIO_SOURCE_ALTI);
cb->addItem(tr("Alti+"), TELEMETRY_VARIO_SOURCE_ALTI_PLUS);
}
cb->addItem(tr("VSpeed"), TELEMETRY_VARIO_SOURCE_VSPEED);
cb->addItem(tr("A1"), TELEMETRY_VARIO_SOURCE_A1);
cb->addItem(tr("A2"), TELEMETRY_VARIO_SOURCE_A2);
if (IS_TARANIS(firmware->getBoard())) {
cb->addItem(tr("dTE"), TELEMETRY_VARIO_SOURCE_DTE);
}
}
void TelemetryPanel::populateVoltsSource()
{
QUnsignedAutoComboBox * cb = ui->frskyVoltCB;
@@ -762,12 +770,6 @@ void TelemetryPanel::on_AltitudeToolbar_ChkB_toggled(bool checked)
emit modified();
}
void TelemetryPanel::on_varioSourceCB_currentIndexChanged(int index)
{
model.frsky.varioSource = index;
emit modified();
}
void TelemetryPanel::on_varioLimitMin_DSB_editingFinished()
{
model.frsky.varioMin = round(ui->varioLimitMin_DSB->value()+10);