1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 00:05:17 +03:00

Issue #860 fixed

This commit is contained in:
bsongis 2014-03-25 19:18:28 +01:00
parent da292d3d4c
commit c5b0e79e99
3 changed files with 25 additions and 1 deletions

View file

@ -246,7 +246,7 @@ void CurveGroup::update()
if (lastType != curve.type) { if (lastType != curve.type) {
lastType = curve.type; lastType = curve.type;
curveValueCB->clear(); curveValueCB->clear();
for (int i=-numcurves; i<numcurves; i++) { for (int i=-numcurves; i<=numcurves; i++) {
curveValueCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, i).toString()); curveValueCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, i).toString());
} }
} }

View file

@ -18,6 +18,8 @@ Channels::Channels(QWidget * parent, ModelData & model):
addLabel(gridLayout, tr("Min"), col++); addLabel(gridLayout, tr("Min"), col++);
addLabel(gridLayout, tr("Max"), col++); addLabel(gridLayout, tr("Max"), col++);
addLabel(gridLayout, tr("Invert"), col++); addLabel(gridLayout, tr("Invert"), col++);
if (IS_TARANIS(GetEepromInterface()->getBoard()))
addLabel(gridLayout, tr("Curve"), col++);
if (GetEepromInterface()->getCapability(PPMCenter)) if (GetEepromInterface()->getCapability(PPMCenter))
addLabel(gridLayout, tr("Center"), col++); addLabel(gridLayout, tr("Center"), col++);
if (GetEepromInterface()->getCapability(SYMLimits)) if (GetEepromInterface()->getCapability(SYMLimits))
@ -88,6 +90,19 @@ Channels::Channels(QWidget * parent, ModelData & model):
connect(invCB, SIGNAL(currentIndexChanged(int)), this, SLOT(invEdited())); connect(invCB, SIGNAL(currentIndexChanged(int)), this, SLOT(invEdited()));
gridLayout->addWidget(invCB, i+1, col++, 1, 1); gridLayout->addWidget(invCB, i+1, col++, 1, 1);
// Curve
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
QComboBox * curveCB = new QComboBox(this);
curveCB->setProperty("index", i);
int numcurves = GetEepromInterface()->getCapability(NumCurves);
for (int j=-numcurves; j<=numcurves; j++) {
curveCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, j).toString(), j);
}
curveCB->setCurrentIndex(model.limitData[i].curve.value+numcurves);
connect(curveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(curveEdited()));
gridLayout->addWidget(curveCB, i+1, col++, 1, 1);
}
// PPM center // PPM center
if (GetEepromInterface()->getCapability(PPMCenter)) { if (GetEepromInterface()->getCapability(PPMCenter)) {
QSpinBox * center = new QSpinBox(this); QSpinBox * center = new QSpinBox(this);
@ -168,6 +183,14 @@ void Channels::invEdited()
emit modified(); emit modified();
} }
void Channels::curveEdited()
{
QComboBox *cb = qobject_cast<QComboBox*>(sender());
int index = cb->property("index").toInt();
model.limitData[index].curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, cb->itemData(cb->currentIndex()).toInt());
emit modified();
}
void Channels::ppmcenterEdited() void Channels::ppmcenterEdited()
{ {
QSpinBox *sb = qobject_cast<QSpinBox*>(sender()); QSpinBox *sb = qobject_cast<QSpinBox*>(sender());

View file

@ -18,6 +18,7 @@ class Channels : public ModelPanel
void minEdited(); void minEdited();
void maxEdited(); void maxEdited();
void invEdited(); void invEdited();
void curveEdited();
void ppmcenterEdited(); void ppmcenterEdited();
}; };