Refactoring FirmwareInterface / EepromInterface

This commit is contained in:
bsongis
2014-04-18 16:27:27 +02:00
parent 7dd9e2d1e2
commit c5ac19a054
51 changed files with 810 additions and 1143 deletions
+9 -9
View File
@@ -18,13 +18,13 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
addLabel(gridLayout, tr("V1"), col++);
addLabel(gridLayout, tr("V2"), col++);
addLabel(gridLayout, tr("AND Switch"), col++);
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
addLabel(gridLayout, tr("Duration"), col++);
addLabel(gridLayout, tr("Delay"), col++);
}
lock = true;
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
// The label
QLabel * label = new QLabel(this);
label->setProperty("index", i);
@@ -90,7 +90,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int)));
gridLayout->addWidget(cswitchAnd[i], i+1, 4);
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
// Duration
cswitchDuration[i] = new QDoubleSpinBox(this);
cswitchDuration[i]->setProperty("index", i);
@@ -115,7 +115,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
}
}
// Push rows upward
addVSpring(gridLayout,0,GetEepromInterface()->getCapability(LogicalSwitches)+1);
addVSpring(gridLayout,0,GetCurrentFirmware()->getCapability(LogicalSwitches)+1);
lock = false;
}
@@ -276,7 +276,7 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
{
case LS_FAMILY_VOFS:
mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE;
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetCurrentFirmware()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
cswitchOffset[i]->setDecimals(range.decimals);
cswitchOffset[i]->setSingleStep(range.step);
if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
@@ -304,8 +304,8 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
break;
case LS_FAMILY_VCOMP:
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetCurrentFirmware()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetCurrentFirmware()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
break;
case LS_FAMILY_TIMER:
mask |= VALUE1_VISIBLE | VALUE2_VISIBLE;
@@ -331,7 +331,7 @@ void LogicalSwitchesPanel::updateLine(int i)
setSwitchWidgetVisibility(i);
lock = true;
populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw));
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
cswitchDuration[i]->setValue(model.customSw[i].duration/10.0);
cswitchDelay[i]->setValue(model.customSw[i].delay/10.0);
}
@@ -340,7 +340,7 @@ void LogicalSwitchesPanel::updateLine(int i)
void LogicalSwitchesPanel::update()
{
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
updateLine(i);
}
}