Companion support for FAS offset, Persistent mAh and Altitude in top bar

This commit is contained in:
Andre Bernet
2014-01-15 20:40:53 +01:00
parent ba9f55cb67
commit bea9c74243
6 changed files with 166 additions and 13 deletions
+43 -2
View File
@@ -375,8 +375,7 @@ void TelemetryPanel::setup()
ui->AltitudeGPS_ChkB->setChecked(model.frsky.FrSkyGpsAlt);
}
int varioCap=GetEepromInterface()->getCapability(HasVario);
// if (IS_TARANIS(GetEepromInterface()->getBoard())) {
if (false) {
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
ui->AltitudeToolbar_ChkB->setChecked(model.frsky.altitudeDisplayed);
} else {
ui->AltitudeToolbar_ChkB->hide();
@@ -481,6 +480,29 @@ void TelemetryPanel::setup()
} else {
ui->frskyProtoCB->addItem(tr("Winged Shadow How High (not supported)"));
}
ui->variousGB->hide();
if (!(GetEepromInterface()->getCapability(HasFasOffset)) && !(firmware_id.contains("fasoffset"))) {
ui->fasOffset_label->hide();
ui->fasOffset_DSB->hide();
} else {
ui->fasOffset_DSB->setValue(model.frsky.fasOffset/10.0);
ui->variousGB->show();
}
if (!(GetEepromInterface()->getCapability(HasMahPersistent))) {
ui->mahCount_label->hide();
ui->mahCount_SB->hide();
ui->mahCount_ChkB->hide();
} else {
if (model.frsky.mAhPersistent) {
ui->mahCount_ChkB->setChecked(true);
ui->mahCount_SB->setValue(model.frsky.storedMah);
} else {
ui->mahCount_SB->setDisabled(true);
}
ui->variousGB->show();
}
ui->frskyProtoCB->setCurrentIndex(model.frsky.usrProto);
ui->frskyUnitsCB->setCurrentIndex(model.frsky.imperial);
@@ -715,6 +737,25 @@ void TelemetryPanel::on_varioLimitCenterMax_DSB_editingFinished()
emit modified();
}
void TelemetryPanel::on_fasOffset_DSB_editingFinished()
{
model.frsky.fasOffset = ui->fasOffset_DSB->value()*10;
emit modified();
}
void TelemetryPanel::on_mahCount_SB_editingFinished()
{
model.frsky.storedMah = ui->mahCount_SB->value();
emit modified();
}
void TelemetryPanel::on_mahCount_ChkB_toggled(bool checked)
{
model.frsky.mAhPersistent = checked;
ui->mahCount_SB->setDisabled(!checked);
emit modified();
}
void TelemetryPanel::telBarUpdate()
{
int index;