mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 20:35:17 +03:00
Issue #592 - Support for Sticky Switches in Companion
This commit is contained in:
parent
873d2c4377
commit
c473b8e105
28 changed files with 767 additions and 627 deletions
|
@ -1040,8 +1040,8 @@ void compareDialog::printSwitches()
|
||||||
str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>");
|
str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>");
|
||||||
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
|
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
|
||||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
for (int i=0; i<GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
||||||
QString sw1 = getCustomSwitchStr(&g_model1->customSw[i], *g_model1);
|
QString sw1 = g_model1->customSw[i].toString(*g_model1);
|
||||||
QString sw2 = getCustomSwitchStr(&g_model2->customSw[i], *g_model2);
|
QString sw2 = g_model2->customSw[i].toString(*g_model2);
|
||||||
if (!(sw1.isEmpty() && sw2.isEmpty())) {
|
if (!(sw1.isEmpty() && sw2.isEmpty())) {
|
||||||
str.append("<tr>");
|
str.append("<tr>");
|
||||||
color=getColor1(sw1,sw2);
|
color=getColor1(sw1,sw2);
|
||||||
|
@ -1095,7 +1095,7 @@ void compareDialog::printFSwitches()
|
||||||
str.append("<tr>");
|
str.append("<tr>");
|
||||||
if (g_model1->funcSw[i].swtch.type) {
|
if (g_model1->funcSw[i].swtch.type) {
|
||||||
str.append(doTC(g_model1->funcSw[i].swtch.toString(),color1));
|
str.append(doTC(g_model1->funcSw[i].swtch.toString(),color1));
|
||||||
str.append(doTC(getFuncName(g_model1->funcSw[i].func),color1));
|
str.append(doTC(g_model1->funcSw[i].funcToString(),color1));
|
||||||
str.append(doTC(g_model1->funcSw[i].paramToString(),color1));
|
str.append(doTC(g_model1->funcSw[i].paramToString(),color1));
|
||||||
int index=g_model1->funcSw[i].func;
|
int index=g_model1->funcSw[i].func;
|
||||||
if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
||||||
|
@ -1114,7 +1114,7 @@ void compareDialog::printFSwitches()
|
||||||
str.append(doTC(tr("CF")+QString("%1").arg(i+1),"",true));
|
str.append(doTC(tr("CF")+QString("%1").arg(i+1),"",true));
|
||||||
if (g_model2->funcSw[i].swtch.type) {
|
if (g_model2->funcSw[i].swtch.type) {
|
||||||
str.append(doTC(g_model2->funcSw[i].swtch.toString(),color2));
|
str.append(doTC(g_model2->funcSw[i].swtch.toString(),color2));
|
||||||
str.append(doTC(getFuncName(g_model2->funcSw[i].func),color2));
|
str.append(doTC(g_model2->funcSw[i].funcToString(),color2));
|
||||||
str.append(doTC(g_model2->funcSw[i].paramToString(),color2));
|
str.append(doTC(g_model2->funcSw[i].paramToString(),color2));
|
||||||
int index=g_model2->funcSw[i].func;
|
int index=g_model2->funcSw[i].func;
|
||||||
if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
||||||
|
|
|
@ -93,6 +93,17 @@ class DataField {
|
||||||
const char *name;
|
const char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ProxyField: public DataField {
|
||||||
|
public:
|
||||||
|
ProxyField():
|
||||||
|
DataField("Proxy")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual DataField * getField() = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
template<int N>
|
template<int N>
|
||||||
class UnsignedField: public DataField {
|
class UnsignedField: public DataField {
|
||||||
public:
|
public:
|
||||||
|
@ -273,9 +284,10 @@ class SpareBitsField: public UnsignedField<N> {
|
||||||
template<int N>
|
template<int N>
|
||||||
class CharField: public DataField {
|
class CharField: public DataField {
|
||||||
public:
|
public:
|
||||||
CharField(char *field):
|
CharField(char *field, bool truncate=true):
|
||||||
DataField("Char"),
|
DataField("Char"),
|
||||||
field(field)
|
field(field),
|
||||||
|
truncate(truncate)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +295,7 @@ class CharField: public DataField {
|
||||||
{
|
{
|
||||||
output.resize(N*8);
|
output.resize(N*8);
|
||||||
int b = 0;
|
int b = 0;
|
||||||
int len = strlen(field);
|
int len = truncate ? strlen(field) : N;
|
||||||
for (int i=0; i<N; i++) {
|
for (int i=0; i<N; i++) {
|
||||||
int idx = (i>=len ? 0 : field[i]);
|
int idx = (i>=len ? 0 : field[i]);
|
||||||
for (int j=0; j<8; j++, b++) {
|
for (int j=0; j<8; j++, b++) {
|
||||||
|
@ -313,6 +325,7 @@ class CharField: public DataField {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
char * field;
|
char * field;
|
||||||
|
bool truncate;
|
||||||
};
|
};
|
||||||
|
|
||||||
int8_t char2idx(char c);
|
int8_t char2idx(char c);
|
||||||
|
|
|
@ -280,45 +280,8 @@ QString RawSwitch::toString()
|
||||||
return CHECK_IN_ARRAY(multiposPots, index);
|
return CHECK_IN_ARRAY(multiposPots, index);
|
||||||
case SWITCH_TYPE_ON:
|
case SWITCH_TYPE_ON:
|
||||||
return QObject::tr("ON");
|
return QObject::tr("ON");
|
||||||
case SWITCH_TYPE_ONM:
|
|
||||||
if (index==0) {
|
|
||||||
return QObject::tr("ONE");
|
|
||||||
}
|
|
||||||
else if (index==1) {
|
|
||||||
return QObject::tr("!ONE");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SWITCH_TYPE_TRN:
|
|
||||||
if (index==0) {
|
|
||||||
if (IS_TARANIS(GetEepromInterface()->getBoard()))
|
|
||||||
return SwitchDn('H')+"s";
|
|
||||||
else
|
|
||||||
return QObject::tr("TRNs");
|
|
||||||
} else if (index==1) {
|
|
||||||
if (IS_TARANIS(GetEepromInterface()->getBoard()))
|
|
||||||
return SwitchDn('H')+"l";
|
|
||||||
else
|
|
||||||
return QObject::tr("TRNl");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SWITCH_TYPE_REA:
|
|
||||||
if (index==0) {
|
|
||||||
if (GetEepromInterface()->getBoard() == BOARD_SKY9X)
|
|
||||||
return QObject::tr("REAs");
|
|
||||||
} else if (index==1) {
|
|
||||||
if (GetEepromInterface()->getBoard() == BOARD_SKY9X)
|
|
||||||
return QObject::tr("REAl");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SWITCH_TYPE_OFF:
|
case SWITCH_TYPE_OFF:
|
||||||
return QObject::tr("OFF");
|
return QObject::tr("OFF");
|
||||||
case SWITCH_TYPE_MOMENT_SWITCH:
|
|
||||||
if (IS_TARANIS(GetEepromInterface()->getBoard()))
|
|
||||||
return index > 0 ? CHECK_IN_ARRAY(switchesX9D, index-1)+QString("t") : QString("!")+CHECK_IN_ARRAY(switchesX9D, -index-1)+QString("t");
|
|
||||||
else
|
|
||||||
return index > 0 ? CHECK_IN_ARRAY(switches9X, index-1)+QString("t") : QString("!")+CHECK_IN_ARRAY(switches9X, -index-1)+QString("t");
|
|
||||||
case SWITCH_TYPE_MOMENT_VIRTUAL:
|
|
||||||
return index > 0 ? CHECK_IN_ARRAY(virtualSwitches, index-1)+QString("t") : QString("!")+CHECK_IN_ARRAY(virtualSwitches, -index-1)+QString("t");
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -345,6 +308,170 @@ QString CurveReference::toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSFunctionFamily CustomSwData::getFunctionFamily()
|
||||||
|
{
|
||||||
|
if (func == CS_FN_TIMER)
|
||||||
|
return CS_FAMILY_TIMER;
|
||||||
|
else if (func == CS_FN_STICKY)
|
||||||
|
return CS_FAMILY_STICKY;
|
||||||
|
else if (func < CS_FN_AND || func > CS_FN_ELESS)
|
||||||
|
return CS_FAMILY_VOFS;
|
||||||
|
else if (func < CS_FN_EQUAL)
|
||||||
|
return CS_FAMILY_VBOOL;
|
||||||
|
else
|
||||||
|
return CS_FAMILY_VCOMP;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CustomSwData::funcToString()
|
||||||
|
{
|
||||||
|
switch (func) {
|
||||||
|
case CS_FN_OFF:
|
||||||
|
return QObject::tr("---");
|
||||||
|
case CS_FN_VPOS:
|
||||||
|
return QObject::tr("a>x");
|
||||||
|
case CS_FN_VNEG:
|
||||||
|
return QObject::tr("a<x");
|
||||||
|
case CS_FN_APOS:
|
||||||
|
return QObject::tr("|a|>x");
|
||||||
|
case CS_FN_ANEG:
|
||||||
|
return QObject::tr("|a|<x");
|
||||||
|
case CS_FN_AND:
|
||||||
|
return QObject::tr("AND");
|
||||||
|
case CS_FN_OR:
|
||||||
|
return QObject::tr("OR");
|
||||||
|
case CS_FN_XOR:
|
||||||
|
return QObject::tr("XOR");
|
||||||
|
case CS_FN_EQUAL:
|
||||||
|
return QObject::tr("a=b");
|
||||||
|
case CS_FN_NEQUAL:
|
||||||
|
return QObject::tr("a!=b");
|
||||||
|
case CS_FN_GREATER:
|
||||||
|
return QObject::tr("a>b");
|
||||||
|
case CS_FN_LESS:
|
||||||
|
return QObject::tr("a<b");
|
||||||
|
case CS_FN_EGREATER:
|
||||||
|
return QObject::tr("a>=b");
|
||||||
|
case CS_FN_ELESS:
|
||||||
|
return QObject::tr("a<=b");
|
||||||
|
case CS_FN_DPOS:
|
||||||
|
return QObject::tr("d>=x");
|
||||||
|
case CS_FN_DAPOS:
|
||||||
|
return QObject::tr("|d|>=x");
|
||||||
|
case CS_FN_VEQUAL:
|
||||||
|
return QObject::tr("a~x");
|
||||||
|
case CS_FN_TIMER:
|
||||||
|
return QObject::tr("Timer");
|
||||||
|
case CS_FN_STICKY:
|
||||||
|
return QObject::tr("Sticky");
|
||||||
|
default:
|
||||||
|
return QObject::tr("Unknown");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CustomSwData::toString(const ModelData & model)
|
||||||
|
{
|
||||||
|
QString result = "";
|
||||||
|
|
||||||
|
if (!func)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
if (andsw!=0) {
|
||||||
|
result +="( ";
|
||||||
|
}
|
||||||
|
switch (getFunctionFamily()) {
|
||||||
|
case CS_FAMILY_STICKY:
|
||||||
|
result = QObject::tr("STICKY(%1 , %2)").arg(RawSwitch(val1).toString()).arg(RawSwitch(val2).toString());
|
||||||
|
break;
|
||||||
|
case CS_FAMILY_TIMER:
|
||||||
|
result = QObject::tr("TIMER(%1 , %2)").arg(ValToTim(val1)).arg(ValToTim(val2));
|
||||||
|
break;
|
||||||
|
case CS_FAMILY_VOFS: {
|
||||||
|
RawSource source = RawSource(val1, &model);
|
||||||
|
RawSourceRange range = source.getRange();
|
||||||
|
if (val1)
|
||||||
|
result += source.toString();
|
||||||
|
else
|
||||||
|
result += "0";
|
||||||
|
result.remove(" ");
|
||||||
|
if (func == CS_FN_APOS || func == CS_FN_ANEG)
|
||||||
|
result = "|" + result + "|";
|
||||||
|
else if (func == CS_FN_DAPOS)
|
||||||
|
result = "|d(" + result + ")|";
|
||||||
|
else if (func == CS_FN_DPOS) result = "d(" + result + ")";
|
||||||
|
if (func == CS_FN_APOS || func == CS_FN_VPOS || func == CS_FN_DAPOS || func == CS_FN_DPOS)
|
||||||
|
result += " > ";
|
||||||
|
else if (func == CS_FN_ANEG || func == CS_FN_VNEG)
|
||||||
|
result += " < ";
|
||||||
|
result += QString::number(range.step * (val2 /*TODO+ source.getRawOffset(model)*/) + range.offset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CS_FAMILY_VBOOL:
|
||||||
|
result = RawSwitch(val1).toString();
|
||||||
|
switch (func) {
|
||||||
|
case CS_FN_AND:
|
||||||
|
result += " AND ";
|
||||||
|
break;
|
||||||
|
case CS_FN_OR:
|
||||||
|
result += " OR ";
|
||||||
|
break;
|
||||||
|
case CS_FN_XOR:
|
||||||
|
result += " XOR ";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
result += RawSwitch(val2).toString();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CS_FAMILY_VCOMP:
|
||||||
|
if (val1)
|
||||||
|
result += RawSource(val1).toString();
|
||||||
|
else
|
||||||
|
result += "0";
|
||||||
|
switch (func) {
|
||||||
|
case CS_FN_EQUAL:
|
||||||
|
result += " = ";
|
||||||
|
break;
|
||||||
|
case CS_FN_NEQUAL:
|
||||||
|
result += " != ";
|
||||||
|
break;
|
||||||
|
case CS_FN_GREATER:
|
||||||
|
result += " > ";
|
||||||
|
break;
|
||||||
|
case CS_FN_LESS:
|
||||||
|
result += " < ";
|
||||||
|
break;
|
||||||
|
case CS_FN_EGREATER:
|
||||||
|
result += " >= ";
|
||||||
|
break;
|
||||||
|
case CS_FN_ELESS:
|
||||||
|
result += " <= ";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (val2)
|
||||||
|
result += RawSource(val2).toString();
|
||||||
|
else
|
||||||
|
result += "0";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (andsw!=0) {
|
||||||
|
result +=" ) AND ";
|
||||||
|
result += RawSwitch(andsw).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
|
||||||
|
if (delay)
|
||||||
|
result += QObject::tr(" Delay %1 sec").arg(delay/2.0);
|
||||||
|
if (duration)
|
||||||
|
result += QObject::tr(" Duration %1 sec").arg(duration/2.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
QStringList FuncSwData::toStringList()
|
QStringList FuncSwData::toStringList()
|
||||||
{
|
{
|
||||||
|
@ -416,10 +543,69 @@ QStringList FuncSwData::toStringList()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (func==FuncPlaySound || func==FuncPlayHaptic || func==FuncPlayValue || func==FuncPlayPrompt || func==FuncPlayBoth || func==FuncBackgroundMusic) {
|
||||||
|
str.append(doTC(QString("%1").arg(g_model->funcSw[i].repeatParam),"green"));
|
||||||
|
} else {
|
||||||
|
str.append(doTC( " ","green"));
|
||||||
|
}
|
||||||
|
if ((index<=FuncInstantTrim) || (index>FuncBackgroundMusicPause)) {
|
||||||
|
str.append(doTC((g_model->funcSw[i].enabled ? "ON" : "OFF"),"green"));
|
||||||
|
} else {
|
||||||
|
str.append(doTC( "---","green"));
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QString FuncSwData::funcToString()
|
||||||
|
{
|
||||||
|
if (func >= FuncSafetyCh1 && func <= FuncSafetyCh32)
|
||||||
|
return QObject::tr("Safety %1").arg(RawSource(SOURCE_TYPE_CH, func).toString());
|
||||||
|
else if (func == FuncTrainer)
|
||||||
|
return QObject::tr("Trainer");
|
||||||
|
else if (func == FuncTrainerRUD)
|
||||||
|
return QObject::tr("Trainer RUD");
|
||||||
|
else if (func == FuncTrainerELE)
|
||||||
|
return QObject::tr("Trainer ELE");
|
||||||
|
else if (func == FuncTrainerTHR)
|
||||||
|
return QObject::tr("Trainer THR");
|
||||||
|
else if (func == FuncTrainerAIL)
|
||||||
|
return QObject::tr("Trainer AIL");
|
||||||
|
else if (func == FuncInstantTrim)
|
||||||
|
return QObject::tr("Instant Trim");
|
||||||
|
else if (func == FuncPlaySound)
|
||||||
|
return QObject::tr("Play Sound");
|
||||||
|
else if (func == FuncPlayHaptic)
|
||||||
|
return QObject::tr("Play Haptic");
|
||||||
|
else if (func == FuncReset)
|
||||||
|
return QObject::tr("Reset");
|
||||||
|
else if (func == FuncVario)
|
||||||
|
return QObject::tr("Vario");
|
||||||
|
else if (func == FuncPlayPrompt)
|
||||||
|
return QObject::tr("Play Track");
|
||||||
|
else if (func == FuncPlayBoth)
|
||||||
|
return QObject::tr("Play Both");
|
||||||
|
else if (func == FuncPlayValue)
|
||||||
|
return QObject::tr("Play Value");
|
||||||
|
else if (func == FuncLogs)
|
||||||
|
return QObject::tr("Start Logs");
|
||||||
|
else if (func == FuncVolume)
|
||||||
|
return QObject::tr("Volume");
|
||||||
|
else if (func == FuncBacklight)
|
||||||
|
return QObject::tr("Backlight");
|
||||||
|
else if (func == FuncBackgroundMusic)
|
||||||
|
return QObject::tr("Background Music");
|
||||||
|
else if (func == FuncBackgroundMusicPause)
|
||||||
|
return QObject::tr("Background Music Pause");
|
||||||
|
else if (func >= FuncAdjustGV1 && func <= FuncAdjustGVLast)
|
||||||
|
return QObject::tr("Adjust GV%1").arg(func-FuncAdjustGV1+1);
|
||||||
|
else {
|
||||||
|
return QString("???"); // Highlight unknown functions with output of question marks.(BTW should not happen that we do not know what a function is)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString FuncSwData::paramToString()
|
QString FuncSwData::paramToString()
|
||||||
{
|
{
|
||||||
QStringList qs;
|
QStringList qs;
|
||||||
|
@ -488,6 +674,17 @@ QString FuncSwData::paramToString()
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString FuncSwData::repeatToString()
|
||||||
|
{
|
||||||
|
if (repeatParam==0) {
|
||||||
|
return QObject::tr("No repeat");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 5 : 10;
|
||||||
|
return QObject::tr("%1 sec").arg(step*repeatParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GeneralSettings::GeneralSettings()
|
GeneralSettings::GeneralSettings()
|
||||||
{
|
{
|
||||||
memset(this, 0, sizeof(GeneralSettings));
|
memset(this, 0, sizeof(GeneralSettings));
|
||||||
|
|
|
@ -146,44 +146,6 @@ enum EnumKeys {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CSFunction {
|
|
||||||
CS_FN_OFF,
|
|
||||||
CS_FN_VPOS,
|
|
||||||
CS_FN_VNEG,
|
|
||||||
CS_FN_APOS,
|
|
||||||
CS_FN_ANEG,
|
|
||||||
CS_FN_AND,
|
|
||||||
CS_FN_OR,
|
|
||||||
CS_FN_XOR,
|
|
||||||
CS_FN_EQUAL,
|
|
||||||
CS_FN_NEQUAL,
|
|
||||||
CS_FN_GREATER,
|
|
||||||
CS_FN_LESS,
|
|
||||||
CS_FN_EGREATER,
|
|
||||||
CS_FN_ELESS,
|
|
||||||
CS_FN_DPOS,
|
|
||||||
CS_FN_DAPOS,
|
|
||||||
CS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
|
||||||
CS_FN_TIM,
|
|
||||||
CS_FN_MAXF
|
|
||||||
};
|
|
||||||
|
|
||||||
enum CSFunctionFamily {
|
|
||||||
CS_FAMILY_VOFS,
|
|
||||||
CS_FAMILY_VBOOL,
|
|
||||||
CS_FAMILY_VCOMP,
|
|
||||||
CS_FAMILY_TIMERS
|
|
||||||
};
|
|
||||||
|
|
||||||
inline CSFunctionFamily getCSFunctionFamily(int fn)
|
|
||||||
{
|
|
||||||
if (fn==CS_FN_TIM) {
|
|
||||||
return (CS_FAMILY_TIMERS);
|
|
||||||
} else {
|
|
||||||
return ((fn<CS_FN_AND || fn>CS_FN_ELESS) ? CS_FAMILY_VOFS : (fn<CS_FN_EQUAL ? CS_FAMILY_VBOOL : CS_FAMILY_VCOMP));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define CHAR_FOR_NAMES " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-."
|
#define CHAR_FOR_NAMES " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-."
|
||||||
#define CHAR_FOR_NAMES_REGEX "[ A-Za-z0-9_.-,]*"
|
#define CHAR_FOR_NAMES_REGEX "[ A-Za-z0-9_.-,]*"
|
||||||
|
|
||||||
|
@ -356,13 +318,8 @@ enum RawSwitchType {
|
||||||
SWITCH_TYPE_SWITCH,
|
SWITCH_TYPE_SWITCH,
|
||||||
SWITCH_TYPE_VIRTUAL,
|
SWITCH_TYPE_VIRTUAL,
|
||||||
SWITCH_TYPE_MULTIPOS_POT,
|
SWITCH_TYPE_MULTIPOS_POT,
|
||||||
SWITCH_TYPE_MOMENT_SWITCH,
|
|
||||||
SWITCH_TYPE_MOMENT_VIRTUAL,
|
|
||||||
SWITCH_TYPE_ON,
|
SWITCH_TYPE_ON,
|
||||||
SWITCH_TYPE_OFF,
|
SWITCH_TYPE_OFF
|
||||||
SWITCH_TYPE_ONM,
|
|
||||||
SWITCH_TYPE_TRN,
|
|
||||||
SWITCH_TYPE_REA,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RawSwitch {
|
class RawSwitch {
|
||||||
|
@ -616,16 +573,54 @@ class MixData {
|
||||||
void clear() { memset(this, 0, sizeof(MixData)); }
|
void clear() { memset(this, 0, sizeof(MixData)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum CSFunction {
|
||||||
|
CS_FN_OFF,
|
||||||
|
CS_FN_VPOS,
|
||||||
|
CS_FN_VNEG,
|
||||||
|
CS_FN_APOS,
|
||||||
|
CS_FN_ANEG,
|
||||||
|
CS_FN_AND,
|
||||||
|
CS_FN_OR,
|
||||||
|
CS_FN_XOR,
|
||||||
|
CS_FN_EQUAL,
|
||||||
|
CS_FN_NEQUAL,
|
||||||
|
CS_FN_GREATER,
|
||||||
|
CS_FN_LESS,
|
||||||
|
CS_FN_EGREATER,
|
||||||
|
CS_FN_ELESS,
|
||||||
|
CS_FN_DPOS,
|
||||||
|
CS_FN_DAPOS,
|
||||||
|
CS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
||||||
|
CS_FN_TIMER,
|
||||||
|
CS_FN_STICKY,
|
||||||
|
CS_FN_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
enum CSFunctionFamily {
|
||||||
|
CS_FAMILY_VOFS,
|
||||||
|
CS_FAMILY_VBOOL,
|
||||||
|
CS_FAMILY_VCOMP,
|
||||||
|
CS_FAMILY_TIMER,
|
||||||
|
CS_FAMILY_STICKY
|
||||||
|
};
|
||||||
|
|
||||||
class CustomSwData { // Custom Switches data
|
class CustomSwData { // Custom Switches data
|
||||||
public:
|
public:
|
||||||
CustomSwData() { clear(); }
|
CustomSwData(unsigned int func=0)
|
||||||
int val1; //input
|
{
|
||||||
int val2; //offset
|
clear();
|
||||||
|
this->func = func;
|
||||||
|
}
|
||||||
unsigned int func;
|
unsigned int func;
|
||||||
|
int val1;
|
||||||
|
int val2;
|
||||||
unsigned int delay;
|
unsigned int delay;
|
||||||
unsigned int duration;
|
unsigned int duration;
|
||||||
unsigned int andsw;
|
unsigned int andsw;
|
||||||
void clear() { memset(this, 0, sizeof(CustomSwData)); }
|
void clear() { memset(this, 0, sizeof(CustomSwData)); }
|
||||||
|
CSFunctionFamily getFunctionFamily();
|
||||||
|
QString funcToString();
|
||||||
|
QString toString(const ModelData & model);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AssignFunc {
|
enum AssignFunc {
|
||||||
|
@ -656,7 +651,7 @@ enum AssignFunc {
|
||||||
|
|
||||||
class FuncSwData { // Function Switches data
|
class FuncSwData { // Function Switches data
|
||||||
public:
|
public:
|
||||||
FuncSwData() { clear(); }
|
FuncSwData(AssignFunc func=FuncSafetyCh1) { clear(); this->func = func; }
|
||||||
RawSwitch swtch;
|
RawSwitch swtch;
|
||||||
AssignFunc func;
|
AssignFunc func;
|
||||||
int param;
|
int param;
|
||||||
|
@ -665,7 +660,9 @@ class FuncSwData { // Function Switches data
|
||||||
unsigned int adjustMode;
|
unsigned int adjustMode;
|
||||||
int repeatParam;
|
int repeatParam;
|
||||||
void clear() { memset(this, 0, sizeof(FuncSwData)); }
|
void clear() { memset(this, 0, sizeof(FuncSwData)); }
|
||||||
|
QString funcToString();
|
||||||
QString paramToString();
|
QString paramToString();
|
||||||
|
QString repeatToString();
|
||||||
QStringList toStringList();
|
QStringList toStringList();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -807,11 +804,8 @@ enum TimerMode {
|
||||||
TMRMODE_THp,
|
TMRMODE_THp,
|
||||||
TMRMODE_THt,
|
TMRMODE_THt,
|
||||||
TMRMODE_FIRST_SWITCH,
|
TMRMODE_FIRST_SWITCH,
|
||||||
TMRMODE_FIRST_MOMENT_SWITCH = TMRMODE_FIRST_SWITCH+64,
|
TMRMODE_FIRST_CHPERC = TMRMODE_FIRST_SWITCH+64,
|
||||||
TMRMODE_FIRST_CHPERC = TMRMODE_FIRST_MOMENT_SWITCH+64,
|
|
||||||
|
|
||||||
TMRMODE_FIRST_NEG_SWITCH=-TMRMODE_FIRST_SWITCH,
|
TMRMODE_FIRST_NEG_SWITCH=-TMRMODE_FIRST_SWITCH,
|
||||||
TMRMODE_FIRST_NEG_MOMENT_SWITCH=-TMRMODE_FIRST_MOMENT_SWITCH,
|
|
||||||
/* sw/!sw, !m_sw/!m_sw */
|
/* sw/!sw, !m_sw/!m_sw */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1174,7 +1168,7 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
|
||||||
// virtual switches
|
// virtual switches
|
||||||
for (int i=0; i<C9X_NUM_CSW; i++) {
|
for (int i=0; i<C9X_NUM_CSW; i++) {
|
||||||
RawSource source;
|
RawSource source;
|
||||||
switch (getCSFunctionFamily(model.customSw[i].func)) {
|
switch (model.customSw[i].getFunctionFamily()) {
|
||||||
case CS_FAMILY_VCOMP:
|
case CS_FAMILY_VCOMP:
|
||||||
source = RawSource(model.customSw[i].val2);
|
source = RawSource(model.customSw[i].val2);
|
||||||
if (source.type == SOURCE_TYPE_STICK)
|
if (source.type == SOURCE_TYPE_STICK)
|
||||||
|
|
|
@ -17,9 +17,9 @@ RawSwitch er9xToSwitch(int8_t sw)
|
||||||
else if (sw == -22)
|
else if (sw == -22)
|
||||||
return RawSwitch(SWITCH_TYPE_OFF);
|
return RawSwitch(SWITCH_TYPE_OFF);
|
||||||
else if (swa <= 22+9)
|
else if (swa <= 22+9)
|
||||||
return RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, sw > 0 ? sw-22 : sw+22);
|
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-22 : sw+22);
|
||||||
else
|
else
|
||||||
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
|
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
|
||||||
}
|
}
|
||||||
|
|
||||||
t_Er9xTrainerMix::t_Er9xTrainerMix()
|
t_Er9xTrainerMix::t_Er9xTrainerMix()
|
||||||
|
@ -338,7 +338,7 @@ t_Er9xFrSkyData::operator FrSkyData ()
|
||||||
TimerMode getEr9xTimerMode(int mode)
|
TimerMode getEr9xTimerMode(int mode)
|
||||||
{
|
{
|
||||||
if (mode <= -33)
|
if (mode <= -33)
|
||||||
return TimerMode(TMRMODE_FIRST_NEG_MOMENT_SWITCH+(mode+33));
|
return TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+33));
|
||||||
else if (mode <= -1)
|
else if (mode <= -1)
|
||||||
return TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1));
|
return TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1));
|
||||||
else if (mode < 16)
|
else if (mode < 16)
|
||||||
|
@ -346,7 +346,7 @@ TimerMode getEr9xTimerMode(int mode)
|
||||||
else if (mode < 16+21)
|
else if (mode < 16+21)
|
||||||
return TimerMode(TMRMODE_FIRST_SWITCH+(mode-16));
|
return TimerMode(TMRMODE_FIRST_SWITCH+(mode-16));
|
||||||
else
|
else
|
||||||
return TimerMode(TMRMODE_FIRST_MOMENT_SWITCH+(mode-16-21));
|
return TimerMode(TMRMODE_FIRST_SWITCH+(mode-16-21));
|
||||||
}
|
}
|
||||||
|
|
||||||
t_Er9xModelData::operator ModelData ()
|
t_Er9xModelData::operator ModelData ()
|
||||||
|
|
|
@ -75,7 +75,7 @@ inline void applyStickModeToModel(Er9xModelData & model, unsigned int mode)
|
||||||
for (int i=0; i<ER9X_MAX_MIXERS; i++)
|
for (int i=0; i<ER9X_MAX_MIXERS; i++)
|
||||||
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
||||||
for (int i=0; i<ER9X_NUM_CSW; i++) {
|
for (int i=0; i<ER9X_NUM_CSW; i++) {
|
||||||
switch (getCSFunctionFamily(model.customSw[i].func)) {
|
switch (CustomSwData(model.customSw[i].func).getFunctionFamily()) {
|
||||||
case CS_FAMILY_VCOMP:
|
case CS_FAMILY_VCOMP:
|
||||||
model.customSw[i].v2 = applyStickMode(model.customSw[i].v2, mode);
|
model.customSw[i].v2 = applyStickMode(model.customSw[i].v2, mode);
|
||||||
// no break
|
// no break
|
||||||
|
|
|
@ -29,9 +29,9 @@ RawSwitch ersky9xToSwitch(int8_t sw)
|
||||||
else if (sw == -34)
|
else if (sw == -34)
|
||||||
return RawSwitch(SWITCH_TYPE_OFF);
|
return RawSwitch(SWITCH_TYPE_OFF);
|
||||||
else if (swa <= 34+9)
|
else if (swa <= 34+9)
|
||||||
return RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, sw > 0 ? sw-34 : sw+34);
|
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-34 : sw+34);
|
||||||
else
|
else
|
||||||
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-34-9 : sw+34+9);
|
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-34-9 : sw+34+9);
|
||||||
}
|
}
|
||||||
|
|
||||||
t_Ersky9xTrainerMix::t_Ersky9xTrainerMix()
|
t_Ersky9xTrainerMix::t_Ersky9xTrainerMix()
|
||||||
|
|
|
@ -74,7 +74,7 @@ inline void applyStickModeToModel(Ersky9xModelData_v10 & model, unsigned int mod
|
||||||
for (int i=0; i<ERSKY9X_MAX_MIXERS_V10; i++)
|
for (int i=0; i<ERSKY9X_MAX_MIXERS_V10; i++)
|
||||||
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
||||||
for (int i=0; i<ERSKY9X_NUM_CSW_V10; i++) {
|
for (int i=0; i<ERSKY9X_NUM_CSW_V10; i++) {
|
||||||
switch (getCSFunctionFamily(model.customSw[i].func)) {
|
switch (CustomSwData(model.customSw[i].func).getFunctionFamily()) {
|
||||||
case CS_FAMILY_VCOMP:
|
case CS_FAMILY_VCOMP:
|
||||||
model.customSw[i].v2 = applyStickMode(model.customSw[i].v2, mode);
|
model.customSw[i].v2 = applyStickMode(model.customSw[i].v2, mode);
|
||||||
// no break
|
// no break
|
||||||
|
@ -106,7 +106,7 @@ inline void applyStickModeToModel(Ersky9xModelData_v11 & model, unsigned int mod
|
||||||
for (int i=0; i<ERSKY9X_MAX_MIXERS_V11; i++)
|
for (int i=0; i<ERSKY9X_MAX_MIXERS_V11; i++)
|
||||||
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
||||||
for (int i=0; i<ERSKY9X_NUM_CSW_V11; i++) {
|
for (int i=0; i<ERSKY9X_NUM_CSW_V11; i++) {
|
||||||
switch (getCSFunctionFamily(model.customSw[i].func)) {
|
switch (CustomSwData(model.customSw[i].func).getFunctionFamily()) {
|
||||||
case CS_FAMILY_VCOMP:
|
case CS_FAMILY_VCOMP:
|
||||||
model.customSw[i].v2 = applyStickMode(model.customSw[i].v2, mode);
|
model.customSw[i].v2 = applyStickMode(model.customSw[i].v2, mode);
|
||||||
// no break
|
// no break
|
||||||
|
|
|
@ -19,13 +19,13 @@ RawSwitch open9xArmToSwitch(int8_t sw)
|
||||||
else if (sw == 42)
|
else if (sw == 42)
|
||||||
return RawSwitch(SWITCH_TYPE_ON);
|
return RawSwitch(SWITCH_TYPE_ON);
|
||||||
else if (sw == 84)
|
else if (sw == 84)
|
||||||
return RawSwitch(SWITCH_TYPE_ONM);
|
return RawSwitch(SWITCH_TYPE_ON);
|
||||||
else if (sw == -42)
|
else if (sw == -42)
|
||||||
return RawSwitch(SWITCH_TYPE_OFF);
|
return RawSwitch(SWITCH_TYPE_OFF);
|
||||||
else if (swa <= 42+9)
|
else if (swa <= 42+9)
|
||||||
return RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, sw > 0 ? sw-42 : sw+42);
|
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-42 : sw+42);
|
||||||
else
|
else
|
||||||
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-42-9 : sw+42+9);
|
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-42-9 : sw+42+9);
|
||||||
}
|
}
|
||||||
|
|
||||||
RawSource open9xArm208ToSource(int8_t value)
|
RawSource open9xArm208ToSource(int8_t value)
|
||||||
|
@ -126,7 +126,7 @@ t_Open9xArmTimerData_v202::operator TimerData ()
|
||||||
TimerData c9x;
|
TimerData c9x;
|
||||||
|
|
||||||
if (mode <= -42)
|
if (mode <= -42)
|
||||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_MOMENT_SWITCH+(mode+22));
|
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+22));
|
||||||
else if (mode <= -1)
|
else if (mode <= -1)
|
||||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1));
|
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1));
|
||||||
else if (mode < 5)
|
else if (mode < 5)
|
||||||
|
@ -134,7 +134,7 @@ t_Open9xArmTimerData_v202::operator TimerData ()
|
||||||
else if (mode < 5+41)
|
else if (mode < 5+41)
|
||||||
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5));
|
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5));
|
||||||
else
|
else
|
||||||
c9x.mode = TimerMode(TMRMODE_FIRST_MOMENT_SWITCH+(mode-5-21));
|
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5-21));
|
||||||
|
|
||||||
c9x.val = val;
|
c9x.val = val;
|
||||||
c9x.persistent = false;
|
c9x.persistent = false;
|
||||||
|
|
|
@ -74,13 +74,13 @@ RawSwitch open9xStockToSwitch(int8_t sw)
|
||||||
else if (sw == 22)
|
else if (sw == 22)
|
||||||
return RawSwitch(SWITCH_TYPE_ON);
|
return RawSwitch(SWITCH_TYPE_ON);
|
||||||
else if (sw == 44)
|
else if (sw == 44)
|
||||||
return RawSwitch(SWITCH_TYPE_ONM);
|
return RawSwitch(SWITCH_TYPE_ON);
|
||||||
else if (sw == -22)
|
else if (sw == -22)
|
||||||
return RawSwitch(SWITCH_TYPE_OFF);
|
return RawSwitch(SWITCH_TYPE_OFF);
|
||||||
else if (swa <= 22+9)
|
else if (swa <= 22+9)
|
||||||
return RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, sw > 0 ? sw-22 : sw+22);
|
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-22 : sw+22);
|
||||||
else
|
else
|
||||||
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
|
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
|
||||||
}
|
}
|
||||||
|
|
||||||
t_Open9xExpoData_v201::operator ExpoData ()
|
t_Open9xExpoData_v201::operator ExpoData ()
|
||||||
|
@ -713,7 +713,7 @@ t_Open9xTimerData_v202::operator TimerData ()
|
||||||
TimerData c9x;
|
TimerData c9x;
|
||||||
|
|
||||||
if (mode <= -22)
|
if (mode <= -22)
|
||||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_MOMENT_SWITCH+(mode+22));
|
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+22));
|
||||||
else if (mode <= -1)
|
else if (mode <= -1)
|
||||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1));
|
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1));
|
||||||
else if (mode < 5)
|
else if (mode < 5)
|
||||||
|
@ -721,7 +721,7 @@ t_Open9xTimerData_v202::operator TimerData ()
|
||||||
else if (mode < 5+21)
|
else if (mode < 5+21)
|
||||||
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5));
|
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5));
|
||||||
else
|
else
|
||||||
c9x.mode = TimerMode(TMRMODE_FIRST_MOMENT_SWITCH+(mode-5-21));
|
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5-21));
|
||||||
|
|
||||||
c9x.val = val;
|
c9x.val = val;
|
||||||
c9x.persistent = false;
|
c9x.persistent = false;
|
||||||
|
|
|
@ -67,23 +67,20 @@ class SwitchesConversionTable: public ConversionTable {
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_OFF), -val);
|
addConversion(RawSwitch(SWITCH_TYPE_OFF), -val);
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_ON), val++);
|
addConversion(RawSwitch(SWITCH_TYPE_ON), val++);
|
||||||
|
|
||||||
|
if (version < 216) {
|
||||||
|
// previous "moment" switches
|
||||||
for (int i=1; i<=MAX_SWITCHES_POSITION(board); i++) {
|
for (int i=1; i<=MAX_SWITCHES_POSITION(board); i++) {
|
||||||
int s = switchIndex(i, board, version);
|
int s = switchIndex(i, board, version);
|
||||||
// addConversion(RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, -s), -val);
|
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val++);
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, s), val++);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=1; i<=MAX_CUSTOM_SWITCHES(board, version); i++) {
|
for (int i=1; i<=MAX_CUSTOM_SWITCHES(board, version); i++) {
|
||||||
// addConversion(RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, -i), -val);
|
addConversion(RawSwitch(SWITCH_TYPE_VIRTUAL, i), val++);
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, i), val++);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// addConversion(RawSwitch(SWITCH_TYPE_ONM, 1 ), -val);
|
// previous "One" switch
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_ONM, 0 ), val++);
|
addConversion(RawSwitch(SWITCH_TYPE_ON), val++);
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_TRN, 0), val++);
|
}
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_TRN, 1), val++);
|
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_REA, 0), val++);
|
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_REA, 1), val++);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -282,9 +279,9 @@ class TimerModeConversionTable: public ConversionTable {
|
||||||
for (int i=0; i<swCount; i++) {
|
for (int i=0; i<swCount; i++) {
|
||||||
int s = switchIndex(i+1, board, version) - 1;
|
int s = switchIndex(i+1, board, version) - 1;
|
||||||
addConversion(TMRMODE_FIRST_SWITCH+i, val+s);
|
addConversion(TMRMODE_FIRST_SWITCH+i, val+s);
|
||||||
addConversion(TMRMODE_FIRST_MOMENT_SWITCH+i, val+s+swCount);
|
addConversion(TMRMODE_FIRST_SWITCH+i, val+s+swCount);
|
||||||
addConversion(TMRMODE_FIRST_NEG_SWITCH-i, -1-s);
|
addConversion(TMRMODE_FIRST_NEG_SWITCH-i, -1-s);
|
||||||
addConversion(TMRMODE_FIRST_NEG_MOMENT_SWITCH-i, -1-s-swCount);
|
addConversion(TMRMODE_FIRST_NEG_SWITCH-i, -1-s-swCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1083,7 +1080,9 @@ class CustomSwitchesFunctionsTable: public ConversionTable {
|
||||||
}
|
}
|
||||||
addConversion(CS_FN_DPOS, val++);
|
addConversion(CS_FN_DPOS, val++);
|
||||||
addConversion(CS_FN_DAPOS, val++);
|
addConversion(CS_FN_DAPOS, val++);
|
||||||
addConversion(CS_FN_TIM, val++);
|
addConversion(CS_FN_TIMER, val++);
|
||||||
|
if (version >= 216)
|
||||||
|
addConversion(CS_FN_STICKY, val++);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1180,40 +1179,40 @@ class CustomSwitchField: public TransformedField {
|
||||||
|
|
||||||
virtual void beforeExport()
|
virtual void beforeExport()
|
||||||
{
|
{
|
||||||
v1 = csw.val1;
|
if ((csw.func >= CS_FN_AND && csw.func <= CS_FN_XOR) || csw.func == CS_FN_STICKY) {
|
||||||
v2 = csw.val2;
|
|
||||||
|
|
||||||
if ((csw.func >= CS_FN_VPOS && csw.func <= CS_FN_ANEG) || (csw.func >= CS_FN_EQUAL && csw.func!=CS_FN_TIM)) {
|
|
||||||
sourcesConversionTable->exportValue(csw.val1, v1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (csw.func >= CS_FN_EQUAL && csw.func <= CS_FN_ELESS) {
|
|
||||||
sourcesConversionTable->exportValue(csw.val2, v2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (csw.func >= CS_FN_AND && csw.func <= CS_FN_XOR) {
|
|
||||||
switchesConversionTable->exportValue(csw.val1, v1);
|
switchesConversionTable->exportValue(csw.val1, v1);
|
||||||
switchesConversionTable->exportValue(csw.val2, v2);
|
switchesConversionTable->exportValue(csw.val2, v2);
|
||||||
}
|
}
|
||||||
|
else if (csw.func >= CS_FN_EQUAL && csw.func <= CS_FN_ELESS) {
|
||||||
|
sourcesConversionTable->exportValue(csw.val1, v1);
|
||||||
|
sourcesConversionTable->exportValue(csw.val2, v2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ((csw.func >= CS_FN_VPOS && csw.func <= CS_FN_ANEG) || (csw.func >= CS_FN_EQUAL && csw.func!=CS_FN_TIMER))
|
||||||
|
sourcesConversionTable->exportValue(csw.val1, v1);
|
||||||
|
else
|
||||||
|
v1 = csw.val1;
|
||||||
|
v2 = csw.val2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void afterImport()
|
virtual void afterImport()
|
||||||
{
|
{
|
||||||
csw.val1 = v1;
|
if ((csw.func >= CS_FN_AND && csw.func <= CS_FN_XOR) || csw.func == CS_FN_STICKY) {
|
||||||
csw.val2 = v2;
|
|
||||||
|
|
||||||
if ((csw.func >= CS_FN_VPOS && csw.func <= CS_FN_ANEG) || (csw.func >= CS_FN_EQUAL && csw.func!=CS_FN_TIM)) {
|
|
||||||
sourcesConversionTable->importValue(v1, csw.val1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (csw.func >= CS_FN_EQUAL && csw.func <= CS_FN_ELESS) {
|
|
||||||
sourcesConversionTable->importValue(v2, csw.val2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (csw.func >= CS_FN_AND && csw.func <= CS_FN_XOR) {
|
|
||||||
switchesConversionTable->importValue(v1, csw.val1);
|
switchesConversionTable->importValue(v1, csw.val1);
|
||||||
switchesConversionTable->importValue(v2, csw.val2);
|
switchesConversionTable->importValue(v2, csw.val2);
|
||||||
}
|
}
|
||||||
|
else if (csw.func >= CS_FN_EQUAL && csw.func <= CS_FN_ELESS) {
|
||||||
|
sourcesConversionTable->importValue(v1, csw.val1);
|
||||||
|
sourcesConversionTable->importValue(v2, csw.val2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ((csw.func >= CS_FN_VPOS && csw.func <= CS_FN_ANEG) || (csw.func >= CS_FN_EQUAL && csw.func!=CS_FN_TIMER))
|
||||||
|
sourcesConversionTable->importValue(v1, csw.val1);
|
||||||
|
else
|
||||||
|
csw.val1 = v1;
|
||||||
|
csw.val2 = v2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -1361,9 +1360,9 @@ class SwitchesWarningField: public TransformedField {
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CustomFunctionField: public TransformedField {
|
class ArmCustomFunctionField: public TransformedField {
|
||||||
public:
|
public:
|
||||||
CustomFunctionField(FuncSwData & fn, BoardEnum board, unsigned int version, unsigned int variant):
|
ArmCustomFunctionField(FuncSwData & fn, BoardEnum board, unsigned int version, unsigned int variant):
|
||||||
TransformedField(internalField),
|
TransformedField(internalField),
|
||||||
internalField("CustomFunction"),
|
internalField("CustomFunction"),
|
||||||
fn(fn),
|
fn(fn),
|
||||||
|
@ -1371,60 +1370,72 @@ class CustomFunctionField: public TransformedField {
|
||||||
version(version),
|
version(version),
|
||||||
variant(variant),
|
variant(variant),
|
||||||
functionsConversionTable(board, version),
|
functionsConversionTable(board, version),
|
||||||
sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, FLAG_NONONE)),
|
sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, version >= 216 ? 0 : FLAG_NONONE)),
|
||||||
_param(0),
|
_active(0)
|
||||||
_delay(0),
|
|
||||||
_union_param(0)
|
|
||||||
{
|
{
|
||||||
memset(_arm_param, 0, sizeof(_arm_param));
|
memset(_param, 0, sizeof(_param));
|
||||||
|
|
||||||
internalField.Append(new SwitchField<8>(fn.swtch, board, version));
|
internalField.Append(new SwitchField<8>(fn.swtch, board, version));
|
||||||
if (IS_ARM(board)) {
|
|
||||||
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> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function")));
|
||||||
|
|
||||||
if (IS_TARANIS(board))
|
if (IS_TARANIS(board))
|
||||||
internalField.Append(new CharField<10>(_arm_param));
|
internalField.Append(new CharField<10>(_param, false));
|
||||||
else
|
else
|
||||||
internalField.Append(new CharField<6>(_arm_param));
|
internalField.Append(new CharField<6>(_param, false));
|
||||||
if (version >= 214) {
|
|
||||||
|
if (version >= 216) {
|
||||||
|
internalField.Append(new UnsignedField<8>(_active));
|
||||||
|
}
|
||||||
|
else if (version >= 214) {
|
||||||
internalField.Append(new UnsignedField<2>(_mode));
|
internalField.Append(new UnsignedField<2>(_mode));
|
||||||
internalField.Append(new SignedField<6>(_delay));
|
internalField.Append(new UnsignedField<6>(_active));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
internalField.Append(new UnsignedField<8>((unsigned int &)_delay));
|
internalField.Append(new UnsignedField<8>((unsigned int &)_active));
|
||||||
}
|
|
||||||
if (version < 214)
|
|
||||||
internalField.Append(new SpareBitsField<8>());
|
internalField.Append(new SpareBitsField<8>());
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (version >= 213) {
|
|
||||||
internalField.Append(new UnsignedField<3>(_union_param));
|
|
||||||
internalField.Append(new ConversionField< UnsignedField<5> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function")));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
internalField.Append(new ConversionField< UnsignedField<7> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function")));
|
|
||||||
internalField.Append(new BoolField<1>((bool &)fn.enabled));
|
|
||||||
}
|
|
||||||
internalField.Append(new UnsignedField<8>(_param));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void beforeExport()
|
virtual void beforeExport()
|
||||||
{
|
{
|
||||||
if (IS_ARM(board)) {
|
|
||||||
_mode = 0;
|
_mode = 0;
|
||||||
|
|
||||||
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue)
|
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue)
|
||||||
_delay = (version >= 216 ? fn.repeatParam : (fn.repeatParam/5));
|
_active = (version >= 216 ? fn.repeatParam : (fn.repeatParam/5));
|
||||||
else
|
else
|
||||||
_delay = (fn.enabled ? 1 : 0);
|
_active = (fn.enabled ? 1 : 0);
|
||||||
if (fn.func <= FuncInstantTrim) {
|
|
||||||
*((uint32_t *)_arm_param) = fn.param;
|
if (fn.func >= FuncSafetyCh1 && fn.func <= FuncSafetyCh32) {
|
||||||
|
if (version >= 216) {
|
||||||
|
*((uint16_t *)_param) = fn.param;
|
||||||
|
*((uint8_t *)(_param+3)) = fn.func - FuncSafetyCh1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
*((uint32_t *)_param) = fn.param;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (fn.func >= FuncTrainer && fn.func <= FuncTrainerAIL) {
|
||||||
|
if (version >= 216)
|
||||||
|
*((uint8_t *)(_param+3)) = fn.func - FuncTrainer;
|
||||||
}
|
}
|
||||||
else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic) {
|
else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic) {
|
||||||
memcpy(_arm_param, fn.paramarm, sizeof(_arm_param));
|
memcpy(_param, fn.paramarm, sizeof(_param));
|
||||||
}
|
}
|
||||||
else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
|
else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
|
||||||
|
if (version >= 216) {
|
||||||
|
*((uint8_t *)(_param+2)) = fn.adjustMode;
|
||||||
|
*((uint8_t *)(_param+3)) = fn.func - FuncAdjustGV1;
|
||||||
|
unsigned int value;
|
||||||
|
if (fn.adjustMode == 1)
|
||||||
|
sourcesConversionTable->exportValue(fn.param, (int &)value);
|
||||||
|
else if (fn.adjustMode == 2)
|
||||||
|
value = RawSource(fn.param).index;
|
||||||
|
else
|
||||||
|
value = fn.param;
|
||||||
|
*((uint16_t *)_param) = value;
|
||||||
|
}
|
||||||
|
else if (version >= 214) {
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
if (version >= 214) {
|
|
||||||
_mode = fn.adjustMode;
|
_mode = fn.adjustMode;
|
||||||
if (fn.adjustMode == 1)
|
if (fn.adjustMode == 1)
|
||||||
sourcesConversionTable->exportValue(fn.param, (int &)value);
|
sourcesConversionTable->exportValue(fn.param, (int &)value);
|
||||||
|
@ -1432,81 +1443,70 @@ class CustomFunctionField: public TransformedField {
|
||||||
value = RawSource(fn.param).index;
|
value = RawSource(fn.param).index;
|
||||||
else
|
else
|
||||||
value = fn.param;
|
value = fn.param;
|
||||||
|
*((uint32_t *)_param) = value;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
sourcesConversionTable->exportValue(fn.param, (int &)value);
|
sourcesConversionTable->exportValue(fn.param, (int &)value);
|
||||||
|
*((uint32_t *)_param) = value;
|
||||||
}
|
}
|
||||||
*((uint32_t *)_arm_param) = value;
|
|
||||||
}
|
}
|
||||||
else if (fn.func == FuncPlayValue || fn.func == FuncVolume) {
|
else if (fn.func == FuncPlayValue || fn.func == FuncVolume) {
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
sourcesConversionTable->exportValue(fn.param, (int &)value);
|
sourcesConversionTable->exportValue(fn.param, (int &)value);
|
||||||
*((uint32_t *)_arm_param) = value;
|
if (version >= 216)
|
||||||
|
*((uint16_t *)_param) = value;
|
||||||
|
else
|
||||||
|
*((uint32_t *)_param) = value;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*((uint32_t *)_arm_param) = fn.param;
|
*((uint32_t *)_param) = fn.param;
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* the default behavior */
|
|
||||||
_param = fn.param;
|
|
||||||
_union_param = (fn.enabled ? 1 : 0);
|
|
||||||
if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
|
|
||||||
if (version >= 213) {
|
|
||||||
_union_param += (fn.adjustMode << 1);
|
|
||||||
if (fn.adjustMode == 1)
|
|
||||||
sourcesConversionTable->exportValue(fn.param, (int &)_param);
|
|
||||||
else if (fn.adjustMode == 2)
|
|
||||||
_param = RawSource(fn.param).index;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sourcesConversionTable->exportValue(fn.param, (int &)_param);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (fn.func == FuncPlayValue) {
|
|
||||||
if (version >= 213) {
|
|
||||||
_union_param = fn.repeatParam / 10;
|
|
||||||
sourcesConversionTable->exportValue(fn.param, (int &)_param);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SourcesConversionTable::getInstance(board, version, variant, FLAG_NONONE|FLAG_NOSWITCHES)->exportValue(fn.param, (int &)_param);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayBoth) {
|
|
||||||
if (version >= 213)
|
|
||||||
_union_param = fn.repeatParam / 10;
|
|
||||||
}
|
|
||||||
else if (fn.func <= FuncSafetyCh32) {
|
|
||||||
if (version >= 213)
|
|
||||||
_union_param += ((fn.func % 4) << 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void afterImport()
|
virtual void afterImport()
|
||||||
{
|
{
|
||||||
if (IS_ARM(board)) {
|
|
||||||
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue)
|
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue)
|
||||||
fn.repeatParam = (version >= 216 ? _delay : (_delay*5));
|
fn.repeatParam = (version >= 216 ? _active : (_active*5));
|
||||||
else
|
else
|
||||||
fn.enabled = (_delay & 0x01);
|
fn.enabled = (_active & 0x01);
|
||||||
|
|
||||||
unsigned int value = *((uint32_t *)_arm_param);
|
unsigned int value=0, mode=0, index=0;
|
||||||
if (fn.func <= FuncTrainer) {
|
if (version >= 216) {
|
||||||
|
value = *((uint16_t *)_param);
|
||||||
|
mode = *((uint8_t *)(_param+2));
|
||||||
|
index = *((uint8_t *)(_param+3));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
value = *((uint32_t *)_param);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fn.func >= FuncSafetyCh1 && fn.func <= FuncSafetyCh32) {
|
||||||
|
fn.func = AssignFunc(fn.func + index);
|
||||||
fn.param = (int)value;
|
fn.param = (int)value;
|
||||||
}
|
}
|
||||||
else if (fn.func <= FuncInstantTrim) {
|
else if (fn.func >= FuncTrainer && fn.func <= FuncTrainerAIL) {
|
||||||
fn.param = value;
|
fn.func = AssignFunc(fn.func + index);
|
||||||
|
fn.param = (int)value;
|
||||||
}
|
}
|
||||||
else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic) {
|
else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic) {
|
||||||
memcpy(fn.paramarm, _arm_param, sizeof(fn.paramarm));
|
memcpy(fn.paramarm, _param, sizeof(fn.paramarm));
|
||||||
}
|
}
|
||||||
else if (fn.func == FuncVolume) {
|
else if (fn.func == FuncVolume) {
|
||||||
sourcesConversionTable->importValue(value, (int &)fn.param);
|
sourcesConversionTable->importValue(value, (int &)fn.param);
|
||||||
}
|
}
|
||||||
else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
|
else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
|
||||||
if (version >= 214) {
|
if (version >= 216) {
|
||||||
|
fn.func = AssignFunc(fn.func + index);
|
||||||
|
fn.adjustMode = mode;
|
||||||
|
if (fn.adjustMode == 1)
|
||||||
|
sourcesConversionTable->importValue(value, (int &)fn.param);
|
||||||
|
else if (fn.adjustMode == 2)
|
||||||
|
fn.param = RawSource(SOURCE_TYPE_GVAR, value).toValue();
|
||||||
|
else
|
||||||
|
fn.param = value;
|
||||||
|
}
|
||||||
|
else if (version >= 214) {
|
||||||
fn.adjustMode = _mode;
|
fn.adjustMode = _mode;
|
||||||
if (fn.adjustMode == 1)
|
if (fn.adjustMode == 1)
|
||||||
sourcesConversionTable->importValue(value, (int &)fn.param);
|
sourcesConversionTable->importValue(value, (int &)fn.param);
|
||||||
|
@ -1529,14 +1529,137 @@ class CustomFunctionField: public TransformedField {
|
||||||
fn.param = value;
|
fn.param = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
StructField internalField;
|
||||||
|
FuncSwData & fn;
|
||||||
|
BoardEnum board;
|
||||||
|
unsigned int version;
|
||||||
|
unsigned int variant;
|
||||||
|
CustomFunctionsConversionTable functionsConversionTable;
|
||||||
|
SourcesConversionTable * sourcesConversionTable;
|
||||||
|
char _param[10];
|
||||||
|
unsigned int _active;
|
||||||
|
unsigned int _mode;
|
||||||
|
};
|
||||||
|
|
||||||
|
class AvrCustomFunctionField: public TransformedField {
|
||||||
|
public:
|
||||||
|
AvrCustomFunctionField(FuncSwData & fn, BoardEnum board, unsigned int version, unsigned int variant):
|
||||||
|
TransformedField(internalField),
|
||||||
|
internalField("CustomFunction"),
|
||||||
|
fn(fn),
|
||||||
|
board(board),
|
||||||
|
version(version),
|
||||||
|
variant(variant),
|
||||||
|
functionsConversionTable(board, version),
|
||||||
|
sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, version >= 216 ? 0 : FLAG_NONONE)),
|
||||||
|
_param(0),
|
||||||
|
_union_param(0),
|
||||||
|
_active(0)
|
||||||
|
{
|
||||||
|
if (version >= 216) {
|
||||||
|
internalField.Append(new SwitchField<6>(fn.swtch, board, version));
|
||||||
|
internalField.Append(new ConversionField< UnsignedField<4> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function")));
|
||||||
|
internalField.Append(new UnsignedField<5>(_union_param));
|
||||||
|
internalField.Append(new UnsignedField<1>(_active));
|
||||||
|
}
|
||||||
|
if (version >= 213) {
|
||||||
|
internalField.Append(new SwitchField<8>(fn.swtch, board, version));
|
||||||
|
internalField.Append(new UnsignedField<3>(_union_param));
|
||||||
|
internalField.Append(new ConversionField< UnsignedField<5> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function")));
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
|
internalField.Append(new SwitchField<8>(fn.swtch, board, version));
|
||||||
|
internalField.Append(new ConversionField< UnsignedField<7> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function")));
|
||||||
|
internalField.Append(new BoolField<1>((bool &)fn.enabled));
|
||||||
|
}
|
||||||
|
internalField.Append(new UnsignedField<8>(_param));
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void beforeExport()
|
||||||
|
{
|
||||||
|
_param = fn.param;
|
||||||
|
_active = (fn.enabled ? 1 : 0);
|
||||||
|
|
||||||
|
if (fn.func >= FuncSafetyCh1 && fn.func <= FuncSafetyCh32) {
|
||||||
|
if (version >= 216)
|
||||||
|
_union_param = fn.func - FuncSafetyCh1;
|
||||||
|
else if (version >= 213)
|
||||||
|
_active += ((fn.func % 4) << 1);
|
||||||
|
}
|
||||||
|
else if (fn.func >= FuncTrainer && fn.func <= FuncTrainerAIL) {
|
||||||
|
if (version >= 216)
|
||||||
|
_union_param = fn.func - FuncTrainer;
|
||||||
|
}
|
||||||
|
else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
|
||||||
|
if (version >= 216) {
|
||||||
|
_union_param = fn.adjustMode;
|
||||||
|
_union_param += (fn.func - FuncAdjustGV1) << 2;
|
||||||
|
if (fn.adjustMode == 1)
|
||||||
|
sourcesConversionTable->exportValue(fn.param, (int &)_param);
|
||||||
|
else if (fn.adjustMode == 2)
|
||||||
|
_param = RawSource(fn.param).index;
|
||||||
|
}
|
||||||
|
else if (version >= 213) {
|
||||||
|
_active += (fn.adjustMode << 1);
|
||||||
|
if (fn.adjustMode == 1)
|
||||||
|
sourcesConversionTable->exportValue(fn.param, (int &)_param);
|
||||||
|
else if (fn.adjustMode == 2)
|
||||||
|
_param = RawSource(fn.param).index;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sourcesConversionTable->exportValue(fn.param, (int &)_param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (fn.func == FuncPlayValue) {
|
||||||
|
if (version >= 216) {
|
||||||
|
_union_param = fn.repeatParam / 10;
|
||||||
|
sourcesConversionTable->exportValue(fn.param, (int &)_param);
|
||||||
|
}
|
||||||
|
else if (version >= 213) {
|
||||||
|
_active = fn.repeatParam / 10;
|
||||||
|
sourcesConversionTable->exportValue(fn.param, (int &)_param);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SourcesConversionTable::getInstance(board, version, variant, FLAG_NONONE|FLAG_NOSWITCHES)->exportValue(fn.param, (int &)_param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayBoth) {
|
||||||
|
if (version >= 216) {
|
||||||
|
_union_param = fn.repeatParam / 10;
|
||||||
|
}
|
||||||
|
else if (version >= 213) {
|
||||||
|
_active = fn.repeatParam / 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void afterImport()
|
||||||
|
{
|
||||||
fn.param = _param;
|
fn.param = _param;
|
||||||
if (version >= 213) {
|
if (version >= 213) {
|
||||||
fn.enabled = (_union_param & 0x01);
|
fn.enabled = (_active & 0x01);
|
||||||
}
|
}
|
||||||
if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
|
|
||||||
if (version >= 213) {
|
if (fn.func >= FuncSafetyCh1 && fn.func <= FuncSafetyCh32) {
|
||||||
fn.adjustMode = ((_union_param >> 1) & 0x03);
|
if (version >= 216)
|
||||||
|
fn.func = AssignFunc(fn.func + _union_param);
|
||||||
|
else if (version >= 213)
|
||||||
|
fn.func = AssignFunc(((fn.func >> 2) << 2) + ((_active >> 1) & 0x03));
|
||||||
|
fn.param = (int8_t)fn.param;
|
||||||
|
}
|
||||||
|
else if (fn.func >= FuncTrainer && fn.func <= FuncTrainerAIL) {
|
||||||
|
if (version >= 216)
|
||||||
|
fn.func = AssignFunc(fn.func + _union_param);
|
||||||
|
}
|
||||||
|
else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
|
||||||
|
if (version >= 216) {
|
||||||
|
fn.func = AssignFunc(fn.func + (_union_param >> 2));
|
||||||
|
fn.adjustMode = (_union_param & 0x03);
|
||||||
|
}
|
||||||
|
else if (version >= 213) {
|
||||||
|
fn.adjustMode = ((_active >> 1) & 0x03);
|
||||||
if (fn.adjustMode == 1)
|
if (fn.adjustMode == 1)
|
||||||
sourcesConversionTable->importValue(_param, (int &)fn.param);
|
sourcesConversionTable->importValue(_param, (int &)fn.param);
|
||||||
else if (fn.adjustMode == 2)
|
else if (fn.adjustMode == 2)
|
||||||
|
@ -1547,24 +1670,23 @@ class CustomFunctionField: public TransformedField {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fn.func == FuncPlayValue) {
|
else if (fn.func == FuncPlayValue) {
|
||||||
if (version >= 213) {
|
if (version >= 216) {
|
||||||
fn.repeatParam = _union_param * 10;
|
fn.repeatParam = _union_param * 10;
|
||||||
sourcesConversionTable->importValue(_param, (int &)fn.param);
|
sourcesConversionTable->importValue(_param, (int &)fn.param);
|
||||||
}
|
}
|
||||||
|
else if (version >= 213) {
|
||||||
|
fn.repeatParam = _active * 10;
|
||||||
|
sourcesConversionTable->importValue(_param, (int &)fn.param);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
SourcesConversionTable::getInstance(board, version, variant, FLAG_NONONE|FLAG_NOSWITCHES)->importValue(_param, (int &)fn.param);
|
SourcesConversionTable::getInstance(board, version, variant, FLAG_NONONE|FLAG_NOSWITCHES)->importValue(_param, (int &)fn.param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayBoth) {
|
else if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayBoth) {
|
||||||
if (version >= 213)
|
if (version >= 216)
|
||||||
fn.repeatParam = _union_param * 10;
|
fn.repeatParam = _union_param * 10;
|
||||||
}
|
else if (version >= 213)
|
||||||
else if (fn.func <= FuncSafetyCh32) {
|
fn.repeatParam = _active * 10;
|
||||||
if (version >= 213) {
|
|
||||||
fn.func = AssignFunc(((fn.func >> 2) << 2) + ((_union_param >> 1) & 0x03));
|
|
||||||
}
|
|
||||||
fn.param = (int8_t)fn.param;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1576,11 +1698,10 @@ class CustomFunctionField: public TransformedField {
|
||||||
unsigned int variant;
|
unsigned int variant;
|
||||||
CustomFunctionsConversionTable functionsConversionTable;
|
CustomFunctionsConversionTable functionsConversionTable;
|
||||||
SourcesConversionTable * sourcesConversionTable;
|
SourcesConversionTable * sourcesConversionTable;
|
||||||
char _arm_param[10];
|
|
||||||
unsigned int _param;
|
unsigned int _param;
|
||||||
int _delay;
|
|
||||||
unsigned int _mode;
|
unsigned int _mode;
|
||||||
unsigned int _union_param;
|
unsigned int _union_param;
|
||||||
|
unsigned int _active;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FrskyScreenField: public DataField {
|
class FrskyScreenField: public DataField {
|
||||||
|
@ -1933,8 +2054,12 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
||||||
internalField.Append(new CurvesField(modelData.curves, board, version));
|
internalField.Append(new CurvesField(modelData.curves, board, version));
|
||||||
for (int i=0; i<MAX_CUSTOM_SWITCHES(board, version); i++)
|
for (int i=0; i<MAX_CUSTOM_SWITCHES(board, version); i++)
|
||||||
internalField.Append(new CustomSwitchField(modelData.customSw[i], board, version, variant));
|
internalField.Append(new CustomSwitchField(modelData.customSw[i], board, version, variant));
|
||||||
for (int i=0; i<MAX_CUSTOM_FUNCTIONS(board, version); i++)
|
for (int i=0; i<MAX_CUSTOM_FUNCTIONS(board, version); i++) {
|
||||||
internalField.Append(new CustomFunctionField(modelData.funcSw[i], board, version, variant));
|
if (IS_ARM(board))
|
||||||
|
internalField.Append(new ArmCustomFunctionField(modelData.funcSw[i], board, version, variant));
|
||||||
|
else
|
||||||
|
internalField.Append(new AvrCustomFunctionField(modelData.funcSw[i], board, version, variant));
|
||||||
|
}
|
||||||
internalField.Append(new HeliField(modelData.swashRingData, board, version, variant));
|
internalField.Append(new HeliField(modelData.swashRingData, board, version, variant));
|
||||||
for (int i=0; i<MAX_PHASES(board, version); i++)
|
for (int i=0; i<MAX_PHASES(board, version); i++)
|
||||||
internalField.Append(new PhaseField(modelData.phaseData[i], i, board, version));
|
internalField.Append(new PhaseField(modelData.phaseData[i], i, board, version));
|
||||||
|
|
|
@ -117,165 +117,6 @@ void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last=fal
|
||||||
b->setMaxVisibleItems(10);
|
b->setMaxVisibleItems(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getRepeatString(unsigned int val)
|
|
||||||
{
|
|
||||||
if (val==0) {
|
|
||||||
return QObject::tr("No repeat");
|
|
||||||
} else {
|
|
||||||
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 5 : 10;
|
|
||||||
return QObject::tr("%1 sec").arg(step*val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString getFuncName(unsigned int val)
|
|
||||||
{
|
|
||||||
if (val < C9X_NUM_CHNOUT) {
|
|
||||||
return QObject::tr("Safety %1").arg(RawSource(SOURCE_TYPE_CH, val).toString());
|
|
||||||
}
|
|
||||||
else if (val == FuncTrainer)
|
|
||||||
return QObject::tr("Trainer");
|
|
||||||
else if (val == FuncTrainerRUD)
|
|
||||||
return QObject::tr("Trainer RUD");
|
|
||||||
else if (val == FuncTrainerELE)
|
|
||||||
return QObject::tr("Trainer ELE");
|
|
||||||
else if (val == FuncTrainerTHR)
|
|
||||||
return QObject::tr("Trainer THR");
|
|
||||||
else if (val == FuncTrainerAIL)
|
|
||||||
return QObject::tr("Trainer AIL");
|
|
||||||
else if (val == FuncInstantTrim)
|
|
||||||
return QObject::tr("Instant Trim");
|
|
||||||
else if (val == FuncPlaySound)
|
|
||||||
return QObject::tr("Play Sound");
|
|
||||||
else if (val == FuncPlayHaptic)
|
|
||||||
return QObject::tr("Play Haptic");
|
|
||||||
else if (val == FuncReset)
|
|
||||||
return QObject::tr("Reset");
|
|
||||||
else if (val == FuncVario)
|
|
||||||
return QObject::tr("Vario");
|
|
||||||
else if (val == FuncPlayPrompt)
|
|
||||||
return QObject::tr("Play Track");
|
|
||||||
else if (val == FuncPlayBoth)
|
|
||||||
return QObject::tr("Play Both");
|
|
||||||
else if (val == FuncPlayValue)
|
|
||||||
return QObject::tr("Play Value");
|
|
||||||
else if (val == FuncLogs)
|
|
||||||
return QObject::tr("Start Logs");
|
|
||||||
else if (val == FuncVolume)
|
|
||||||
return QObject::tr("Volume");
|
|
||||||
else if (val == FuncBacklight)
|
|
||||||
return QObject::tr("Backlight");
|
|
||||||
else if (val == FuncBackgroundMusic)
|
|
||||||
return QObject::tr("Background Music");
|
|
||||||
else if (val == FuncBackgroundMusicPause)
|
|
||||||
return QObject::tr("Background Music Pause");
|
|
||||||
else if (val >= FuncAdjustGV1 && val <= FuncAdjustGVLast)
|
|
||||||
return QObject::tr("Adjust GV%1").arg(val-FuncAdjustGV1+1);
|
|
||||||
else {
|
|
||||||
return QString("???"); // Highlight unknown functions with output of question marks.(BTW should not happen that we do not know what a function is)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO should be a toString() method in CustoSwData ...
|
|
||||||
QString getCustomSwitchStr(CustomSwData * customSw, const ModelData & model)
|
|
||||||
{
|
|
||||||
QString result = "";
|
|
||||||
|
|
||||||
if (!customSw->func)
|
|
||||||
return result;
|
|
||||||
if (customSw->andsw!=0) {
|
|
||||||
result +="( ";
|
|
||||||
}
|
|
||||||
switch (getCSFunctionFamily(customSw->func)) {
|
|
||||||
case CS_FAMILY_TIMERS:
|
|
||||||
result = QString("TIM(%1 , %2)").arg(ValToTim(customSw->val1)).arg(ValToTim(customSw->val2));
|
|
||||||
break;
|
|
||||||
case CS_FAMILY_VOFS: {
|
|
||||||
RawSource source = RawSource(customSw->val1, &model);
|
|
||||||
RawSourceRange range = source.getRange();
|
|
||||||
if (customSw->val1)
|
|
||||||
result += source.toString();
|
|
||||||
else
|
|
||||||
result += "0";
|
|
||||||
result.remove(" ");
|
|
||||||
if (customSw->func == CS_FN_APOS || customSw->func == CS_FN_ANEG)
|
|
||||||
result = "|" + result + "|";
|
|
||||||
else if (customSw->func == CS_FN_DAPOS)
|
|
||||||
result = "|d(" + result + ")|";
|
|
||||||
else if (customSw->func == CS_FN_DPOS) result = "d(" + result + ")";
|
|
||||||
if (customSw->func == CS_FN_APOS || customSw->func == CS_FN_VPOS || customSw->func == CS_FN_DAPOS || customSw->func == CS_FN_DPOS)
|
|
||||||
result += " > ";
|
|
||||||
else if (customSw->func == CS_FN_ANEG || customSw->func == CS_FN_VNEG)
|
|
||||||
result += " < ";
|
|
||||||
result += QString::number(range.step * (customSw->val2 /*TODO+ source.getRawOffset(model)*/) + range.offset);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CS_FAMILY_VBOOL:
|
|
||||||
result = RawSwitch(customSw->val1).toString();
|
|
||||||
switch (customSw->func) {
|
|
||||||
case CS_FN_AND:
|
|
||||||
result += " AND ";
|
|
||||||
break;
|
|
||||||
case CS_FN_OR:
|
|
||||||
result += " OR ";
|
|
||||||
break;
|
|
||||||
case CS_FN_XOR:
|
|
||||||
result += " XOR ";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
result += RawSwitch(customSw->val2).toString();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CS_FAMILY_VCOMP:
|
|
||||||
if (customSw->val1)
|
|
||||||
result += RawSource(customSw->val1).toString();
|
|
||||||
else
|
|
||||||
result += "0";
|
|
||||||
switch (customSw->func) {
|
|
||||||
case CS_FN_EQUAL:
|
|
||||||
result += " = ";
|
|
||||||
break;
|
|
||||||
case CS_FN_NEQUAL:
|
|
||||||
result += " != ";
|
|
||||||
break;
|
|
||||||
case CS_FN_GREATER:
|
|
||||||
result += " > ";
|
|
||||||
break;
|
|
||||||
case CS_FN_LESS:
|
|
||||||
result += " < ";
|
|
||||||
break;
|
|
||||||
case CS_FN_EGREATER:
|
|
||||||
result += " >= ";
|
|
||||||
break;
|
|
||||||
case CS_FN_ELESS:
|
|
||||||
result += " <= ";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (customSw->val2)
|
|
||||||
result += RawSource(customSw->val2).toString();
|
|
||||||
else
|
|
||||||
result += "0";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (customSw->andsw!=0) {
|
|
||||||
result +=" ) AND ";
|
|
||||||
result += RawSwitch(customSw->andsw).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
|
|
||||||
if (customSw->delay)
|
|
||||||
result += QObject::tr(" Delay %1 sec").arg(customSw->delay/2.0);
|
|
||||||
if (customSw->duration)
|
|
||||||
result += QObject::tr(" Duration %1 sec").arg(customSw->duration/2.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString getProtocolStr(const int proto)
|
QString getProtocolStr(const int proto)
|
||||||
{
|
{
|
||||||
static const char *strings[] = { "OFF",
|
static const char *strings[] = { "OFF",
|
||||||
|
@ -567,17 +408,6 @@ QString getTimerMode(int tm) {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tma >= TMRMODE_FIRST_MOMENT_SWITCH && tma < TMRMODE_FIRST_MOMENT_SWITCH + GetEepromInterface()->getCapability(SwitchesPositions)) {
|
|
||||||
s = RawSwitch(SWITCH_TYPE_SWITCH, tma - TMRMODE_FIRST_MOMENT_SWITCH + 1).toString()+"t";
|
|
||||||
if (tm < 0) s.prepend("!");
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tma >= TMRMODE_FIRST_MOMENT_SWITCH + GetEepromInterface()->getCapability(SwitchesPositions) && tma < TMRMODE_FIRST_MOMENT_SWITCH + GetEepromInterface()->getCapability(SwitchesPositions) + GetEepromInterface()->getCapability(CustomSwitches)) {
|
|
||||||
s = RawSwitch(SWITCH_TYPE_VIRTUAL, tma - TMRMODE_FIRST_MOMENT_SWITCH - GetEepromInterface()->getCapability(SwitchesPositions) + 1).toString()+"t";
|
|
||||||
if (tm < 0) s.prepend("!");
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
if (tma >=TMRMODE_FIRST_CHPERC && tma <TMRMODE_FIRST_CHPERC+16) {
|
if (tma >=TMRMODE_FIRST_CHPERC && tma <TMRMODE_FIRST_CHPERC+16) {
|
||||||
s = QString("CH%1%").arg(tma-TMRMODE_FIRST_CHPERC+1);
|
s = QString("CH%1%").arg(tma-TMRMODE_FIRST_CHPERC+1);
|
||||||
return s;
|
return s;
|
||||||
|
@ -585,30 +415,6 @@ QString getTimerMode(int tm) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getTimerModeB(int tm) {
|
|
||||||
|
|
||||||
QString stt = "---THRRUDELEIDOID1ID2AILGEATRN";
|
|
||||||
|
|
||||||
QString s;
|
|
||||||
int tma = abs(tm);
|
|
||||||
if (tma>33) {
|
|
||||||
tma-=32;
|
|
||||||
}
|
|
||||||
if (tma < 10) {
|
|
||||||
s=stt.mid(abs(tma)*3, 3);
|
|
||||||
} else if (tma <19) {
|
|
||||||
s=QString("SW%1").arg(tma-9);
|
|
||||||
} else {
|
|
||||||
s=QString("SW")+QChar('A'+tma-19);
|
|
||||||
}
|
|
||||||
if (tm<0) {
|
|
||||||
s.prepend("!");
|
|
||||||
} else if (tm>33) {
|
|
||||||
s.append("m");
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
void populateBacklightCB(QComboBox *b, const uint8_t value)
|
void populateBacklightCB(QComboBox *b, const uint8_t value)
|
||||||
{
|
{
|
||||||
QString strings[] = { QObject::tr("OFF"), QObject::tr("Keys"), QObject::tr("Sticks"), QObject::tr("Keys + Sticks"), QObject::tr("ON"), NULL };
|
QString strings[] = { QObject::tr("OFF"), QObject::tr("Keys"), QObject::tr("Sticks"), QObject::tr("Keys + Sticks"), QObject::tr("ON"), NULL };
|
||||||
|
@ -720,15 +526,6 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr,
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// TODO One ?
|
|
||||||
if (attr & POPULATE_ONOFF) {
|
|
||||||
item = RawSwitch(SWITCH_TYPE_ONM);
|
|
||||||
b->addItem(item.toString(), item.toValue());
|
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
b->setMaxVisibleItems(10);
|
b->setMaxVisibleItems(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -878,35 +675,6 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
|
||||||
b->setMaxVisibleItems(10);
|
b->setMaxVisibleItems(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CSWITCH_STR "---- a~x a>x a<x |a|>x |a|<x AND OR XOR a=b a!=b a>b a<b a>=b a<=b d>=x |d|>=xTIM "
|
|
||||||
#define CSW_NUM_FUNC 18 // TODO enum
|
|
||||||
#define CSW_LEN_FUNC 6
|
|
||||||
int csw_values[]={
|
|
||||||
CS_FN_OFF,
|
|
||||||
CS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
|
||||||
CS_FN_VPOS,
|
|
||||||
CS_FN_VNEG,
|
|
||||||
CS_FN_APOS,
|
|
||||||
CS_FN_ANEG,
|
|
||||||
CS_FN_AND,
|
|
||||||
CS_FN_OR,
|
|
||||||
CS_FN_XOR,
|
|
||||||
CS_FN_EQUAL,
|
|
||||||
CS_FN_NEQUAL,
|
|
||||||
CS_FN_GREATER,
|
|
||||||
CS_FN_LESS,
|
|
||||||
CS_FN_EGREATER,
|
|
||||||
CS_FN_ELESS,
|
|
||||||
CS_FN_DPOS,
|
|
||||||
CS_FN_DAPOS,
|
|
||||||
CS_FN_TIM
|
|
||||||
};
|
|
||||||
|
|
||||||
QString getCSWFunc(int val)
|
|
||||||
{
|
|
||||||
return QString(CSWITCH_STR).mid(val*CSW_LEN_FUNC, CSW_LEN_FUNC);
|
|
||||||
}
|
|
||||||
|
|
||||||
float ValToTim(int value)
|
float ValToTim(int value)
|
||||||
{
|
{
|
||||||
return ((value < -109 ? 129+value : (value < 7 ? (113+value)*5 : (53+value)*10))/10.0);
|
return ((value < -109 ? 129+value : (value < 7 ? (113+value)*5 : (53+value)*10))/10.0);
|
||||||
|
@ -927,14 +695,37 @@ int TimToVal(float value)
|
||||||
|
|
||||||
void populateCSWCB(QComboBox *b, int value)
|
void populateCSWCB(QComboBox *b, int value)
|
||||||
{
|
{
|
||||||
|
int order[] = {
|
||||||
|
CS_FN_OFF,
|
||||||
|
CS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
||||||
|
CS_FN_VPOS,
|
||||||
|
CS_FN_VNEG,
|
||||||
|
CS_FN_APOS,
|
||||||
|
CS_FN_ANEG,
|
||||||
|
CS_FN_AND,
|
||||||
|
CS_FN_OR,
|
||||||
|
CS_FN_XOR,
|
||||||
|
CS_FN_EQUAL,
|
||||||
|
CS_FN_NEQUAL,
|
||||||
|
CS_FN_GREATER,
|
||||||
|
CS_FN_LESS,
|
||||||
|
CS_FN_EGREATER,
|
||||||
|
CS_FN_ELESS,
|
||||||
|
CS_FN_DPOS,
|
||||||
|
CS_FN_DAPOS,
|
||||||
|
CS_FN_TIMER,
|
||||||
|
CS_FN_STICKY
|
||||||
|
};
|
||||||
|
|
||||||
b->clear();
|
b->clear();
|
||||||
for (int i = 0; i < CSW_NUM_FUNC; i++) {
|
for (int i=0; i<CS_FN_MAX; i++) {
|
||||||
b->addItem(getCSWFunc(i),csw_values[i]);
|
int func = order[i];
|
||||||
if (i>GetEepromInterface()->getCapability(CSFunc)) {
|
b->addItem(CustomSwData(func).funcToString(), func);
|
||||||
QModelIndex index = b->model()->index(i, 0);
|
// if (i>GetEepromInterface()->getCapability(CSFunc)) {
|
||||||
QVariant v(0);
|
// QModelIndex index = b->model()->index(i, 0);
|
||||||
}
|
// QVariant v(0);
|
||||||
if (value == csw_values[i]) {
|
// }
|
||||||
|
if (value == func) {
|
||||||
b->setCurrentIndex(b->count()-1);
|
b->setCurrentIndex(b->count()-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1143,13 +934,6 @@ QString getPhasesStr(unsigned int phases, ModelData & model)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float c9xexpou(float point, float coeff)
|
|
||||||
{
|
|
||||||
float x=point*1024.0/100.0;
|
|
||||||
float k=coeff*256.0/100.0;
|
|
||||||
return ((k*x*x*x/(1024*1024) + x*(256-k) + 128) / 256)/1024.0*100;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString getCenterBeep(ModelData * g_model)
|
QString getCenterBeep(ModelData * g_model)
|
||||||
{
|
{
|
||||||
//RETA123
|
//RETA123
|
||||||
|
|
|
@ -87,7 +87,6 @@ void populateTrimUseCB(QComboBox *b, unsigned int phase);
|
||||||
void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
||||||
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last, int hubproto);
|
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last, int hubproto);
|
||||||
void populateTimerSwitchCB(QComboBox *b, int value);
|
void populateTimerSwitchCB(QComboBox *b, int value);
|
||||||
QString getCustomSwitchStr(CustomSwData * customSw, const ModelData & model);
|
|
||||||
QString getProtocolStr(const int proto);
|
QString getProtocolStr(const int proto);
|
||||||
QString getPhasesStr(unsigned int phases, ModelData & model);
|
QString getPhasesStr(unsigned int phases, ModelData & model);
|
||||||
|
|
||||||
|
@ -107,12 +106,8 @@ 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);
|
||||||
void populateCSWCB(QComboBox *b, int value);
|
void populateCSWCB(QComboBox *b, int value);
|
||||||
QString getTimerMode(int tm);
|
QString getTimerMode(int tm);
|
||||||
QString getTimerModeB(int tm);
|
|
||||||
QString getPhaseName(int val, char * phasename=NULL);
|
QString getPhaseName(int val, char * phasename=NULL);
|
||||||
QString getInputStr(ModelData & model, int index);
|
QString getInputStr(ModelData & model, int index);
|
||||||
QString getCSWFunc(int val);
|
|
||||||
QString getFuncName(unsigned int val);
|
|
||||||
QString getRepeatString(unsigned int val);
|
|
||||||
QString getSignedStr(int value);
|
QString getSignedStr(int value);
|
||||||
QString getGVarString(int16_t val, bool sign=false);
|
QString getGVarString(int16_t val, bool sign=false);
|
||||||
QString image2qstring(QImage image);
|
QString image2qstring(QImage image);
|
||||||
|
@ -132,7 +127,6 @@ QString getFrSkyProtocol(int protocol);
|
||||||
QString getFrSkyMeasure(int units);
|
QString getFrSkyMeasure(int units);
|
||||||
QString getFrSkySrc(int index);
|
QString getFrSkySrc(int index);
|
||||||
|
|
||||||
float c9xexpou(float point, float coeff);
|
|
||||||
float ValToTim(int value);
|
float ValToTim(int value);
|
||||||
int TimToVal(float value);
|
int TimToVal(float value);
|
||||||
|
|
||||||
|
|
|
@ -495,6 +495,13 @@ void ModelEdit::on_ca_ctype_CB_currentIndexChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float c9xexpou(float point, float coeff)
|
||||||
|
{
|
||||||
|
float x=point*1024.0/100.0;
|
||||||
|
float k=coeff*256.0/100.0;
|
||||||
|
return ((k*x*x*x/(1024*1024) + x*(256-k) + 128) / 256)/1024.0*100;
|
||||||
|
}
|
||||||
|
|
||||||
void ModelEdit::on_ca_apply_PB_clicked()
|
void ModelEdit::on_ca_apply_PB_clicked()
|
||||||
{
|
{
|
||||||
int index=ui->ca_ctype_CB->currentIndex();
|
int index=ui->ca_ctype_CB->currentIndex();
|
||||||
|
|
|
@ -513,7 +513,7 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
|
||||||
{
|
{
|
||||||
b->clear();
|
b->clear();
|
||||||
for (unsigned int i=0; i<FuncCount; i++) {
|
for (unsigned int i=0; i<FuncCount; i++) {
|
||||||
b->addItem(getFuncName(i));
|
b->addItem(FuncSwData(AssignFunc(i)).funcToString());
|
||||||
if (!GetEepromInterface()->getCapability(HasVolume)) {
|
if (!GetEepromInterface()->getCapability(HasVolume)) {
|
||||||
if (i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) {
|
if (i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) {
|
||||||
QModelIndex index = b->model()->index(i, 0);
|
QModelIndex index = b->model()->index(i, 0);
|
||||||
|
|
|
@ -78,7 +78,7 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||||
// AND
|
// AND
|
||||||
cswitchAnd[i] = new QComboBox(this);
|
cswitchAnd[i] = new QComboBox(this);
|
||||||
cswitchAnd[i]->setProperty("index", i);
|
cswitchAnd[i]->setProperty("index", i);
|
||||||
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
|
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int)));
|
||||||
gridLayout->addWidget(cswitchAnd[i], i+1, 4);
|
gridLayout->addWidget(cswitchAnd[i], i+1, 4);
|
||||||
cswitchAnd[i]->setVisible(false);
|
cswitchAnd[i]->setVisible(false);
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||||
cswitchDuration[i]->setMinimum(0);
|
cswitchDuration[i]->setMinimum(0);
|
||||||
cswitchDuration[i]->setAccelerated(true);
|
cswitchDuration[i]->setAccelerated(true);
|
||||||
cswitchDuration[i]->setDecimals(1);
|
cswitchDuration[i]->setDecimals(1);
|
||||||
connect(cswitchDuration[i],SIGNAL(editingFinished()), this, SLOT(edited()));
|
connect(cswitchDuration[i], SIGNAL(valueChanged(double)), this, SLOT(durationEdited(double)));
|
||||||
gridLayout->addWidget(cswitchDuration[i], i+1, 5);
|
gridLayout->addWidget(cswitchDuration[i], i+1, 5);
|
||||||
cswitchDuration[i]->setVisible(false);
|
cswitchDuration[i]->setVisible(false);
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||||
cswitchDelay[i]->setMinimum(0);
|
cswitchDelay[i]->setMinimum(0);
|
||||||
cswitchDelay[i]->setAccelerated(true);
|
cswitchDelay[i]->setAccelerated(true);
|
||||||
cswitchDelay[i]->setDecimals(1);
|
cswitchDelay[i]->setDecimals(1);
|
||||||
connect(cswitchDelay[i], SIGNAL(editingFinished()), this, SLOT(edited()));
|
connect(cswitchDelay[i], SIGNAL(valueChanged(double)), this, SLOT(delayEdited(double)));
|
||||||
gridLayout->addWidget(cswitchDelay[i], i+1, 6);
|
gridLayout->addWidget(cswitchDelay[i], i+1, 6);
|
||||||
cswitchDelay[i]->setVisible(false);
|
cswitchDelay[i]->setVisible(false);
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,27 @@ CustomSwitchesPanel::~CustomSwitchesPanel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CustomSwitchesPanel::durationEdited(double duration)
|
||||||
|
{
|
||||||
|
int index = sender()->property("index").toInt();
|
||||||
|
model.customSw[index].duration = (uint8_t)round(duration*2);
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomSwitchesPanel::delayEdited(double delay)
|
||||||
|
{
|
||||||
|
int index = sender()->property("index").toInt();
|
||||||
|
model.customSw[index].delay = (uint8_t)round(delay*2);
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomSwitchesPanel::andEdited(int value)
|
||||||
|
{
|
||||||
|
int index = sender()->property("index").toInt();
|
||||||
|
model.customSw[index].andsw = cswitchAnd[index]->itemData(value).toInt();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::edited()
|
void CustomSwitchesPanel::edited()
|
||||||
{
|
{
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
|
@ -124,27 +145,25 @@ void CustomSwitchesPanel::edited()
|
||||||
bool chAr;
|
bool chAr;
|
||||||
float value, step;
|
float value, step;
|
||||||
int newval;
|
int newval;
|
||||||
chAr = (getCSFunctionFamily(model.customSw[i].func) != getCSFunctionFamily(csw[i]->itemData(csw[i]->currentIndex()).toInt()));
|
chAr = (model.customSw[i].getFunctionFamily() != CustomSwData(csw[i]->itemData(csw[i]->currentIndex()).toInt()).getFunctionFamily());
|
||||||
model.customSw[i].func = csw[i]->itemData(csw[i]->currentIndex()).toInt();
|
model.customSw[i].func = csw[i]->itemData(csw[i]->currentIndex()).toInt();
|
||||||
if(chAr) {
|
if(chAr) {
|
||||||
if (getCSFunctionFamily(model.customSw[i].func)==CS_FAMILY_TIMERS) {
|
if (model.customSw[i].getFunctionFamily() == CS_FAMILY_TIMER) {
|
||||||
model.customSw[i].val1 = -119;
|
model.customSw[i].val1 = -119;
|
||||||
model.customSw[i].val2 = -119;
|
model.customSw[i].val2 = -119;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
model.customSw[i].val1 = 0;
|
model.customSw[i].val1 = 0;
|
||||||
model.customSw[i].val2 = 0;
|
model.customSw[i].val2 = 0;
|
||||||
}
|
}
|
||||||
model.customSw[i].andsw = 0;
|
model.customSw[i].andsw = 0;
|
||||||
setSwitchWidgetVisibility(i);
|
setSwitchWidgetVisibility(i);
|
||||||
}
|
}
|
||||||
if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
|
|
||||||
model.customSw[i].duration= (uint8_t)round(cswitchDuration[i]->value()*2);
|
|
||||||
model.customSw[i].delay= (uint8_t)round(cswitchDelay[i]->value()*2);
|
|
||||||
}
|
|
||||||
RawSource source;
|
RawSource source;
|
||||||
switch (getCSFunctionFamily(model.customSw[i].func))
|
switch (model.customSw[i].getFunctionFamily())
|
||||||
{
|
{
|
||||||
case (CS_FAMILY_VOFS):
|
case CS_FAMILY_VOFS:
|
||||||
if (model.customSw[i].val1 != cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt()) {
|
if (model.customSw[i].val1 != cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt()) {
|
||||||
source = RawSource(model.customSw[i].val1, &model);
|
source = RawSource(model.customSw[i].val1, &model);
|
||||||
model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt();
|
model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt();
|
||||||
|
@ -181,7 +200,8 @@ void CustomSwitchesPanel::edited()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (CS_FAMILY_TIMERS): {
|
case CS_FAMILY_TIMER:
|
||||||
|
{
|
||||||
value = cswitchOffset[i]->value();
|
value = cswitchOffset[i]->value();
|
||||||
newval=TimToVal(value);
|
newval=TimToVal(value);
|
||||||
if (newval>model.customSw[i].val2) {
|
if (newval>model.customSw[i].val2) {
|
||||||
|
@ -194,7 +214,8 @@ void CustomSwitchesPanel::edited()
|
||||||
} else {
|
} else {
|
||||||
step=0.1;
|
step=0.1;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (value <=2) {
|
if (value <=2) {
|
||||||
step=0.1;
|
step=0.1;
|
||||||
} else if (value<=60) {
|
} else if (value<=60) {
|
||||||
|
@ -239,13 +260,13 @@ void CustomSwitchesPanel::edited()
|
||||||
cswitchValue[i]->setSingleStep(step);
|
cswitchValue[i]->setSingleStep(step);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CS_FAMILY_VBOOL):
|
case CS_FAMILY_VBOOL:
|
||||||
case (CS_FAMILY_VCOMP):
|
case CS_FAMILY_VCOMP:
|
||||||
|
case CS_FAMILY_STICKY:
|
||||||
model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt();
|
model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt();
|
||||||
model.customSw[i].val2 = cswitchSource2[i]->itemData(cswitchSource2[i]->currentIndex()).toInt();
|
model.customSw[i].val2 = cswitchSource2[i]->itemData(cswitchSource2[i]->currentIndex()).toInt();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
model.customSw[i].andsw = cswitchAnd[i]->itemData(cswitchAnd[i]->currentIndex()).toInt();
|
|
||||||
emit modified();
|
emit modified();
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +277,7 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||||
RawSource source = RawSource(model.customSw[i].val1, &model);
|
RawSource source = RawSource(model.customSw[i].val1, &model);
|
||||||
RawSourceRange range = source.getRange();
|
RawSourceRange range = source.getRange();
|
||||||
|
|
||||||
switch (getCSFunctionFamily(model.customSw[i].func))
|
switch (model.customSw[i].getFunctionFamily())
|
||||||
{
|
{
|
||||||
case CS_FAMILY_VOFS:
|
case CS_FAMILY_VOFS:
|
||||||
cswitchSource1[i]->setVisible(true);
|
cswitchSource1[i]->setVisible(true);
|
||||||
|
@ -270,13 +291,15 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||||
cswitchOffset[i]->setMinimum(range.step*-127);
|
cswitchOffset[i]->setMinimum(range.step*-127);
|
||||||
cswitchOffset[i]->setMaximum(range.step*127);
|
cswitchOffset[i]->setMaximum(range.step*127);
|
||||||
cswitchOffset[i]->setValue(range.step*model.customSw[i].val2);
|
cswitchOffset[i]->setValue(range.step*model.customSw[i].val2);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
cswitchOffset[i]->setMinimum(range.min);
|
cswitchOffset[i]->setMinimum(range.min);
|
||||||
cswitchOffset[i]->setMaximum(range.max);
|
cswitchOffset[i]->setMaximum(range.max);
|
||||||
cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
|
cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CS_FAMILY_VBOOL:
|
case CS_FAMILY_VBOOL:
|
||||||
|
case CS_FAMILY_STICKY:
|
||||||
cswitchSource1[i]->setVisible(true);
|
cswitchSource1[i]->setVisible(true);
|
||||||
cswitchSource2[i]->setVisible(true);
|
cswitchSource2[i]->setVisible(true);
|
||||||
cswitchValue[i]->setVisible(false);
|
cswitchValue[i]->setVisible(false);
|
||||||
|
@ -292,7 +315,7 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||||
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||||
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||||
break;
|
break;
|
||||||
case CS_FAMILY_TIMERS:
|
case CS_FAMILY_TIMER:
|
||||||
cswitchSource1[i]->setVisible(false);
|
cswitchSource1[i]->setVisible(false);
|
||||||
cswitchSource2[i]->setVisible(false);
|
cswitchSource2[i]->setVisible(false);
|
||||||
cswitchValue[i]->setVisible(true);
|
cswitchValue[i]->setVisible(true);
|
||||||
|
|
|
@ -17,6 +17,9 @@ class CustomSwitchesPanel : public ModelPanel
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void edited();
|
void edited();
|
||||||
|
void durationEdited(double duration);
|
||||||
|
void delayEdited(double delay);
|
||||||
|
void andEdited(int value);
|
||||||
void csw_customContextMenuRequested(QPoint pos);
|
void csw_customContextMenuRequested(QPoint pos);
|
||||||
void cswDelete();
|
void cswDelete();
|
||||||
void cswCopy();
|
void cswCopy();
|
||||||
|
|
|
@ -352,7 +352,7 @@ void TelemetryCustomScreen::updateBar(int line)
|
||||||
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1, &model);
|
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1, &model);
|
||||||
RawSourceRange range = source.getRange(true);
|
RawSourceRange range = source.getRange(true);
|
||||||
int max = round((range.max - range.min) / range.step);
|
int max = round((range.max - range.min) / range.step);
|
||||||
if (255-screen.body.bars[line].barMax > max)
|
if (int(255-screen.body.bars[line].barMax) > max)
|
||||||
screen.body.bars[line].barMax = 255 - max;
|
screen.body.bars[line].barMax = 255 - max;
|
||||||
minSB[line]->setEnabled(true);
|
minSB[line]->setEnabled(true);
|
||||||
minSB[line]->setDecimals(range.decimals);
|
minSB[line]->setDecimals(range.decimals);
|
||||||
|
|
|
@ -650,7 +650,7 @@ void printDialog::printSwitches()
|
||||||
} else {
|
} else {
|
||||||
str.append("<td width=\"60\" align=\"center\"><b>"+tr("LS")+('A'+(i-9))+"</b></td>");
|
str.append("<td width=\"60\" align=\"center\"><b>"+tr("LS")+('A'+(i-9))+"</b></td>");
|
||||||
}
|
}
|
||||||
QString tstr = getCustomSwitchStr(&g_model->customSw[i], *g_model);
|
QString tstr = g_model->customSw[i].toString(*g_model);
|
||||||
str.append(doTC(tstr,"green"));
|
str.append(doTC(tstr,"green"));
|
||||||
str.append("</tr>");
|
str.append("</tr>");
|
||||||
sc++;
|
sc++;
|
||||||
|
@ -708,7 +708,7 @@ void printDialog::printFSwitches()
|
||||||
if (g_model->funcSw[i].swtch.type!=SWITCH_TYPE_NONE) {
|
if (g_model->funcSw[i].swtch.type!=SWITCH_TYPE_NONE) {
|
||||||
str.append("<tr>");
|
str.append("<tr>");
|
||||||
str.append(doTC(g_model->funcSw[i].swtch.toString(),"green"));
|
str.append(doTC(g_model->funcSw[i].swtch.toString(),"green"));
|
||||||
str.append(doTC(getFuncName(g_model->funcSw[i].func),"green"));
|
str.append(doTC(g_model->funcSw[i].funcToString(),"green"));
|
||||||
str.append(doTC(g_model->funcSw[i].paramToString(),"green"));
|
str.append(doTC(g_model->funcSw[i].paramToString(),"green"));
|
||||||
int index=g_model->funcSw[i].func;
|
int index=g_model->funcSw[i].func;
|
||||||
if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
||||||
|
|
|
@ -335,9 +335,9 @@
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
||||||
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "*1 "
|
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS
|
||||||
#else
|
#else
|
||||||
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "*1 "
|
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
|
|
@ -335,9 +335,9 @@
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
||||||
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "ONE"
|
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS
|
||||||
#else
|
#else
|
||||||
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "ONE"
|
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
|
|
@ -340,9 +340,9 @@
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
||||||
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "One"
|
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS
|
||||||
#else
|
#else
|
||||||
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "One"
|
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
|
|
@ -335,9 +335,9 @@
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
||||||
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "Uno"
|
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS
|
||||||
#else
|
#else
|
||||||
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "ACE""DIR""ELE""ALE""GEA""TRN" TR_CUSTOMSW "Uno"
|
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "ACE""DIR""ELE""ALE""GEA""TRN" TR_CUSTOMSW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
|
|
@ -335,9 +335,9 @@
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
||||||
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "1*\0"
|
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS
|
||||||
#else
|
#else
|
||||||
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "1*\0"
|
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
|
|
@ -337,7 +337,7 @@
|
||||||
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
||||||
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "1*\0"
|
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "1*\0"
|
||||||
#else
|
#else
|
||||||
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "One"
|
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
|
|
@ -335,9 +335,9 @@
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
||||||
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS " * "
|
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS
|
||||||
#else
|
#else
|
||||||
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "GAZ""SK ""LOT""SW ""GEA""TRN" TR_CUSTOMSW " * "
|
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "GAZ""SK ""LOT""SW ""GEA""TRN" TR_CUSTOMSW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
|
|
@ -335,9 +335,9 @@
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
||||||
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "1*\0"
|
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS
|
||||||
#else
|
#else
|
||||||
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "1*\0"
|
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
|
|
@ -335,9 +335,9 @@
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
#define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
|
||||||
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "One"
|
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS
|
||||||
#else
|
#else
|
||||||
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "One"
|
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue