mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 14:25:11 +03:00
Fixes #1596
Conflicts: companion/src/firmwares/opentx/opentxeeprom.cpp More EEPROM saving in Mixes
This commit is contained in:
parent
2f3664145d
commit
1721fd635e
7 changed files with 216 additions and 61 deletions
|
@ -633,7 +633,7 @@ void concatGvarParam(int & gvar, const int _gvar, const unsigned int _gvarParam,
|
||||||
|
|
||||||
void exportGvarParam(const int gvar, int & _gvar, int version)
|
void exportGvarParam(const int gvar, int & _gvar, int version)
|
||||||
{
|
{
|
||||||
int GV1 = (version >= 216 ? 4096 : 512);
|
int GV1 = (version >= 217 ? 1024 : (version >= 216 ? 4096 : 512));
|
||||||
|
|
||||||
if (gvar < -10000) {
|
if (gvar < -10000) {
|
||||||
_gvar = GV1 + gvar + 10000;
|
_gvar = GV1 + gvar + 10000;
|
||||||
|
@ -648,7 +648,7 @@ void exportGvarParam(const int gvar, int & _gvar, int version)
|
||||||
|
|
||||||
void importGvarParam(int & gvar, const int _gvar, int version)
|
void importGvarParam(int & gvar, const int _gvar, int version)
|
||||||
{
|
{
|
||||||
int GV1 = (version >= 216 ? 4096 : 512);
|
int GV1 = (version >= 217 ? 1024 : (version >= 216 ? 4096 : 512));
|
||||||
|
|
||||||
if (_gvar >= GV1) {
|
if (_gvar >= GV1) {
|
||||||
gvar = 10001 + _gvar - GV1;
|
gvar = 10001 + _gvar - GV1;
|
||||||
|
@ -867,7 +867,43 @@ class MixField: public TransformedField {
|
||||||
version(version),
|
version(version),
|
||||||
model(model)
|
model(model)
|
||||||
{
|
{
|
||||||
if (IS_TARANIS(board) && version >= 216) {
|
if (IS_TARANIS(board) && version >= 217) {
|
||||||
|
internalField.Append(new UnsignedField<8>(_destCh));
|
||||||
|
internalField.Append(new UnsignedField<9>(mix.phases));
|
||||||
|
internalField.Append(new UnsignedField<2>((unsigned int &)mix.mltpx));
|
||||||
|
internalField.Append(new UnsignedField<1>((unsigned int &)mix.carryTrim));
|
||||||
|
internalField.Append(new UnsignedField<4>(mix.mixWarn));
|
||||||
|
internalField.Append(new SignedField<16>(_weight));
|
||||||
|
internalField.Append(new SwitchField<8>(mix.swtch, board, version));
|
||||||
|
internalField.Append(new CurveReferenceField(mix.curve, board, version));
|
||||||
|
internalField.Append(new UnsignedField<8>(mix.delayUp));
|
||||||
|
internalField.Append(new UnsignedField<8>(mix.delayDown));
|
||||||
|
internalField.Append(new UnsignedField<8>(mix.speedUp));
|
||||||
|
internalField.Append(new UnsignedField<8>(mix.speedDown));
|
||||||
|
internalField.Append(new SourceField<8>(mix.srcRaw, board, version, FLAG_NOTELEMETRY));
|
||||||
|
internalField.Append(new SignedField<16>(_offset));
|
||||||
|
internalField.Append(new ZCharField<8>(mix.name));
|
||||||
|
}
|
||||||
|
else if (IS_ARM(board) && version >= 217) {
|
||||||
|
internalField.Append(new UnsignedField<5>(_destCh));
|
||||||
|
internalField.Append(new UnsignedField<3>(mix.mixWarn));
|
||||||
|
internalField.Append(new UnsignedField<9>(mix.phases));
|
||||||
|
internalField.Append(new BoolField<1>(_curveMode));
|
||||||
|
internalField.Append(new BoolField<1>(mix.noExpo));
|
||||||
|
internalField.Append(new SignedField<3>(mix.carryTrim));
|
||||||
|
internalField.Append(new UnsignedField<2>((unsigned int &)mix.mltpx));
|
||||||
|
internalField.Append(new SignedField<16>(_weight));
|
||||||
|
internalField.Append(new SwitchField<8>(mix.swtch, board, version));
|
||||||
|
internalField.Append(new SignedField<8>(_curveParam));
|
||||||
|
internalField.Append(new UnsignedField<8>(mix.delayUp));
|
||||||
|
internalField.Append(new UnsignedField<8>(mix.delayDown));
|
||||||
|
internalField.Append(new UnsignedField<8>(mix.speedUp));
|
||||||
|
internalField.Append(new UnsignedField<8>(mix.speedDown));
|
||||||
|
internalField.Append(new SourceField<8>(mix.srcRaw, board, version, FLAG_NOTELEMETRY));
|
||||||
|
internalField.Append(new SignedField<16>(_offset));
|
||||||
|
internalField.Append(new ZCharField<6>(mix.name));
|
||||||
|
}
|
||||||
|
else if (IS_TARANIS(board) && version == 216) {
|
||||||
internalField.Append(new UnsignedField<8>(_destCh));
|
internalField.Append(new UnsignedField<8>(_destCh));
|
||||||
internalField.Append(new UnsignedField<16>(mix.phases));
|
internalField.Append(new UnsignedField<16>(mix.phases));
|
||||||
internalField.Append(new UnsignedField<2>((unsigned int &)mix.mltpx));
|
internalField.Append(new UnsignedField<2>((unsigned int &)mix.mltpx));
|
||||||
|
@ -887,7 +923,7 @@ class MixField: public TransformedField {
|
||||||
internalField.Append(new ZCharField<8>(mix.name));
|
internalField.Append(new ZCharField<8>(mix.name));
|
||||||
internalField.Append(new SpareBitsField<8>());
|
internalField.Append(new SpareBitsField<8>());
|
||||||
}
|
}
|
||||||
else if (IS_ARM(board) && version >= 216) {
|
else if (IS_ARM(board) && version == 216) {
|
||||||
internalField.Append(new UnsignedField<5>(_destCh));
|
internalField.Append(new UnsignedField<5>(_destCh));
|
||||||
internalField.Append(new UnsignedField<3>(mix.mixWarn));
|
internalField.Append(new UnsignedField<3>(mix.mixWarn));
|
||||||
internalField.Append(new UnsignedField<16>(mix.phases));
|
internalField.Append(new UnsignedField<16>(mix.phases));
|
||||||
|
@ -1154,7 +1190,7 @@ class InputField: public TransformedField {
|
||||||
|
|
||||||
virtual void beforeExport()
|
virtual void beforeExport()
|
||||||
{
|
{
|
||||||
_weight = smallGvarToEEPROM(expo.weight);
|
_weight = smallGvarToEEPROM(expo.weight);
|
||||||
|
|
||||||
if (!IS_TARANIS(board) || version < 216) {
|
if (!IS_TARANIS(board) || version < 216) {
|
||||||
if (expo.curve.type==CurveReference::CURVE_REF_FUNC && expo.curve.value) {
|
if (expo.curve.type==CurveReference::CURVE_REF_FUNC && expo.curve.value) {
|
||||||
|
@ -1209,13 +1245,35 @@ class InputField: public TransformedField {
|
||||||
|
|
||||||
class LimitField: public StructField {
|
class LimitField: public StructField {
|
||||||
public:
|
public:
|
||||||
|
template <int shift>
|
||||||
|
static int exportLimitValue(int value)
|
||||||
|
{
|
||||||
|
if (value > 10000)
|
||||||
|
return 1023 + value - 10000;
|
||||||
|
else if (value < -10000)
|
||||||
|
return -1024 + value + 10000;
|
||||||
|
else
|
||||||
|
return value + shift;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int shift>
|
||||||
|
static int importLimitValue(int value)
|
||||||
|
{
|
||||||
|
if (value > 1023)
|
||||||
|
return 10000 + value - 1023;
|
||||||
|
else if (value < -1024)
|
||||||
|
return -10000 + value + 1024;
|
||||||
|
else
|
||||||
|
return value - shift;
|
||||||
|
}
|
||||||
|
|
||||||
LimitField(LimitData & limit, BoardEnum board, unsigned int version):
|
LimitField(LimitData & limit, BoardEnum board, unsigned int version):
|
||||||
StructField("Limit")
|
StructField("Limit")
|
||||||
{
|
{
|
||||||
if (IS_TARANIS(board) && version >= 217) {
|
if (IS_TARANIS(board) && version >= 217) {
|
||||||
Append(new ConversionField< SignedField<11> >(limit.min, +1000));
|
Append(new ConversionField< SignedField<11> >(limit.min, exportLimitValue<1000>, importLimitValue<1000>));
|
||||||
Append(new ConversionField< SignedField<11> >(limit.max, -1000));
|
Append(new ConversionField< SignedField<11> >(limit.max, exportLimitValue<-1000>, importLimitValue<-1000>));
|
||||||
Append(new SignedField<11>(limit.offset));
|
Append(new ConversionField< SignedField<11> >(limit.offset, exportLimitValue<0>, importLimitValue<0>));
|
||||||
Append(new SignedField<11>(limit.ppmCenter));
|
Append(new SignedField<11>(limit.ppmCenter));
|
||||||
Append(new BoolField<1>(limit.symetrical));
|
Append(new BoolField<1>(limit.symetrical));
|
||||||
Append(new BoolField<1>(limit.revert));
|
Append(new BoolField<1>(limit.revert));
|
||||||
|
@ -1227,15 +1285,17 @@ class LimitField: public StructField {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (IS_TARANIS(board) && version >= 216) {
|
if (IS_TARANIS(board) && version >= 216) {
|
||||||
Append(new ConversionField< SignedField<16> >(limit.min, +1000));
|
Append(new ConversionField< SignedField<16> >(limit.min, exportLimitValue<1000>, importLimitValue<1000>));
|
||||||
Append(new ConversionField< SignedField<16> >(limit.max, -1000));
|
Append(new ConversionField< SignedField<16> >(limit.max, exportLimitValue<-1000>, importLimitValue<-1000>));
|
||||||
|
Append(new SignedField<8>(limit.ppmCenter));
|
||||||
|
Append(new ConversionField< SignedField<14> >(limit.offset, exportLimitValue<0>, importLimitValue<0>));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Append(new ConversionField< SignedField<8> >(limit.min, +100, 10));
|
Append(new ConversionField< SignedField<8> >(limit.min, +100, 10));
|
||||||
Append(new ConversionField< SignedField<8> >(limit.max, -100, 10));
|
Append(new ConversionField< SignedField<8> >(limit.max, -100, 10));
|
||||||
|
Append(new SignedField<8>(limit.ppmCenter));
|
||||||
|
Append(new SignedField<14>(limit.offset));
|
||||||
}
|
}
|
||||||
Append(new SignedField<8>(limit.ppmCenter));
|
|
||||||
Append(new SignedField<14>(limit.offset));
|
|
||||||
Append(new BoolField<1>(limit.symetrical));
|
Append(new BoolField<1>(limit.symetrical));
|
||||||
Append(new BoolField<1>(limit.revert));
|
Append(new BoolField<1>(limit.revert));
|
||||||
if (HAS_LARGE_LCD(board)) {
|
if (HAS_LARGE_LCD(board)) {
|
||||||
|
|
|
@ -147,17 +147,18 @@ void populatePhasesCB(QComboBox *b, int value)
|
||||||
b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightModes));
|
b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightModes));
|
||||||
}
|
}
|
||||||
|
|
||||||
GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const unsigned int flags):
|
GVarGroup::GVarGroup(QCheckBox *weightGV, QAbstractSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const double step, const unsigned int flags):
|
||||||
QObject(),
|
QObject(),
|
||||||
weightGV(weightGV),
|
weightGV(weightGV),
|
||||||
weightSB(weightSB),
|
weightSB(weightSB),
|
||||||
|
sb(dynamic_cast<QSpinBox *>(weightSB)),
|
||||||
|
dsb(dynamic_cast<QDoubleSpinBox *>(weightSB)),
|
||||||
weightCB(weightCB),
|
weightCB(weightCB),
|
||||||
weight(weight),
|
weight(weight),
|
||||||
|
step(step),
|
||||||
flags(flags),
|
flags(flags),
|
||||||
lock(false)
|
lock(true)
|
||||||
{
|
{
|
||||||
lock = true;
|
|
||||||
|
|
||||||
if (GetCurrentFirmware()->getCapability(Gvars)) {
|
if (GetCurrentFirmware()->getCapability(Gvars)) {
|
||||||
populateGVCB(weightCB, weight);
|
populateGVCB(weightCB, weight);
|
||||||
connect(weightGV, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
|
connect(weightGV, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
|
||||||
|
@ -170,21 +171,32 @@ GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
weightSB->setMinimum(mini);
|
int val;
|
||||||
weightSB->setMaximum(maxi);
|
|
||||||
|
|
||||||
if (weight>maxi || weight<mini) {
|
if (weight>maxi || weight<mini) {
|
||||||
|
val = deflt;
|
||||||
weightGV->setChecked(true);
|
weightGV->setChecked(true);
|
||||||
weightSB->hide();
|
weightSB->hide();
|
||||||
weightCB->show();
|
weightCB->show();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
val = weight;
|
||||||
weightGV->setChecked(false);
|
weightGV->setChecked(false);
|
||||||
weightSB->setValue(weight);
|
|
||||||
weightSB->show();
|
weightSB->show();
|
||||||
weightCB->hide();
|
weightCB->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sb) {
|
||||||
|
sb->setMinimum(step*mini);
|
||||||
|
sb->setMaximum(step*maxi);
|
||||||
|
sb->setValue(step*val);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dsb->setMinimum(step*mini);
|
||||||
|
dsb->setMaximum(step*maxi);
|
||||||
|
dsb->setValue(step*val);
|
||||||
|
}
|
||||||
|
|
||||||
connect(weightSB, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
|
connect(weightSB, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
|
||||||
|
|
||||||
lock = false;
|
lock = false;
|
||||||
|
@ -193,16 +205,23 @@ GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightC
|
||||||
void GVarGroup::gvarCBChanged(int state)
|
void GVarGroup::gvarCBChanged(int state)
|
||||||
{
|
{
|
||||||
weightCB->setVisible(state);
|
weightCB->setVisible(state);
|
||||||
weightSB->setVisible(!state);
|
if (weightSB)
|
||||||
|
weightSB->setVisible(!state);
|
||||||
|
else
|
||||||
|
weightSB->setVisible(!state);
|
||||||
valuesChanged();
|
valuesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GVarGroup::valuesChanged()
|
void GVarGroup::valuesChanged()
|
||||||
{
|
{
|
||||||
if (weightGV->isChecked())
|
if (!lock) {
|
||||||
weight = weightCB->itemData(weightCB->currentIndex()).toInt();
|
if (weightGV->isChecked())
|
||||||
else
|
weight = weightCB->itemData(weightCB->currentIndex()).toInt();
|
||||||
weight = weightSB->value();
|
else if (sb)
|
||||||
|
weight = sb->value()/step;
|
||||||
|
else
|
||||||
|
weight = dsb->value()/step;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CurveGroup::CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags):
|
CurveGroup::CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags):
|
||||||
|
|
|
@ -37,12 +37,12 @@ class CompanionIcon: public QIcon {
|
||||||
CompanionIcon(QString baseimage);
|
CompanionIcon(QString baseimage);
|
||||||
};
|
};
|
||||||
|
|
||||||
class GVarGroup : public QObject {
|
class GVarGroup: public QObject {
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const unsigned int flags=0);
|
GVarGroup(QCheckBox *weightGV, QAbstractSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const double step=1, const unsigned int flags=0);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void gvarCBChanged(int);
|
void gvarCBChanged(int);
|
||||||
|
@ -50,10 +50,13 @@ class GVarGroup : public QObject {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QCheckBox *weightGV;
|
QCheckBox *weightGV;
|
||||||
QSpinBox *weightSB;
|
QAbstractSpinBox *weightSB;
|
||||||
|
QSpinBox *sb;
|
||||||
|
QDoubleSpinBox *dsb;
|
||||||
QComboBox *weightCB;
|
QComboBox *weightCB;
|
||||||
int & weight;
|
int & weight;
|
||||||
const unsigned int flags;
|
double step;
|
||||||
|
unsigned int flags;
|
||||||
bool lock;
|
bool lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "channels.h"
|
#include "channels.h"
|
||||||
|
#include "helpers.h"
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
@ -13,8 +14,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||||
bool minimize = false;
|
bool minimize = false;
|
||||||
|
|
||||||
int col = 1;
|
int col = 1;
|
||||||
if (firmware->getCapability(ChannelsName))
|
if (firmware->getCapability(ChannelsName)) {
|
||||||
{
|
|
||||||
minimize=true;
|
minimize=true;
|
||||||
addLabel(gridLayout, tr("Name"), col++);
|
addLabel(gridLayout, tr("Name"), col++);
|
||||||
}
|
}
|
||||||
|
@ -57,24 +57,51 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||||
offset->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
offset->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||||
offset->setAccelerated(true);
|
offset->setAccelerated(true);
|
||||||
offset->setDecimals(1);
|
offset->setDecimals(1);
|
||||||
offset->setMinimum(-100);
|
|
||||||
offset->setSingleStep(0.1);
|
offset->setSingleStep(0.1);
|
||||||
offset->setValue(float(model.limitData[i].offset) / 10);
|
if (IS_TARANIS(firmware->getBoard())) {
|
||||||
connect(offset, SIGNAL(editingFinished()), this, SLOT(offsetEdited()));
|
QHBoxLayout * horizontalLayout = new QHBoxLayout();
|
||||||
gridLayout->addWidget(offset, i+1, col++, 1, 1);
|
QCheckBox * ofsGV = new QCheckBox(tr("GV"));
|
||||||
|
horizontalLayout->addWidget(ofsGV);
|
||||||
|
QComboBox * ofsCB = new QComboBox(this);
|
||||||
|
horizontalLayout->addWidget(ofsCB);
|
||||||
|
horizontalLayout->addWidget(offset);
|
||||||
|
gridLayout->addLayout(horizontalLayout, i+1, col++, 1, 1);
|
||||||
|
ofsGroup = new GVarGroup(ofsGV, offset, ofsCB, model.limitData[i].offset, 0, -10*model.getChannelsMax(), 10*model.getChannelsMax(), 0.1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
offset->setMinimum(-100);
|
||||||
|
offset->setMaximum(100);
|
||||||
|
offset->setValue(float(model.limitData[i].offset) / 10);
|
||||||
|
connect(offset, SIGNAL(editingFinished()), this, SLOT(offsetEdited()));
|
||||||
|
gridLayout->addWidget(offset, i+1, col++, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// Channel min
|
// Channel min
|
||||||
QDoubleSpinBox * minSB = new QDoubleSpinBox(this);
|
QDoubleSpinBox * minSB = new QDoubleSpinBox(this);
|
||||||
minSB->setProperty("index", i);
|
minSB->setProperty("index", i);
|
||||||
minSB->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
minSB->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||||
minSB->setAccelerated(true);
|
minSB->setAccelerated(true);
|
||||||
minSB->setDecimals(1);
|
if (IS_TARANIS(firmware->getBoard())) {
|
||||||
minSB->setMinimum(-model.getChannelsMax());
|
QHBoxLayout * horizontalLayout = new QHBoxLayout();
|
||||||
minSB->setSingleStep(0.1);
|
QCheckBox * minGV = new QCheckBox(tr("GV"));
|
||||||
minSB->setMaximum(0);
|
horizontalLayout->addWidget(minGV);
|
||||||
minSB->setValue(float(model.limitData[i].min) / 10);
|
QComboBox * minCB = new QComboBox(this);
|
||||||
connect(minSB, SIGNAL(editingFinished()), this, SLOT(minEdited()));
|
horizontalLayout->addWidget(minCB);
|
||||||
gridLayout->addWidget(minSB, i+1, col++, 1, 1);
|
minSB->setDecimals(1);
|
||||||
|
minSB->setSingleStep(0.1);
|
||||||
|
horizontalLayout->addWidget(minSB);
|
||||||
|
gridLayout->addLayout(horizontalLayout, i+1, col++, 1, 1);
|
||||||
|
minGroup = new GVarGroup(minGV, minSB, minCB, model.limitData[i].min, -1000, -10*model.getChannelsMax(), 0, 0.1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
minSB->setDecimals(0);
|
||||||
|
minSB->setSingleStep(1);
|
||||||
|
minSB->setMinimum(-model.getChannelsMax());
|
||||||
|
minSB->setMaximum(0);
|
||||||
|
minSB->setValue(model.limitData[i].min / 10);
|
||||||
|
connect(minSB, SIGNAL(editingFinished()), this, SLOT(minEdited()));
|
||||||
|
gridLayout->addWidget(minSB, i+1, col++, 1, 1);
|
||||||
|
}
|
||||||
minSpins << minSB;
|
minSpins << minSB;
|
||||||
|
|
||||||
// Channel max
|
// Channel max
|
||||||
|
@ -82,13 +109,27 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||||
maxSB->setProperty("index", i);
|
maxSB->setProperty("index", i);
|
||||||
maxSB->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
maxSB->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||||
maxSB->setAccelerated(true);
|
maxSB->setAccelerated(true);
|
||||||
maxSB->setDecimals(1);
|
if (IS_TARANIS(firmware->getBoard())) {
|
||||||
maxSB->setMinimum(0);
|
QHBoxLayout * horizontalLayout = new QHBoxLayout();
|
||||||
maxSB->setSingleStep(0.1);
|
QCheckBox * maxGV = new QCheckBox(tr("GV"));
|
||||||
maxSB->setMaximum(model.getChannelsMax());
|
horizontalLayout->addWidget(maxGV);
|
||||||
maxSB->setValue(float(model.limitData[i].max) / 10);
|
QComboBox * maxCB = new QComboBox(this);
|
||||||
connect(maxSB, SIGNAL(editingFinished()), this, SLOT(maxEdited()));
|
horizontalLayout->addWidget(maxCB);
|
||||||
gridLayout->addWidget(maxSB, i+1, col++, 1, 1);
|
maxSB->setDecimals(1);
|
||||||
|
maxSB->setSingleStep(0.1);
|
||||||
|
horizontalLayout->addWidget(maxSB);
|
||||||
|
gridLayout->addLayout(horizontalLayout, i+1, col++, 1, 1);
|
||||||
|
maxGroup = new GVarGroup(maxGV, maxSB, maxCB, model.limitData[i].max, 1000, 0, 10*model.getChannelsMax(), 0.1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
maxSB->setDecimals(0);
|
||||||
|
maxSB->setSingleStep(1);
|
||||||
|
maxSB->setMinimum(0);
|
||||||
|
maxSB->setMaximum(model.getChannelsMax());
|
||||||
|
maxSB->setValue(model.limitData[i].max / 10);
|
||||||
|
connect(maxSB, SIGNAL(editingFinished()), this, SLOT(maxEdited()));
|
||||||
|
gridLayout->addWidget(maxSB, i+1, col++, 1, 1);
|
||||||
|
}
|
||||||
maxSpins << maxSB;
|
maxSpins << maxSB;
|
||||||
|
|
||||||
// Channel inversion
|
// Channel inversion
|
||||||
|
@ -135,6 +176,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||||
gridLayout->addWidget(symlimits, i+1, col++, 1, 1);
|
gridLayout->addWidget(symlimits, i+1, col++, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push the rows up
|
// Push the rows up
|
||||||
addVSpring(gridLayout, 0,firmware->getCapability(Outputs)+1);
|
addVSpring(gridLayout, 0,firmware->getCapability(Outputs)+1);
|
||||||
|
|
||||||
|
@ -143,6 +185,9 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||||
|
|
||||||
Channels::~Channels()
|
Channels::~Channels()
|
||||||
{
|
{
|
||||||
|
delete ofsGroup;
|
||||||
|
delete minGroup;
|
||||||
|
delete maxGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Channels::symlimitsEdited()
|
void Channels::symlimitsEdited()
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "modelpanel.h"
|
#include "modelpanel.h"
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
|
||||||
|
class GVarGroup;
|
||||||
|
|
||||||
class Channels : public ModelPanel
|
class Channels : public ModelPanel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -15,6 +17,9 @@ class Channels : public ModelPanel
|
||||||
private:
|
private:
|
||||||
QVector<QDoubleSpinBox *> minSpins;
|
QVector<QDoubleSpinBox *> minSpins;
|
||||||
QVector<QDoubleSpinBox *> maxSpins;
|
QVector<QDoubleSpinBox *> maxSpins;
|
||||||
|
GVarGroup * ofsGroup;
|
||||||
|
GVarGroup * minGroup;
|
||||||
|
GVarGroup * maxGroup;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void refreshExtendedLimits();
|
void refreshExtendedLimits();
|
||||||
|
|
|
@ -1051,6 +1051,15 @@ void ConvertModel_215_to_216(ModelData &model)
|
||||||
memcpy(newModel.moduleData, oldModel.moduleData, sizeof(newModel.moduleData));
|
memcpy(newModel.moduleData, oldModel.moduleData, sizeof(newModel.moduleData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ConvertGVar_216_to_217(int value)
|
||||||
|
{
|
||||||
|
if (value < -4096 + 9)
|
||||||
|
value += 4096 - 1024;
|
||||||
|
else if (value > 4095 - 9)
|
||||||
|
value -= 4095 - 1023;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
void ConvertModel_216_to_217(ModelData &model)
|
void ConvertModel_216_to_217(ModelData &model)
|
||||||
{
|
{
|
||||||
// Timer3 added
|
// Timer3 added
|
||||||
|
@ -1086,14 +1095,33 @@ void ConvertModel_216_to_217(ModelData &model)
|
||||||
newModel.throttleReversed = oldModel.throttleReversed;
|
newModel.throttleReversed = oldModel.throttleReversed;
|
||||||
newModel.beepANACenter = oldModel.beepANACenter;
|
newModel.beepANACenter = oldModel.beepANACenter;
|
||||||
for (int i=0; i<MAX_MIXERS; i++) {
|
for (int i=0; i<MAX_MIXERS; i++) {
|
||||||
newModel.mixData[i] = oldModel.mixData[i];
|
newModel.mixData[i].destCh = oldModel.mixData[i].destCh;
|
||||||
|
newModel.mixData[i].flightModes = oldModel.mixData[i].flightModes;
|
||||||
|
newModel.mixData[i].mltpx = oldModel.mixData[i].mltpx;
|
||||||
|
newModel.mixData[i].carryTrim = oldModel.mixData[i].carryTrim;
|
||||||
|
newModel.mixData[i].mixWarn = oldModel.mixData[i].mixWarn;
|
||||||
|
newModel.mixData[i].weight = ConvertGVar_216_to_217(oldModel.mixData[i].weight);
|
||||||
|
newModel.mixData[i].swtch = oldModel.mixData[i].swtch;
|
||||||
|
#if defined(PCBTARANIS)
|
||||||
|
newModel.mixData[i].curve = oldModel.mixData[i].curve;
|
||||||
|
#else
|
||||||
|
newModel.mixData[i].curveMode = oldModel.mixData[i].curveMode;
|
||||||
|
newModel.mixData[i].noExpo = oldModel.mixData[i].noExpo;
|
||||||
|
newModel.mixData[i].curveParam = oldModel.mixData[i].curveParam;
|
||||||
|
#endif
|
||||||
|
newModel.mixData[i].delayUp = oldModel.mixData[i].delayUp;
|
||||||
|
newModel.mixData[i].delayDown = oldModel.mixData[i].delayDown;
|
||||||
|
newModel.mixData[i].speedUp = oldModel.mixData[i].speedUp;
|
||||||
|
newModel.mixData[i].speedDown = oldModel.mixData[i].speedDown;
|
||||||
newModel.mixData[i].srcRaw = ConvertSource_216_to_217(oldModel.mixData[i].srcRaw);
|
newModel.mixData[i].srcRaw = ConvertSource_216_to_217(oldModel.mixData[i].srcRaw);
|
||||||
|
newModel.mixData[i].offset = ConvertGVar_216_to_217(oldModel.mixData[i].offset);
|
||||||
|
memcpy(newModel.mixData[i].name, oldModel.mixData[i].name, sizeof(newModel.mixData[i].name));
|
||||||
}
|
}
|
||||||
for (int i=0; i<NUM_CHNOUT; i++) {
|
for (int i=0; i<NUM_CHNOUT; i++) {
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
newModel.limitData[i].min = oldModel.limitData[i].min;
|
newModel.limitData[i].min = ConvertGVar_216_to_217(oldModel.limitData[i].min);
|
||||||
newModel.limitData[i].max = oldModel.limitData[i].max;
|
newModel.limitData[i].max = ConvertGVar_216_to_217(oldModel.limitData[i].max);
|
||||||
newModel.limitData[i].offset = oldModel.limitData[i].offset;
|
newModel.limitData[i].offset = ConvertGVar_216_to_217(oldModel.limitData[i].offset);
|
||||||
newModel.limitData[i].ppmCenter = oldModel.limitData[i].ppmCenter;
|
newModel.limitData[i].ppmCenter = oldModel.limitData[i].ppmCenter;
|
||||||
newModel.limitData[i].symetrical = oldModel.limitData[i].symetrical;
|
newModel.limitData[i].symetrical = oldModel.limitData[i].symetrical;
|
||||||
newModel.limitData[i].revert = oldModel.limitData[i].revert;
|
newModel.limitData[i].revert = oldModel.limitData[i].revert;
|
||||||
|
|
|
@ -608,7 +608,7 @@ PACK(typedef struct t_LimitData {
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
#define GV1_SMALL 128
|
#define GV1_SMALL 128
|
||||||
#define GV1_LARGE 4096
|
#define GV1_LARGE 1024
|
||||||
#define GV_RANGE_WEIGHT 500
|
#define GV_RANGE_WEIGHT 500
|
||||||
#define GV_RANGE_OFFSET 500
|
#define GV_RANGE_OFFSET 500
|
||||||
#define DELAY_STEP 10
|
#define DELAY_STEP 10
|
||||||
|
@ -618,15 +618,13 @@ PACK(typedef struct t_LimitData {
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
uint8_t destCh;
|
uint8_t destCh;
|
||||||
uint16_t flightModes;
|
uint16_t flightModes:9;
|
||||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||||
uint8_t carryTrim:1;
|
uint8_t carryTrim:1;
|
||||||
uint8_t spare1:5;
|
uint8_t mixWarn:4; // mixer warning
|
||||||
int16_t weight;
|
int16_t weight;
|
||||||
int8_t swtch;
|
int8_t swtch;
|
||||||
CurveRef curve;
|
CurveRef curve;
|
||||||
uint8_t mixWarn:4; // mixer warning
|
|
||||||
uint8_t spare2:4;
|
|
||||||
uint8_t delayUp;
|
uint8_t delayUp;
|
||||||
uint8_t delayDown;
|
uint8_t delayDown;
|
||||||
uint8_t speedUp;
|
uint8_t speedUp;
|
||||||
|
@ -634,18 +632,16 @@ PACK(typedef struct {
|
||||||
uint8_t srcRaw;
|
uint8_t srcRaw;
|
||||||
int16_t offset;
|
int16_t offset;
|
||||||
char name[LEN_EXPOMIX_NAME];
|
char name[LEN_EXPOMIX_NAME];
|
||||||
uint8_t spare3;
|
|
||||||
}) MixData;
|
}) MixData;
|
||||||
#else
|
#else
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
uint8_t destCh:5;
|
uint8_t destCh:5;
|
||||||
uint8_t mixWarn:3; // mixer warning
|
uint8_t mixWarn:3; // mixer warning
|
||||||
uint16_t flightModes;
|
uint16_t flightModes:9;
|
||||||
uint8_t curveMode:1;
|
uint8_t curveMode:1;
|
||||||
uint8_t noExpo:1;
|
uint8_t noExpo:1;
|
||||||
int8_t carryTrim:3;
|
int8_t carryTrim:3;
|
||||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||||
uint8_t spare:1;
|
|
||||||
int16_t weight;
|
int16_t weight;
|
||||||
int8_t swtch;
|
int8_t swtch;
|
||||||
int8_t curveParam;
|
int8_t curveParam;
|
||||||
|
@ -661,7 +657,6 @@ PACK(typedef struct {
|
||||||
#define MD_WEIGHT(md) (md->weight)
|
#define MD_WEIGHT(md) (md->weight)
|
||||||
#define MD_WEIGHT_TO_UNION(md, var) var.word = md->weight
|
#define MD_WEIGHT_TO_UNION(md, var) var.word = md->weight
|
||||||
#define MD_UNION_TO_WEIGHT(var, md) md->weight = var.word
|
#define MD_UNION_TO_WEIGHT(var, md) md->weight = var.word
|
||||||
// #define MD_SETWEIGHT(md, val) md->weight = val
|
|
||||||
|
|
||||||
PACK( union u_int8int16_t {
|
PACK( union u_int8int16_t {
|
||||||
struct {
|
struct {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue