Telemetry Volts and Current sources (RxBatt, A3, A4) now available in

Companion. QAutoComboBox introduced to simplify code
This commit is contained in:
bsongis
2014-05-25 09:43:54 +02:00
parent 09d49126a4
commit 2fd1f575ba
8 changed files with 168 additions and 69 deletions
+35 -15
View File
@@ -655,10 +655,42 @@ void TelemetryPanel::setup()
ui->frskyProtoCB->setCurrentIndex(model.frsky.usrProto);
ui->frskyUnitsCB->setCurrentIndex(model.frsky.imperial);
ui->bladesCount->setValue(model.frsky.blades);
ui->frskyCurrentCB->setCurrentIndex(model.frsky.currentSource);
ui->frskyVoltCB->setCurrentIndex(model.frsky.voltsSource);
lock=false;
populateVoltsSource();
populateCurrentSource();
lock = false;
}
void TelemetryPanel::populateVoltsSource()
{
QUnsignedAutoComboBox * cb = ui->frskyVoltCB;
cb->setField(&model.frsky.voltsSource, this);
if (IS_ARM(firmware->getBoard())) {
cb->addItem(tr("RxBatt"), TELEMETRY_VOLTS_SOURCE_RXBATT);
}
cb->addItem(tr("A1"), TELEMETRY_VOLTS_SOURCE_A1);
cb->addItem(tr("A2"), TELEMETRY_VOLTS_SOURCE_A2);
if (IS_ARM(firmware->getBoard())) {
cb->addItem(tr("A3"), TELEMETRY_VOLTS_SOURCE_A3);
cb->addItem(tr("A4"), TELEMETRY_VOLTS_SOURCE_A4);
}
cb->addItem(tr("FAS"), TELEMETRY_VOLTS_SOURCE_FAS);
cb->addItem(tr("Cells"), TELEMETRY_VOLTS_SOURCE_CELLS);
}
void TelemetryPanel::populateCurrentSource()
{
QUnsignedAutoComboBox * cb = ui->frskyCurrentCB;
cb->setField(&model.frsky.currentSource, this);
cb->addItem(tr("---"), TELEMETRY_CURRENT_SOURCE_NONE);
cb->addItem(tr("A1"), TELEMETRY_CURRENT_SOURCE_A1);
cb->addItem(tr("A2"), TELEMETRY_CURRENT_SOURCE_A2);
if (IS_ARM(firmware->getBoard())) {
cb->addItem(tr("A3"), TELEMETRY_CURRENT_SOURCE_A3);
cb->addItem(tr("A4"), TELEMETRY_CURRENT_SOURCE_A4);
}
cb->addItem(tr("FAS"), TELEMETRY_CURRENT_SOURCE_FAS);
}
void TelemetryPanel::onAnalogModified()
@@ -678,18 +710,6 @@ void TelemetryPanel::on_bladesCount_editingFinished()
emit modified();
}
void TelemetryPanel::on_frskyCurrentCB_currentIndexChanged(int index)
{
model.frsky.currentSource=index;
emit modified();
}
void TelemetryPanel::on_frskyVoltCB_currentIndexChanged(int index)
{
model.frsky.voltsSource=index;
emit modified();
}
void TelemetryPanel::on_frskyProtoCB_currentIndexChanged(int index)
{
model.frsky.usrProto = index;