mirror of
https://github.com/opentx/opentx.git
synced 2025-07-13 11:29:51 +03:00
Rotary Encoder Switches / Sources removed
This commit is contained in:
parent
7fac7b627d
commit
cfa7a0a50b
23 changed files with 1 additions and 307 deletions
|
@ -139,9 +139,6 @@ void FlightModeData::clear(const int phaseIdx)
|
||||||
for (int i = 0; i < CPN_MAX_GVARS; i++) {
|
for (int i = 0; i < CPN_MAX_GVARS; i++) {
|
||||||
gvars[i] = linkedGVarFlightModeZero(phaseIdx);
|
gvars[i] = linkedGVarFlightModeZero(phaseIdx);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < CPN_MAX_ENCODERS; i++) {
|
|
||||||
rotaryEncoders[i] = linkedREncFlightModeZero(phaseIdx);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FlightModeData::nameToString(int phaseIdx) const
|
QString FlightModeData::nameToString(int phaseIdx) const
|
||||||
|
@ -168,10 +165,6 @@ bool FlightModeData::isEmpty(int phaseIdx) const
|
||||||
if (!isGVarEmpty(phaseIdx, i))
|
if (!isGVarEmpty(phaseIdx, i))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < CPN_MAX_ENCODERS; i++) {
|
|
||||||
if (!isREncEmpty(phaseIdx, i))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,13 +175,6 @@ bool FlightModeData::isGVarEmpty(int phaseIdx, int gvIdx) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FlightModeData::isREncEmpty(int phaseIdx, int reIdx) const
|
|
||||||
{
|
|
||||||
if ((phaseIdx == 0 && rotaryEncoders[reIdx] == 0) || (phaseIdx != 0 && rotaryEncoders[reIdx] == linkedREncFlightModeZero(phaseIdx)))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int FlightModeData::linkedFlightModeZero(int phaseIdx, int maxOwnValue) const
|
int FlightModeData::linkedFlightModeZero(int phaseIdx, int maxOwnValue) const
|
||||||
{
|
{
|
||||||
if (phaseIdx == 0)
|
if (phaseIdx == 0)
|
||||||
|
@ -200,8 +186,3 @@ int FlightModeData::linkedGVarFlightModeZero(int phaseIdx) const
|
||||||
{
|
{
|
||||||
return linkedFlightModeZero(phaseIdx, GVAR_MAX_VALUE);
|
return linkedFlightModeZero(phaseIdx, GVAR_MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int FlightModeData::linkedREncFlightModeZero(int phaseIdx) const
|
|
||||||
{
|
|
||||||
return linkedFlightModeZero(phaseIdx, RENC_MAX_VALUE);
|
|
||||||
}
|
|
||||||
|
|
|
@ -173,10 +173,8 @@ class FlightModeData {
|
||||||
void convert(RadioDataConversionState & cstate);
|
void convert(RadioDataConversionState & cstate);
|
||||||
bool isEmpty(int phaseIdx) const;
|
bool isEmpty(int phaseIdx) const;
|
||||||
bool isGVarEmpty(int phaseIdx, int gvIdx) const;
|
bool isGVarEmpty(int phaseIdx, int gvIdx) const;
|
||||||
bool isREncEmpty(int phaseIdx, int reIdx) const;
|
|
||||||
int linkedFlightModeZero(int phaseIdx, int maxOwnValue) const;
|
int linkedFlightModeZero(int phaseIdx, int maxOwnValue) const;
|
||||||
int linkedGVarFlightModeZero(int phaseIdx) const;
|
int linkedGVarFlightModeZero(int phaseIdx) const;
|
||||||
int linkedREncFlightModeZero(int phaseIdx) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SwashRingData {
|
class SwashRingData {
|
||||||
|
|
|
@ -306,39 +306,6 @@ int ModelData::getGVarValue(int phaseIdx, int gvarIdx)
|
||||||
return flightModeData[0].gvars[gvarIdx]; // circular linked so return FM0 value
|
return flightModeData[0].gvars[gvarIdx]; // circular linked so return FM0 value
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModelData::isREncLinked(int phaseIdx, int reIdx)
|
|
||||||
{
|
|
||||||
return flightModeData[phaseIdx].rotaryEncoders[reIdx] > RENC_MAX_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ModelData::isREncLinkedCircular(int phaseIdx, int reIdx)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < CPN_MAX_FLIGHT_MODES; i++) {
|
|
||||||
int val = flightModeData[phaseIdx].rotaryEncoders[reIdx];
|
|
||||||
if (phaseIdx == 0 || val <= RENC_MAX_VALUE)
|
|
||||||
return false;
|
|
||||||
int nextPhase = val - (RENC_MAX_VALUE + 1);
|
|
||||||
if (nextPhase >= phaseIdx)
|
|
||||||
nextPhase += 1;
|
|
||||||
phaseIdx = nextPhase;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ModelData::getREncValue(int phaseIdx, int reIdx)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < CPN_MAX_FLIGHT_MODES; i++) {
|
|
||||||
int val = flightModeData[phaseIdx].rotaryEncoders[reIdx];
|
|
||||||
if (phaseIdx == 0 || val <= RENC_MAX_VALUE)
|
|
||||||
return val;
|
|
||||||
int nextPhase = val - (RENC_MAX_VALUE + 1);
|
|
||||||
if (nextPhase >= phaseIdx)
|
|
||||||
nextPhase += 1;
|
|
||||||
phaseIdx = nextPhase;
|
|
||||||
}
|
|
||||||
return flightModeData[0].rotaryEncoders[reIdx]; // circular linked so return FM0 value
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelData::setTrimValue(int phaseIdx, int trimIdx, int value)
|
void ModelData::setTrimValue(int phaseIdx, int trimIdx, int value)
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < CPN_MAX_FLIGHT_MODES; i++) {
|
for (uint8_t i = 0; i < CPN_MAX_FLIGHT_MODES; i++) {
|
||||||
|
@ -1255,18 +1222,6 @@ void ModelData::setGVarFlightModeIndexToValue(const int phaseIdx, const int gvar
|
||||||
flightModeData[phaseIdx].gvars[gvarIdx] = linkedFlightModeIndexToValue(phaseIdx, useFmIdx, GVAR_MAX_VALUE);
|
flightModeData[phaseIdx].gvars[gvarIdx] = linkedFlightModeIndexToValue(phaseIdx, useFmIdx, GVAR_MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ModelData::getREncFlightModeIndex(const int phaseIdx, const int reIdx)
|
|
||||||
{
|
|
||||||
if (!isREncLinked(phaseIdx, reIdx))
|
|
||||||
return -1;
|
|
||||||
return (linkedFlightModeValueToIndex(phaseIdx, flightModeData[phaseIdx].rotaryEncoders[reIdx], RENC_MAX_VALUE));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelData::setREncFlightModeIndexToValue(const int phaseIdx, const int reIdx, const int useFmIdx)
|
|
||||||
{
|
|
||||||
flightModeData[phaseIdx].rotaryEncoders[reIdx] = linkedFlightModeIndexToValue(phaseIdx, useFmIdx, RENC_MAX_VALUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ModelData::isExpoParent(const int index)
|
bool ModelData::isExpoParent(const int index)
|
||||||
{
|
{
|
||||||
const ExpoData &ed = expoData[index];
|
const ExpoData &ed = expoData[index];
|
||||||
|
|
|
@ -229,12 +229,6 @@ class ModelData {
|
||||||
int getGVarFlightModeIndex(const int phaseIdx, const int gvarIdx);
|
int getGVarFlightModeIndex(const int phaseIdx, const int gvarIdx);
|
||||||
void setGVarFlightModeIndexToValue(const int phaseIdx, const int gvarIdx, const int useFmIdx);
|
void setGVarFlightModeIndexToValue(const int phaseIdx, const int gvarIdx, const int useFmIdx);
|
||||||
|
|
||||||
bool isREncLinked(int phaseIdx, int reIdx);
|
|
||||||
bool isREncLinkedCircular(int phaseIdx, int reIdx);
|
|
||||||
int getREncValue(int phaseIdx, int reIdx);
|
|
||||||
int getREncFlightModeIndex(const int phaseIdx, const int reIdx);
|
|
||||||
void setREncFlightModeIndexToValue(const int phaseIdx, const int reIdx, const int useFmIdx);
|
|
||||||
|
|
||||||
ModelData removeGlobalVars();
|
ModelData removeGlobalVars();
|
||||||
|
|
||||||
int linkedFlightModeIndexToValue(const int phaseIdx, const int useFmIdx, const int maxOwnValue);
|
int linkedFlightModeIndexToValue(const int phaseIdx, const int useFmIdx, const int maxOwnValue);
|
||||||
|
|
|
@ -283,10 +283,6 @@ void FlightModePanel::update()
|
||||||
updateGVar(i);
|
updateGVar(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < reCount; i++) {
|
|
||||||
updateRotaryEncoder(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit nameModified();
|
emit nameModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,20 +322,6 @@ void FlightModePanel::setGVSB(QDoubleSpinBox * sb, int min, int max, int val)
|
||||||
sb->setValue(val * mul);
|
sb->setValue(val * mul);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlightModePanel::updateRotaryEncoder(int index)
|
|
||||||
{
|
|
||||||
lock = true;
|
|
||||||
if (phaseIdx > 0) {
|
|
||||||
if (model->isREncLinked(phaseIdx, index))
|
|
||||||
reUse[index]->setCurrentIndex(phase.rotaryEncoders[index] - RENC_MAX_VALUE);
|
|
||||||
else
|
|
||||||
reUse[index]->setCurrentIndex(0);
|
|
||||||
}
|
|
||||||
reValues[index]->setDisabled(model->isREncLinked(phaseIdx, index));
|
|
||||||
reValues[index]->setValue(model->getREncValue(phaseIdx, index));
|
|
||||||
lock = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: pull units from GVarData
|
// TODO: pull units from GVarData
|
||||||
void FlightModePanel::populateGvarUnitCB(QComboBox * cb)
|
void FlightModePanel::populateGvarUnitCB(QComboBox * cb)
|
||||||
{
|
{
|
||||||
|
@ -542,36 +524,6 @@ void FlightModePanel::phaseGVPopupToggled(bool checked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlightModePanel::phaseREValue_editingFinished()
|
|
||||||
{
|
|
||||||
if (!lock) {
|
|
||||||
QSpinBox *spinBox = qobject_cast<QSpinBox*>(sender());
|
|
||||||
int re = spinBox->property("index").toInt();
|
|
||||||
phase.rotaryEncoders[re] = spinBox->value();
|
|
||||||
emit modified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FlightModePanel::phaseREUse_currentIndexChanged(int index)
|
|
||||||
{
|
|
||||||
if (!lock) {
|
|
||||||
lock = true;
|
|
||||||
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
|
|
||||||
int re = comboBox->property("index").toInt();
|
|
||||||
if (index == 0) {
|
|
||||||
phase.rotaryEncoders[re] = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
phase.rotaryEncoders[re] = RENC_MAX_VALUE + index; ;
|
|
||||||
}
|
|
||||||
update();
|
|
||||||
if (model->isREncLinkedCircular(phaseIdx, re))
|
|
||||||
QMessageBox::warning(this, "Companion", tr("Warning: Rotary encoder links back to itself. Flight Mode 0 value used."));
|
|
||||||
emit modified();
|
|
||||||
lock = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FlightModePanel::phaseTrimUse_currentIndexChanged(int index)
|
void FlightModePanel::phaseTrimUse_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
|
@ -702,9 +654,6 @@ void FlightModePanel::cmClear()
|
||||||
for (int i = 0; i < gvCount; i++) {
|
for (int i = 0; i < gvCount; i++) {
|
||||||
phase.gvars[i] = phase.linkedGVarFlightModeZero(phaseIdx);
|
phase.gvars[i] = phase.linkedGVarFlightModeZero(phaseIdx);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < reCount; i++) {
|
|
||||||
phase.rotaryEncoders[i] = phase.linkedREncFlightModeZero(phaseIdx);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model->updateAllReferences(ModelData::REF_UPD_TYPE_FLIGHT_MODE, ModelData::REF_UPD_ACT_CLEAR, phaseIdx);
|
model->updateAllReferences(ModelData::REF_UPD_TYPE_FLIGHT_MODE, ModelData::REF_UPD_ACT_CLEAR, phaseIdx);
|
||||||
|
@ -724,9 +673,6 @@ void FlightModePanel::cmClearAll()
|
||||||
for (int i = 0; i < gvCount; i++) {
|
for (int i = 0; i < gvCount; i++) {
|
||||||
fm->gvars[i] = fm->linkedGVarFlightModeZero(j);
|
fm->gvars[i] = fm->linkedGVarFlightModeZero(j);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < reCount; i++) {
|
|
||||||
fm->rotaryEncoders[i] = fm->linkedREncFlightModeZero(j);
|
|
||||||
}
|
|
||||||
model->updateAllReferences(ModelData::REF_UPD_TYPE_FLIGHT_MODE, ModelData::REF_UPD_ACT_CLEAR, j);
|
model->updateAllReferences(ModelData::REF_UPD_TYPE_FLIGHT_MODE, ModelData::REF_UPD_ACT_CLEAR, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,18 +742,6 @@ void FlightModePanel::cmDelete()
|
||||||
model->setGVarFlightModeIndexToValue(j, i, 0);
|
model->setGVarFlightModeIndexToValue(j, i, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < reCount; i++) {
|
|
||||||
if (model->isREncLinked(j, i)) {
|
|
||||||
int idx = model->getREncFlightModeIndex(j, i);
|
|
||||||
if (phaseIdx == 0 && j == 0)
|
|
||||||
model->setREncFlightModeIndexToValue(j, i, j);
|
|
||||||
else if (idx > phaseIdx)
|
|
||||||
model->setREncFlightModeIndexToValue(j, i, idx - 1);
|
|
||||||
else if (idx == phaseIdx)
|
|
||||||
model->setREncFlightModeIndexToValue(j, i, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model->updateAllReferences(ModelData::REF_UPD_TYPE_FLIGHT_MODE, ModelData::REF_UPD_ACT_SHIFT, phaseIdx, 0, -1);
|
model->updateAllReferences(ModelData::REF_UPD_TYPE_FLIGHT_MODE, ModelData::REF_UPD_ACT_SHIFT, phaseIdx, 0, -1);
|
||||||
|
@ -849,16 +783,6 @@ void FlightModePanel::cmInsert()
|
||||||
model->setGVarFlightModeIndexToValue(j, i, idx + 1);
|
model->setGVarFlightModeIndexToValue(j, i, idx + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < reCount; i++) {
|
|
||||||
if (model->isREncLinked(j, i)) {
|
|
||||||
int idx = model->getREncFlightModeIndex(j, i);
|
|
||||||
if (phaseIdx == 0 && j == 1)
|
|
||||||
model->setREncFlightModeIndexToValue(j, i, j);
|
|
||||||
else if (idx >= phaseIdx)
|
|
||||||
model->setREncFlightModeIndexToValue(j, i, idx + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model->updateAllReferences(ModelData::REF_UPD_TYPE_FLIGHT_MODE, ModelData::REF_UPD_ACT_SHIFT, phaseIdx, 0, 1);
|
model->updateAllReferences(ModelData::REF_UPD_TYPE_FLIGHT_MODE, ModelData::REF_UPD_ACT_SHIFT, phaseIdx, 0, 1);
|
||||||
|
@ -903,15 +827,6 @@ void FlightModePanel::cmPaste()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO fix up linked REs but need to know source FM index to make adjustments
|
|
||||||
for (int i = 0; i < reCount; i++) {
|
|
||||||
if (model->isREncLinked(phaseIdx, i)) {
|
|
||||||
int linkedidx = model->getREncFlightModeIndex(phaseIdx, i);
|
|
||||||
if (phaseIdx == 0 || linkedidx == phaseIdx)
|
|
||||||
model->setREncFlightModeIndexToValue(phaseIdx, i, phaseIdx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
emit datachanged();
|
emit datachanged();
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
|
@ -978,28 +893,6 @@ void FlightModePanel::swapData(int idx1, int idx2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < reCount; i++) {
|
|
||||||
if (model->isREncLinked(idx1, i)) {
|
|
||||||
int linkedidx = model->getREncFlightModeIndex(idx1, i);
|
|
||||||
if (linkedidx == idx1)
|
|
||||||
model->setREncFlightModeIndexToValue(idx1, i, idx2 - shift);
|
|
||||||
else if (linkedidx == idx2)
|
|
||||||
model->setREncFlightModeIndexToValue(idx1, i, idx1 + shift);
|
|
||||||
else
|
|
||||||
model->setREncFlightModeIndexToValue(idx1, i, linkedidx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model->isREncLinked(idx2, i)) {
|
|
||||||
int linkedidx = model->getREncFlightModeIndex(idx2, i);
|
|
||||||
if (linkedidx == idx1)
|
|
||||||
model->setREncFlightModeIndexToValue(idx2, i, idx2 - shift);
|
|
||||||
else if (linkedidx == idx2)
|
|
||||||
model->setREncFlightModeIndexToValue(idx2, i, idx1 + shift);
|
|
||||||
else
|
|
||||||
model->setREncFlightModeIndexToValue(idx2, i, linkedidx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
model->updateAllReferences(ModelData::REF_UPD_TYPE_FLIGHT_MODE, ModelData::REF_UPD_ACT_SWAP, idx1, idx2);
|
model->updateAllReferences(ModelData::REF_UPD_TYPE_FLIGHT_MODE, ModelData::REF_UPD_ACT_SWAP, idx1, idx2);
|
||||||
emit datachanged();
|
emit datachanged();
|
||||||
emit modified();
|
emit modified();
|
||||||
|
|
|
@ -64,8 +64,6 @@ class FlightModePanel : public ModelPanel
|
||||||
void phaseGVPrec_currentIndexChanged(int index);
|
void phaseGVPrec_currentIndexChanged(int index);
|
||||||
void phaseGVMin_editingFinished();
|
void phaseGVMin_editingFinished();
|
||||||
void phaseGVMax_editingFinished();
|
void phaseGVMax_editingFinished();
|
||||||
void phaseREValue_editingFinished();
|
|
||||||
void phaseREUse_currentIndexChanged(int index);
|
|
||||||
void onCustomContextMenuRequested(QPoint pos);
|
void onCustomContextMenuRequested(QPoint pos);
|
||||||
void cmClear();
|
void cmClear();
|
||||||
void cmClearAll();
|
void cmClearAll();
|
||||||
|
@ -92,7 +90,6 @@ class FlightModePanel : public ModelPanel
|
||||||
int phaseIdx;
|
int phaseIdx;
|
||||||
FlightModeData & phase;
|
FlightModeData & phase;
|
||||||
int fmCount;
|
int fmCount;
|
||||||
int reCount;
|
|
||||||
int gvCount;
|
int gvCount;
|
||||||
int gvIdx;
|
int gvIdx;
|
||||||
int trimCount;
|
int trimCount;
|
||||||
|
@ -105,8 +102,6 @@ class FlightModePanel : public ModelPanel
|
||||||
QComboBox * gvPrec[CPN_MAX_GVARS];
|
QComboBox * gvPrec[CPN_MAX_GVARS];
|
||||||
QDoubleSpinBox * gvMin[CPN_MAX_GVARS];
|
QDoubleSpinBox * gvMin[CPN_MAX_GVARS];
|
||||||
QDoubleSpinBox * gvMax[CPN_MAX_GVARS];
|
QDoubleSpinBox * gvMax[CPN_MAX_GVARS];
|
||||||
QSpinBox * reValues[CPN_MAX_ENCODERS];
|
|
||||||
QComboBox * reUse[CPN_MAX_ENCODERS];
|
|
||||||
QVector<QComboBox *> trimsUse;
|
QVector<QComboBox *> trimsUse;
|
||||||
QVector<QSpinBox *> trimsValue;
|
QVector<QSpinBox *> trimsValue;
|
||||||
QVector<QSlider *> trimsSlider;
|
QVector<QSlider *> trimsSlider;
|
||||||
|
@ -115,7 +110,6 @@ class FlightModePanel : public ModelPanel
|
||||||
|
|
||||||
void trimUpdate(unsigned int trim);
|
void trimUpdate(unsigned int trim);
|
||||||
void updateGVar(int index);
|
void updateGVar(int index);
|
||||||
void updateRotaryEncoder(int index);
|
|
||||||
void setGVSB(QDoubleSpinBox * spinBox, int min, int max, int val);
|
void setGVSB(QDoubleSpinBox * spinBox, int min, int max, int val);
|
||||||
void populateGvarUnitCB(QComboBox * cb);
|
void populateGvarUnitCB(QComboBox * cb);
|
||||||
void populateGvarPrecCB(QComboBox * cb);
|
void populateGvarPrecCB(QComboBox * cb);
|
||||||
|
|
|
@ -353,20 +353,6 @@ QString ModelPrinter::printGlobalVar(int flightModeIndex, int gvarIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ModelPrinter::printRotaryEncoder(int flightModeIndex, int reIndex)
|
|
||||||
{
|
|
||||||
const FlightModeData & fm = model.flightModeData[flightModeIndex];
|
|
||||||
|
|
||||||
if (fm.rotaryEncoders[reIndex] <= 1024) {
|
|
||||||
return QString("%1").arg(fm.rotaryEncoders[reIndex]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
int num = fm.rotaryEncoders[reIndex] - 1025;
|
|
||||||
if (num >= flightModeIndex) num++;
|
|
||||||
return tr("FM%1").arg(num);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ModelPrinter::printInputName(int idx)
|
QString ModelPrinter::printInputName(int idx)
|
||||||
{
|
{
|
||||||
RawSourceType srcType = (firmware->getCapability(VirtualInputs) ? SOURCE_TYPE_VIRTUAL_INPUT : SOURCE_TYPE_STICK);
|
RawSourceType srcType = (firmware->getCapability(VirtualInputs) ? SOURCE_TYPE_VIRTUAL_INPUT : SOURCE_TYPE_STICK);
|
||||||
|
|
|
@ -67,7 +67,6 @@ class ModelPrinter: public QObject
|
||||||
QString printHeliSwashType();
|
QString printHeliSwashType();
|
||||||
QString printTrim(int flightModeIndex, int stickIndex);
|
QString printTrim(int flightModeIndex, int stickIndex);
|
||||||
QString printGlobalVar(int flightModeIndex, int gvarIndex);
|
QString printGlobalVar(int flightModeIndex, int gvarIndex);
|
||||||
QString printRotaryEncoder(int flightModeIndex, int reIndex);
|
|
||||||
QString printTimer(int idx);
|
QString printTimer(int idx);
|
||||||
QString printTimer(const TimerData & timer);
|
QString printTimer(const TimerData & timer);
|
||||||
QString printInputName(int idx);
|
QString printInputName(int idx);
|
||||||
|
|
|
@ -535,10 +535,6 @@ enum SwitchSources {
|
||||||
SWSRC_TrimT6Up,
|
SWSRC_TrimT6Up,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
SWSRC_REa,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SWSRC_FIRST_LOGICAL_SWITCH,
|
SWSRC_FIRST_LOGICAL_SWITCH,
|
||||||
SWSRC_SW1 = SWSRC_FIRST_LOGICAL_SWITCH,
|
SWSRC_SW1 = SWSRC_FIRST_LOGICAL_SWITCH,
|
||||||
SWSRC_SW2,
|
SWSRC_SW2,
|
||||||
|
|
|
@ -342,12 +342,6 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X) && defined(REVX)
|
|
||||||
if (swtch == SWSRC_REa) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (swtch >= SWSRC_FIRST_LOGICAL_SWITCH && swtch <= SWSRC_LAST_LOGICAL_SWITCH) {
|
if (swtch >= SWSRC_FIRST_LOGICAL_SWITCH && swtch <= SWSRC_LAST_LOGICAL_SWITCH) {
|
||||||
if (context == GeneralCustomFunctionsContext) {
|
if (context == GeneralCustomFunctionsContext) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -312,16 +312,9 @@ char * getSwitchPositionName(char * dest, swsrc_t idx)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
else if (idx <= SWSRC_REa) {
|
|
||||||
getStringAtIndex(s, STR_VSWITCHES, IDX_TRIMS_IN_STR_VSWITCHES+idx-SWSRC_FIRST_TRIM);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
else if (idx <= SWSRC_LAST_TRIM) {
|
else if (idx <= SWSRC_LAST_TRIM) {
|
||||||
getStringAtIndex(s, STR_VSWITCHES, IDX_TRIMS_IN_STR_VSWITCHES+idx-SWSRC_FIRST_TRIM);
|
getStringAtIndex(s, STR_VSWITCHES, IDX_TRIMS_IN_STR_VSWITCHES+idx-SWSRC_FIRST_TRIM);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
else if (idx <= SWSRC_LAST_LOGICAL_SWITCH) {
|
else if (idx <= SWSRC_LAST_LOGICAL_SWITCH) {
|
||||||
*s++ = 'L';
|
*s++ = 'L';
|
||||||
strAppendUnsigned(s, idx-SWSRC_FIRST_LOGICAL_SWITCH+1, 2);
|
strAppendUnsigned(s, idx-SWSRC_FIRST_LOGICAL_SWITCH+1, 2);
|
||||||
|
|
|
@ -319,14 +319,6 @@
|
||||||
#define TR_TRIMS_SWITCHES TR("tSl""tSp""tVd""tVn""tPd""tPn""tKl""tKp", "\313Sl""\313Sp""\313Vd""\313Vn""\313Pd""\313Pn""\313Kl""\313Kp")
|
#define TR_TRIMS_SWITCHES TR("tSl""tSp""tVd""tVn""tPd""tPn""tKl""tKp", "\313Sl""\313Sp""\313Vd""\313Vn""\313Pd""\313Pn""\313Kl""\313Kp")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
#define TR_ROTARY_ENCODERS "REa\0"
|
|
||||||
#define TR_ROTENC_SWITCHES "REa"
|
|
||||||
#else
|
|
||||||
#define TR_ROTARY_ENCODERS
|
|
||||||
#define TR_ROTENC_SWITCHES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TR_ON_ONE_SWITCHES "ZAP""One"
|
#define TR_ON_ONE_SWITCHES "ZAP""One"
|
||||||
|
|
||||||
#if defined(GYRO)
|
#if defined(GYRO)
|
||||||
|
|
|
@ -322,14 +322,6 @@
|
||||||
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
#define TR_ROTARY_ENCODERS "DGa\0"
|
|
||||||
#define TR_ROTENC_SWITCHES "DGa"
|
|
||||||
#else
|
|
||||||
#define TR_ROTARY_ENCODERS
|
|
||||||
#define TR_ROTENC_SWITCHES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||||
|
|
||||||
#if defined(GYRO)
|
#if defined(GYRO)
|
||||||
|
|
|
@ -322,14 +322,6 @@
|
||||||
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
#define TR_ROTARY_ENCODERS "REa\0"
|
|
||||||
#define TR_ROTENC_SWITCHES "REa"
|
|
||||||
#else
|
|
||||||
#define TR_ROTARY_ENCODERS
|
|
||||||
#define TR_ROTENC_SWITCHES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||||
|
|
||||||
#if defined(GYRO)
|
#if defined(GYRO)
|
||||||
|
|
|
@ -319,14 +319,6 @@
|
||||||
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
#define TR_ROTARY_ENCODERS "REa\0"
|
|
||||||
#define TR_ROTENC_SWITCHES "REa"
|
|
||||||
#else
|
|
||||||
#define TR_ROTARY_ENCODERS
|
|
||||||
#define TR_ROTENC_SWITCHES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||||
|
|
||||||
#if defined(GYRO)
|
#if defined(GYRO)
|
||||||
|
|
|
@ -340,14 +340,6 @@
|
||||||
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
#define TR_ROTARY_ENCODERS "REa\0"
|
|
||||||
#define TR_ROTENC_SWITCHES "REa"
|
|
||||||
#else
|
|
||||||
#define TR_ROTARY_ENCODERS
|
|
||||||
#define TR_ROTENC_SWITCHES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||||
|
|
||||||
#if defined(GYRO)
|
#if defined(GYRO)
|
||||||
|
|
|
@ -342,14 +342,6 @@
|
||||||
#define TR_TRIMS_SWITCHES TR("tDg""tDd""tPb""tPh""tGb""tGh""tAg""tAd", "\313Dg""\313Dd""\313Pb""\313Ph""\313Gb""\313Gh""\313Ag""\313Ad")
|
#define TR_TRIMS_SWITCHES TR("tDg""tDd""tPb""tPh""tGb""tGh""tAg""tAd", "\313Dg""\313Dd""\313Pb""\313Ph""\313Gb""\313Gh""\313Ag""\313Ad")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
#define TR_ROTARY_ENCODERS "REa\0"
|
|
||||||
#define TR_ROTENC_SWITCHES "REa"
|
|
||||||
#else
|
|
||||||
#define TR_ROTARY_ENCODERS
|
|
||||||
#define TR_ROTENC_SWITCHES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TR_ON_ONE_SWITCHES "ON\0""Un"
|
#define TR_ON_ONE_SWITCHES "ON\0""Un"
|
||||||
|
|
||||||
#if defined(GYRO)
|
#if defined(GYRO)
|
||||||
|
|
|
@ -343,15 +343,6 @@
|
||||||
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
#define TR_ROTARY_ENCODERS "REa\0"
|
|
||||||
#define TR_ROTENC_SWITCHES "REa"
|
|
||||||
#else
|
|
||||||
#define TR_ROTARY_ENCODERS
|
|
||||||
#define TR_ROTENC_SWITCHES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||||
|
|
||||||
#if defined(GYRO)
|
#if defined(GYRO)
|
||||||
|
|
|
@ -320,14 +320,6 @@
|
||||||
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
#define TR_ROTARY_ENCODERS "REa\0"
|
|
||||||
#define TR_ROTENC_SWITCHES "REa"
|
|
||||||
#else
|
|
||||||
#define TR_ROTARY_ENCODERS
|
|
||||||
#define TR_ROTENC_SWITCHES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||||
|
|
||||||
#if defined(GYRO)
|
#if defined(GYRO)
|
||||||
|
|
|
@ -340,14 +340,6 @@
|
||||||
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
#define TR_ROTARY_ENCODERS "REa\0"
|
|
||||||
#define TR_ROTENC_SWITCHES "REa"
|
|
||||||
#else
|
|
||||||
#define TR_ROTARY_ENCODERS
|
|
||||||
#define TR_ROTENC_SWITCHES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||||
|
|
||||||
#if defined(GYRO)
|
#if defined(GYRO)
|
||||||
|
|
|
@ -322,14 +322,6 @@
|
||||||
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
#define TR_TRIMS_SWITCHES TR("tRl""tRr""tEd""tEu""tTd""tTu""tAl""tAr", "\313Rl""\313Rr""\313Ed""\313Eu""\313Eu""\313Td""\313Tu""\313Al""\313Ar")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
#define TR_ROTARY_ENCODERS "REa\0"
|
|
||||||
#define TR_ROTENC_SWITCHES "REa"
|
|
||||||
#else
|
|
||||||
#define TR_ROTARY_ENCODERS
|
|
||||||
#define TR_ROTENC_SWITCHES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
#define TR_ON_ONE_SWITCHES "ON\0""One"
|
||||||
|
|
||||||
#if defined(GYRO)
|
#if defined(GYRO)
|
||||||
|
|
|
@ -335,14 +335,6 @@
|
||||||
#define TR_TRIMS_SWITCHES TR("tRv""tRh""tHn""tHu""tGn""tGu""tSv""tSh", "\313Rv""\313Rh""\313Hn""\313Hu""\313Gn""\313Gu""\313Sv""\313Sh")
|
#define TR_TRIMS_SWITCHES TR("tRv""tRh""tHn""tHu""tGn""tGu""tSv""tSh", "\313Rv""\313Rh""\313Hn""\313Hu""\313Gn""\313Gu""\313Sv""\313Sh")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
#define TR_ROTARY_ENCODERS "REa\0"
|
|
||||||
#define TR_ROTENC_SWITCHES "REa"
|
|
||||||
#else
|
|
||||||
#define TR_ROTARY_ENCODERS
|
|
||||||
#define TR_ROTENC_SWITCHES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TR_ON_ONE_SWITCHES "På\0""Ett"
|
#define TR_ON_ONE_SWITCHES "På\0""Ett"
|
||||||
|
|
||||||
#if defined(GYRO)
|
#if defined(GYRO)
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
// only special switches here
|
// only special switches here
|
||||||
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||||
#elif defined(PCBSKY9X)
|
#elif defined(PCBSKY9X)
|
||||||
#define TR_VSWITCHES "---" "ID0""ID1""ID2" "THR""RUD""ELE""AIL""GEA""TRN" TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_ON_ONE_SWITCHES
|
#define TR_VSWITCHES "---" "ID0""ID1""ID2" "THR""RUD""ELE""AIL""GEA""TRN" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBHORUS) && defined(AUX_SERIAL)
|
#if defined(PCBHORUS) && defined(AUX_SERIAL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue