mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-24 00:35:14 +03:00
Add data modification for su trim, min and max
This commit is contained in:
parent
dcf9870b3a
commit
05ca719522
5 changed files with 16 additions and 9 deletions
|
@ -127,7 +127,7 @@ void populatePhasesCB(QComboBox *b, int value)
|
||||||
b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightModes));
|
b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightModes));
|
||||||
}
|
}
|
||||||
|
|
||||||
GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step, bool allowGvars):
|
GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step, bool allowGvars, ModelPanel * panel):
|
||||||
QObject(),
|
QObject(),
|
||||||
weightGV(weightGV),
|
weightGV(weightGV),
|
||||||
weightSB(weightSB),
|
weightSB(weightSB),
|
||||||
|
@ -136,7 +136,8 @@ GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBo
|
||||||
weightCB(weightCB),
|
weightCB(weightCB),
|
||||||
weight(weight),
|
weight(weight),
|
||||||
step(step),
|
step(step),
|
||||||
lock(true)
|
lock(true),
|
||||||
|
panel(panel)
|
||||||
{
|
{
|
||||||
if (allowGvars && GetCurrentFirmware()->getCapability(Gvars)) {
|
if (allowGvars && GetCurrentFirmware()->getCapability(Gvars)) {
|
||||||
populateGVCB(*weightCB, weight, model);
|
populateGVCB(*weightCB, weight, model);
|
||||||
|
@ -200,6 +201,9 @@ void GVarGroup::valuesChanged()
|
||||||
weight = sb->value();
|
weight = sb->value();
|
||||||
else
|
else
|
||||||
weight = round(dsb->value()/step);
|
weight = round(dsb->value()/step);
|
||||||
|
if (panel)
|
||||||
|
emit panel->modified();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "eeprominterface.h"
|
#include "eeprominterface.h"
|
||||||
|
#include "modeledit/modeledit.h"
|
||||||
|
|
||||||
extern const QColor colors[CPN_MAX_CURVES];
|
extern const QColor colors[CPN_MAX_CURVES];
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ class GVarGroup: public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step=1.0, bool allowGVars=true);
|
GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step=1.0, bool allowGVars=true, ModelPanel * panel=NULL);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void gvarCBChanged(int);
|
void gvarCBChanged(int);
|
||||||
|
@ -81,6 +82,7 @@ class GVarGroup: public QObject {
|
||||||
int & weight;
|
int & weight;
|
||||||
double step;
|
double step;
|
||||||
bool lock;
|
bool lock;
|
||||||
|
ModelPanel * panel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define HIDE_DIFF 0x01
|
#define HIDE_DIFF 0x01
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "channels.h"
|
#include "channels.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row, int col, int & value, const ModelData & model, int min, int max, int deflt):
|
LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row, int col, int & value, const ModelData & model, int min, int max, int deflt, ModelPanel * panel):
|
||||||
firmware(firmware),
|
firmware(firmware),
|
||||||
spinbox(new QDoubleSpinBox()),
|
spinbox(new QDoubleSpinBox()),
|
||||||
value(value),
|
value(value),
|
||||||
|
@ -64,7 +64,7 @@ LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row
|
||||||
horizontalLayout->addWidget(cb);
|
horizontalLayout->addWidget(cb);
|
||||||
horizontalLayout->addWidget(spinbox);
|
horizontalLayout->addWidget(spinbox);
|
||||||
tableLayout->addLayout(row, col, horizontalLayout);
|
tableLayout->addLayout(row, col, horizontalLayout);
|
||||||
gvarGroup = new GVarGroup(gv, spinbox, cb, value, model, deflt, min, max, displayStep, allowGVars);
|
gvarGroup = new GVarGroup(gv, spinbox, cb, value, model, deflt, min, max, displayStep, allowGVars, panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
LimitsGroup::~LimitsGroup()
|
LimitsGroup::~LimitsGroup()
|
||||||
|
@ -133,13 +133,13 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||||
}
|
}
|
||||||
|
|
||||||
// Channel offset
|
// Channel offset
|
||||||
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].offset, model, -1000, 1000, 0);
|
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].offset, model, -1000, 1000, 0, this);
|
||||||
|
|
||||||
// Channel min
|
// Channel min
|
||||||
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].min, model, -model.getChannelsMax()*10, 0, -1000);
|
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].min, model, -model.getChannelsMax()*10, 0, -1000, this);
|
||||||
|
|
||||||
// Channel max
|
// Channel max
|
||||||
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].max, model, 0, model.getChannelsMax()*10, 1000);
|
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].max, model, 0, model.getChannelsMax()*10, 1000, this);
|
||||||
|
|
||||||
// Channel inversion
|
// Channel inversion
|
||||||
QComboBox * invCB = new QComboBox(this);
|
QComboBox * invCB = new QComboBox(this);
|
||||||
|
|
|
@ -29,7 +29,7 @@ class GVarGroup;
|
||||||
class LimitsGroup
|
class LimitsGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, const ModelData & model, int min, int max, int deflt);
|
LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, const ModelData & model, int min, int max, int deflt, ModelPanel * panel=NULL);
|
||||||
~LimitsGroup();
|
~LimitsGroup();
|
||||||
|
|
||||||
void updateMinMax(int max);
|
void updateMinMax(int max);
|
||||||
|
|
|
@ -38,6 +38,7 @@ class GenericPanel : public QWidget
|
||||||
friend class AutoCheckBox;
|
friend class AutoCheckBox;
|
||||||
friend class AutoHexSpinBox;
|
friend class AutoHexSpinBox;
|
||||||
friend class AutoLineEdit;
|
friend class AutoLineEdit;
|
||||||
|
friend class GVarGroup;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GenericPanel(QWidget *parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware);
|
GenericPanel(QWidget *parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue