mirror of
https://github.com/opentx/opentx.git
synced 2025-07-14 03:49:52 +03:00
Global Functions now integrated inside Companion - Fixes #502
This commit is contained in:
parent
343e395652
commit
ef7bbea285
45 changed files with 685 additions and 687 deletions
|
@ -296,7 +296,7 @@ void CompareDialog::printPhases()
|
|||
str.append("</b></td><td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center width=\"80\"><b>"+tr("Flight mode name"));
|
||||
str.append("</b></td><td align=center width=\"30\"><b>"+tr("IN")+"</b></td><td align=center width=\"30\"><b>"+tr("OUT")+"</b></td>");
|
||||
for (i=0; i<4; i++) {
|
||||
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(*g_model1, i)));
|
||||
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(g_model1, i)));
|
||||
}
|
||||
str.append("</tr>");
|
||||
for (i=0; i<GetCurrentFirmware()->getCapability(FlightModes); i++) {
|
||||
|
@ -385,7 +385,7 @@ void CompareDialog::printPhases()
|
|||
str.append("</b></td><td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center width=\"80\"><b>"+tr("Flight mode name"));
|
||||
str.append("</b></td><td align=center width=\"30\"><b>"+tr("IN")+"</b></td><td align=center width=\"30\"><b>"+tr("OUT")+"</b></td>");
|
||||
for (i=0; i<4; i++) {
|
||||
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(*g_model1, i)));
|
||||
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(g_model1, i)));
|
||||
}
|
||||
str.append("</tr>");
|
||||
for (i=0; i<GetCurrentFirmware()->getCapability(FlightModes); i++) {
|
||||
|
@ -668,7 +668,7 @@ void CompareDialog::printExpos()
|
|||
}
|
||||
}
|
||||
str.append("</table></td>");
|
||||
str.append("<td width=\"10%\" align=\"center\" valign=\"middle\"><b>"+getInputStr(*g_model2, i)+"</b></td>");
|
||||
str.append("<td width=\"10%\" align=\"center\" valign=\"middle\"><b>"+getInputStr(g_model2, i)+"</b></td>");
|
||||
str.append("<td width=\"45%\">");
|
||||
str.append("<table border=0 cellspacing=0 cellpadding=0>");
|
||||
for (int j=0; j<C9X_MAX_EXPOS; j++) {
|
||||
|
@ -793,7 +793,7 @@ void CompareDialog::printMixers()
|
|||
break;
|
||||
};
|
||||
str += QString(" %1").arg(getGVarString(md->weight)).rightJustified(6, ' ');
|
||||
str += md->srcRaw.toString(*g_model1);
|
||||
str += md->srcRaw.toString(g_model1);
|
||||
if (md->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
|
||||
if (md->carryTrim) str += " " + tr("noTrim");
|
||||
if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
|
||||
|
@ -871,7 +871,7 @@ void CompareDialog::printMixers()
|
|||
break;
|
||||
};
|
||||
str += QString(" %1").arg(getGVarString(md->weight)).rightJustified(6, ' ');
|
||||
str += md->srcRaw.toString(*g_model2);
|
||||
str += md->srcRaw.toString(g_model2);
|
||||
if (md->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
|
||||
if (md->carryTrim) str += " " + tr("noTrim");
|
||||
if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
|
||||
|
|
|
@ -92,7 +92,7 @@ QString getGVarString(int16_t val, bool sign)
|
|||
}
|
||||
}
|
||||
|
||||
RawSourceRange RawSource::getRange(const ModelData & model, const GeneralSettings & settings, unsigned int flags) const
|
||||
RawSourceRange RawSource::getRange(const ModelData * model, const GeneralSettings & settings, unsigned int flags) const
|
||||
{
|
||||
RawSourceRange result;
|
||||
|
||||
|
@ -137,13 +137,13 @@ RawSourceRange RawSource::getRange(const ModelData & model, const GeneralSetting
|
|||
case TELEMETRY_SOURCE_A2_MIN:
|
||||
case TELEMETRY_SOURCE_A3_MIN:
|
||||
case TELEMETRY_SOURCE_A4_MIN:
|
||||
result = model.frsky.channels[index-TELEMETRY_SOURCE_A1_MIN].getRange();
|
||||
if (model) result = model->frsky.channels[index-TELEMETRY_SOURCE_A1_MIN].getRange();
|
||||
break;
|
||||
case TELEMETRY_SOURCE_A1:
|
||||
case TELEMETRY_SOURCE_A2:
|
||||
case TELEMETRY_SOURCE_A3:
|
||||
case TELEMETRY_SOURCE_A4:
|
||||
result = model.frsky.channels[index-TELEMETRY_SOURCE_A1].getRange();
|
||||
if (model) result = model->frsky.channels[index-TELEMETRY_SOURCE_A1].getRange();
|
||||
break;
|
||||
case TELEMETRY_SOURCE_ALT:
|
||||
case TELEMETRY_SOURCE_ALT_MIN:
|
||||
|
@ -302,8 +302,10 @@ RawSourceRange RawSource::getRange(const ModelData & model, const GeneralSetting
|
|||
break;
|
||||
|
||||
default:
|
||||
result.max = model.getChannelsMax(true);
|
||||
if (model) {
|
||||
result.max = model->getChannelsMax(true);
|
||||
result.min = -result.max;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -332,7 +334,7 @@ QString RotaryEncoderString(int index)
|
|||
return CHECK_IN_ARRAY(rotary, index);
|
||||
}
|
||||
|
||||
QString RawSource::toString(const ModelData & model)
|
||||
QString RawSource::toString(const ModelData * model)
|
||||
{
|
||||
static const QString trims[] = {
|
||||
QObject::tr("TrmR"), QObject::tr("TrmE"), QObject::tr("TrmT"), QObject::tr("TrmA")
|
||||
|
@ -367,8 +369,8 @@ QString RawSource::toString(const ModelData & model)
|
|||
case SOURCE_TYPE_VIRTUAL_INPUT:
|
||||
{
|
||||
QString result = QObject::tr("[I%1]").arg(index+1);
|
||||
if (strlen(model.inputNames[index]) > 0) {
|
||||
result += QString(model.inputNames[index]);
|
||||
if (model && strlen(model->inputNames[index]) > 0) {
|
||||
result += QString(model->inputNames[index]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -618,10 +620,10 @@ QString LogicalSwitchData::toString(const ModelData & model, const GeneralSettin
|
|||
break;
|
||||
case LS_FAMILY_VOFS: {
|
||||
RawSource source = RawSource(val1);
|
||||
RawSourceRange range = source.getRange(model, settings);
|
||||
RawSourceRange range = source.getRange(&model, settings);
|
||||
QString res;
|
||||
if (val1)
|
||||
res += source.toString(model);
|
||||
res += source.toString(&model);
|
||||
else
|
||||
res += "0";
|
||||
res.remove(" ");
|
||||
|
@ -664,7 +666,7 @@ QString LogicalSwitchData::toString(const ModelData & model, const GeneralSettin
|
|||
|
||||
case LS_FAMILY_VCOMP:
|
||||
if (val1)
|
||||
result += RawSource(val1).toString(model);
|
||||
result += RawSource(val1).toString(&model);
|
||||
else
|
||||
result += "0";
|
||||
switch (func) {
|
||||
|
@ -692,7 +694,7 @@ QString LogicalSwitchData::toString(const ModelData & model, const GeneralSettin
|
|||
break;
|
||||
}
|
||||
if (val2)
|
||||
result += RawSource(val2).toString(model);
|
||||
result += RawSource(val2).toString(&model);
|
||||
else
|
||||
result += "0";
|
||||
break;
|
||||
|
@ -723,9 +725,8 @@ void CustomFunctionData::clear()
|
|||
|
||||
QString CustomFunctionData::funcToString()
|
||||
{
|
||||
ModelData model;
|
||||
if (func >= FuncOverrideCH1 && func <= FuncOverrideCH32)
|
||||
return QObject::tr("Override %1").arg(RawSource(SOURCE_TYPE_CH, func).toString(model));
|
||||
return QObject::tr("Override %1").arg(RawSource(SOURCE_TYPE_CH, func).toString());
|
||||
else if (func == FuncTrainer)
|
||||
return QObject::tr("Trainer");
|
||||
else if (func == FuncTrainerRUD)
|
||||
|
@ -805,27 +806,26 @@ QString CustomFunctionData::paramToString()
|
|||
}
|
||||
else if ((func==FuncVolume)|| (func==FuncPlayValue)) {
|
||||
RawSource item(param);
|
||||
ModelData model;
|
||||
return item.toString(model);
|
||||
return item.toString();
|
||||
}
|
||||
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
|
||||
if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
|
||||
return QString("%1").arg(param);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return paramarm;
|
||||
}
|
||||
}
|
||||
else if ((func>FuncBackgroundMusicPause) && (func<FuncCount)) {
|
||||
ModelData model;
|
||||
switch (adjustMode) {
|
||||
case 0:
|
||||
return QObject::tr("Value ")+QString("%1").arg(param);
|
||||
break;
|
||||
case 1:
|
||||
return RawSource(param).toString(model);
|
||||
return RawSource(param).toString();
|
||||
break;
|
||||
case 2:
|
||||
return RawSource(param).toString(model);
|
||||
return RawSource(param).toString();
|
||||
break;
|
||||
case 3:
|
||||
if (param==0) {
|
||||
|
@ -1184,7 +1184,7 @@ void ModelData::setDefaultInputs(const GeneralSettings & settings)
|
|||
expo->mode = INPUT_MODE_BOTH;
|
||||
expo->srcRaw = settings.getDefaultSource(i);
|
||||
expo->weight = 100;
|
||||
strncpy(inputNames[i], expo->srcRaw.toString(*this).toLatin1().constData(), sizeof(inputNames[i])-1);
|
||||
strncpy(inputNames[i], expo->srcRaw.toString(this).toLatin1().constData(), sizeof(inputNames[i])-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,6 +208,9 @@ extern const char rightArrow[];
|
|||
extern const char upArrow[];
|
||||
extern const char downArrow[];
|
||||
|
||||
class ModelData;
|
||||
class GeneralSettings;
|
||||
|
||||
enum ThrottleSource {
|
||||
THROTTLE_SOURCE_THR,
|
||||
THROTTLE_SOURCE_P1,
|
||||
|
@ -302,8 +305,6 @@ enum RawSourceType {
|
|||
MAX_SOURCE_TYPE
|
||||
};
|
||||
|
||||
class ModelData;
|
||||
|
||||
QString AnalogString(int index);
|
||||
QString RotaryEncoderString(int index);
|
||||
|
||||
|
@ -335,7 +336,6 @@ class RawSourceRange
|
|||
#define RANGE_DELTA_FUNCTION 2
|
||||
#define RANGE_DELTA_ABS_FUNCTION 4
|
||||
|
||||
class GeneralSettings;
|
||||
class RawSource {
|
||||
public:
|
||||
RawSource():
|
||||
|
@ -361,9 +361,9 @@ class RawSource {
|
|||
return index >= 0 ? (type * 65536 + index) : -(type * 65536 - index);
|
||||
}
|
||||
|
||||
QString toString(const ModelData & model);
|
||||
QString toString(const ModelData * model = NULL);
|
||||
|
||||
RawSourceRange getRange(const ModelData & model, const GeneralSettings & settings, unsigned int flags=0) const;
|
||||
RawSourceRange getRange(const ModelData * model, const GeneralSettings & settings, unsigned int flags=0) const;
|
||||
|
||||
bool operator == ( const RawSource & other) {
|
||||
return (this->type == other.type) && (this->index == other.index);
|
||||
|
@ -434,121 +434,6 @@ class RawSwitch {
|
|||
int index;
|
||||
};
|
||||
|
||||
class TrainerMix {
|
||||
public:
|
||||
TrainerMix() { clear(); }
|
||||
unsigned int src; // 0-7 = ch1-8
|
||||
RawSwitch swtch;
|
||||
int weight;
|
||||
unsigned int mode; // off, add-mode, subst-mode
|
||||
void clear() { memset(this, 0, sizeof(TrainerMix)); }
|
||||
};
|
||||
|
||||
class TrainerData {
|
||||
public:
|
||||
TrainerData() { clear(); }
|
||||
int calib[4];
|
||||
TrainerMix mix[4];
|
||||
void clear() { memset(this, 0, sizeof(TrainerData)); }
|
||||
};
|
||||
|
||||
enum BeeperMode {
|
||||
e_quiet = -2,
|
||||
e_alarms_only = -1,
|
||||
e_no_keys = 0,
|
||||
e_all = 1
|
||||
};
|
||||
|
||||
class GeneralSettings {
|
||||
public:
|
||||
GeneralSettings();
|
||||
|
||||
int getDefaultStick(unsigned int channel) const;
|
||||
RawSource getDefaultSource(unsigned int channel) const;
|
||||
int getDefaultChannel(unsigned int stick) const;
|
||||
|
||||
unsigned int version;
|
||||
unsigned int variant;
|
||||
int calibMid[NUM_STICKS+C9X_NUM_POTS];
|
||||
int calibSpanNeg[NUM_STICKS+C9X_NUM_POTS];
|
||||
int calibSpanPos[NUM_STICKS+C9X_NUM_POTS];
|
||||
unsigned int currModel; // 0..15
|
||||
unsigned int contrast;
|
||||
unsigned int vBatWarn;
|
||||
int vBatCalib;
|
||||
int vBatMin;
|
||||
int vBatMax;
|
||||
int backlightMode;
|
||||
TrainerData trainer;
|
||||
unsigned int view; // main screen view // TODO enum
|
||||
bool disableThrottleWarning;
|
||||
bool fai;
|
||||
int switchWarning; // -1=down, 0=off, 1=up
|
||||
bool disableMemoryWarning;
|
||||
BeeperMode beeperMode;
|
||||
bool disableAlarmWarning;
|
||||
bool enableTelemetryAlarm;
|
||||
BeeperMode hapticMode;
|
||||
unsigned int stickMode; // TODO enum
|
||||
int timezone;
|
||||
bool optrexDisplay;
|
||||
unsigned int inactivityTimer;
|
||||
bool minuteBeep;
|
||||
bool preBeep;
|
||||
bool flashBeep;
|
||||
bool disablePotScroll;
|
||||
bool frskyinternalalarm;
|
||||
bool disableBG;
|
||||
unsigned int splashMode;
|
||||
int splashDuration;
|
||||
unsigned int backlightDelay;
|
||||
bool blightinv;
|
||||
bool stickScroll;
|
||||
unsigned int templateSetup; //RETA order according to chout_ar array
|
||||
int PPM_Multiplier;
|
||||
int hapticLength;
|
||||
unsigned int reNavigation;
|
||||
unsigned int stickReverse;
|
||||
bool hideNameOnSplash;
|
||||
bool enablePpmsim;
|
||||
unsigned int speakerPitch;
|
||||
int hapticStrength;
|
||||
unsigned int speakerMode;
|
||||
unsigned int lightOnStickMove; /* er9x / ersky9x only */
|
||||
char ownerName[10+1];
|
||||
unsigned int switchWarningStates;
|
||||
int beeperLength;
|
||||
unsigned int gpsFormat;
|
||||
int speakerVolume;
|
||||
unsigned int backlightBright;
|
||||
int switchesDelay;
|
||||
int currentCalib;
|
||||
int temperatureCalib;
|
||||
int temperatureWarn;
|
||||
unsigned int mAhWarn;
|
||||
unsigned int mAhUsed;
|
||||
unsigned int globalTimer;
|
||||
unsigned int btBaudrate;
|
||||
unsigned int sticksGain;
|
||||
unsigned int rotarySteps;
|
||||
unsigned int countryCode;
|
||||
unsigned int imperial;
|
||||
bool crosstrim;
|
||||
char ttsLanguage[2+1];
|
||||
int beepVolume;
|
||||
int wavVolume;
|
||||
int varioVolume;
|
||||
int varioPitch;
|
||||
int varioRange;
|
||||
int varioRepeat;
|
||||
int backgroundVolume;
|
||||
unsigned int mavbaud;
|
||||
unsigned int switchUnlockStates;
|
||||
unsigned int hw_uartMode;
|
||||
unsigned int potsType[8];
|
||||
unsigned int backlightColor;
|
||||
};
|
||||
|
||||
class CurveReference {
|
||||
public:
|
||||
enum CurveRefType {
|
||||
|
@ -1067,6 +952,123 @@ class ModelData {
|
|||
void removeGlobalVar(int & var);
|
||||
};
|
||||
|
||||
|
||||
class TrainerMix {
|
||||
public:
|
||||
TrainerMix() { clear(); }
|
||||
unsigned int src; // 0-7 = ch1-8
|
||||
RawSwitch swtch;
|
||||
int weight;
|
||||
unsigned int mode; // off, add-mode, subst-mode
|
||||
void clear() { memset(this, 0, sizeof(TrainerMix)); }
|
||||
};
|
||||
|
||||
class TrainerData {
|
||||
public:
|
||||
TrainerData() { clear(); }
|
||||
int calib[4];
|
||||
TrainerMix mix[4];
|
||||
void clear() { memset(this, 0, sizeof(TrainerData)); }
|
||||
};
|
||||
|
||||
enum BeeperMode {
|
||||
e_quiet = -2,
|
||||
e_alarms_only = -1,
|
||||
e_no_keys = 0,
|
||||
e_all = 1
|
||||
};
|
||||
|
||||
class GeneralSettings {
|
||||
public:
|
||||
GeneralSettings();
|
||||
|
||||
int getDefaultStick(unsigned int channel) const;
|
||||
RawSource getDefaultSource(unsigned int channel) const;
|
||||
int getDefaultChannel(unsigned int stick) const;
|
||||
|
||||
unsigned int version;
|
||||
unsigned int variant;
|
||||
int calibMid[NUM_STICKS+C9X_NUM_POTS];
|
||||
int calibSpanNeg[NUM_STICKS+C9X_NUM_POTS];
|
||||
int calibSpanPos[NUM_STICKS+C9X_NUM_POTS];
|
||||
unsigned int currModel; // 0..15
|
||||
unsigned int contrast;
|
||||
unsigned int vBatWarn;
|
||||
int vBatCalib;
|
||||
int vBatMin;
|
||||
int vBatMax;
|
||||
int backlightMode;
|
||||
TrainerData trainer;
|
||||
unsigned int view; // main screen view // TODO enum
|
||||
bool disableThrottleWarning;
|
||||
bool fai;
|
||||
int switchWarning; // -1=down, 0=off, 1=up
|
||||
bool disableMemoryWarning;
|
||||
BeeperMode beeperMode;
|
||||
bool disableAlarmWarning;
|
||||
bool enableTelemetryAlarm;
|
||||
BeeperMode hapticMode;
|
||||
unsigned int stickMode; // TODO enum
|
||||
int timezone;
|
||||
bool optrexDisplay;
|
||||
unsigned int inactivityTimer;
|
||||
bool minuteBeep;
|
||||
bool preBeep;
|
||||
bool flashBeep;
|
||||
bool disablePotScroll;
|
||||
bool frskyinternalalarm;
|
||||
bool disableBG;
|
||||
unsigned int splashMode;
|
||||
int splashDuration;
|
||||
unsigned int backlightDelay;
|
||||
bool blightinv;
|
||||
bool stickScroll;
|
||||
unsigned int templateSetup; //RETA order according to chout_ar array
|
||||
int PPM_Multiplier;
|
||||
int hapticLength;
|
||||
unsigned int reNavigation;
|
||||
unsigned int stickReverse;
|
||||
bool hideNameOnSplash;
|
||||
bool enablePpmsim;
|
||||
unsigned int speakerPitch;
|
||||
int hapticStrength;
|
||||
unsigned int speakerMode;
|
||||
unsigned int lightOnStickMove; /* er9x / ersky9x only */
|
||||
char ownerName[10+1];
|
||||
unsigned int switchWarningStates;
|
||||
int beeperLength;
|
||||
unsigned int gpsFormat;
|
||||
int speakerVolume;
|
||||
unsigned int backlightBright;
|
||||
int switchesDelay;
|
||||
int currentCalib;
|
||||
int temperatureCalib;
|
||||
int temperatureWarn;
|
||||
unsigned int mAhWarn;
|
||||
unsigned int mAhUsed;
|
||||
unsigned int globalTimer;
|
||||
unsigned int btBaudrate;
|
||||
unsigned int sticksGain;
|
||||
unsigned int rotarySteps;
|
||||
unsigned int countryCode;
|
||||
unsigned int imperial;
|
||||
bool crosstrim;
|
||||
char ttsLanguage[2+1];
|
||||
int beepVolume;
|
||||
int wavVolume;
|
||||
int varioVolume;
|
||||
int varioPitch;
|
||||
int varioRange;
|
||||
int varioRepeat;
|
||||
int backgroundVolume;
|
||||
unsigned int mavbaud;
|
||||
unsigned int switchUnlockStates;
|
||||
unsigned int hw_uartMode;
|
||||
unsigned int potsType[8];
|
||||
unsigned int backlightColor;
|
||||
CustomFunctionData customFn[C9X_MAX_CUSTOM_FUNCTIONS];
|
||||
};
|
||||
|
||||
class RadioData {
|
||||
public:
|
||||
GeneralSettings generalSettings;
|
||||
|
|
|
@ -524,7 +524,7 @@ class SourceField: public ConversionField< UnsignedField<N> > {
|
|||
public:
|
||||
SourceField(RawSource & source, BoardEnum board, unsigned int version, unsigned int variant, unsigned long flags=0):
|
||||
ConversionField< UnsignedField<N> >(_source, SourcesConversionTable::getInstance(board, version, variant, flags),
|
||||
"Source", "Source "+ source.toString(ModelData())+" cannot be exported on this board!"),
|
||||
"Source", "Source "+ source.toString()+" cannot be exported on this board!"),
|
||||
source(source),
|
||||
_source(0)
|
||||
{
|
||||
|
@ -1888,12 +1888,14 @@ class ArmCustomFunctionField: public TransformedField {
|
|||
variant(variant),
|
||||
functionsConversionTable(board, version),
|
||||
sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, version >= 216 ? 0 : FLAG_NONONE)),
|
||||
_active(0)
|
||||
_func(0),
|
||||
_active(0),
|
||||
_mode(0)
|
||||
{
|
||||
memset(_param, 0, sizeof(_param));
|
||||
|
||||
internalField.Append(new SwitchField<8>(fn.swtch, board, version));
|
||||
internalField.Append(new ConversionField< UnsignedField<8> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function")));
|
||||
internalField.Append(new ConversionField< UnsignedField<8> >(_func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function")));
|
||||
|
||||
if (IS_TARANIS(board) && version >= 216)
|
||||
internalField.Append(new CharField<8>(_param, false));
|
||||
|
@ -1917,7 +1919,8 @@ class ArmCustomFunctionField: public TransformedField {
|
|||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
_mode = 0;
|
||||
if (fn.swtch.type != SWITCH_TYPE_NONE) {
|
||||
_func = fn.func;
|
||||
|
||||
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic)
|
||||
_active = (version >= 216 ? fn.repeatParam : (fn.repeatParam/5));
|
||||
|
@ -1994,9 +1997,12 @@ class ArmCustomFunctionField: public TransformedField {
|
|||
*((uint32_t *)_param) = fn.param;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void afterImport()
|
||||
{
|
||||
fn.func = (AssignFunc)_func;
|
||||
|
||||
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic)
|
||||
fn.repeatParam = (version >= 216 ? _active : (_active*5));
|
||||
else
|
||||
|
@ -2079,6 +2085,7 @@ class ArmCustomFunctionField: public TransformedField {
|
|||
unsigned int variant;
|
||||
CustomFunctionsConversionTable functionsConversionTable;
|
||||
SourcesConversionTable * sourcesConversionTable;
|
||||
unsigned int _func;
|
||||
char _param[10];
|
||||
int _active;
|
||||
unsigned int _mode;
|
||||
|
@ -2978,6 +2985,14 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
|
|||
}
|
||||
internalField.Append(new UnsignedField<8>(generalData.backlightColor));
|
||||
}
|
||||
if (version >= 216) {
|
||||
internalField.Append(new SpareBitsField<16>());
|
||||
}
|
||||
if (version >= 217) {
|
||||
for (int i=0; i<MAX_CUSTOM_FUNCTIONS(board, version); i++) {
|
||||
internalField.Append(new ArmCustomFunctionField(generalData.customFn[i], board, version, variant));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
|||
|
||||
set(generaledit_NAMES
|
||||
generaledit
|
||||
setup
|
||||
generalsetup
|
||||
trainer
|
||||
calibration
|
||||
)
|
||||
|
|
|
@ -5,20 +5,10 @@
|
|||
#include "ui_generaledit.h"
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
#include "setup.h"
|
||||
#include "generalsetup.h"
|
||||
#include "trainer.h"
|
||||
#include "calibration.h"
|
||||
|
||||
GeneralPanel::GeneralPanel(QWidget * parent, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
||||
GenericPanel(parent),
|
||||
generalSettings(generalSettings),
|
||||
firmware(firmware)
|
||||
{
|
||||
}
|
||||
|
||||
GeneralPanel::~GeneralPanel()
|
||||
{
|
||||
}
|
||||
#include "../modeledit/customfunctions.h"
|
||||
|
||||
GeneralEdit::GeneralEdit(QWidget * parent, RadioData & radioData, FirmwareInterface * firmware) :
|
||||
QDialog(parent),
|
||||
|
@ -48,6 +38,9 @@ GeneralEdit::GeneralEdit(QWidget * parent, RadioData & radioData, FirmwareInterf
|
|||
}
|
||||
|
||||
addTab(new GeneralSetupPanel(this, generalSettings, firmware), tr("Setup"));
|
||||
if (IS_ARM(firmware->getBoard())) {
|
||||
addTab(new CustomFunctionsPanel(this, NULL, generalSettings, firmware), tr("Global Functions"));
|
||||
}
|
||||
addTab(new TrainerPanel(this, generalSettings, firmware), tr("Trainer"));
|
||||
addTab(new CalibrationPanel(this, generalSettings, firmware), tr("Calibration"));
|
||||
}
|
||||
|
@ -57,7 +50,7 @@ GeneralEdit::~GeneralEdit()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void GeneralEdit::addTab(GeneralPanel *panel, QString text)
|
||||
void GeneralEdit::addTab(GenericPanel *panel, QString text)
|
||||
{
|
||||
panels << panel;
|
||||
QWidget * widget = new QWidget(ui->tabWidget);
|
||||
|
@ -75,6 +68,7 @@ void GeneralEdit::onTabModified()
|
|||
|
||||
void GeneralEdit::on_tabWidget_currentChanged(int index)
|
||||
{
|
||||
panels[index]->update();
|
||||
g.generalEditTab(index);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,15 +11,11 @@ namespace Ui {
|
|||
|
||||
class GeneralPanel : public GenericPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GeneralPanel(QWidget *parent, GeneralSettings & generalSettings, FirmwareInterface * firmware);
|
||||
virtual ~GeneralPanel();
|
||||
|
||||
protected:
|
||||
GeneralSettings & generalSettings;
|
||||
FirmwareInterface * firmware;
|
||||
GeneralPanel(QWidget *parent, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
||||
GenericPanel(parent, NULL, generalSettings, firmware)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class GeneralEdit : public QDialog
|
||||
|
@ -52,8 +48,8 @@ class GeneralEdit : public QDialog
|
|||
|
||||
private:
|
||||
FirmwareInterface * firmware;
|
||||
QVector<GeneralPanel *> panels;
|
||||
void addTab(GeneralPanel *panel, QString text);
|
||||
QVector<GenericPanel *> panels;
|
||||
void addTab(GenericPanel *panel, QString text);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include "setup.h"
|
||||
#include "ui_setup.h"
|
||||
#include "generalsetup.h"
|
||||
#include "ui_generalsetup.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
GeneralSetupPanel::GeneralSetupPanel(QWidget * parent, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
||||
GeneralPanel(parent, generalSettings, firmware),
|
||||
ui(new Ui::Setup)
|
||||
ui(new Ui::GeneralSetup)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef SETUP_H
|
||||
#define SETUP_H
|
||||
#ifndef GENERALSETUP_H
|
||||
#define GENERALSETUP_H
|
||||
|
||||
#include "generaledit.h"
|
||||
#include "eeprominterface.h"
|
||||
|
||||
namespace Ui {
|
||||
class Setup;
|
||||
class GeneralSetup;
|
||||
}
|
||||
|
||||
class GeneralSetupPanel : public GeneralPanel
|
||||
|
@ -63,7 +63,7 @@ class GeneralSetupPanel : public GeneralPanel
|
|||
|
||||
|
||||
private:
|
||||
Ui::Setup *ui;
|
||||
Ui::GeneralSetup *ui;
|
||||
|
||||
void setValues();
|
||||
void populateBacklightCB();
|
||||
|
@ -72,4 +72,4 @@ class GeneralSetupPanel : public GeneralPanel
|
|||
void updateVarioPitchRange();
|
||||
};
|
||||
|
||||
#endif // SETUP_H
|
||||
#endif // GENERALSETUP_H
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Setup</class>
|
||||
<widget class="QWidget" name="Setup">
|
||||
<class>GeneralSetup</class>
|
||||
<widget class="QWidget" name="GeneralSetup">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
|
@ -65,14 +65,14 @@ QString getPhaseName(int val, const char * phasename)
|
|||
}
|
||||
}
|
||||
|
||||
QString getInputStr(ModelData & model, int index)
|
||||
QString getInputStr(ModelData * model, int index)
|
||||
{
|
||||
QString result;
|
||||
|
||||
if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
|
||||
if (strlen(model.inputNames[index]) > 0) {
|
||||
if (strlen(model->inputNames[index]) > 0) {
|
||||
result = QObject::tr("[I%1]").arg(index+1);
|
||||
result += QString(model.inputNames[index]);
|
||||
result += QString(model->inputNames[index]);
|
||||
}
|
||||
else {
|
||||
result = QObject::tr("Input%1").arg(index+1, 2, 10, QChar('0'));
|
||||
|
@ -516,7 +516,7 @@ void populateGVCB(QComboBox *b, int value)
|
|||
}
|
||||
}
|
||||
|
||||
void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData & model, unsigned int flags)
|
||||
void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData * model, unsigned int flags)
|
||||
{
|
||||
BoardEnum board = GetCurrentFirmware()->getBoard();
|
||||
RawSource item;
|
||||
|
@ -539,10 +539,10 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
|
|||
}
|
||||
}
|
||||
|
||||
if (flags & POPULATE_VIRTUAL_INPUTS) {
|
||||
if (model && (flags & POPULATE_VIRTUAL_INPUTS)) {
|
||||
int virtualInputs = GetCurrentFirmware()->getCapability(VirtualInputs);
|
||||
for (int i=0; i<virtualInputs; i++) {
|
||||
if (model.isInputValid(i)) {
|
||||
if (model->isInputValid(i)) {
|
||||
item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||
|
@ -761,8 +761,7 @@ QString getFrSkyMeasure(int units)
|
|||
|
||||
QString getFrSkySrc(int index)
|
||||
{
|
||||
ModelData model;
|
||||
return RawSource(SOURCE_TYPE_TELEMETRY, index-1).toString(model);
|
||||
return RawSource(SOURCE_TYPE_TELEMETRY, index-1).toString();
|
||||
}
|
||||
|
||||
QString getTrimInc(ModelData * g_model)
|
||||
|
@ -808,7 +807,7 @@ QString getProtocol(ModelData * g_model)
|
|||
return str;
|
||||
}
|
||||
|
||||
QString getPhasesStr(unsigned int phases, ModelData & model)
|
||||
QString getPhasesStr(unsigned int phases, ModelData * model)
|
||||
{
|
||||
int numphases = GetCurrentFirmware()->getCapability(FlightModes);
|
||||
|
||||
|
@ -822,7 +821,7 @@ QString getPhasesStr(unsigned int phases, ModelData & model)
|
|||
for (int i=0; i<numphases;i++) {
|
||||
if (!(phases & (1<<i))) {
|
||||
if (count++ > 0) str += QString(", ");
|
||||
str += getPhaseName(i+1, model.flightModeData[i].name);
|
||||
str += getPhaseName(i+1, model->flightModeData[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -998,8 +997,11 @@ QString generateProcessUniqueTempFileName(const QString & fileName)
|
|||
return QDir::tempPath() + QString("/%1-").arg(QCoreApplication::applicationPid()) + sanitizedFileName;
|
||||
}
|
||||
|
||||
GenericPanel::GenericPanel(QWidget * parent):
|
||||
GenericPanel::GenericPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
||||
QWidget(parent),
|
||||
model(model),
|
||||
generalSettings(generalSettings),
|
||||
firmware(firmware),
|
||||
lock(false)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
|||
void populatePhasesCB(QComboBox *b, int value);
|
||||
void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
||||
QString getProtocolStr(const int proto);
|
||||
QString getPhasesStr(unsigned int phases, ModelData & model);
|
||||
QString getPhasesStr(unsigned int phases, ModelData * model);
|
||||
|
||||
#define POPULATE_SOURCES (1<<0)
|
||||
#define POPULATE_TRIMS (1<<1)
|
||||
|
@ -110,9 +110,9 @@ QString getPhasesStr(unsigned int phases, ModelData & model);
|
|||
|
||||
// void populateGVarCB(QComboBox *b, int value, int min, int max,int pgvars=5); //TODO: Clean Up
|
||||
void populateGVCB(QComboBox *b, int value);
|
||||
void populateSourceCB(QComboBox *b, const RawSource &source, const ModelData & model, unsigned int flags);
|
||||
void populateSourceCB(QComboBox *b, const RawSource &source, const ModelData * model, unsigned int flags);
|
||||
QString getPhaseName(int val, const char * phasename=NULL);
|
||||
QString getInputStr(ModelData & model, int index);
|
||||
QString getInputStr(ModelData * model, int index);
|
||||
QString image2qstring(QImage image);
|
||||
QImage qstring2image(QString imagestr);
|
||||
int findmult(float value, float base);
|
||||
|
@ -157,7 +157,7 @@ class GenericPanel : public QWidget
|
|||
friend class QUnsignedAutoComboBox;
|
||||
|
||||
public:
|
||||
GenericPanel(QWidget *parent);
|
||||
GenericPanel(QWidget *parent, ModelData * model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
|
||||
virtual ~GenericPanel();
|
||||
|
||||
signals:
|
||||
|
@ -167,6 +167,9 @@ class GenericPanel : public QWidget
|
|||
virtual void update();
|
||||
|
||||
protected:
|
||||
ModelData * model;
|
||||
GeneralSettings & generalSettings;
|
||||
FirmwareInterface * firmware;
|
||||
bool lock;
|
||||
void addLabel(QGridLayout * gridLayout, QString text, int col, bool mimimize=false);
|
||||
void addEmptyLabel(QGridLayout * gridLayout, int col);
|
||||
|
|
|
@ -11,7 +11,6 @@ set(modeledit_NAMES
|
|||
)
|
||||
|
||||
set(modeledit_SRCS
|
||||
modelpanel.cpp
|
||||
flightmodes.cpp
|
||||
inputs.cpp
|
||||
mixes.cpp
|
||||
|
@ -25,7 +24,6 @@ set(modeledit_SRCS
|
|||
)
|
||||
|
||||
set(modeledit_HDRS
|
||||
modelpanel.h
|
||||
flightmodes.h
|
||||
inputs.h
|
||||
mixes.h
|
||||
|
|
|
@ -187,7 +187,7 @@ void Channels::symlimitsEdited()
|
|||
{
|
||||
QCheckBox * ckb = qobject_cast<QCheckBox*>(sender());
|
||||
int index = ckb->property("index").toInt();
|
||||
model.limitData[index].symetrical = (ckb->checkState() ? 1 : 0);
|
||||
model->limitData[index].symetrical = (ckb->checkState() ? 1 : 0);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ void Channels::nameEdited()
|
|||
lock = true;
|
||||
QLineEdit *le = qobject_cast<QLineEdit*>(sender());
|
||||
int index = le->property("index").toInt();
|
||||
strcpy(model.limitData[index].name, le->text().toAscii());
|
||||
strcpy(model->limitData[index].name, le->text().toAscii());
|
||||
lock = false;
|
||||
emit modified();
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ void Channels::nameEdited()
|
|||
|
||||
void Channels::refreshExtendedLimits()
|
||||
{
|
||||
int channelMax = model.getChannelsMax();
|
||||
int channelMax = model->getChannelsMax();
|
||||
|
||||
foreach(LimitsGroup *group, limitsGroups) {
|
||||
group->updateMinMax(10*channelMax);
|
||||
|
@ -218,7 +218,7 @@ void Channels::invEdited()
|
|||
{
|
||||
QComboBox *cb = qobject_cast<QComboBox*>(sender());
|
||||
int index = cb->property("index").toInt();
|
||||
model.limitData[index].revert = cb->currentIndex();
|
||||
model->limitData[index].revert = cb->currentIndex();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ 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());
|
||||
model->limitData[index].curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, cb->itemData(cb->currentIndex()).toInt());
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ void Channels::ppmcenterEdited()
|
|||
{
|
||||
QSpinBox *sb = qobject_cast<QSpinBox*>(sender());
|
||||
int index = sb->property("index").toInt();
|
||||
model.limitData[index].ppmCenter = sb->value() - 1500;
|
||||
model->limitData[index].ppmCenter = sb->value() - 1500;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CHANNELS_H
|
||||
#define CHANNELS_H
|
||||
|
||||
#include "modelpanel.h"
|
||||
#include "modeledit.h"
|
||||
#include <QSpinBox>
|
||||
|
||||
class GVarGroup;
|
||||
|
|
|
@ -204,7 +204,7 @@ void Curves::resetCurve()
|
|||
int index = button->property("index").toInt();
|
||||
int res = QMessageBox::question(this, "companion", tr("Are you sure you want to reset curve %1 ?").arg(index+1), QMessageBox::Yes | QMessageBox::No);
|
||||
if (res == QMessageBox::Yes) {
|
||||
model.curves[index].clear(5);
|
||||
model->curves[index].clear(5);
|
||||
update();
|
||||
emit modified();
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ void Curves::update()
|
|||
lock = true;
|
||||
|
||||
if (firmware->getCapability(HasCvNames)) {
|
||||
ui->curveName->setText(model.curves[currentCurve].name);
|
||||
ui->curveName->setText(model->curves[currentCurve].name);
|
||||
}
|
||||
|
||||
updateCurveType();
|
||||
|
@ -245,21 +245,21 @@ void Curves::updateCurveType()
|
|||
int index = 0;
|
||||
|
||||
if (firmware->getCapability(EnhancedCurves)) {
|
||||
index = model.curves[currentCurve].count - 2;
|
||||
index = model->curves[currentCurve].count - 2;
|
||||
}
|
||||
else {
|
||||
ui->curveSmooth->hide();
|
||||
if (model.curves[currentCurve].count == 5)
|
||||
if (model->curves[currentCurve].count == 5)
|
||||
index = 1;
|
||||
else if (model.curves[currentCurve].count == 9)
|
||||
else if (model->curves[currentCurve].count == 9)
|
||||
index = 2;
|
||||
else if (model.curves[currentCurve].count == 17)
|
||||
else if (model->curves[currentCurve].count == 17)
|
||||
index = 3;
|
||||
}
|
||||
|
||||
ui->curvePoints->setCurrentIndex(index);
|
||||
ui->curveCustom->setCurrentIndex(model.curves[currentCurve].type);
|
||||
ui->curveSmooth->setCurrentIndex(model.curves[currentCurve].smooth);
|
||||
ui->curveCustom->setCurrentIndex(model->curves[currentCurve].type);
|
||||
ui->curveSmooth->setCurrentIndex(model->curves[currentCurve].smooth);
|
||||
|
||||
lock = false;
|
||||
}
|
||||
|
@ -295,36 +295,36 @@ void Curves::updateCurve()
|
|||
for (int k=0; k<numcurves; k++) {
|
||||
pen.setColor(colors[k]);
|
||||
if (currentCurve!=k && visibleCurves[k]) {
|
||||
int numpoints = model.curves[k].count;
|
||||
int numpoints = model->curves[k].count;
|
||||
for (int i=0; i<numpoints-1; i++) {
|
||||
if (model.curves[k].type == CurveData::CURVE_TYPE_CUSTOM)
|
||||
scene->addLine(centerX + (qreal)model.curves[k].points[i].x*width/200,centerY - (qreal)model.curves[k].points[i].y*height/200,centerX + (qreal)model.curves[k].points[i+1].x*width/200,centerY - (qreal)model.curves[k].points[i+1].y*height/200, pen);
|
||||
if (model->curves[k].type == CurveData::CURVE_TYPE_CUSTOM)
|
||||
scene->addLine(centerX + (qreal)model->curves[k].points[i].x*width/200,centerY - (qreal)model->curves[k].points[i].y*height/200,centerX + (qreal)model->curves[k].points[i+1].x*width/200,centerY - (qreal)model->curves[k].points[i+1].y*height/200, pen);
|
||||
else
|
||||
scene->addLine(GFX_MARGIN + i*width/(numpoints-1),centerY - (qreal)model.curves[k].points[i].y*height/200,GFX_MARGIN + (i+1)*width/(numpoints-1),centerY - (qreal)model.curves[k].points[i+1].y*height/200, pen);
|
||||
scene->addLine(GFX_MARGIN + i*width/(numpoints-1),centerY - (qreal)model->curves[k].points[i].y*height/200,GFX_MARGIN + (i+1)*width/(numpoints-1),centerY - (qreal)model->curves[k].points[i+1].y*height/200, pen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int numpoints = model.curves[currentCurve].count;
|
||||
int numpoints = model->curves[currentCurve].count;
|
||||
for (int i=0; i<numpoints; i++) {
|
||||
nodel = nodex;
|
||||
nodex = new Node();
|
||||
nodex->setProperty("index", i);
|
||||
nodex->setColor(colors[currentCurve]);
|
||||
if (model.curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM) {
|
||||
if (model->curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM) {
|
||||
if (i>0 && i<numpoints-1) {
|
||||
nodex->setFixedX(false);
|
||||
nodex->setMinX(model.curves[currentCurve].points[i-1].x);
|
||||
nodex->setMaxX(model.curves[currentCurve].points[i+1].x);
|
||||
nodex->setMinX(model->curves[currentCurve].points[i-1].x);
|
||||
nodex->setMaxX(model->curves[currentCurve].points[i+1].x);
|
||||
}
|
||||
else {
|
||||
nodex->setFixedX(true);
|
||||
}
|
||||
nodex->setPos(centerX + (qreal)model.curves[currentCurve].points[i].x*width/200,centerY - (qreal)model.curves[currentCurve].points[i].y*height/200);
|
||||
nodex->setPos(centerX + (qreal)model->curves[currentCurve].points[i].x*width/200,centerY - (qreal)model->curves[currentCurve].points[i].y*height/200);
|
||||
}
|
||||
else {
|
||||
nodex->setFixedX(true);
|
||||
nodex->setPos(GFX_MARGIN + i*width/(numpoints-1), centerY - (qreal)model.curves[currentCurve].points[i].y*height/200);
|
||||
nodex->setPos(GFX_MARGIN + i*width/(numpoints-1), centerY - (qreal)model->curves[currentCurve].points[i].y*height/200);
|
||||
}
|
||||
connect(nodex, SIGNAL(moved(int, int)), this, SLOT(onNodeMoved(int, int)));
|
||||
connect(nodex, SIGNAL(focus()), this, SLOT(onNodeFocus()));
|
||||
|
@ -340,23 +340,23 @@ void Curves::updateCurvePoints()
|
|||
{
|
||||
lock = true;
|
||||
|
||||
int count = model.curves[currentCurve].count;
|
||||
int count = model->curves[currentCurve].count;
|
||||
for (int i=0; i<count; i++) {
|
||||
spny[i]->show();
|
||||
spny[i]->setValue(model.curves[currentCurve].points[i].y);
|
||||
if (model.curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM) {
|
||||
spny[i]->setValue(model->curves[currentCurve].points[i].y);
|
||||
if (model->curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM) {
|
||||
spnx[i]->show();
|
||||
if (i==0 || i==model.curves[currentCurve].count-1) {
|
||||
if (i==0 || i==model->curves[currentCurve].count-1) {
|
||||
spnx[i]->setDisabled(true);
|
||||
spnx[i]->setMaximum(+100);
|
||||
spnx[i]->setMinimum(-100);
|
||||
}
|
||||
else {
|
||||
spnx[i]->setDisabled(false);
|
||||
spnx[i]->setMaximum(model.curves[currentCurve].points[i+1].x);
|
||||
spnx[i]->setMinimum(model.curves[currentCurve].points[i-1].x);
|
||||
spnx[i]->setMaximum(model->curves[currentCurve].points[i+1].x);
|
||||
spnx[i]->setMinimum(model->curves[currentCurve].points[i-1].x);
|
||||
}
|
||||
spnx[i]->setValue(model.curves[currentCurve].points[i].x);
|
||||
spnx[i]->setValue(model->curves[currentCurve].points[i].x);
|
||||
}
|
||||
else {
|
||||
spnx[i]->hide();
|
||||
|
@ -374,8 +374,8 @@ void Curves::onPointEdited()
|
|||
{
|
||||
if (!lock) {
|
||||
int index = sender()->property("index").toInt();
|
||||
model.curves[currentCurve].points[index].x = spnx[index]->value();
|
||||
model.curves[currentCurve].points[index].y = spny[index]->value();
|
||||
model->curves[currentCurve].points[index].x = spnx[index]->value();
|
||||
model->curves[currentCurve].points[index].y = spny[index]->value();
|
||||
updateCurve();
|
||||
emit modified();
|
||||
}
|
||||
|
@ -386,13 +386,13 @@ void Curves::onNodeMoved(int x, int y)
|
|||
if (!lock) {
|
||||
lock = true;
|
||||
int index = sender()->property("index").toInt();
|
||||
model.curves[currentCurve].points[index].x = x;
|
||||
model.curves[currentCurve].points[index].y = y;
|
||||
model->curves[currentCurve].points[index].x = x;
|
||||
model->curves[currentCurve].points[index].y = y;
|
||||
spnx[index]->setValue(x);
|
||||
spny[index]->setValue(y);
|
||||
if (index > 0)
|
||||
spnx[index-1]->setMaximum(x);
|
||||
if (index < model.curves[currentCurve].count-1)
|
||||
if (index < model->curves[currentCurve].count-1)
|
||||
spnx[index+1]->setMinimum(x);
|
||||
emit modified();
|
||||
lock = false;
|
||||
|
@ -418,8 +418,8 @@ bool Curves::allowCurveType(int points, CurveData::CurveType type)
|
|||
|
||||
int totalpoints = 0;
|
||||
for (int i=0; i<numcurves; i++) {
|
||||
int cvPoints = (i==currentCurve ? points : model.curves[i].count);
|
||||
CurveData::CurveType cvType = (i==currentCurve ? type : model.curves[i].type);
|
||||
int cvPoints = (i==currentCurve ? points : model->curves[i].count);
|
||||
CurveData::CurveType cvType = (i==currentCurve ? type : model->curves[i].type);
|
||||
totalpoints += cvPoints + (cvType==CurveData::CURVE_TYPE_CUSTOM ? cvPoints-2 : 0);
|
||||
}
|
||||
|
||||
|
@ -438,13 +438,13 @@ void Curves::on_curvePoints_currentIndexChanged(int index)
|
|||
if (!lock) {
|
||||
int numpoints = ((QComboBox *)sender())->itemData(index).toInt();
|
||||
|
||||
if (allowCurveType(numpoints, model.curves[currentCurve].type)) {
|
||||
model.curves[currentCurve].count = numpoints;
|
||||
if (allowCurveType(numpoints, model->curves[currentCurve].type)) {
|
||||
model->curves[currentCurve].count = numpoints;
|
||||
|
||||
// TODO something better + reuse!
|
||||
for (int i=0; i<C9X_MAX_POINTS; i++) {
|
||||
model.curves[currentCurve].points[i].x = (i >= numpoints-1 ? +100 : -100 + (200*i)/(numpoints-1));
|
||||
model.curves[currentCurve].points[i].y = 0;
|
||||
model->curves[currentCurve].points[i].x = (i >= numpoints-1 ? +100 : -100 + (200*i)/(numpoints-1));
|
||||
model->curves[currentCurve].points[i].y = 0;
|
||||
}
|
||||
|
||||
update();
|
||||
|
@ -461,13 +461,13 @@ void Curves::on_curveCustom_currentIndexChanged(int index)
|
|||
if (!lock) {
|
||||
CurveData::CurveType type = (CurveData::CurveType)index;
|
||||
int numpoints = ui->curvePoints->itemData(ui->curvePoints->currentIndex()).toInt();
|
||||
if (allowCurveType(model.curves[currentCurve].count, type)) {
|
||||
model.curves[currentCurve].type = type;
|
||||
if (allowCurveType(model->curves[currentCurve].count, type)) {
|
||||
model->curves[currentCurve].type = type;
|
||||
|
||||
// TODO something better + reuse!
|
||||
for (int i=0; i<C9X_MAX_POINTS; i++) {
|
||||
model.curves[currentCurve].points[i].x = (i >= numpoints-1 ? +100 : -100 + (200*i)/(numpoints-1));
|
||||
model.curves[currentCurve].points[i].y = 0;
|
||||
model->curves[currentCurve].points[i].x = (i >= numpoints-1 ? +100 : -100 + (200*i)/(numpoints-1));
|
||||
model->curves[currentCurve].points[i].y = 0;
|
||||
}
|
||||
|
||||
update();
|
||||
|
@ -481,14 +481,14 @@ void Curves::on_curveCustom_currentIndexChanged(int index)
|
|||
|
||||
void Curves::on_curveSmooth_currentIndexChanged(int index)
|
||||
{
|
||||
model.curves[currentCurve].smooth = index;
|
||||
model->curves[currentCurve].smooth = index;
|
||||
update();
|
||||
}
|
||||
|
||||
void Curves::on_curveName_editingFinished()
|
||||
{
|
||||
memset(model.curves[currentCurve].name, 0, sizeof(model.curves[currentCurve].name));
|
||||
strcpy(model.curves[currentCurve].name, ui->curveName->text().toAscii());
|
||||
memset(model->curves[currentCurve].name, 0, sizeof(model->curves[currentCurve].name));
|
||||
strcpy(model->curves[currentCurve].name, ui->curveName->text().toAscii());
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
@ -528,12 +528,12 @@ void Curves::addTemplate(QString name, unsigned int flags, curveFunction functio
|
|||
void Curves::on_curveApply_clicked()
|
||||
{
|
||||
int index = ui->curveType->currentIndex();
|
||||
int numpoints = model.curves[currentCurve].count;
|
||||
int numpoints = model->curves[currentCurve].count;
|
||||
|
||||
for (int i=0; i<numpoints; i++) {
|
||||
float x;
|
||||
if (model.curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM)
|
||||
x = model.curves[currentCurve].points[i].x;
|
||||
if (model->curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM)
|
||||
x = model->curves[currentCurve].points[i].x;
|
||||
else
|
||||
x = -100.0 + (200.0/(numpoints-1))*i;
|
||||
|
||||
|
@ -553,7 +553,7 @@ void Curves::on_curveApply_clicked()
|
|||
}
|
||||
|
||||
if (apply) {
|
||||
model.curves[currentCurve].points[i].y = templates[index].function(x, ui->curveCoeff->value(), ui->yMin->value(), ui->yMid->value(), ui->yMax->value());
|
||||
model->curves[currentCurve].points[i].y = templates[index].function(x, ui->curveCoeff->value(), ui->yMin->value(), ui->yMid->value(), ui->yMax->value());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -571,12 +571,12 @@ void ModelEdit::clearCurves(bool ask)
|
|||
}
|
||||
curvesLock=true;
|
||||
for (int j=0; j<16; j++) {
|
||||
model.curves[j].count = 5;
|
||||
model.curves[j].custom = false;
|
||||
memset(model.curves[j].name, 0, sizeof(model.curves[j].name));
|
||||
model->curves[j].count = 5;
|
||||
model->curves[j].custom = false;
|
||||
memset(model->curves[j].name, 0, sizeof(model->curves[j].name));
|
||||
for (int i=0; i<17; i++) {
|
||||
model.curves[j].points[i].x = 0;
|
||||
model.curves[j].points[i].y = 0;
|
||||
model->curves[j].points[i].x = 0;
|
||||
model->curves[j].points[i].y = 0;
|
||||
}
|
||||
}
|
||||
for (int i=0; i<17; i++) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CURVES_H
|
||||
#define CURVES_H
|
||||
|
||||
#include "modelpanel.h"
|
||||
#include "modeledit.h"
|
||||
#include <QSpinBox>
|
||||
|
||||
namespace Ui {
|
||||
|
|
|
@ -47,8 +47,9 @@ void RepeatComboBox::update()
|
|||
setCurrentIndex(value);
|
||||
}
|
||||
|
||||
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
||||
ModelPanel(parent, model, generalSettings, firmware),
|
||||
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
||||
GenericPanel(parent, model, generalSettings, firmware),
|
||||
functions(model ? model->customFn : generalSettings.customFn),
|
||||
initialized(false)
|
||||
#if defined(PHONON)
|
||||
,
|
||||
|
@ -70,8 +71,8 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
|||
|
||||
if (!firmware->getCapability(VoicesAsNumbers)) {
|
||||
for (int i=0; i<num_fsw; i++) {
|
||||
if (model.customFn[i].func==FuncPlayPrompt || model.customFn[i].func==FuncBackgroundMusic) {
|
||||
QString temp = model.customFn[i].paramarm;
|
||||
if (functions[i].func==FuncPlayPrompt || functions[i].func==FuncBackgroundMusic) {
|
||||
QString temp = functions[i].paramarm;
|
||||
if (!temp.isEmpty()) {
|
||||
if (!paramarmList.contains(temp)) {
|
||||
paramarmList.append(temp);
|
||||
|
@ -118,6 +119,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
|||
fswtchSwtch[i] = new QComboBox(this);
|
||||
fswtchSwtch[i]->setProperty("index", i);
|
||||
fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||
fswtchSwtch[i]->setMaxVisibleItems(10);
|
||||
connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
gridLayout->addWidget(fswtchSwtch[i], i+1, 1);
|
||||
|
||||
|
@ -181,7 +183,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
|||
|
||||
QHBoxLayout *repeatLayout = new QHBoxLayout();
|
||||
gridLayout->addLayout(repeatLayout, i+1, 4);
|
||||
fswtchRepeat[i] = new RepeatComboBox(this, model.customFn[i].repeatParam);
|
||||
fswtchRepeat[i] = new RepeatComboBox(this, functions[i].repeatParam);
|
||||
repeatLayout->addWidget(fswtchRepeat[i], i+1);
|
||||
connect(fswtchRepeat[i], SIGNAL(modified()), this, SLOT(onChildModified()));
|
||||
|
||||
|
@ -308,20 +310,20 @@ void CustomFunctionsPanel::onChildModified()
|
|||
|
||||
void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
{
|
||||
CustomFunctionData & cfn = model.customFn[i];
|
||||
CustomFunctionData & cfn = functions[i];
|
||||
AssignFunc func = (AssignFunc)fswtchFunc[i]->itemData(fswtchFunc[i]->currentIndex()).toInt();
|
||||
|
||||
unsigned int widgetsMask = 0;
|
||||
if (modified) {
|
||||
cfn.swtch = RawSwitch(fswtchSwtch[i]->itemData(fswtchSwtch[i]->currentIndex()).toInt());
|
||||
cfn.func = (AssignFunc)fswtchFunc[i]->currentIndex();
|
||||
cfn.func = func;
|
||||
cfn.enabled = fswtchEnable[i]->isChecked();
|
||||
cfn.adjustMode = (AssignFunc)fswtchGVmode[i]->currentIndex();
|
||||
}
|
||||
|
||||
int index = fswtchFunc[i]->currentIndex();
|
||||
|
||||
if (index>=FuncOverrideCH1 && index<=FuncOverrideCH32) {
|
||||
int channelsMax = model.getChannelsMax(true);
|
||||
if (func>=FuncOverrideCH1 && func<=FuncOverrideCH32) {
|
||||
if (model) {
|
||||
int channelsMax = model->getChannelsMax(true);
|
||||
fswtchParam[i]->setDecimals(0);
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
fswtchParam[i]->setMinimum(-channelsMax);
|
||||
|
@ -332,7 +334,8 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
|||
fswtchParam[i]->setValue(cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
else if (index==FuncLogs) {
|
||||
}
|
||||
else if (func==FuncLogs) {
|
||||
fswtchParam[i]->setDecimals(1);
|
||||
fswtchParam[i]->setMinimum(0);
|
||||
fswtchParam[i]->setMaximum(25.5);
|
||||
|
@ -341,7 +344,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
|||
fswtchParam[i]->setValue(cfn.param/10.0);
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM;
|
||||
}
|
||||
else if (index>=FuncAdjustGV1 && index<=FuncAdjustGVLast) {
|
||||
else if (func>=FuncAdjustGV1 && func<=FuncAdjustGVLast) {
|
||||
if (modified) cfn.adjustMode = fswtchGVmode[i]->currentIndex();
|
||||
widgetsMask |= CUSTOM_FUNCTION_GV_MODE + CUSTOM_FUNCTION_ENABLE;
|
||||
if (cfn.adjustMode==0) {
|
||||
|
@ -361,16 +364,16 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
|||
}
|
||||
else {
|
||||
if (modified) cfn.param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, cfn.param, cfn.adjustMode);
|
||||
populateFuncParamCB(fswtchParamT[i], func, cfn.param, cfn.adjustMode);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
|
||||
}
|
||||
}
|
||||
else if (index==FuncReset) {
|
||||
else if (func==FuncReset) {
|
||||
if (modified) cfn.param = (uint8_t)fswtchParamT[i]->currentIndex();
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, cfn.param);
|
||||
populateFuncParamCB(fswtchParamT[i], func, cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM | CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
else if (index>=FuncSetTimer1 && index<=FuncSetTimer2) {
|
||||
else if (func>=FuncSetTimer1 && func<=FuncSetTimer2) {
|
||||
if (modified) cfn.param = fswtchParam[i]->value();
|
||||
fswtchParam[i]->setDecimals(0);
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
|
@ -379,34 +382,34 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
|||
fswtchParam[i]->setValue(cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
else if (index==FuncVolume) {
|
||||
else if (func==FuncVolume) {
|
||||
if (modified) cfn.param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, cfn.param);
|
||||
populateFuncParamCB(fswtchParamT[i], func, cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
else if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
||||
if (index != FuncBackgroundMusic) {
|
||||
else if (func==FuncPlaySound || func==FuncPlayHaptic || func==FuncPlayValue || func==FuncPlayPrompt || func==FuncPlayBoth || func==FuncBackgroundMusic) {
|
||||
if (func != FuncBackgroundMusic) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_REPEAT;
|
||||
fswtchRepeat[i]->update();
|
||||
}
|
||||
if (index==FuncPlayValue) {
|
||||
if (func==FuncPlayValue) {
|
||||
if (modified) cfn.param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, cfn.param);
|
||||
populateFuncParamCB(fswtchParamT[i], func, cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_REPEAT;
|
||||
}
|
||||
else if (index==FuncPlayPrompt || index==FuncPlayBoth) {
|
||||
else if (func==FuncPlayPrompt || func==FuncPlayBoth) {
|
||||
if (firmware->getCapability(VoicesAsNumbers)) {
|
||||
fswtchParam[i]->setDecimals(0);
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
fswtchParam[i]->setMinimum(0);
|
||||
if (index==FuncPlayPrompt) {
|
||||
if (func==FuncPlayPrompt) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_REPEAT + CUSTOM_FUNCTION_GV_TOOGLE;
|
||||
}
|
||||
else {
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_REPEAT;
|
||||
fswtchParamGV[i]->setChecked(false);
|
||||
}
|
||||
fswtchParam[i]->setMaximum(index==FuncPlayBoth ? 254 : 255);
|
||||
fswtchParam[i]->setMaximum(func==FuncPlayBoth ? 254 : 255);
|
||||
if (modified) {
|
||||
if (fswtchParamGV[i]->isChecked()) {
|
||||
fswtchParam[i]->setMinimum(1);
|
||||
|
@ -416,7 +419,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
|||
cfn.param = fswtchParam[i]->value();
|
||||
}
|
||||
}
|
||||
if (cfn.param>250 && (index!=FuncPlayBoth)) {
|
||||
if (cfn.param>250 && (func!=FuncPlayBoth)) {
|
||||
fswtchParamGV[i]->setChecked(true);
|
||||
fswtchParam[i]->setValue(cfn.param-250);
|
||||
fswtchParam[i]->setMaximum(5);
|
||||
|
@ -448,7 +451,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (index==FuncBackgroundMusic) {
|
||||
else if (func==FuncBackgroundMusic) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
|
||||
if (modified) {
|
||||
memset(cfn.paramarm, 0, sizeof(cfn.paramarm));
|
||||
|
@ -461,18 +464,18 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (index==FuncPlaySound) {
|
||||
else if (func==FuncPlaySound) {
|
||||
if (modified) cfn.param = (uint8_t)fswtchParamT[i]->currentIndex();
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, cfn.param);
|
||||
populateFuncParamCB(fswtchParamT[i], func, cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
|
||||
}
|
||||
else if (index==FuncPlayHaptic) {
|
||||
else if (func==FuncPlayHaptic) {
|
||||
if (modified) cfn.param = (uint8_t)fswtchParamT[i]->currentIndex();
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, cfn.param);
|
||||
populateFuncParamCB(fswtchParamT[i], func, cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
|
||||
}
|
||||
}
|
||||
else if (index==FuncBacklight && IS_TARANIS_PLUS(GetEepromInterface()->getBoard())) {
|
||||
else if (func==FuncBacklight && IS_TARANIS_PLUS(GetEepromInterface()->getBoard())) {
|
||||
if (modified) cfn.param = (uint8_t)fswtchBLcolor[i]->value();
|
||||
fswtchBLcolor[i]->setValue(cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_BL_COLOR;
|
||||
|
@ -482,7 +485,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
|||
fswtchParam[i]->setDecimals(0);
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
fswtchParam[i]->setValue(cfn.param);
|
||||
if (index <= FuncInstantTrim) {
|
||||
if (func <= FuncInstantTrim) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
}
|
||||
|
@ -509,11 +512,11 @@ void CustomFunctionsPanel::update()
|
|||
lock = true;
|
||||
for (int i=0; i<firmware->getCapability(CustomFunctions); i++) {
|
||||
if (!initialized) {
|
||||
populateSwitchCB(fswtchSwtch[i], model.customFn[i].swtch, generalSettings, CustomFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[i], model.customFn[i].func);
|
||||
populateGVmodeCB(fswtchGVmode[i], model.customFn[i].adjustMode);
|
||||
populateFuncParamCB(fswtchParamT[i], model, model.customFn[i].func, model.customFn[i].param, model.customFn[i].adjustMode);
|
||||
populateFuncParamArmTCB(fswtchParamArmT[i], model.customFn[i].paramarm, paramarmList);
|
||||
populateSwitchCB(fswtchSwtch[i], functions[i].swtch, generalSettings, CustomFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[i], functions[i].func);
|
||||
populateGVmodeCB(fswtchGVmode[i], functions[i].adjustMode);
|
||||
populateFuncParamCB(fswtchParamT[i], functions[i].func, functions[i].param, functions[i].adjustMode);
|
||||
populateFuncParamArmTCB(fswtchParamArmT[i], functions[i].paramarm, paramarmList);
|
||||
}
|
||||
refreshCustomFunction(i);
|
||||
}
|
||||
|
@ -527,14 +530,14 @@ void CustomFunctionsPanel::fswPaste()
|
|||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
if (mimeData->hasFormat("application/x-companion-fsw")) {
|
||||
QByteArray fswData = mimeData->data("application/x-companion-fsw");
|
||||
CustomFunctionData *fsw = &model.customFn[selectedFunction];
|
||||
CustomFunctionData *fsw = &functions[selectedFunction];
|
||||
memcpy(fsw, fswData.mid(0, sizeof(CustomFunctionData)).constData(), sizeof(CustomFunctionData));
|
||||
lock = true;
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.customFn[selectedFunction].swtch, generalSettings, CustomFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[selectedFunction], model.customFn[selectedFunction].func);
|
||||
populateGVmodeCB(fswtchGVmode[selectedFunction], model.customFn[selectedFunction].adjustMode);
|
||||
populateFuncParamCB(fswtchParamT[selectedFunction], model, model.customFn[selectedFunction].func, model.customFn[selectedFunction].param, model.customFn[selectedFunction].adjustMode);
|
||||
populateFuncParamArmTCB(fswtchParamArmT[selectedFunction], model.customFn[selectedFunction].paramarm, paramarmList);
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], functions[selectedFunction].swtch, generalSettings, CustomFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[selectedFunction], functions[selectedFunction].func);
|
||||
populateGVmodeCB(fswtchGVmode[selectedFunction], functions[selectedFunction].adjustMode);
|
||||
populateFuncParamCB(fswtchParamT[selectedFunction], functions[selectedFunction].func, functions[selectedFunction].param, functions[selectedFunction].adjustMode);
|
||||
populateFuncParamArmTCB(fswtchParamArmT[selectedFunction], functions[selectedFunction].paramarm, paramarmList);
|
||||
refreshCustomFunction(selectedFunction);
|
||||
lock = false;
|
||||
emit modified();
|
||||
|
@ -543,11 +546,11 @@ void CustomFunctionsPanel::fswPaste()
|
|||
|
||||
void CustomFunctionsPanel::fswDelete()
|
||||
{
|
||||
model.customFn[selectedFunction].clear();
|
||||
functions[selectedFunction].clear();
|
||||
// TODO update switch and func
|
||||
lock = true;
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.customFn[selectedFunction].swtch, generalSettings, CustomFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[selectedFunction], model.customFn[selectedFunction].func);
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], functions[selectedFunction].swtch, generalSettings, CustomFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[selectedFunction], functions[selectedFunction].func);
|
||||
refreshCustomFunction(selectedFunction);
|
||||
lock = false;
|
||||
emit modified();
|
||||
|
@ -556,7 +559,7 @@ void CustomFunctionsPanel::fswDelete()
|
|||
void CustomFunctionsPanel::fswCopy()
|
||||
{
|
||||
QByteArray fswData;
|
||||
fswData.append((char*)&model.customFn[selectedFunction], sizeof(CustomFunctionData));
|
||||
fswData.append((char*)&functions[selectedFunction], sizeof(CustomFunctionData));
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData("application/x-companion-fsw", fswData);
|
||||
QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
|
||||
|
@ -592,21 +595,26 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
|
|||
{
|
||||
b->clear();
|
||||
for (unsigned int i=0; i<FuncCount; i++) {
|
||||
b->addItem(CustomFunctionData(AssignFunc(i)).funcToString());
|
||||
if (((i>=FuncOverrideCH1 && i<=FuncOverrideCH32) && !firmware->getCapability(SafetyChannelCustomFunction)) ||
|
||||
if (((i>=FuncOverrideCH1 && i<=FuncOverrideCH32) && (!model || !firmware->getCapability(SafetyChannelCustomFunction))) ||
|
||||
((i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) && !firmware->getCapability(HasVolume)) ||
|
||||
((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) ||
|
||||
((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) ||
|
||||
((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) ||
|
||||
((i>=FuncAdjustGV1 && i<=FuncAdjustGVLast) && !firmware->getCapability(Gvars))
|
||||
) {
|
||||
QModelIndex index = b->model()->index(i, 0);
|
||||
QVariant v(0);
|
||||
b->model()->setData(index, v, Qt::UserRole - 1);
|
||||
// skipped
|
||||
// b->addItem(CustomFunctionData(AssignFunc(i)).funcToString(), i);
|
||||
// QModelIndex index = b->model()->index(i, 0);
|
||||
// QVariant v(0);
|
||||
// b->model()->setData(index, v, Qt::UserRole - 1);
|
||||
}
|
||||
else {
|
||||
b->addItem(CustomFunctionData(AssignFunc(i)).funcToString(), i);
|
||||
if (i == value) {
|
||||
b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
b->setCurrentIndex(value);
|
||||
b->setMaxVisibleItems(10);
|
||||
}
|
||||
|
||||
void CustomFunctionsPanel::populateGVmodeCB(QComboBox *b, unsigned int value)
|
||||
|
@ -640,7 +648,7 @@ void CustomFunctionsPanel::populateFuncParamArmTCB(QComboBox *b, char * value, Q
|
|||
}
|
||||
}
|
||||
|
||||
void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, const ModelData & model, uint function, unsigned int value, unsigned int adjustmode)
|
||||
void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode)
|
||||
{
|
||||
QStringList qs;
|
||||
b->clear();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CUSTOMFUNCTIONS_H
|
||||
#define CUSTOMFUNCTIONS_H
|
||||
|
||||
#include "modelpanel.h"
|
||||
#include "modeledit.h"
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
|
@ -31,16 +31,19 @@ class RepeatComboBox: public QComboBox
|
|||
int & repeatParam;
|
||||
};
|
||||
|
||||
class CustomFunctionsPanel : public ModelPanel
|
||||
class CustomFunctionsPanel : public GenericPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CustomFunctionsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
|
||||
CustomFunctionsPanel(QWidget *parent, ModelData * mode, GeneralSettings & generalSettings, FirmwareInterface * firmware);
|
||||
~CustomFunctionsPanel();
|
||||
|
||||
virtual void update();
|
||||
|
||||
protected:
|
||||
CustomFunctionData * functions;
|
||||
|
||||
private slots:
|
||||
void customFunctionEdited();
|
||||
void fsw_customContextMenuRequested(QPoint pos);
|
||||
|
@ -58,7 +61,7 @@ class CustomFunctionsPanel : public ModelPanel
|
|||
private:
|
||||
void populateFuncCB(QComboBox *b, unsigned int value);
|
||||
void populateGVmodeCB(QComboBox *b, unsigned int value);
|
||||
void populateFuncParamCB(QComboBox *b, const ModelData & model, uint function, unsigned int value, unsigned int adjustmode=0);
|
||||
void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode=0);
|
||||
void populateFuncParamArmTCB(QComboBox *b, char * value, QStringList & paramsList);
|
||||
|
||||
bool initialized;
|
||||
|
|
|
@ -15,7 +15,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
|||
QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
|
||||
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
||||
|
||||
setWindowTitle(tr("Edit %1").arg(getInputStr(model, ed->chn)));
|
||||
setWindowTitle(tr("Edit %1").arg(getInputStr(&model, ed->chn)));
|
||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
|
@ -60,7 +60,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
|||
|
||||
if (firmware->getCapability(VirtualInputs)) {
|
||||
ui->inputName->setMaxLength(4);
|
||||
populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
|
||||
populateSourceCB(ui->sourceCB, ed->srcRaw, &model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
|
||||
ui->sourceCB->removeItem(0);
|
||||
}
|
||||
else {
|
||||
|
@ -122,7 +122,7 @@ ExpoDialog::~ExpoDialog()
|
|||
void ExpoDialog::updateScale()
|
||||
{
|
||||
if (firmware->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) {
|
||||
RawSourceRange range = ed->srcRaw.getRange(model, generalSettings);
|
||||
RawSourceRange range = ed->srcRaw.getRange(&model, generalSettings);
|
||||
ui->scaleLabel->show();
|
||||
ui->scale->show();
|
||||
ui->scale->setDecimals(range.decimals);
|
||||
|
@ -146,7 +146,7 @@ void ExpoDialog::valuesChanged()
|
|||
updateScale();
|
||||
}
|
||||
|
||||
RawSourceRange range = srcRaw.getRange(model, generalSettings);
|
||||
RawSourceRange range = srcRaw.getRange(&model, generalSettings);
|
||||
ed->scale = round(float(ui->scale->value()) / range.step);
|
||||
ed->carryTrim = 1 - ui->trimCB->currentIndex();
|
||||
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
|
||||
|
|
|
@ -196,24 +196,24 @@ void FlightModePanel::update()
|
|||
|
||||
for (int i=0; i<4; i++) {
|
||||
int trimsMax = firmware->getCapability(ExtendedTrims);
|
||||
if (trimsMax == 0 || !model.extendedTrims) {
|
||||
if (trimsMax == 0 || !model->extendedTrims) {
|
||||
trimsMax = 125;
|
||||
}
|
||||
trimsSlider[i]->setRange(-trimsMax, +trimsMax);
|
||||
trimsValue[i]->setRange(-trimsMax, +trimsMax);
|
||||
int chn = CONVERT_MODE(i+1)-1;
|
||||
if (chn == 2/*TODO constant*/ && model.throttleReversed)
|
||||
if (chn == 2/*TODO constant*/ && model->throttleReversed)
|
||||
trimsSlider[i]->setInvertedAppearance(true);
|
||||
trimUpdate(i);
|
||||
}
|
||||
|
||||
if (ui->gvGB->isVisible()) {
|
||||
for (int i=0; i<gvCount; i++) {
|
||||
gvNames[i]->setText(model.gvars_names[i]);
|
||||
gvValues[i]->setDisabled(model.isGVarLinked(phaseIdx, i));
|
||||
gvValues[i]->setValue(model.getGVarValue(phaseIdx, i));
|
||||
gvNames[i]->setText(model->gvars_names[i]);
|
||||
gvValues[i]->setDisabled(model->isGVarLinked(phaseIdx, i));
|
||||
gvValues[i]->setValue(model->getGVarValue(phaseIdx, i));
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard()) && phaseIdx == 0) {
|
||||
gvPopups[i]->setChecked(model.gvars_popups[i]);
|
||||
gvPopups[i]->setChecked(model->gvars_popups[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ void FlightModePanel::update()
|
|||
FlightModeData *phasere = &phase;
|
||||
while (idx > 1024) {
|
||||
idx -= 1025;
|
||||
phasere = &model.flightModeData[idx];
|
||||
phasere = &model->flightModeData[idx];
|
||||
idx = phasere->rotaryEncoders[i];
|
||||
reValues[i]->setDisabled(true);
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ void FlightModePanel::trimUpdate(unsigned int trim)
|
|||
{
|
||||
lock = true;
|
||||
int chn = CONVERT_MODE(trim+1)-1;
|
||||
int value = model.getTrimValue(phaseIdx, chn);
|
||||
int value = model->getTrimValue(phaseIdx, chn);
|
||||
trimsSlider[trim]->setValue(value);
|
||||
trimsValue[trim]->setValue(value);
|
||||
if (phase.trimMode[chn] < 0) {
|
||||
|
@ -302,8 +302,8 @@ void FlightModePanel::GVName_editingFinished()
|
|||
if (!lock) {
|
||||
QLineEdit *lineedit = qobject_cast<QLineEdit*>(sender());
|
||||
int gvar = lineedit->property("index").toInt();
|
||||
memset(&model.gvars_names[gvar], 0, sizeof(model.gvars_names[gvar]));
|
||||
strcpy(model.gvars_names[gvar], lineedit->text().toAscii());
|
||||
memset(&model->gvars_names[gvar], 0, sizeof(model->gvars_names[gvar]));
|
||||
strcpy(model->gvars_names[gvar], lineedit->text().toAscii());
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ void FlightModePanel::phaseGVPopupToggled(bool checked)
|
|||
{
|
||||
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
|
||||
int gvar = cb->property("index").toInt();
|
||||
model.gvars_popups[gvar] = checked;
|
||||
model->gvars_popups[gvar] = checked;
|
||||
}
|
||||
|
||||
void FlightModePanel::phaseREValue_editingFinished()
|
||||
|
@ -397,7 +397,7 @@ void FlightModePanel::phaseTrim_valueChanged()
|
|||
int trim = spinBox->property("index").toInt();
|
||||
int chn = CONVERT_MODE(trim+1)-1;
|
||||
int value = spinBox->value();
|
||||
model.setTrimValue(phaseIdx, chn, value);
|
||||
model->setTrimValue(phaseIdx, chn, value);
|
||||
lock = true;
|
||||
trimsSlider[trim]->setValue(value);
|
||||
lock = false;
|
||||
|
@ -412,7 +412,7 @@ void FlightModePanel::phaseTrimSlider_valueChanged()
|
|||
int trim = slider->property("index").toInt();
|
||||
int chn = CONVERT_MODE(trim+1)-1;
|
||||
int value = slider->value();
|
||||
model.setTrimValue(phaseIdx, chn, value);
|
||||
model->setTrimValue(phaseIdx, chn, value);
|
||||
lock = true;
|
||||
trimsValue[trim]->setValue(value);
|
||||
lock = false;
|
||||
|
@ -452,7 +452,7 @@ void FlightModesPanel::onPhaseModified()
|
|||
QString FlightModesPanel::getTabName(int index)
|
||||
{
|
||||
QString result = tr("Flight Mode %1").arg(index);
|
||||
const char *name = model.flightModeData[index].name;
|
||||
const char *name = model->flightModeData[index].name;
|
||||
if (firmware->getCapability(FlightModesName) && strlen(name) > 0) {
|
||||
result += tr(" (%1)").arg(name);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef FLIGHTMODES_H
|
||||
#define FLIGHTMODES_H
|
||||
|
||||
#include "modelpanel.h"
|
||||
#include "modeledit.h"
|
||||
#include <QVector>
|
||||
#include <QLabel>
|
||||
#include <QTabWidget>
|
||||
|
|
|
@ -27,12 +27,12 @@ void HeliPanel::update()
|
|||
{
|
||||
lock = true;
|
||||
|
||||
ui->swashTypeCB->setCurrentIndex(model.swashRingData.type);
|
||||
populateSourceCB(ui->swashCollectiveCB, model.swashRingData.collectiveSource, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
ui->swashRingValSB->setValue(model.swashRingData.value);
|
||||
ui->swashInvertELE->setChecked(model.swashRingData.invertELE);
|
||||
ui->swashInvertAIL->setChecked(model.swashRingData.invertAIL);
|
||||
ui->swashInvertCOL->setChecked(model.swashRingData.invertCOL);
|
||||
ui->swashTypeCB->setCurrentIndex(model->swashRingData.type);
|
||||
populateSourceCB(ui->swashCollectiveCB, model->swashRingData.collectiveSource, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
ui->swashRingValSB->setValue(model->swashRingData.value);
|
||||
ui->swashInvertELE->setChecked(model->swashRingData.invertELE);
|
||||
ui->swashInvertAIL->setChecked(model->swashRingData.invertAIL);
|
||||
ui->swashInvertCOL->setChecked(model->swashRingData.invertCOL);
|
||||
|
||||
lock = false;
|
||||
}
|
||||
|
@ -40,12 +40,12 @@ void HeliPanel::update()
|
|||
void HeliPanel::edited()
|
||||
{
|
||||
if (!lock) {
|
||||
model.swashRingData.type = ui->swashTypeCB->currentIndex();
|
||||
model.swashRingData.collectiveSource = ui->swashCollectiveCB->itemData(ui->swashCollectiveCB->currentIndex()).toInt();
|
||||
model.swashRingData.value = ui->swashRingValSB->value();
|
||||
model.swashRingData.invertELE = ui->swashInvertELE->isChecked();
|
||||
model.swashRingData.invertAIL = ui->swashInvertAIL->isChecked();
|
||||
model.swashRingData.invertCOL = ui->swashInvertCOL->isChecked();
|
||||
model->swashRingData.type = ui->swashTypeCB->currentIndex();
|
||||
model->swashRingData.collectiveSource = ui->swashCollectiveCB->itemData(ui->swashCollectiveCB->currentIndex()).toInt();
|
||||
model->swashRingData.value = ui->swashRingValSB->value();
|
||||
model->swashRingData.invertELE = ui->swashInvertELE->isChecked();
|
||||
model->swashRingData.invertAIL = ui->swashInvertAIL->isChecked();
|
||||
model->swashRingData.invertCOL = ui->swashInvertCOL->isChecked();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef HELI_H
|
||||
#define HELI_H
|
||||
|
||||
#include "modelpanel.h"
|
||||
#include "modeledit.h"
|
||||
|
||||
namespace Ui {
|
||||
class Heli;
|
||||
|
|
|
@ -59,7 +59,7 @@ void InputsPanel::update()
|
|||
int curDest = -1;
|
||||
|
||||
for (int i=0; i<C9X_MAX_EXPOS; i++) {
|
||||
ExpoData *md = &model.expoData[i];
|
||||
ExpoData *md = &model->expoData[i];
|
||||
|
||||
if (md->mode==0) break;
|
||||
|
||||
|
@ -104,7 +104,7 @@ bool InputsPanel::AddInputLine(int dest)
|
|||
QByteArray qba(1, (quint8)dest);
|
||||
if (dest >= 0) {
|
||||
//add input data
|
||||
ExpoData *md = &model.expoData[dest];
|
||||
ExpoData *md = &model->expoData[dest];
|
||||
qba.append((const char*)md, sizeof(ExpoData));
|
||||
}
|
||||
itm->setData(Qt::UserRole, qba);
|
||||
|
@ -139,9 +139,9 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
|
|||
if (new_ch) *new_ch = 1;
|
||||
}
|
||||
else {
|
||||
ExpoData *md = &model.expoData[dest];
|
||||
ExpoData *md = &model->expoData[dest];
|
||||
|
||||
if ((dest == 0) || (model.expoData[dest-1].chn != md->chn)) {
|
||||
if ((dest == 0) || (model->expoData[dest-1].chn != md->chn)) {
|
||||
if (new_ch) *new_ch = 1;
|
||||
if (firmware->getCapability(VirtualInputs))
|
||||
str = QString("%1").arg(getInputStr(model, md->chn), -10, ' ');
|
||||
|
@ -191,14 +191,14 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
|
|||
|
||||
bool InputsPanel::gm_insertExpo(int idx)
|
||||
{
|
||||
if (idx<0 || idx>=C9X_MAX_EXPOS || model.expoData[C9X_MAX_EXPOS-1].mode > 0) {
|
||||
if (idx<0 || idx>=C9X_MAX_EXPOS || model->expoData[C9X_MAX_EXPOS-1].mode > 0) {
|
||||
QMessageBox::information(this, "Companion", tr("Not enough available inputs!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
int chn = model.expoData[idx].chn;
|
||||
int chn = model->expoData[idx].chn;
|
||||
|
||||
ExpoData * newExpo = model.insertInput(idx);
|
||||
ExpoData * newExpo = model->insertInput(idx);
|
||||
newExpo->chn = chn;
|
||||
newExpo->weight = 100;
|
||||
newExpo->mode = INPUT_MODE_BOTH;
|
||||
|
@ -208,26 +208,27 @@ bool InputsPanel::gm_insertExpo(int idx)
|
|||
|
||||
void InputsPanel::gm_deleteExpo(int index)
|
||||
{
|
||||
model.removeInput(index);
|
||||
model->removeInput(index);
|
||||
}
|
||||
|
||||
void InputsPanel::gm_openExpo(int index)
|
||||
{
|
||||
if(index<0 || index>=C9X_MAX_EXPOS) return;
|
||||
|
||||
ExpoData mixd(model.expoData[index]);
|
||||
ExpoData mixd(model->expoData[index]);
|
||||
char inputName[4+1];
|
||||
emit modified();
|
||||
update();
|
||||
|
||||
if (firmware->getCapability(VirtualInputs))
|
||||
strcpy(inputName, model.inputNames[mixd.chn]);
|
||||
if (firmware->getCapability(VirtualInputs)) {
|
||||
strcpy(inputName, model->inputNames[mixd.chn]);
|
||||
}
|
||||
|
||||
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings, firmware, inputName);
|
||||
ExpoDialog *g = new ExpoDialog(this, *model, &mixd, generalSettings, firmware, inputName);
|
||||
if (g->exec()) {
|
||||
model.expoData[index] = mixd;
|
||||
model->expoData[index] = mixd;
|
||||
if (firmware->getCapability(VirtualInputs))
|
||||
strcpy(model.inputNames[mixd.chn], inputName);
|
||||
strcpy(model->inputNames[mixd.chn], inputName);
|
||||
emit modified();
|
||||
update();
|
||||
}
|
||||
|
@ -244,7 +245,7 @@ void InputsPanel::gm_openExpo(int index)
|
|||
int InputsPanel::getExpoIndex(unsigned int dch)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
while (model.expoData[i].chn<=dch && model.expoData[i].mode && i<C9X_MAX_EXPOS) i++;
|
||||
while (model->expoData[i].chn<=dch && model->expoData[i].mode && i<C9X_MAX_EXPOS) i++;
|
||||
if(i==C9X_MAX_EXPOS) return -1;
|
||||
return i;
|
||||
}
|
||||
|
@ -302,7 +303,7 @@ void InputsPanel::exposCopy()
|
|||
|
||||
QByteArray mxData;
|
||||
foreach(int idx, list) {
|
||||
mxData.append((char*)&model.expoData[idx],sizeof(ExpoData));
|
||||
mxData.append((char*)&model->expoData[idx], sizeof(ExpoData));
|
||||
}
|
||||
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
|
@ -329,7 +330,7 @@ void InputsPanel::pasteExpoMimeData(const QMimeData * mimeData, int destIdx)
|
|||
idx = getExpoIndex(dch) - 1; //get expo index to insert
|
||||
} else {
|
||||
idx = destIdx;
|
||||
dch = model.expoData[idx].chn;
|
||||
dch = model->expoData[idx].chn;
|
||||
}
|
||||
|
||||
QByteArray mxData = mimeData->data("application/x-companion-expo");
|
||||
|
@ -339,7 +340,7 @@ void InputsPanel::pasteExpoMimeData(const QMimeData * mimeData, int destIdx)
|
|||
idx++;
|
||||
if (!gm_insertExpo(idx))
|
||||
break;
|
||||
ExpoData *md = &model.expoData[idx];
|
||||
ExpoData *md = &model->expoData[idx];
|
||||
memcpy(md, mxData.mid(i, sizeof(ExpoData)).constData(), sizeof(ExpoData));
|
||||
md->chn = dch;
|
||||
i += sizeof(ExpoData);
|
||||
|
@ -378,7 +379,7 @@ void InputsPanel::expoOpen(QListWidgetItem *item)
|
|||
idx = getExpoIndex(ch); // get expo index to insert
|
||||
if (!gm_insertExpo(idx))
|
||||
return;
|
||||
model.expoData[idx].chn = ch;
|
||||
model->expoData[idx].chn = ch;
|
||||
expoInserted=true;
|
||||
} else {
|
||||
expoInserted=false;
|
||||
|
@ -396,7 +397,7 @@ void InputsPanel::expoAdd()
|
|||
index++;
|
||||
if (!gm_insertExpo(index))
|
||||
return;
|
||||
model.expoData[index].chn = model.expoData[index-1].chn;
|
||||
model->expoData[index].chn = model->expoData[index-1].chn;
|
||||
}
|
||||
gm_openExpo(index);
|
||||
}
|
||||
|
@ -452,8 +453,8 @@ int InputsPanel::gm_moveExpo(int idx, bool dir) //true=inc=down false=dec=up
|
|||
int tdx = dir ? idx+1 : idx-1;
|
||||
ExpoData temp;
|
||||
temp.clear();
|
||||
ExpoData &src=model.expoData[idx];
|
||||
ExpoData &tgt=model.expoData[tdx];
|
||||
ExpoData &src=model->expoData[idx];
|
||||
ExpoData &tgt=model->expoData[tdx];
|
||||
if (!dir && tdx<0 && src.chn>0) {
|
||||
src.chn--;
|
||||
return idx;
|
||||
|
@ -524,7 +525,7 @@ void InputsPanel::exposDeleteList(QList<int> list)
|
|||
void InputsPanel::clearExpos()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Clear Inputs?"), tr("Really clear all the inputs?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
model.clearInputs();
|
||||
model->clearInputs();
|
||||
emit modified();
|
||||
update();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef INPUTS_H
|
||||
#define INPUTS_H
|
||||
|
||||
#include "modelpanel.h"
|
||||
#include "modeledit.h"
|
||||
#include "mixerslist.h"
|
||||
|
||||
class InputsPanel : public ModelPanel
|
||||
|
|
|
@ -138,11 +138,11 @@ void LogicalSwitchesPanel::v1Edited(int value)
|
|||
{
|
||||
if (!lock) {
|
||||
int i = sender()->property("index").toInt();
|
||||
model.logicalSw[i].val1 = cswitchSource1[i]->itemData(value).toInt();
|
||||
if (model.logicalSw[i].getFunctionFamily() == LS_FAMILY_VOFS) {
|
||||
RawSource source = RawSource(model.logicalSw[i].val1);
|
||||
RawSourceRange range = source.getRange(model, generalSettings, model.logicalSw[i].getRangeFlags());
|
||||
model.logicalSw[i].val2 = (cswitchOffset[i]->value() - range.offset) / range.step;
|
||||
model->logicalSw[i].val1 = cswitchSource1[i]->itemData(value).toInt();
|
||||
if (model->logicalSw[i].getFunctionFamily() == LS_FAMILY_VOFS) {
|
||||
RawSource source = RawSource(model->logicalSw[i].val1);
|
||||
RawSourceRange range = source.getRange(model, generalSettings, model->logicalSw[i].getRangeFlags());
|
||||
model->logicalSw[i].val2 = (cswitchOffset[i]->value() - range.offset) / range.step;
|
||||
setSwitchWidgetVisibility(i);
|
||||
}
|
||||
emit modified();
|
||||
|
@ -153,7 +153,7 @@ void LogicalSwitchesPanel::v2Edited(int value)
|
|||
{
|
||||
if (!lock) {
|
||||
int i = sender()->property("index").toInt();
|
||||
model.logicalSw[i].val2 = cswitchSource2[i]->itemData(value).toInt();
|
||||
model->logicalSw[i].val2 = cswitchSource2[i]->itemData(value).toInt();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ void LogicalSwitchesPanel::andEdited(int value)
|
|||
{
|
||||
if (!lock) {
|
||||
int index = sender()->property("index").toInt();
|
||||
model.logicalSw[index].andsw = cswitchAnd[index]->itemData(value).toInt();
|
||||
model->logicalSw[index].andsw = cswitchAnd[index]->itemData(value).toInt();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ void LogicalSwitchesPanel::durationEdited(double duration)
|
|||
{
|
||||
if (!lock) {
|
||||
int index = sender()->property("index").toInt();
|
||||
model.logicalSw[index].duration = (uint8_t)round(duration*10);
|
||||
model->logicalSw[index].duration = (uint8_t)round(duration*10);
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ void LogicalSwitchesPanel::delayEdited(double delay)
|
|||
{
|
||||
if (!lock) {
|
||||
int index = sender()->property("index").toInt();
|
||||
model.logicalSw[index].delay = (uint8_t)round(delay*10);
|
||||
model->logicalSw[index].delay = (uint8_t)round(delay*10);
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
@ -190,30 +190,30 @@ void LogicalSwitchesPanel::edited()
|
|||
if (!lock) {
|
||||
lock = true;
|
||||
int i = sender()->property("index").toInt();
|
||||
CSFunctionFamily oldFuncFamily = model.logicalSw[i].getFunctionFamily();
|
||||
model.logicalSw[i].func = csw[i]->itemData(csw[i]->currentIndex()).toInt();
|
||||
CSFunctionFamily newFuncFamily = model.logicalSw[i].getFunctionFamily();
|
||||
CSFunctionFamily oldFuncFamily = model->logicalSw[i].getFunctionFamily();
|
||||
model->logicalSw[i].func = csw[i]->itemData(csw[i]->currentIndex()).toInt();
|
||||
CSFunctionFamily newFuncFamily = model->logicalSw[i].getFunctionFamily();
|
||||
|
||||
if (oldFuncFamily != newFuncFamily) {
|
||||
if (newFuncFamily == LS_FAMILY_TIMER) {
|
||||
model.logicalSw[i].val1 = -119;
|
||||
model.logicalSw[i].val2 = -119;
|
||||
model->logicalSw[i].val1 = -119;
|
||||
model->logicalSw[i].val2 = -119;
|
||||
}
|
||||
else if (newFuncFamily == LS_FAMILY_EDGE) {
|
||||
model.logicalSw[i].val1 = 0;
|
||||
model.logicalSw[i].val2 = -129;
|
||||
model.logicalSw[i].val3 = 0;
|
||||
model->logicalSw[i].val1 = 0;
|
||||
model->logicalSw[i].val2 = -129;
|
||||
model->logicalSw[i].val3 = 0;
|
||||
}
|
||||
else if (newFuncFamily == LS_FAMILY_STICKY) {
|
||||
model.logicalSw[i].val1 = 0;
|
||||
model.logicalSw[i].val2 = 0;
|
||||
model.logicalSw[i].delay = 0;
|
||||
model->logicalSw[i].val1 = 0;
|
||||
model->logicalSw[i].val2 = 0;
|
||||
model->logicalSw[i].delay = 0;
|
||||
}
|
||||
else {
|
||||
model.logicalSw[i].val1 = 0;
|
||||
model.logicalSw[i].val2 = 0;
|
||||
model->logicalSw[i].val1 = 0;
|
||||
model->logicalSw[i].val2 = 0;
|
||||
}
|
||||
model.logicalSw[i].andsw = 0;
|
||||
model->logicalSw[i].andsw = 0;
|
||||
setSwitchWidgetVisibility(i);
|
||||
}
|
||||
|
||||
|
@ -223,11 +223,11 @@ void LogicalSwitchesPanel::edited()
|
|||
{
|
||||
case LS_FAMILY_VOFS:
|
||||
{
|
||||
source = RawSource(model.logicalSw[i].val1);
|
||||
RawSourceRange range = source.getRange(model, generalSettings, model.logicalSw[i].getRangeFlags());
|
||||
source = RawSource(model->logicalSw[i].val1);
|
||||
RawSourceRange range = source.getRange(model, generalSettings, model->logicalSw[i].getRangeFlags());
|
||||
double value = source.isTimeBased() ? QTimeS(cswitchTOffset[i]->time()).seconds() : cswitchOffset[i]->value();
|
||||
model.logicalSw[i].val2 = round((value-range.offset)/range.step);;
|
||||
value = model.logicalSw[i].val2*range.step + range.offset;
|
||||
model->logicalSw[i].val2 = round((value-range.offset)/range.step);;
|
||||
value = model->logicalSw[i].val2*range.step + range.offset;
|
||||
if (source.isTimeBased())
|
||||
cswitchTOffset[i]->setTime(QTimeS(round(value)));
|
||||
else
|
||||
|
@ -235,22 +235,22 @@ void LogicalSwitchesPanel::edited()
|
|||
break;
|
||||
}
|
||||
case LS_FAMILY_TIMER:
|
||||
model.logicalSw[i].val1 = TimToVal(cswitchValue[i]->value());
|
||||
model.logicalSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchValue[i], model.logicalSw[i].val1, 0.1);
|
||||
updateTimerParam(cswitchOffset[i], model.logicalSw[i].val2, 0.1);
|
||||
model->logicalSw[i].val1 = TimToVal(cswitchValue[i]->value());
|
||||
model->logicalSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchValue[i], model->logicalSw[i].val1, 0.1);
|
||||
updateTimerParam(cswitchOffset[i], model->logicalSw[i].val2, 0.1);
|
||||
break;
|
||||
case LS_FAMILY_EDGE:
|
||||
cswitchOffset2[i]->setSpecialValueText(tr("(no release)"));
|
||||
if (sender() == cswitchOffset[i]) {
|
||||
model.logicalSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchOffset[i], model.logicalSw[i].val2, 0.0);
|
||||
model->logicalSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchOffset[i], model->logicalSw[i].val2, 0.0);
|
||||
}
|
||||
else {
|
||||
model.logicalSw[i].val3 = TimToVal(cswitchOffset2[i]->value()) - model.logicalSw[i].val2;
|
||||
model->logicalSw[i].val3 = TimToVal(cswitchOffset2[i]->value()) - model->logicalSw[i].val2;
|
||||
}
|
||||
updateTimerParam(cswitchOffset2[i], model.logicalSw[i].val2+model.logicalSw[i].val3, cswitchOffset[i]->value()-0.1);
|
||||
if (model.logicalSw[i].val3 == 0) {
|
||||
updateTimerParam(cswitchOffset2[i], model->logicalSw[i].val2+model->logicalSw[i].val3, cswitchOffset[i]->value()-0.1);
|
||||
if (model->logicalSw[i].val3 == 0) {
|
||||
cswitchOffset2[i]->setSuffix("(infinite)");
|
||||
}
|
||||
else {
|
||||
|
@ -294,10 +294,10 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
|||
lock = true;
|
||||
|
||||
unsigned int mask = DELAY_ENABLED;
|
||||
RawSource source = RawSource(model.logicalSw[i].val1);
|
||||
RawSourceRange range = source.getRange(model, generalSettings, model.logicalSw[i].getRangeFlags());
|
||||
RawSource source = RawSource(model->logicalSw[i].val1);
|
||||
RawSourceRange range = source.getRange(model, generalSettings, model->logicalSw[i].getRangeFlags());
|
||||
|
||||
switch (model.logicalSw[i].getFunctionFamily())
|
||||
switch (model->logicalSw[i].getFunctionFamily())
|
||||
{
|
||||
case LS_FAMILY_VOFS:
|
||||
mask |= SOURCE1_VISIBLE;
|
||||
|
@ -307,7 +307,7 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
|||
if (source.isTimeBased()) {
|
||||
mask |= VALUE_TO_VISIBLE;
|
||||
int maxTime = round(range.max);
|
||||
int value = round(range.step*model.logicalSw[i].val2 + range.offset);
|
||||
int value = round(range.step*model->logicalSw[i].val2 + range.offset);
|
||||
cswitchTOffset[i]->setMaximumTime(QTimeS(maxTime));
|
||||
cswitchTOffset[i]->setDisplayFormat((maxTime>=3600)?"hh:mm:ss":"mm:ss");
|
||||
cswitchTOffset[i]->setTime(QTimeS(value));
|
||||
|
@ -320,24 +320,24 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
|||
cswitchOffset[i]->setSuffix(" " + range.unit);
|
||||
cswitchOffset[i]->setMinimum(range.min);
|
||||
cswitchOffset[i]->setMaximum(range.max);
|
||||
cswitchOffset[i]->setValue(range.step*(model.logicalSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
|
||||
cswitchOffset[i]->setValue(range.step*(model->logicalSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
|
||||
}
|
||||
break;
|
||||
case LS_FAMILY_STICKY:
|
||||
// no break
|
||||
case LS_FAMILY_VBOOL:
|
||||
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.logicalSw[i].val1), generalSettings, LogicalSwitchesContext);
|
||||
populateSwitchCB(cswitchSource2[i], RawSwitch(model.logicalSw[i].val2), generalSettings, LogicalSwitchesContext);
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model->logicalSw[i].val1), generalSettings, LogicalSwitchesContext);
|
||||
populateSwitchCB(cswitchSource2[i], RawSwitch(model->logicalSw[i].val2), generalSettings, LogicalSwitchesContext);
|
||||
break;
|
||||
case LS_FAMILY_EDGE:
|
||||
mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE | VALUE3_VISIBLE;
|
||||
mask &= ~DELAY_ENABLED;
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.logicalSw[i].val1), generalSettings, LogicalSwitchesContext);
|
||||
updateTimerParam(cswitchOffset[i], model.logicalSw[i].val2, 0.0);
|
||||
updateTimerParam(cswitchOffset2[i], model.logicalSw[i].val2+model.logicalSw[i].val3, cswitchOffset[i]->value()-0.1);
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model->logicalSw[i].val1), generalSettings, LogicalSwitchesContext);
|
||||
updateTimerParam(cswitchOffset[i], model->logicalSw[i].val2, 0.0);
|
||||
updateTimerParam(cswitchOffset2[i], model->logicalSw[i].val2+model->logicalSw[i].val3, cswitchOffset[i]->value()-0.1);
|
||||
cswitchOffset2[i]->setSpecialValueText(tr("(no release)"));
|
||||
if (model.logicalSw[i].val3 == 0) {
|
||||
if (model->logicalSw[i].val3 == 0) {
|
||||
cswitchOffset2[i]->setSuffix(tr("(infinite)"));
|
||||
}
|
||||
else {
|
||||
|
@ -346,14 +346,13 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
|||
break;
|
||||
case LS_FAMILY_VCOMP:
|
||||
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
|
||||
populateSourceCB(cswitchSource1[i], RawSource(model.logicalSw[i].val1), model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
populateSourceCB(cswitchSource2[i], RawSource(model.logicalSw[i].val2), model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
populateSourceCB(cswitchSource1[i], RawSource(model->logicalSw[i].val1), model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
populateSourceCB(cswitchSource2[i], RawSource(model->logicalSw[i].val2), model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
break;
|
||||
case LS_FAMILY_TIMER:
|
||||
mask |= VALUE1_VISIBLE | VALUE2_VISIBLE;
|
||||
updateTimerParam(cswitchValue[i], model.logicalSw[i].val1, 0.1);
|
||||
updateTimerParam(cswitchOffset[i], model.logicalSw[i].val2, 0.1);
|
||||
break;
|
||||
updateTimerParam(cswitchValue[i], model->logicalSw[i].val1, 0.1);
|
||||
updateTimerParam(cswitchOffset[i], model->logicalSw[i].val2, 0.1);
|
||||
}
|
||||
|
||||
cswitchSource1[i]->setVisible(mask & SOURCE1_VISIBLE);
|
||||
|
@ -364,8 +363,8 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
|||
cswitchTOffset[i]->setVisible(mask & VALUE_TO_VISIBLE);
|
||||
if (firmware->getCapability(LogicalSwitchesExt)) {
|
||||
cswitchDelay[i]->setEnabled(mask & DELAY_ENABLED);
|
||||
cswitchDuration[i]->setValue(model.logicalSw[i].duration/10.0);
|
||||
cswitchDelay[i]->setValue(model.logicalSw[i].delay/10.0);
|
||||
cswitchDuration[i]->setValue(model->logicalSw[i].duration/10.0);
|
||||
cswitchDelay[i]->setValue(model->logicalSw[i].delay/10.0);
|
||||
}
|
||||
lock = false;
|
||||
}
|
||||
|
@ -445,11 +444,11 @@ void LogicalSwitchesPanel::populateAndSwitchCB(QComboBox *b, const RawSwitch & v
|
|||
void LogicalSwitchesPanel::updateLine(int i)
|
||||
{
|
||||
lock = true;
|
||||
populateCSWCB(csw[i], model.logicalSw[i].func);
|
||||
populateCSWCB(csw[i], model->logicalSw[i].func);
|
||||
lock = true;
|
||||
setSwitchWidgetVisibility(i);
|
||||
lock = true;
|
||||
populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.logicalSw[i].andsw));
|
||||
populateAndSwitchCB(cswitchAnd[i], RawSwitch(model->logicalSw[i].andsw));
|
||||
lock = false;
|
||||
}
|
||||
|
||||
|
@ -466,7 +465,7 @@ void LogicalSwitchesPanel::cswPaste()
|
|||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
if (mimeData->hasFormat("application/x-companion-csw")) {
|
||||
QByteArray cswData = mimeData->data("application/x-companion-csw");
|
||||
LogicalSwitchData *csw = &model.logicalSw[selectedSwitch];
|
||||
LogicalSwitchData *csw = &model->logicalSw[selectedSwitch];
|
||||
memcpy(csw, cswData.mid(0, sizeof(LogicalSwitchData)).constData(), sizeof(LogicalSwitchData));
|
||||
emit modified();
|
||||
updateLine(selectedSwitch);
|
||||
|
@ -475,7 +474,7 @@ void LogicalSwitchesPanel::cswPaste()
|
|||
|
||||
void LogicalSwitchesPanel::cswDelete()
|
||||
{
|
||||
model.logicalSw[selectedSwitch].clear();
|
||||
model->logicalSw[selectedSwitch].clear();
|
||||
emit modified();
|
||||
updateLine(selectedSwitch);
|
||||
}
|
||||
|
@ -483,7 +482,7 @@ void LogicalSwitchesPanel::cswDelete()
|
|||
void LogicalSwitchesPanel::cswCopy()
|
||||
{
|
||||
QByteArray cswData;
|
||||
cswData.append((char*)&model.logicalSw[selectedSwitch],sizeof(LogicalSwitchData));
|
||||
cswData.append((char*)&model->logicalSw[selectedSwitch],sizeof(LogicalSwitchData));
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData("application/x-companion-csw", cswData);
|
||||
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CUSTOMSWITCHES_H
|
||||
#define CUSTOMSWITCHES_H
|
||||
|
||||
#include "modelpanel.h"
|
||||
#include "modeledit.h"
|
||||
#include <QComboBox>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QTimeEdit>
|
||||
|
|
|
@ -19,7 +19,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
|
|||
|
||||
this->setWindowTitle(tr("DEST -> CH%1").arg(md->destCh));
|
||||
|
||||
populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
populateSourceCB(ui->sourceCB, md->srcRaw, &model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
ui->sourceCB->removeItem(0);
|
||||
|
||||
int limit = firmware->getCapability(OffsetWeight);
|
||||
|
|
|
@ -50,7 +50,7 @@ QString MixesPanel::getChannelLabel(int curDest)
|
|||
// TODO not nice, Qt brings a function for that, I don't remember right now
|
||||
(str.length() < 4) ? str.append(" ") : str.append(" ");
|
||||
if (firmware->getCapability(HasChNames)) {
|
||||
QString name = model.limitData[curDest-1].name;
|
||||
QString name = model->limitData[curDest-1].name;
|
||||
if (!name.isEmpty()) {
|
||||
name = QString("(") + name + QString(")");
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ void MixesPanel::update()
|
|||
unsigned int outputs = firmware->getCapability(Outputs);
|
||||
|
||||
for (i=0; i<firmware->getCapability(Mixes); i++) {
|
||||
MixData *md = &model.mixData[i];
|
||||
MixData *md = &model->mixData[i];
|
||||
// qDebug() << "md->destCh: " << md->destCh;
|
||||
if (md->destCh==0 || md->destCh>outputs) continue;
|
||||
QString str = "";
|
||||
|
@ -111,7 +111,7 @@ bool MixesPanel::AddMixerLine(int dest)
|
|||
QByteArray qba(1, (quint8)dest);
|
||||
if (dest >= 0) {
|
||||
//add mix data
|
||||
MixData *md = &model.mixData[dest];
|
||||
MixData *md = &model->mixData[dest];
|
||||
qba.append((const char*)md, sizeof(MixData));
|
||||
}
|
||||
itm->setData(Qt::UserRole, qba);
|
||||
|
@ -149,11 +149,11 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
|||
if (new_ch) *new_ch = 1;
|
||||
}
|
||||
else {
|
||||
MixData *md = &model.mixData[dest];
|
||||
MixData *md = &model->mixData[dest];
|
||||
//md->destCh from 1 to 32
|
||||
str = getChannelLabel(md->destCh);
|
||||
|
||||
if ((dest == 0) || (model.mixData[dest-1].destCh != md->destCh)) {
|
||||
if ((dest == 0) || (model->mixData[dest-1].destCh != md->destCh)) {
|
||||
if (new_ch) *new_ch = 1;
|
||||
//highlight channell if needed
|
||||
if (md->destCh == highlightedSource) {
|
||||
|
@ -187,8 +187,10 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
|||
str += " " + Qt::escape(tr("Switch(%1)").arg(md->swtch.toString()));
|
||||
}
|
||||
|
||||
if (md->carryTrim>0) str += " " + Qt::escape(tr("NoTrim"));
|
||||
else if (md->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(model);
|
||||
if (md->carryTrim > 0)
|
||||
str += " " + Qt::escape(tr("NoTrim"));
|
||||
else if (md->carryTrim<0)
|
||||
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(model);
|
||||
|
||||
if (firmware->getCapability(HasNoExpo) && md->noExpo) str += " " + Qt::escape(tr("No DR/Expo"));
|
||||
if (md->sOffset) str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(md->sOffset)));
|
||||
|
@ -215,39 +217,39 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
|||
|
||||
bool MixesPanel::gm_insertMix(int idx)
|
||||
{
|
||||
if (idx<0 || idx>=firmware->getCapability(Mixes) || model.mixData[firmware->getCapability(Mixes)-1].destCh > 0) {
|
||||
if (idx<0 || idx>=firmware->getCapability(Mixes) || model->mixData[firmware->getCapability(Mixes)-1].destCh > 0) {
|
||||
QMessageBox::information(this, "companion", tr("Not enough available mixers!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
int i = model.mixData[idx].destCh;
|
||||
memmove(&model.mixData[idx+1],&model.mixData[idx],
|
||||
int i = model->mixData[idx].destCh;
|
||||
memmove(&model->mixData[idx+1],&model->mixData[idx],
|
||||
(firmware->getCapability(Mixes)-(idx+1))*sizeof(MixData) );
|
||||
memset(&model.mixData[idx],0,sizeof(MixData));
|
||||
model.mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||
model.mixData[idx].destCh = i;
|
||||
model.mixData[idx].weight = 100;
|
||||
memset(&model->mixData[idx],0,sizeof(MixData));
|
||||
model->mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||
model->mixData[idx].destCh = i;
|
||||
model->mixData[idx].weight = 100;
|
||||
return true;
|
||||
}
|
||||
|
||||
void MixesPanel::gm_deleteMix(int index)
|
||||
{
|
||||
memmove(&model.mixData[index],&model.mixData[index+1],
|
||||
memmove(&model->mixData[index],&model->mixData[index+1],
|
||||
(firmware->getCapability(Mixes)-(index+1))*sizeof(MixData));
|
||||
memset(&model.mixData[firmware->getCapability(Mixes)-1],0,sizeof(MixData));
|
||||
memset(&model->mixData[firmware->getCapability(Mixes)-1],0,sizeof(MixData));
|
||||
}
|
||||
|
||||
void MixesPanel::gm_openMix(int index)
|
||||
{
|
||||
if(index<0 || index>=firmware->getCapability(Mixes)) return;
|
||||
|
||||
MixData mixd(model.mixData[index]);
|
||||
MixData mixd(model->mixData[index]);
|
||||
emit modified();
|
||||
update();
|
||||
|
||||
MixerDialog *g = new MixerDialog(this, model, &mixd, generalSettings, firmware);
|
||||
MixerDialog *g = new MixerDialog(this, *model, &mixd, generalSettings, firmware);
|
||||
if(g->exec()) {
|
||||
model.mixData[index] = mixd;
|
||||
model->mixData[index] = mixd;
|
||||
emit modified();
|
||||
update();
|
||||
} else {
|
||||
|
@ -263,7 +265,7 @@ void MixesPanel::gm_openMix(int index)
|
|||
int MixesPanel::getMixerIndex(unsigned int dch)
|
||||
{
|
||||
int i = 0;
|
||||
while ((model.mixData[i].destCh<=dch) && (model.mixData[i].destCh) && (i<firmware->getCapability(Mixes))) i++;
|
||||
while ((model->mixData[i].destCh<=dch) && (model->mixData[i].destCh) && (i<firmware->getCapability(Mixes))) i++;
|
||||
if(i==firmware->getCapability(Mixes)) return -1;
|
||||
return i;
|
||||
}
|
||||
|
@ -276,7 +278,7 @@ void MixesPanel::mixerlistWidget_doubleClicked(QModelIndex index)
|
|||
idx = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(idx))
|
||||
return;
|
||||
model.mixData[idx].destCh = i;
|
||||
model->mixData[idx].destCh = i;
|
||||
mixInserted=true;
|
||||
} else {
|
||||
mixInserted=false;
|
||||
|
@ -349,7 +351,7 @@ void MixesPanel::mixersCopy()
|
|||
|
||||
QByteArray mxData;
|
||||
foreach(int idx, list) {
|
||||
mxData.append((char*)&model.mixData[idx],sizeof(MixData));
|
||||
mxData.append((char*)&model->mixData[idx],sizeof(MixData));
|
||||
}
|
||||
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
|
@ -368,7 +370,7 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
|||
idx = getMixerIndex(dch) - 1; //get mixer index to insert
|
||||
} else {
|
||||
idx = destIdx;
|
||||
dch = model.mixData[idx].destCh;
|
||||
dch = model->mixData[idx].destCh;
|
||||
}
|
||||
|
||||
QByteArray mxData = mimeData->data("application/x-companion-mix");
|
||||
|
@ -380,7 +382,7 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
|||
|
||||
if (!gm_insertMix(idx))
|
||||
break;
|
||||
MixData *md = &model.mixData[idx];
|
||||
MixData *md = &model->mixData[idx];
|
||||
memcpy(md,mxData.mid(i,sizeof(MixData)).constData(),sizeof(MixData));
|
||||
md->destCh = dch;
|
||||
i += sizeof(MixData);
|
||||
|
@ -415,7 +417,7 @@ void MixesPanel::mixerOpen()
|
|||
idx = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(idx))
|
||||
return;
|
||||
model.mixData[idx].destCh = i;
|
||||
model->mixData[idx].destCh = i;
|
||||
mixInserted=true;
|
||||
} else {
|
||||
mixInserted=false;
|
||||
|
@ -432,7 +434,7 @@ void MixesPanel::mixerHighlight()
|
|||
dest = -idx;
|
||||
}
|
||||
else {
|
||||
dest = model.mixData[idx].destCh;
|
||||
dest = model->mixData[idx].destCh;
|
||||
}
|
||||
highlightedSource = ( (int)highlightedSource == dest) ? 0 : dest;
|
||||
// qDebug() << "MixesPanel::mixerHighlight(): " << highlightedSource ;
|
||||
|
@ -453,13 +455,13 @@ void MixesPanel::mixerAdd()
|
|||
index = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(index))
|
||||
return;
|
||||
model.mixData[index].destCh = i;
|
||||
model->mixData[index].destCh = i;
|
||||
mixInserted=true;
|
||||
} else {
|
||||
index++;
|
||||
if (!gm_insertMix(index))
|
||||
return;
|
||||
model.mixData[index].destCh = model.mixData[index-1].destCh;
|
||||
model->mixData[index].destCh = model->mixData[index-1].destCh;
|
||||
mixInserted=true;
|
||||
}
|
||||
gm_openMix(index);
|
||||
|
@ -523,7 +525,7 @@ int MixesPanel::gm_moveMix(int idx, bool dir) //true=inc=down false=dec=up
|
|||
{
|
||||
if(idx>firmware->getCapability(Mixes) || (idx==firmware->getCapability(Mixes) && dir)) return idx;
|
||||
|
||||
MixData &src=model.mixData[idx];
|
||||
MixData &src=model->mixData[idx];
|
||||
|
||||
if (idx==0 && !dir) {
|
||||
//special case: topmost mixer moving up
|
||||
|
@ -532,7 +534,7 @@ int MixesPanel::gm_moveMix(int idx, bool dir) //true=inc=down false=dec=up
|
|||
}
|
||||
|
||||
int tdx = dir ? idx+1 : idx-1;
|
||||
MixData &tgt=model.mixData[tdx];
|
||||
MixData &tgt=model->mixData[tdx];
|
||||
|
||||
unsigned int outputs = firmware->getCapability(Outputs);
|
||||
if((src.destCh==0) || (src.destCh>outputs) || (tgt.destCh>outputs)) return idx;
|
||||
|
@ -578,7 +580,7 @@ void MixesPanel::moveMixDown()
|
|||
void MixesPanel::clearMixes()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Clear Mixes?"), tr("Really clear all the mixes?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
model.clearMixes();
|
||||
model->clearMixes();
|
||||
emit modified();
|
||||
update();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef MIXES_H
|
||||
#define MIXES_H
|
||||
|
||||
#include "modelpanel.h"
|
||||
#include "modeledit.h"
|
||||
#include "mixerslist.h"
|
||||
#include "mixerdialog.h"
|
||||
|
||||
|
|
|
@ -37,8 +37,7 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw
|
|||
addTab(chnPanel, tr("Servos"));
|
||||
addTab(new Curves(this, model, generalSettings, firmware), tr("Curves"));
|
||||
addTab(new LogicalSwitchesPanel(this, model, generalSettings, firmware), tr("Logical Switches"));
|
||||
if (firmware->getCapability(CustomFunctions))
|
||||
addTab(new CustomFunctionsPanel(this, model, generalSettings, firmware), tr("Special Functions"));
|
||||
addTab(new CustomFunctionsPanel(this, &model, generalSettings, firmware), tr("Special Functions"));
|
||||
if (firmware->getCapability(Telemetry) & TM_HASTELEMETRY)
|
||||
addTab(new TelemetryPanel(this, model, generalSettings, firmware), tr("Telemetry"));
|
||||
|
||||
|
@ -55,7 +54,7 @@ void ModelEdit::closeEvent(QCloseEvent *event)
|
|||
g.modelEditGeo( saveGeometry() );
|
||||
}
|
||||
|
||||
void ModelEdit::addTab(ModelPanel *panel, QString text)
|
||||
void ModelEdit::addTab(GenericPanel *panel, QString text)
|
||||
{
|
||||
panels << panel;
|
||||
QWidget * widget = new QWidget(ui->tabWidget);
|
||||
|
|
|
@ -2,12 +2,21 @@
|
|||
#define MODELEDIT_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "modelpanel.h"
|
||||
#include "helpers.h"
|
||||
|
||||
namespace Ui {
|
||||
class ModelEdit;
|
||||
}
|
||||
|
||||
class ModelPanel : public GenericPanel
|
||||
{
|
||||
public:
|
||||
ModelPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
||||
GenericPanel(parent, &model, generalSettings, firmware)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class ModelEdit : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -33,9 +42,9 @@ class ModelEdit : public QDialog
|
|||
ModelData & model;
|
||||
GeneralSettings & generalSettings;
|
||||
FirmwareInterface * firmware;
|
||||
QVector<ModelPanel *> panels;
|
||||
QVector<GenericPanel *> panels;
|
||||
|
||||
void addTab(ModelPanel *panel, QString text);
|
||||
void addTab(GenericPanel *panel, QString text);
|
||||
void launchSimulation();
|
||||
|
||||
};
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
#include "modelpanel.h"
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include <QSpinBox>
|
||||
|
||||
ModelPanel::ModelPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
||||
GenericPanel(parent),
|
||||
model(model),
|
||||
generalSettings(generalSettings),
|
||||
firmware(firmware)
|
||||
{
|
||||
}
|
||||
|
||||
ModelPanel::~ModelPanel()
|
||||
{
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef MODELPANEL_H
|
||||
#define MODELPANEL_H
|
||||
|
||||
#include "eeprominterface.h"
|
||||
#include "helpers.h"
|
||||
|
||||
class ModelPanel : public GenericPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ModelPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
|
||||
virtual ~ModelPanel();
|
||||
|
||||
protected:
|
||||
ModelData & model;
|
||||
GeneralSettings & generalSettings;
|
||||
FirmwareInterface * firmware;
|
||||
};
|
||||
|
||||
#endif // CHANNELS_H
|
|
@ -223,7 +223,7 @@ void ModulePanel::update()
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (!IS_TARANIS(firmware->getBoard()) || model.trainerMode != 0) {
|
||||
else if (!IS_TARANIS(firmware->getBoard()) || model->trainerMode != 0) {
|
||||
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ void ModulePanel::update()
|
|||
ui->protocol->setVisible(mask & MASK_PROTOCOL);
|
||||
ui->label_rxNumber->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->rxNumber->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->rxNumber->setValue(model.modelId);
|
||||
ui->rxNumber->setValue(model->modelId);
|
||||
ui->label_channelsStart->setVisible(mask & MASK_CHANNELS_RANGE);
|
||||
ui->channelsStart->setVisible(mask & MASK_CHANNELS_RANGE);
|
||||
ui->channelsStart->setValue(module.channelsStart+1);
|
||||
|
@ -250,7 +250,7 @@ void ModulePanel::update()
|
|||
ui->ppmDelay->setValue(module.ppmDelay);
|
||||
ui->label_ppmFrameLength->setVisible(mask & MASK_PPM_FIELDS);
|
||||
ui->ppmFrameLength->setVisible(mask & MASK_PPM_FIELDS);
|
||||
ui->ppmFrameLength->setMinimum(module.channelsCount*(model.extendedLimits ? 2.250 : 2)+3.5);
|
||||
ui->ppmFrameLength->setMinimum(module.channelsCount*(model->extendedLimits ? 2.250 : 2)+3.5);
|
||||
ui->ppmFrameLength->setMaximum(firmware->getCapability(PPMFrameLength));
|
||||
ui->ppmFrameLength->setValue(22.5+((double)module.ppmFrameLength)*0.5);
|
||||
|
||||
|
@ -271,7 +271,7 @@ void ModulePanel::update()
|
|||
void ModulePanel::on_trainerMode_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
model.trainerMode = index;
|
||||
model->trainerMode = index;
|
||||
update();
|
||||
emit modified();
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ void ModulePanel::on_ppmDelay_editingFinished()
|
|||
|
||||
void ModulePanel::on_rxNumber_editingFinished()
|
||||
{
|
||||
model.modelId = ui->rxNumber->value();
|
||||
model->modelId = ui->rxNumber->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
@ -522,39 +522,39 @@ SetupPanel::~SetupPanel()
|
|||
|
||||
void SetupPanel::on_extendedLimits_toggled(bool checked)
|
||||
{
|
||||
model.extendedLimits = checked;
|
||||
model->extendedLimits = checked;
|
||||
emit extendedLimitsToggled();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void SetupPanel::on_throttleWarning_toggled(bool checked)
|
||||
{
|
||||
model.disableThrottleWarning = !checked;
|
||||
model->disableThrottleWarning = !checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void SetupPanel::on_throttleReverse_toggled(bool checked)
|
||||
{
|
||||
model.throttleReversed = checked;
|
||||
model->throttleReversed = checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void SetupPanel::on_extendedTrims_toggled(bool checked)
|
||||
{
|
||||
model.extendedTrims = checked;
|
||||
model->extendedTrims = checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void SetupPanel::on_trimIncrement_currentIndexChanged(int index)
|
||||
{
|
||||
model.trimInc = index-2;
|
||||
model->trimInc = index-2;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void SetupPanel::on_throttleSource_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
model.thrTraceSrc = ui->throttleSource->itemData(index).toInt();
|
||||
model->thrTraceSrc = ui->throttleSource->itemData(index).toInt();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
@ -562,25 +562,25 @@ void SetupPanel::on_throttleSource_currentIndexChanged(int index)
|
|||
void SetupPanel::on_name_editingFinished()
|
||||
{
|
||||
int length = ui->name->maxLength();
|
||||
strncpy(model.name, ui->name->text().toAscii(), length);
|
||||
strncpy(model->name, ui->name->text().toAscii(), length);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void SetupPanel::on_image_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
strncpy(model.bitmap, ui->image->currentText().toAscii(), 10);
|
||||
strncpy(model->bitmap, ui->image->currentText().toAscii(), 10);
|
||||
QString path = g.profile[g.id()].sdPath();
|
||||
path.append("/BMP/");
|
||||
QDir qd(path);
|
||||
if (qd.exists()) {
|
||||
QString fileName=path;
|
||||
fileName.append(model.bitmap);
|
||||
fileName.append(model->bitmap);
|
||||
fileName.append(".bmp");
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
fileName=path;
|
||||
fileName.append(model.bitmap);
|
||||
fileName.append(model->bitmap);
|
||||
fileName.append(".BMP");
|
||||
image.load(fileName);
|
||||
}
|
||||
|
@ -618,13 +618,13 @@ void SetupPanel::populateThrottleSourceCB()
|
|||
}
|
||||
}
|
||||
|
||||
if (model.thrTraceSrc < i)
|
||||
ui->throttleSource->setCurrentIndex(model.thrTraceSrc);
|
||||
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))
|
||||
if (model->thrTraceSrc == unsigned(THROTTLE_SOURCE_FIRST_CHANNEL+i))
|
||||
ui->throttleSource->setCurrentIndex(ui->throttleSource->count()-1);
|
||||
}
|
||||
|
||||
|
@ -633,18 +633,18 @@ void SetupPanel::populateThrottleSourceCB()
|
|||
|
||||
void SetupPanel::update()
|
||||
{
|
||||
ui->name->setText(model.name);
|
||||
ui->name->setText(model->name);
|
||||
|
||||
ui->throttleReverse->setChecked(model.throttleReversed);
|
||||
ui->throttleReverse->setChecked(model->throttleReversed);
|
||||
populateThrottleSourceCB();
|
||||
ui->throttleWarning->setChecked(!model.disableThrottleWarning);
|
||||
ui->throttleWarning->setChecked(!model->disableThrottleWarning);
|
||||
|
||||
//trim inc, thro trim, thro expo, instatrim
|
||||
ui->trimIncrement->setCurrentIndex(model.trimInc+2);
|
||||
ui->throttleTrim->setChecked(model.thrTrim);
|
||||
ui->extendedLimits->setChecked(model.extendedLimits);
|
||||
ui->extendedTrims->setChecked(model.extendedTrims);
|
||||
ui->displayText->setChecked(model.displayChecklist);
|
||||
ui->trimIncrement->setCurrentIndex(model->trimInc+2);
|
||||
ui->throttleTrim->setChecked(model->thrTrim);
|
||||
ui->extendedLimits->setChecked(model->extendedLimits);
|
||||
ui->extendedTrims->setChecked(model->extendedTrims);
|
||||
ui->displayText->setChecked(model->displayChecklist);
|
||||
|
||||
updateBeepCenter();
|
||||
updateStartupSwitches();
|
||||
|
@ -664,7 +664,7 @@ void SetupPanel::update()
|
|||
void SetupPanel::updateBeepCenter()
|
||||
{
|
||||
for (int i=0; i<centerBeepCheckboxes.size(); i++) {
|
||||
centerBeepCheckboxes[i]->setChecked(model.beepANACenter & (0x01 << i));
|
||||
centerBeepCheckboxes[i]->setChecked(model->beepANACenter & (0x01 << i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -672,12 +672,12 @@ void SetupPanel::updateStartupSwitches()
|
|||
{
|
||||
lock = true;
|
||||
|
||||
unsigned int switchStates = model.switchWarningStates;
|
||||
unsigned int switchStates = model->switchWarningStates;
|
||||
|
||||
for (int i=0; i<firmware->getCapability(Switches)-1; i++) {
|
||||
QSlider * slider = startupSwitchesSliders[i];
|
||||
QCheckBox * cb = startupSwitchesCheckboxes[i];
|
||||
bool enabled = !(model.nSwToWarn & (1 << i));
|
||||
bool enabled = !(model->nSwToWarn & (1 << i));
|
||||
slider->setEnabled(enabled);
|
||||
cb->setChecked(enabled);
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
|
@ -721,10 +721,10 @@ void SetupPanel::startupSwitchEdited(int value)
|
|||
}
|
||||
}
|
||||
|
||||
model.switchWarningStates &= ~mask;
|
||||
model->switchWarningStates &= ~mask;
|
||||
|
||||
if (value) {
|
||||
model.switchWarningStates |= (value << shift);
|
||||
model->switchWarningStates |= (value << shift);
|
||||
}
|
||||
|
||||
updateStartupSwitches();
|
||||
|
@ -738,9 +738,9 @@ void SetupPanel::startupSwitchToggled(bool checked)
|
|||
int index = sender()->property("index").toInt()-1;
|
||||
|
||||
if (checked)
|
||||
model.nSwToWarn &= ~(1 << index);
|
||||
model->nSwToWarn &= ~(1 << index);
|
||||
else
|
||||
model.nSwToWarn |= (1 << index);
|
||||
model->nSwToWarn |= (1 << index);
|
||||
|
||||
updateStartupSwitches();
|
||||
emit modified();
|
||||
|
@ -750,14 +750,14 @@ void SetupPanel::startupSwitchToggled(bool checked)
|
|||
void SetupPanel::updatePotWarnings()
|
||||
{
|
||||
lock = true;
|
||||
int mode = model.nPotsToWarn >> 6;
|
||||
int mode = model->nPotsToWarn >> 6;
|
||||
ui->potWarningMode->setCurrentIndex(mode);
|
||||
|
||||
if (mode == 0)
|
||||
model.nPotsToWarn = 0x3F;
|
||||
model->nPotsToWarn = 0x3F;
|
||||
|
||||
for (int i=0; i<potWarningCheckboxes.size(); i++) {
|
||||
bool enabled = !(model.nPotsToWarn & (1 << i));
|
||||
bool enabled = !(model->nPotsToWarn & (1 << i));
|
||||
|
||||
potWarningCheckboxes[i]->setChecked(enabled);
|
||||
potWarningCheckboxes[i]->setDisabled(mode == 0);
|
||||
|
@ -771,9 +771,9 @@ void SetupPanel::potWarningToggled(bool checked)
|
|||
int index = sender()->property("index").toInt()-1;
|
||||
|
||||
if(checked)
|
||||
model.nPotsToWarn &= ~(1 << index);
|
||||
model->nPotsToWarn &= ~(1 << index);
|
||||
else
|
||||
model.nPotsToWarn |= (1 << index);
|
||||
model->nPotsToWarn |= (1 << index);
|
||||
|
||||
updatePotWarnings();
|
||||
emit modified();
|
||||
|
@ -784,8 +784,8 @@ void SetupPanel::on_potWarningMode_currentIndexChanged(int index)
|
|||
{
|
||||
if (!lock) {
|
||||
int mask = 0xC0;
|
||||
model.nPotsToWarn = model.nPotsToWarn & ~mask;
|
||||
model.nPotsToWarn = model.nPotsToWarn | ((index << 6) & mask);
|
||||
model->nPotsToWarn = model->nPotsToWarn & ~mask;
|
||||
model->nPotsToWarn = model->nPotsToWarn | ((index << 6) & mask);
|
||||
|
||||
updatePotWarnings();
|
||||
emit modified();
|
||||
|
@ -794,13 +794,13 @@ void SetupPanel::on_potWarningMode_currentIndexChanged(int index)
|
|||
|
||||
void SetupPanel::on_displayText_toggled(bool checked)
|
||||
{
|
||||
model.displayChecklist = checked;
|
||||
model->displayChecklist = checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void SetupPanel::on_throttleTrim_toggled(bool checked)
|
||||
{
|
||||
model.thrTrim = checked;
|
||||
model->thrTrim = checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
@ -810,9 +810,9 @@ void SetupPanel::onBeepCenterToggled(bool checked)
|
|||
int index = sender()->property("index").toInt();
|
||||
unsigned int mask = (0x01 << index);
|
||||
if (checked)
|
||||
model.beepANACenter |= mask;
|
||||
model->beepANACenter |= mask;
|
||||
else
|
||||
model.beepANACenter &= ~mask;
|
||||
model->beepANACenter &= ~mask;
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef SETUP_H
|
||||
#define SETUP_H
|
||||
|
||||
#include "modelpanel.h"
|
||||
#include "modeledit.h"
|
||||
#include <QVector>
|
||||
#include <QCheckBox>
|
||||
#include <QSlider>
|
||||
|
|
|
@ -367,12 +367,12 @@ void TelemetryCustomScreen::update()
|
|||
|
||||
for (int l=0; l<4; l++) {
|
||||
for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
|
||||
populateTelemetrySourceCB(fieldsCB[l][c], screen.body.lines[l].source[c], l==3, model.frsky.usrProto);
|
||||
populateTelemetrySourceCB(fieldsCB[l][c], screen.body.lines[l].source[c], l==3, model->frsky.usrProto);
|
||||
}
|
||||
}
|
||||
|
||||
for (int l=0; l<4; l++) {
|
||||
populateTelemetrySourceCB(barsCB[l], screen.body.bars[l].source, false, model.frsky.usrProto);
|
||||
populateTelemetrySourceCB(barsCB[l], screen.body.bars[l].source, false, model->frsky.usrProto);
|
||||
}
|
||||
|
||||
if (screen.type == TELEMETRY_SCREEN_BARS) {
|
||||
|
@ -540,7 +540,7 @@ TelemetryPanel::~TelemetryPanel()
|
|||
void TelemetryPanel::update()
|
||||
{
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
if (model.moduleData[0].protocol == OFF && model.moduleData[1].protocol == PPM) {
|
||||
if (model->moduleData[0].protocol == OFF && model->moduleData[1].protocol == PPM) {
|
||||
ui->telemetryProtocol->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
|
@ -556,11 +556,11 @@ void TelemetryPanel::setup()
|
|||
|
||||
lock = true;
|
||||
|
||||
ui->rssiAlarm1SB->setValue(model.frsky.rssiAlarms[0].value);
|
||||
ui->rssiAlarm2SB->setValue(model.frsky.rssiAlarms[1].value);
|
||||
ui->rssiAlarm1SB->setValue(model->frsky.rssiAlarms[0].value);
|
||||
ui->rssiAlarm2SB->setValue(model->frsky.rssiAlarms[1].value);
|
||||
if (!IS_TARANIS(firmware->getBoard())) {
|
||||
ui->rssiAlarm1CB->setCurrentIndex(model.frsky.rssiAlarms[0].level);
|
||||
ui->rssiAlarm2CB->setCurrentIndex(model.frsky.rssiAlarms[1].level);
|
||||
ui->rssiAlarm1CB->setCurrentIndex(model->frsky.rssiAlarms[0].level);
|
||||
ui->rssiAlarm2CB->setCurrentIndex(model->frsky.rssiAlarms[1].level);
|
||||
}
|
||||
else {
|
||||
ui->rssiAlarm1CB->hide();
|
||||
|
@ -573,11 +573,11 @@ void TelemetryPanel::setup()
|
|||
ui->AltitudeGPS_ChkB->hide();
|
||||
}
|
||||
else {
|
||||
ui->AltitudeGPS_ChkB->setChecked(model.frsky.FrSkyGpsAlt);
|
||||
ui->AltitudeGPS_ChkB->setChecked(model->frsky.FrSkyGpsAlt);
|
||||
}
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
ui->AltitudeToolbar_ChkB->setChecked(model.frsky.altitudeDisplayed);
|
||||
ui->AltitudeToolbar_ChkB->setChecked(model->frsky.altitudeDisplayed);
|
||||
}
|
||||
else {
|
||||
ui->AltitudeToolbar_ChkB->hide();
|
||||
|
@ -606,17 +606,17 @@ void TelemetryPanel::setup()
|
|||
ui->VarioLabel_1->hide();
|
||||
ui->VarioLabel_2->hide();
|
||||
}
|
||||
ui->varioLimitMin_DSB->setValue(model.frsky.varioMin-10);
|
||||
ui->varioLimitMax_DSB->setValue(model.frsky.varioMax+10);
|
||||
ui->varioLimitCenterMax_DSB->setValue((model.frsky.varioCenterMax/10.0)+0.5);
|
||||
if (model.frsky.varioCenterMin==-16) {
|
||||
ui->varioLimitMin_DSB->setValue(model->frsky.varioMin-10);
|
||||
ui->varioLimitMax_DSB->setValue(model->frsky.varioMax+10);
|
||||
ui->varioLimitCenterMax_DSB->setValue((model->frsky.varioCenterMax/10.0)+0.5);
|
||||
if (model->frsky.varioCenterMin==-16) {
|
||||
ui->varioLimitMinOff_ChkB->setChecked(true);
|
||||
ui->varioLimitCenterMin_DSB->setValue(-2.0);
|
||||
ui->varioLimitCenterMin_DSB->setDisabled(true);
|
||||
}
|
||||
else {
|
||||
ui->varioLimitMinOff_ChkB->setChecked(false);
|
||||
ui->varioLimitCenterMin_DSB->setValue((model.frsky.varioCenterMin/10.0)-0.5);
|
||||
ui->varioLimitCenterMin_DSB->setValue((model->frsky.varioCenterMin/10.0)-0.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -636,7 +636,7 @@ void TelemetryPanel::setup()
|
|||
ui->fasOffset_DSB->hide();
|
||||
}
|
||||
else {
|
||||
ui->fasOffset_DSB->setValue(model.frsky.fasOffset/10.0);
|
||||
ui->fasOffset_DSB->setValue(model->frsky.fasOffset/10.0);
|
||||
ui->variousGB->show();
|
||||
}
|
||||
|
||||
|
@ -646,9 +646,9 @@ void TelemetryPanel::setup()
|
|||
ui->mahCount_ChkB->hide();
|
||||
}
|
||||
else {
|
||||
if (model.frsky.mAhPersistent) {
|
||||
if (model->frsky.mAhPersistent) {
|
||||
ui->mahCount_ChkB->setChecked(true);
|
||||
ui->mahCount_SB->setValue(model.frsky.storedMah);
|
||||
ui->mahCount_SB->setValue(model->frsky.storedMah);
|
||||
}
|
||||
else {
|
||||
ui->mahCount_SB->setDisabled(true);
|
||||
|
@ -656,8 +656,8 @@ void TelemetryPanel::setup()
|
|||
ui->variousGB->show();
|
||||
}
|
||||
|
||||
ui->frskyProtoCB->setCurrentIndex(model.frsky.usrProto);
|
||||
ui->bladesCount->setValue(model.frsky.blades);
|
||||
ui->frskyProtoCB->setCurrentIndex(model->frsky.usrProto);
|
||||
ui->bladesCount->setValue(model->frsky.blades);
|
||||
|
||||
populateVoltsSource();
|
||||
populateCurrentSource();
|
||||
|
@ -669,7 +669,7 @@ void TelemetryPanel::setup()
|
|||
void TelemetryPanel::populateVarioSource()
|
||||
{
|
||||
QUnsignedAutoComboBox * cb = ui->varioSourceCB;
|
||||
cb->setField(&model.frsky.varioSource, this);
|
||||
cb->setField(&model->frsky.varioSource, this);
|
||||
if (!IS_TARANIS(firmware->getBoard())) {
|
||||
cb->addItem(tr("Alti"), TELEMETRY_VARIO_SOURCE_ALTI);
|
||||
cb->addItem(tr("Alti+"), TELEMETRY_VARIO_SOURCE_ALTI_PLUS);
|
||||
|
@ -685,7 +685,7 @@ void TelemetryPanel::populateVarioSource()
|
|||
void TelemetryPanel::populateVoltsSource()
|
||||
{
|
||||
QUnsignedAutoComboBox * cb = ui->frskyVoltCB;
|
||||
cb->setField(&model.frsky.voltsSource, this);
|
||||
cb->setField(&model->frsky.voltsSource, this);
|
||||
cb->addItem(tr("A1"), TELEMETRY_VOLTS_SOURCE_A1);
|
||||
cb->addItem(tr("A2"), TELEMETRY_VOLTS_SOURCE_A2);
|
||||
if (IS_ARM(firmware->getBoard())) {
|
||||
|
@ -699,7 +699,7 @@ void TelemetryPanel::populateVoltsSource()
|
|||
void TelemetryPanel::populateCurrentSource()
|
||||
{
|
||||
QUnsignedAutoComboBox * cb = ui->frskyCurrentCB;
|
||||
cb->setField(&model.frsky.currentSource, this);
|
||||
cb->setField(&model->frsky.currentSource, this);
|
||||
cb->addItem(tr("---"), TELEMETRY_CURRENT_SOURCE_NONE);
|
||||
cb->addItem(tr("A1"), TELEMETRY_CURRENT_SOURCE_A1);
|
||||
cb->addItem(tr("A2"), TELEMETRY_CURRENT_SOURCE_A2);
|
||||
|
@ -712,7 +712,7 @@ void TelemetryPanel::populateCurrentSource()
|
|||
|
||||
void TelemetryPanel::on_telemetryProtocol_currentIndexChanged(int index)
|
||||
{
|
||||
model.telemetryProtocol = index;
|
||||
model->telemetryProtocol = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
@ -723,13 +723,13 @@ void TelemetryPanel::onAnalogModified()
|
|||
|
||||
void TelemetryPanel::on_bladesCount_editingFinished()
|
||||
{
|
||||
model.frsky.blades = ui->bladesCount->value();
|
||||
model->frsky.blades = ui->bladesCount->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_frskyProtoCB_currentIndexChanged(int index)
|
||||
{
|
||||
model.frsky.usrProto = index;
|
||||
model->frsky.usrProto = index;
|
||||
for (int i=0; i<firmware->getCapability(TelemetryCustomScreens); i++)
|
||||
telemetryCustomScreens[i]->update();
|
||||
emit modified();
|
||||
|
@ -737,49 +737,49 @@ void TelemetryPanel::on_frskyProtoCB_currentIndexChanged(int index)
|
|||
|
||||
void TelemetryPanel::on_rssiAlarm1CB_currentIndexChanged(int index)
|
||||
{
|
||||
model.frsky.rssiAlarms[0].level = index;
|
||||
model->frsky.rssiAlarms[0].level = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_rssiAlarm2CB_currentIndexChanged(int index)
|
||||
{
|
||||
model.frsky.rssiAlarms[1].level = index;
|
||||
model->frsky.rssiAlarms[1].level = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_rssiAlarm1SB_editingFinished()
|
||||
{
|
||||
model.frsky.rssiAlarms[0].value = ui->rssiAlarm1SB->value();
|
||||
model->frsky.rssiAlarms[0].value = ui->rssiAlarm1SB->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_rssiAlarm2SB_editingFinished()
|
||||
{
|
||||
model.frsky.rssiAlarms[1].value = ui->rssiAlarm2SB->value();
|
||||
model->frsky.rssiAlarms[1].value = ui->rssiAlarm2SB->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_AltitudeGPS_ChkB_toggled(bool checked)
|
||||
{
|
||||
model.frsky.FrSkyGpsAlt = checked;
|
||||
model->frsky.FrSkyGpsAlt = checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_AltitudeToolbar_ChkB_toggled(bool checked)
|
||||
{
|
||||
model.frsky.altitudeDisplayed = checked;
|
||||
model->frsky.altitudeDisplayed = checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_varioLimitMin_DSB_editingFinished()
|
||||
{
|
||||
model.frsky.varioMin = round(ui->varioLimitMin_DSB->value()+10);
|
||||
model->frsky.varioMin = round(ui->varioLimitMin_DSB->value()+10);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_varioLimitMax_DSB_editingFinished()
|
||||
{
|
||||
model.frsky.varioMax = round(ui->varioLimitMax_DSB->value()-10);
|
||||
model->frsky.varioMax = round(ui->varioLimitMax_DSB->value()-10);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
@ -789,7 +789,7 @@ void TelemetryPanel::on_varioLimitCenterMin_DSB_editingFinished()
|
|||
if (ui->varioLimitCenterMin_DSB->value()>ui->varioLimitCenterMax_DSB->value()) {
|
||||
ui->varioLimitCenterMax_DSB->setValue(ui->varioLimitCenterMin_DSB->value());
|
||||
}
|
||||
model.frsky.varioCenterMin = round((ui->varioLimitCenterMin_DSB->value()+0.5)*10);
|
||||
model->frsky.varioCenterMin = round((ui->varioLimitCenterMin_DSB->value()+0.5)*10);
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
@ -797,7 +797,7 @@ void TelemetryPanel::on_varioLimitCenterMin_DSB_editingFinished()
|
|||
void TelemetryPanel::on_varioLimitMinOff_ChkB_toggled(bool checked)
|
||||
{
|
||||
if (!lock) {
|
||||
model.frsky.varioCenterMin = -16;
|
||||
model->frsky.varioCenterMin = -16;
|
||||
if (!checked) {
|
||||
lock=true;
|
||||
ui->varioLimitCenterMin_DSB->setValue(-2.0);
|
||||
|
@ -818,26 +818,26 @@ void TelemetryPanel::on_varioLimitCenterMax_DSB_editingFinished()
|
|||
if (ui->varioLimitCenterMin_DSB->value()>ui->varioLimitCenterMax_DSB->value()) {
|
||||
ui->varioLimitCenterMax_DSB->setValue(ui->varioLimitCenterMin_DSB->value());
|
||||
}
|
||||
model.frsky.varioCenterMax = round((ui->varioLimitCenterMax_DSB->value()-0.5)*10);
|
||||
model->frsky.varioCenterMax = round((ui->varioLimitCenterMax_DSB->value()-0.5)*10);
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_fasOffset_DSB_editingFinished()
|
||||
{
|
||||
model.frsky.fasOffset = ui->fasOffset_DSB->value() * 10;
|
||||
model->frsky.fasOffset = ui->fasOffset_DSB->value() * 10;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_mahCount_SB_editingFinished()
|
||||
{
|
||||
model.frsky.storedMah = ui->mahCount_SB->value();
|
||||
model->frsky.storedMah = ui->mahCount_SB->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_mahCount_ChkB_toggled(bool checked)
|
||||
{
|
||||
model.frsky.mAhPersistent = checked;
|
||||
model->frsky.mAhPersistent = checked;
|
||||
ui->mahCount_SB->setDisabled(!checked);
|
||||
emit modified();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef TELEMETRY_H
|
||||
#define TELEMETRY_H
|
||||
|
||||
#include "modelpanel.h"
|
||||
#include "modeledit.h"
|
||||
#include <QGroupBox>
|
||||
#include <QComboBox>
|
||||
#include <QDoubleSpinBox>
|
||||
|
|
|
@ -211,7 +211,7 @@ void PrintDialog::printInputs()
|
|||
str.append("<tr><td><font size=+1 face='Courier New'>");
|
||||
if(lastCHN!=ed->chn) {
|
||||
lastCHN=ed->chn;
|
||||
str.append("<b>"+getInputStr(*g_model, ed->chn)+"</b>");
|
||||
str.append("<b>"+getInputStr(g_model, ed->chn)+"</b>");
|
||||
}
|
||||
str.append("</font></td>");
|
||||
str.append("<td><font size=+1 face='Courier New' color=green>");
|
||||
|
@ -231,9 +231,9 @@ void PrintDialog::printInputs()
|
|||
str += " " + tr("Weight") + QString("(%1)").arg(getGVarString(ed->weight,true));
|
||||
|
||||
if (firmware->getCapability(VirtualInputs)) {
|
||||
str += " " + tr("Source") + QString("(%1)").arg(ed->srcRaw.toString(*g_model));
|
||||
str += " " + tr("Source") + QString("(%1)").arg(ed->srcRaw.toString(g_model));
|
||||
if (ed->carryTrim>0) str += " " + tr("NoTrim");
|
||||
else if (ed->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(ed->carryTrim)-1)).toString(*g_model);
|
||||
else if (ed->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(ed->carryTrim)-1)).toString(g_model);
|
||||
}
|
||||
if (ed->curve.value) str += " " + Qt::escape(ed->curve.toString());
|
||||
|
||||
|
@ -315,10 +315,10 @@ void PrintDialog::printMixes()
|
|||
default: str += " "; break;
|
||||
};
|
||||
|
||||
str += " " + md->srcRaw.toString(*g_model);
|
||||
str += " " + md->srcRaw.toString(g_model);
|
||||
str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(md->weight, true)));
|
||||
|
||||
QString phasesStr = getPhasesStr(md->phases, *g_model);
|
||||
QString phasesStr = getPhasesStr(md->phases, g_model);
|
||||
if (!phasesStr.isEmpty()) str += " " + Qt::escape(phasesStr);
|
||||
|
||||
if (md->swtch.type != SWITCH_TYPE_NONE) {
|
||||
|
@ -328,7 +328,7 @@ void PrintDialog::printMixes()
|
|||
if (md->carryTrim>0)
|
||||
str += " " + Qt::escape(tr("NoTrim"));
|
||||
else if (md->carryTrim<0)
|
||||
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(*g_model);
|
||||
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(g_model);
|
||||
|
||||
if (firmware->getCapability(HasNoExpo) && md->noExpo) str += " " + Qt::escape(tr("No DR/Expo"));
|
||||
if (md->sOffset) str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(md->sOffset)));
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define QAUTOCOMBOBOX_H_
|
||||
|
||||
#include <QComboBox>
|
||||
#include "modeledit/modelpanel.h"
|
||||
#include "modeledit/modeledit.h"
|
||||
|
||||
class QUnsignedAutoComboBox: public QComboBox
|
||||
{
|
||||
|
|
|
@ -373,7 +373,7 @@ void SimulatorDialog::initUi(T * ui)
|
|||
}
|
||||
QLabel * label = new QLabel(tabWidget);
|
||||
ModelData model;
|
||||
label->setText(RawSource(SOURCE_TYPE_CH, i).toString(model));
|
||||
label->setText(RawSource(SOURCE_TYPE_CH, i).toString(&model));
|
||||
outputTab->addWidget(label, line, column == 0 ? 0 : 5, 1, 1);
|
||||
|
||||
QSlider * slider = new QSlider(tabWidget);
|
||||
|
|
|
@ -5071,8 +5071,10 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
|||
{
|
||||
int8_t sub = m_posVert - 1;
|
||||
|
||||
#if defined(CPUARM) || defined(AUTOSWITCH)
|
||||
#if defined(CPUARM)
|
||||
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
|
||||
#elif !defined(CPUM64) || defined(AUTOSWITCH)
|
||||
uint8_t eeFlags = EE_MODEL;
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
|
|
|
@ -520,7 +520,7 @@ enum AdjustGvarFunctionParam {
|
|||
#define LEN_CFN_NAME 6
|
||||
#define CFN_SPARE_TYPE int16_t
|
||||
#endif
|
||||
PACK(typedef struct t_CustomFunctionData { // Function Switches data
|
||||
PACK(typedef struct {
|
||||
int8_t swtch;
|
||||
uint8_t func;
|
||||
PACK(union {
|
||||
|
@ -557,7 +557,7 @@ PACK(typedef struct t_CustomFunctionData { // Function Switches data
|
|||
#define CFN_RESET(p) ((p)->active=0, (p)->clear.val1=0, (p)->clear.val2=0)
|
||||
#define CFN_GVAR_CST_MAX GVAR_LIMIT
|
||||
#else
|
||||
PACK(typedef struct t_CustomFunctionData {
|
||||
PACK(typedef struct {
|
||||
PACK(union {
|
||||
PACK(struct {
|
||||
int16_t swtch:6;
|
||||
|
@ -650,7 +650,7 @@ PACK(typedef struct t_EEGeneral {
|
|||
|
||||
EXTRA_GENERAL_FIELDS
|
||||
|
||||
swstate_t switchUnlockStates;
|
||||
ARM_FIELD(swstate_t switchUnlockStates)
|
||||
|
||||
ARM_FIELD(CustomFunctionData customFn[NUM_CFN])
|
||||
|
||||
|
|
|
@ -389,12 +389,15 @@ TEST(Trims, CopyTrimsToOffset)
|
|||
MODEL_RESET();
|
||||
modelDefault(0);
|
||||
setTrimValue(0, ELE_STICK, -100); // -100 on elevator
|
||||
#if defined(CPUARM)
|
||||
evalFunctions(g_model.customFn, modelFunctionsContext); // it disables all safety channels
|
||||
copyTrimsToOffset(1);
|
||||
EXPECT_EQ(getTrimValue(0, ELE_STICK), -100); // unchanged
|
||||
EXPECT_EQ(g_model.limitData[1].offset, -195);
|
||||
#else
|
||||
evalFunctions(); // it disables all safety channels
|
||||
copyTrimsToOffset(1);
|
||||
EXPECT_EQ(getTrimValue(0, ELE_STICK), -100); // unchanged
|
||||
#if defined(CPUARM)
|
||||
EXPECT_EQ(g_model.limitData[1].offset, -195);
|
||||
#else
|
||||
EXPECT_EQ(g_model.limitData[1].offset, -200);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue