mirror of
https://github.com/opentx/opentx.git
synced 2025-07-21 15:25:17 +03:00
Issue #807 fixed
This commit is contained in:
parent
1476ef9126
commit
7f5d6ad7ad
7 changed files with 80 additions and 26 deletions
|
@ -170,6 +170,19 @@ enum HeliSwashTypes {
|
||||||
extern const char * switches9X[];
|
extern const char * switches9X[];
|
||||||
extern const char * switchesX9D[];
|
extern const char * switchesX9D[];
|
||||||
|
|
||||||
|
enum ThrottleSource {
|
||||||
|
THROTTLE_SOURCE_THR,
|
||||||
|
THROTTLE_SOURCE_P1,
|
||||||
|
THROTTLE_SOURCE_P2,
|
||||||
|
THROTTLE_SOURCE_P3,
|
||||||
|
THROTTLE_SOURCE_S1 = THROTTLE_SOURCE_P1,
|
||||||
|
THROTTLE_SOURCE_S2,
|
||||||
|
THROTTLE_SOURCE_S3,
|
||||||
|
THROTTLE_SOURCE_LS,
|
||||||
|
THROTTLE_SOURCE_RS,
|
||||||
|
THROTTLE_SOURCE_FIRST_CHANNEL,
|
||||||
|
};
|
||||||
|
|
||||||
enum TelemetrySource {
|
enum TelemetrySource {
|
||||||
TELEMETRY_SOURCE_TX_BATT,
|
TELEMETRY_SOURCE_TX_BATT,
|
||||||
TELEMETRY_SOURCE_TIMER1,
|
TELEMETRY_SOURCE_TIMER1,
|
||||||
|
|
|
@ -294,6 +294,32 @@ class SourcesConversionTable: public ConversionTable {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ThrottleSourceConversionTable::ThrottleSourceConversionTable(BoardEnum board, unsigned int version)
|
||||||
|
{
|
||||||
|
int val=0;
|
||||||
|
|
||||||
|
addConversion(THROTTLE_SOURCE_THR, val++);
|
||||||
|
|
||||||
|
if (IS_TARANIS(board)) {
|
||||||
|
addConversion(THROTTLE_SOURCE_S1, val++);
|
||||||
|
addConversion(THROTTLE_SOURCE_S2, val++);
|
||||||
|
if (version >= 216)
|
||||||
|
addConversion(THROTTLE_SOURCE_S3, val++);
|
||||||
|
addConversion(THROTTLE_SOURCE_LS, val++);
|
||||||
|
addConversion(THROTTLE_SOURCE_RS, val++);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
addConversion(THROTTLE_SOURCE_P1, val++);
|
||||||
|
addConversion(THROTTLE_SOURCE_P2, val++);
|
||||||
|
addConversion(THROTTLE_SOURCE_P3, val++);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0; i<MAX_CHANNELS(board, version); i++) {
|
||||||
|
addConversion(THROTTLE_SOURCE_FIRST_CHANNEL+i, val++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <int N>
|
template <int N>
|
||||||
class SwitchField: public ConversionField< SignedField<N> > {
|
class SwitchField: public ConversionField< SignedField<N> > {
|
||||||
public:
|
public:
|
||||||
|
@ -2178,7 +2204,8 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||||
board(board),
|
board(board),
|
||||||
version(version),
|
version(version),
|
||||||
variant(variant),
|
variant(variant),
|
||||||
protocolsConversionTable(board)
|
protocolsConversionTable(board),
|
||||||
|
throttleSourceConversionTable(board, version)
|
||||||
{
|
{
|
||||||
sprintf(name, "Model %s", modelData.name);
|
sprintf(name, "Model %s", modelData.name);
|
||||||
|
|
||||||
|
@ -2288,7 +2315,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||||
internalField.Append(new SignedField<8>(modelData.moduleData[0].ppmFrameLength));
|
internalField.Append(new SignedField<8>(modelData.moduleData[0].ppmFrameLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
internalField.Append(new UnsignedField<8>(modelData.thrTraceSrc));
|
internalField.Append(new ConversionField< UnsignedField<8> >(modelData.thrTraceSrc, &throttleSourceConversionTable, "Throttle Source"));
|
||||||
|
|
||||||
if (!afterrelease21March2013) {
|
if (!afterrelease21March2013) {
|
||||||
internalField.Append(new UnsignedField<8>(modelData.modelId));
|
internalField.Append(new UnsignedField<8>(modelData.modelId));
|
||||||
|
|
|
@ -102,6 +102,12 @@ class ProtocolsConversionTable: public ConversionTable
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ThrottleSourceConversionTable: public ConversionTable {
|
||||||
|
|
||||||
|
public:
|
||||||
|
ThrottleSourceConversionTable(BoardEnum board, unsigned int version);
|
||||||
|
};
|
||||||
|
|
||||||
class ChannelsConversionTable: public ConversionTable
|
class ChannelsConversionTable: public ConversionTable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -133,6 +139,7 @@ class OpenTxModelData: public TransformedField {
|
||||||
char name[256];
|
char name[256];
|
||||||
int subprotocols[C9X_NUM_MODULES+1/*trainer*/];
|
int subprotocols[C9X_NUM_MODULES+1/*trainer*/];
|
||||||
ProtocolsConversionTable protocolsConversionTable;
|
ProtocolsConversionTable protocolsConversionTable;
|
||||||
|
ThrottleSourceConversionTable throttleSourceConversionTable;
|
||||||
ChannelsConversionTable channelsConversionTable;
|
ChannelsConversionTable channelsConversionTable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -63,27 +63,6 @@ void populateVoiceLangCB(QComboBox *b, QString language)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void populateTTraceCB(QComboBox *b, int value)
|
|
||||||
{
|
|
||||||
const QString strings9x[] = { QObject::tr("THR"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
|
|
||||||
const QString stringstaranis[] = { QObject::tr("THR"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS")};
|
|
||||||
b->clear();
|
|
||||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
|
||||||
for (int i=0; i< 5; i++) {
|
|
||||||
b->addItem(stringstaranis[i]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i=0; i< 4; i++) {
|
|
||||||
b->addItem(strings9x[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int channels=(IS_ARM(GetEepromInterface()->getBoard()) ? 32 : 16);
|
|
||||||
for (int i=1; i<= channels; i++) {
|
|
||||||
b->addItem(QObject::tr("CH%1").arg(i, 2, 10, QChar('0')));
|
|
||||||
}
|
|
||||||
b->setCurrentIndex(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void populateRotEncCB(QComboBox *b, int value, int renumber)
|
void populateRotEncCB(QComboBox *b, int value, int renumber)
|
||||||
{
|
{
|
||||||
QString strings[] = { QObject::tr("No"), QObject::tr("RotEnc A"), QObject::tr("Rot Enc B"), QObject::tr("Rot Enc C"), QObject::tr("Rot Enc D"), QObject::tr("Rot Enc E")};
|
QString strings[] = { QObject::tr("No"), QObject::tr("RotEnc A"), QObject::tr("Rot Enc B"), QObject::tr("Rot Enc C"), QObject::tr("Rot Enc D"), QObject::tr("Rot Enc E")};
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
|
|
||||||
void populateGvSourceCB(QComboBox *b, int value);
|
void populateGvSourceCB(QComboBox *b, int value);
|
||||||
void populateVoiceLangCB(QComboBox *b, QString language);
|
void populateVoiceLangCB(QComboBox *b, QString language);
|
||||||
void populateTTraceCB(QComboBox *b, int value);
|
|
||||||
void populateRotEncCB(QComboBox *b, int value, int renumber);
|
void populateRotEncCB(QComboBox *b, int value, int renumber);
|
||||||
void populateBacklightCB(QComboBox *b, const uint8_t value);
|
void populateBacklightCB(QComboBox *b, const uint8_t value);
|
||||||
|
|
||||||
|
|
|
@ -500,7 +500,7 @@ void Setup::on_trimIncrement_currentIndexChanged(int index)
|
||||||
|
|
||||||
void Setup::on_throttleSource_currentIndexChanged(int index)
|
void Setup::on_throttleSource_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
model.thrTraceSrc = index;
|
model.thrTraceSrc = ui->throttleSource->itemData(index).toInt();
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,12 +543,39 @@ void Setup::on_image_currentIndexChanged(int index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Setup::populateThrottleSourceCB()
|
||||||
|
{
|
||||||
|
const QString sources9x[] = { QObject::tr("THR"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
|
||||||
|
const QString sourcesTaranis[] = { QObject::tr("THR"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("S3"), QObject::tr("LS"), QObject::tr("RS")};
|
||||||
|
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||||
|
for (i=0; i<6; i++) {
|
||||||
|
ui->throttleSource->addItem(sourcesTaranis[i], i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (i=0; i<4; i++) {
|
||||||
|
ui->throttleSource->addItem(sources9x[i], i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.thrTraceSrc < i) ui->throttleSource->setCurrentIndex(model.thrTraceSrc);
|
||||||
|
|
||||||
|
int channels = (IS_ARM(GetEepromInterface()->getBoard()) ? 32 : 16);
|
||||||
|
for (int i=0; i<channels; i++) {
|
||||||
|
ui->throttleSource->addItem(QObject::tr("CH%1").arg(i+1, 2, 10, QChar('0')), THROTTLE_SOURCE_FIRST_CHANNEL+i);
|
||||||
|
if (model.thrTraceSrc == unsigned(THROTTLE_SOURCE_FIRST_CHANNEL+i)) ui->throttleSource->setCurrentIndex(ui->throttleSource->count()-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Setup::update()
|
void Setup::update()
|
||||||
{
|
{
|
||||||
ui->name->setText(model.name);
|
ui->name->setText(model.name);
|
||||||
|
|
||||||
ui->throttleReverse->setChecked(model.throttleReversed);
|
ui->throttleReverse->setChecked(model.throttleReversed);
|
||||||
populateTTraceCB(ui->throttleSource, model.thrTraceSrc);
|
populateThrottleSourceCB();
|
||||||
ui->throttleWarning->setChecked(!model.disableThrottleWarning);
|
ui->throttleWarning->setChecked(!model.disableThrottleWarning);
|
||||||
|
|
||||||
//trim inc, thro trim, thro expo, instatrim
|
//trim inc, thro trim, thro expo, instatrim
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
#include <QComboBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -104,6 +105,7 @@ class Setup : public ModelPanel
|
||||||
void updateStartupSwitches();
|
void updateStartupSwitches();
|
||||||
void updatePotWarnings();
|
void updatePotWarnings();
|
||||||
void updateBeepCenter();
|
void updateBeepCenter();
|
||||||
|
void populateThrottleSourceCB();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETUP_H
|
#endif // SETUP_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue