mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 16:55:20 +03:00
Renaming started ... who wants to continue?
This commit is contained in:
parent
afc3b61232
commit
08a37b77e7
40 changed files with 577 additions and 563 deletions
|
@ -1039,7 +1039,7 @@ void compareDialog::printSwitches()
|
||||||
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
|
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
|
||||||
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(LogicalSwitches); i++) {
|
||||||
QString sw1 = g_model1->customSw[i].toString(*g_model1);
|
QString sw1 = g_model1->customSw[i].toString(*g_model1);
|
||||||
QString sw2 = g_model2->customSw[i].toString(*g_model2);
|
QString sw2 = g_model2->customSw[i].toString(*g_model2);
|
||||||
if (!(sw1.isEmpty() && sw2.isEmpty())) {
|
if (!(sw1.isEmpty() && sw2.isEmpty())) {
|
||||||
|
|
|
@ -335,71 +335,71 @@ QString CurveReference::toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSFunctionFamily CustomSwData::getFunctionFamily()
|
CSFunctionFamily LogicalSwitchData::getFunctionFamily()
|
||||||
{
|
{
|
||||||
if (func == CS_FN_STAY)
|
if (func == LS_FN_STAY)
|
||||||
return CS_FAMILY_STAY;
|
return LS_FAMILY_STAY;
|
||||||
else if (func == CS_FN_TIMER)
|
else if (func == LS_FN_TIMER)
|
||||||
return CS_FAMILY_TIMER;
|
return LS_FAMILY_TIMER;
|
||||||
else if (func == CS_FN_STICKY)
|
else if (func == LS_FN_STICKY)
|
||||||
return CS_FAMILY_STICKY;
|
return LS_FAMILY_STICKY;
|
||||||
else if (func < CS_FN_AND || func > CS_FN_ELESS)
|
else if (func < LS_FN_AND || func > LS_FN_ELESS)
|
||||||
return CS_FAMILY_VOFS;
|
return LS_FAMILY_VOFS;
|
||||||
else if (func < CS_FN_EQUAL)
|
else if (func < LS_FN_EQUAL)
|
||||||
return CS_FAMILY_VBOOL;
|
return LS_FAMILY_VBOOL;
|
||||||
else
|
else
|
||||||
return CS_FAMILY_VCOMP;
|
return LS_FAMILY_VCOMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CustomSwData::funcToString()
|
QString LogicalSwitchData::funcToString()
|
||||||
{
|
{
|
||||||
switch (func) {
|
switch (func) {
|
||||||
case CS_FN_OFF:
|
case LS_FN_OFF:
|
||||||
return QObject::tr("---");
|
return QObject::tr("---");
|
||||||
case CS_FN_VPOS:
|
case LS_FN_VPOS:
|
||||||
return QObject::tr("a>x");
|
return QObject::tr("a>x");
|
||||||
case CS_FN_VNEG:
|
case LS_FN_VNEG:
|
||||||
return QObject::tr("a<x");
|
return QObject::tr("a<x");
|
||||||
case CS_FN_APOS:
|
case LS_FN_APOS:
|
||||||
return QObject::tr("|a|>x");
|
return QObject::tr("|a|>x");
|
||||||
case CS_FN_ANEG:
|
case LS_FN_ANEG:
|
||||||
return QObject::tr("|a|<x");
|
return QObject::tr("|a|<x");
|
||||||
case CS_FN_AND:
|
case LS_FN_AND:
|
||||||
return QObject::tr("AND");
|
return QObject::tr("AND");
|
||||||
case CS_FN_OR:
|
case LS_FN_OR:
|
||||||
return QObject::tr("OR");
|
return QObject::tr("OR");
|
||||||
case CS_FN_XOR:
|
case LS_FN_XOR:
|
||||||
return QObject::tr("XOR");
|
return QObject::tr("XOR");
|
||||||
case CS_FN_EQUAL:
|
case LS_FN_EQUAL:
|
||||||
return QObject::tr("a=b");
|
return QObject::tr("a=b");
|
||||||
case CS_FN_NEQUAL:
|
case LS_FN_NEQUAL:
|
||||||
return QObject::tr("a!=b");
|
return QObject::tr("a!=b");
|
||||||
case CS_FN_GREATER:
|
case LS_FN_GREATER:
|
||||||
return QObject::tr("a>b");
|
return QObject::tr("a>b");
|
||||||
case CS_FN_LESS:
|
case LS_FN_LESS:
|
||||||
return QObject::tr("a<b");
|
return QObject::tr("a<b");
|
||||||
case CS_FN_EGREATER:
|
case LS_FN_EGREATER:
|
||||||
return QObject::tr("a>=b");
|
return QObject::tr("a>=b");
|
||||||
case CS_FN_ELESS:
|
case LS_FN_ELESS:
|
||||||
return QObject::tr("a<=b");
|
return QObject::tr("a<=b");
|
||||||
case CS_FN_DPOS:
|
case LS_FN_DPOS:
|
||||||
return QObject::tr("d>=x");
|
return QObject::tr("d>=x");
|
||||||
case CS_FN_DAPOS:
|
case LS_FN_DAPOS:
|
||||||
return QObject::tr("|d|>=x");
|
return QObject::tr("|d|>=x");
|
||||||
case CS_FN_VEQUAL:
|
case LS_FN_VEQUAL:
|
||||||
return QObject::tr("a~x");
|
return QObject::tr("a~x");
|
||||||
case CS_FN_TIMER:
|
case LS_FN_TIMER:
|
||||||
return QObject::tr("Timer");
|
return QObject::tr("Timer");
|
||||||
case CS_FN_STICKY:
|
case LS_FN_STICKY:
|
||||||
return QObject::tr("Sticky");
|
return QObject::tr("Sticky");
|
||||||
case CS_FN_STAY:
|
case LS_FN_STAY:
|
||||||
return QObject::tr("Stay");
|
return QObject::tr("Stay");
|
||||||
default:
|
default:
|
||||||
return QObject::tr("Unknown");
|
return QObject::tr("Unknown");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CustomSwData::toString(const ModelData & model)
|
QString LogicalSwitchData::toString(const ModelData & model)
|
||||||
{
|
{
|
||||||
QString result = "";
|
QString result = "";
|
||||||
|
|
||||||
|
@ -410,16 +410,16 @@ QString CustomSwData::toString(const ModelData & model)
|
||||||
result +="( ";
|
result +="( ";
|
||||||
}
|
}
|
||||||
switch (getFunctionFamily()) {
|
switch (getFunctionFamily()) {
|
||||||
case CS_FAMILY_STAY:
|
case LS_FAMILY_STAY:
|
||||||
result = QObject::tr("STAY(%1, [%2:%3])").arg(RawSwitch(val1).toString()).arg(ValToTim(val2)).arg(ValToTim(val2+val3));
|
result = QObject::tr("STAY(%1, [%2:%3])").arg(RawSwitch(val1).toString()).arg(ValToTim(val2)).arg(ValToTim(val2+val3));
|
||||||
break;
|
break;
|
||||||
case CS_FAMILY_STICKY:
|
case LS_FAMILY_STICKY:
|
||||||
result = QObject::tr("STICKY(%1, %2)").arg(RawSwitch(val1).toString()).arg(RawSwitch(val2).toString());
|
result = QObject::tr("STICKY(%1, %2)").arg(RawSwitch(val1).toString()).arg(RawSwitch(val2).toString());
|
||||||
break;
|
break;
|
||||||
case CS_FAMILY_TIMER:
|
case LS_FAMILY_TIMER:
|
||||||
result = QObject::tr("TIMER(%1, %2)").arg(ValToTim(val1)).arg(ValToTim(val2));
|
result = QObject::tr("TIMER(%1, %2)").arg(ValToTim(val1)).arg(ValToTim(val2));
|
||||||
break;
|
break;
|
||||||
case CS_FAMILY_VOFS: {
|
case LS_FAMILY_VOFS: {
|
||||||
RawSource source = RawSource(val1, &model);
|
RawSource source = RawSource(val1, &model);
|
||||||
RawSourceRange range = source.getRange();
|
RawSourceRange range = source.getRange();
|
||||||
if (val1)
|
if (val1)
|
||||||
|
@ -427,28 +427,28 @@ QString CustomSwData::toString(const ModelData & model)
|
||||||
else
|
else
|
||||||
result += "0";
|
result += "0";
|
||||||
result.remove(" ");
|
result.remove(" ");
|
||||||
if (func == CS_FN_APOS || func == CS_FN_ANEG)
|
if (func == LS_FN_APOS || func == LS_FN_ANEG)
|
||||||
result = "|" + result + "|";
|
result = "|" + result + "|";
|
||||||
else if (func == CS_FN_DAPOS)
|
else if (func == LS_FN_DAPOS)
|
||||||
result = "|d(" + result + ")|";
|
result = "|d(" + result + ")|";
|
||||||
else if (func == CS_FN_DPOS) result = "d(" + result + ")";
|
else if (func == LS_FN_DPOS) result = "d(" + result + ")";
|
||||||
if (func == CS_FN_APOS || func == CS_FN_VPOS || func == CS_FN_DAPOS || func == CS_FN_DPOS)
|
if (func == LS_FN_APOS || func == LS_FN_VPOS || func == LS_FN_DAPOS || func == LS_FN_DPOS)
|
||||||
result += " > ";
|
result += " > ";
|
||||||
else if (func == CS_FN_ANEG || func == CS_FN_VNEG)
|
else if (func == LS_FN_ANEG || func == LS_FN_VNEG)
|
||||||
result += " < ";
|
result += " < ";
|
||||||
result += QString::number(range.step * (val2 /*TODO+ source.getRawOffset(model)*/) + range.offset);
|
result += QString::number(range.step * (val2 /*TODO+ source.getRawOffset(model)*/) + range.offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CS_FAMILY_VBOOL:
|
case LS_FAMILY_VBOOL:
|
||||||
result = RawSwitch(val1).toString();
|
result = RawSwitch(val1).toString();
|
||||||
switch (func) {
|
switch (func) {
|
||||||
case CS_FN_AND:
|
case LS_FN_AND:
|
||||||
result += " AND ";
|
result += " AND ";
|
||||||
break;
|
break;
|
||||||
case CS_FN_OR:
|
case LS_FN_OR:
|
||||||
result += " OR ";
|
result += " OR ";
|
||||||
break;
|
break;
|
||||||
case CS_FN_XOR:
|
case LS_FN_XOR:
|
||||||
result += " XOR ";
|
result += " XOR ";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -457,28 +457,28 @@ QString CustomSwData::toString(const ModelData & model)
|
||||||
result += RawSwitch(val2).toString();
|
result += RawSwitch(val2).toString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CS_FAMILY_VCOMP:
|
case LS_FAMILY_VCOMP:
|
||||||
if (val1)
|
if (val1)
|
||||||
result += RawSource(val1).toString();
|
result += RawSource(val1).toString();
|
||||||
else
|
else
|
||||||
result += "0";
|
result += "0";
|
||||||
switch (func) {
|
switch (func) {
|
||||||
case CS_FN_EQUAL:
|
case LS_FN_EQUAL:
|
||||||
result += " = ";
|
result += " = ";
|
||||||
break;
|
break;
|
||||||
case CS_FN_NEQUAL:
|
case LS_FN_NEQUAL:
|
||||||
result += " != ";
|
result += " != ";
|
||||||
break;
|
break;
|
||||||
case CS_FN_GREATER:
|
case LS_FN_GREATER:
|
||||||
result += " > ";
|
result += " > ";
|
||||||
break;
|
break;
|
||||||
case CS_FN_LESS:
|
case LS_FN_LESS:
|
||||||
result += " < ";
|
result += " < ";
|
||||||
break;
|
break;
|
||||||
case CS_FN_EGREATER:
|
case LS_FN_EGREATER:
|
||||||
result += " >= ";
|
result += " >= ";
|
||||||
break;
|
break;
|
||||||
case CS_FN_ELESS:
|
case LS_FN_ELESS:
|
||||||
result += " <= ";
|
result += " <= ";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -496,7 +496,7 @@ QString CustomSwData::toString(const ModelData & model)
|
||||||
result += RawSwitch(andsw).toString();
|
result += RawSwitch(andsw).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
|
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
|
||||||
if (delay)
|
if (delay)
|
||||||
result += QObject::tr(" Delay %1 sec").arg(delay/2.0);
|
result += QObject::tr(" Delay %1 sec").arg(delay/2.0);
|
||||||
if (duration)
|
if (duration)
|
||||||
|
|
|
@ -577,42 +577,42 @@ class MixData {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CSFunction {
|
enum CSFunction {
|
||||||
CS_FN_OFF,
|
LS_FN_OFF,
|
||||||
CS_FN_VPOS,
|
LS_FN_VPOS,
|
||||||
CS_FN_VNEG,
|
LS_FN_VNEG,
|
||||||
CS_FN_APOS,
|
LS_FN_APOS,
|
||||||
CS_FN_ANEG,
|
LS_FN_ANEG,
|
||||||
CS_FN_AND,
|
LS_FN_AND,
|
||||||
CS_FN_OR,
|
LS_FN_OR,
|
||||||
CS_FN_XOR,
|
LS_FN_XOR,
|
||||||
CS_FN_EQUAL,
|
LS_FN_EQUAL,
|
||||||
CS_FN_NEQUAL,
|
LS_FN_NEQUAL,
|
||||||
CS_FN_GREATER,
|
LS_FN_GREATER,
|
||||||
CS_FN_LESS,
|
LS_FN_LESS,
|
||||||
CS_FN_EGREATER,
|
LS_FN_EGREATER,
|
||||||
CS_FN_ELESS,
|
LS_FN_ELESS,
|
||||||
CS_FN_DPOS,
|
LS_FN_DPOS,
|
||||||
CS_FN_DAPOS,
|
LS_FN_DAPOS,
|
||||||
CS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
LS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
||||||
CS_FN_TIMER,
|
LS_FN_TIMER,
|
||||||
CS_FN_STICKY,
|
LS_FN_STICKY,
|
||||||
CS_FN_STAY,
|
LS_FN_STAY,
|
||||||
// later ... CS_FN_RANGE,
|
// later ... LS_FN_RANGE,
|
||||||
CS_FN_MAX
|
LS_FN_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CSFunctionFamily {
|
enum CSFunctionFamily {
|
||||||
CS_FAMILY_VOFS,
|
LS_FAMILY_VOFS,
|
||||||
CS_FAMILY_VBOOL,
|
LS_FAMILY_VBOOL,
|
||||||
CS_FAMILY_VCOMP,
|
LS_FAMILY_VCOMP,
|
||||||
CS_FAMILY_TIMER,
|
LS_FAMILY_TIMER,
|
||||||
CS_FAMILY_STICKY,
|
LS_FAMILY_STICKY,
|
||||||
CS_FAMILY_STAY,
|
LS_FAMILY_STAY,
|
||||||
};
|
};
|
||||||
|
|
||||||
class CustomSwData { // Custom Switches data
|
class LogicalSwitchData { // Custom Switches data
|
||||||
public:
|
public:
|
||||||
CustomSwData(unsigned int func=0)
|
LogicalSwitchData(unsigned int func=0)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
this->func = func;
|
this->func = func;
|
||||||
|
@ -624,7 +624,7 @@ class CustomSwData { // Custom Switches data
|
||||||
unsigned int delay;
|
unsigned int delay;
|
||||||
unsigned int duration;
|
unsigned int duration;
|
||||||
int andsw;
|
int andsw;
|
||||||
void clear() { memset(this, 0, sizeof(CustomSwData)); }
|
void clear() { memset(this, 0, sizeof(LogicalSwitchData)); }
|
||||||
CSFunctionFamily getFunctionFamily();
|
CSFunctionFamily getFunctionFamily();
|
||||||
QString funcToString();
|
QString funcToString();
|
||||||
QString toString(const ModelData & model);
|
QString toString(const ModelData & model);
|
||||||
|
@ -876,7 +876,7 @@ class ModelData {
|
||||||
ExpoData expoData[C9X_MAX_EXPOS];
|
ExpoData expoData[C9X_MAX_EXPOS];
|
||||||
|
|
||||||
CurveData curves[C9X_MAX_CURVES];
|
CurveData curves[C9X_MAX_CURVES];
|
||||||
CustomSwData customSw[C9X_NUM_CSW];
|
LogicalSwitchData customSw[C9X_NUM_CSW];
|
||||||
FuncSwData funcSw[C9X_MAX_CUSTOM_FUNCTIONS];
|
FuncSwData funcSw[C9X_MAX_CUSTOM_FUNCTIONS];
|
||||||
SwashRingData swashRingData;
|
SwashRingData swashRingData;
|
||||||
unsigned int thrTraceSrc;
|
unsigned int thrTraceSrc;
|
||||||
|
@ -942,10 +942,10 @@ enum Capability {
|
||||||
Pots,
|
Pots,
|
||||||
Switches,
|
Switches,
|
||||||
SwitchesPositions,
|
SwitchesPositions,
|
||||||
CustomSwitches,
|
LogicalSwitches,
|
||||||
CustomAndSwitches,
|
CustomAndSwitches,
|
||||||
HasNegAndSwitches,
|
HasNegAndSwitches,
|
||||||
CustomSwitchesExt,
|
LogicalSwitchesExt,
|
||||||
RotaryEncoders,
|
RotaryEncoders,
|
||||||
Outputs,
|
Outputs,
|
||||||
ChannelsName,
|
ChannelsName,
|
||||||
|
@ -1161,13 +1161,13 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
|
||||||
for (int i=0; i<C9X_NUM_CSW; i++) {
|
for (int i=0; i<C9X_NUM_CSW; i++) {
|
||||||
RawSource source;
|
RawSource source;
|
||||||
switch (model.customSw[i].getFunctionFamily()) {
|
switch (model.customSw[i].getFunctionFamily()) {
|
||||||
case CS_FAMILY_VCOMP:
|
case LS_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)
|
||||||
source.index = applyStickMode(source.index + 1, mode) - 1;
|
source.index = applyStickMode(source.index + 1, mode) - 1;
|
||||||
model.customSw[i].val2 = source.toValue();
|
model.customSw[i].val2 = source.toValue();
|
||||||
// no break
|
// no break
|
||||||
case CS_FAMILY_VOFS:
|
case LS_FAMILY_VOFS:
|
||||||
source = RawSource(model.customSw[i].val1);
|
source = RawSource(model.customSw[i].val1);
|
||||||
if (source.type == SOURCE_TYPE_STICK)
|
if (source.type == SOURCE_TYPE_STICK)
|
||||||
source.index = applyStickMode(source.index + 1, mode) - 1;
|
source.index = applyStickMode(source.index + 1, mode) - 1;
|
||||||
|
|
|
@ -269,22 +269,22 @@ RawSource er9xToSource(int8_t value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Er9xCustomSwData::operator CustomSwData ()
|
Er9xLogicalSwitchData::operator LogicalSwitchData ()
|
||||||
{
|
{
|
||||||
CustomSwData c9x;
|
LogicalSwitchData c9x;
|
||||||
c9x.func = func;
|
c9x.func = func;
|
||||||
c9x.val1 = v1;
|
c9x.val1 = v1;
|
||||||
c9x.val2 = v2;
|
c9x.val2 = v2;
|
||||||
|
|
||||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val1 = er9xToSource(v1).toValue();
|
c9x.val1 = er9xToSource(v1).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_EQUAL) {
|
if (c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val2 = er9xToSource(v2).toValue();
|
c9x.val2 = er9xToSource(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||||
c9x.val1 = er9xToSwitch(v1).toValue();
|
c9x.val1 = er9xToSwitch(v1).toValue();
|
||||||
c9x.val2 = er9xToSwitch(v2).toValue();
|
c9x.val2 = er9xToSwitch(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,15 +154,15 @@ PACK(typedef struct t_Er9xMixData {
|
||||||
}) Er9xMixData;
|
}) Er9xMixData;
|
||||||
|
|
||||||
|
|
||||||
PACK(typedef struct t_Er9xCustomSwData { // Custom Switches data
|
PACK(typedef struct t_Er9xLogicalSwitchData { // Custom Switches data
|
||||||
int8_t v1; //input
|
int8_t v1; //input
|
||||||
int8_t v2; //offset
|
int8_t v2; //offset
|
||||||
uint8_t func:4;
|
uint8_t func:4;
|
||||||
uint8_t andsw:4;
|
uint8_t andsw:4;
|
||||||
|
|
||||||
operator CustomSwData();
|
operator LogicalSwitchData();
|
||||||
t_Er9xCustomSwData() { memset(this, 0, sizeof(t_Er9xCustomSwData)); }
|
t_Er9xLogicalSwitchData() { memset(this, 0, sizeof(t_Er9xLogicalSwitchData)); }
|
||||||
}) Er9xCustomSwData;
|
}) Er9xLogicalSwitchData;
|
||||||
|
|
||||||
PACK(typedef struct t_Er9xSafetySwData { // Custom Switches data
|
PACK(typedef struct t_Er9xSafetySwData { // Custom Switches data
|
||||||
int8_t swtch;
|
int8_t swtch;
|
||||||
|
@ -241,7 +241,7 @@ PACK(typedef struct t_Er9xModelData {
|
||||||
int8_t trim[4];
|
int8_t trim[4];
|
||||||
int8_t curves5[ER9X_MAX_CURVE5][5];
|
int8_t curves5[ER9X_MAX_CURVE5][5];
|
||||||
int8_t curves9[ER9X_MAX_CURVE9][9];
|
int8_t curves9[ER9X_MAX_CURVE9][9];
|
||||||
Er9xCustomSwData customSw[ER9X_NUM_CSW];
|
Er9xLogicalSwitchData customSw[ER9X_NUM_CSW];
|
||||||
uint8_t frSkyVoltThreshold ;
|
uint8_t frSkyVoltThreshold ;
|
||||||
int8_t tmrModeB;
|
int8_t tmrModeB;
|
||||||
uint8_t numVoice;
|
uint8_t numVoice;
|
||||||
|
|
|
@ -75,11 +75,11 @@ 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 (CustomSwData(model.customSw[i].func).getFunctionFamily()) {
|
switch (LogicalSwitchData(model.customSw[i].func).getFunctionFamily()) {
|
||||||
case CS_FAMILY_VCOMP:
|
case LS_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
|
||||||
case CS_FAMILY_VOFS:
|
case LS_FAMILY_VOFS:
|
||||||
model.customSw[i].v1 = applyStickMode(model.customSw[i].v1, mode);
|
model.customSw[i].v1 = applyStickMode(model.customSw[i].v1, mode);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -239,7 +239,7 @@ int Er9xInterface::getCapability(const Capability capability)
|
||||||
return 9;
|
return 9;
|
||||||
case CustomFunctions:
|
case CustomFunctions:
|
||||||
return 0;
|
return 0;
|
||||||
case CustomSwitches:
|
case LogicalSwitches:
|
||||||
return 12;
|
return 12;
|
||||||
case CustomAndSwitches:
|
case CustomAndSwitches:
|
||||||
return 5;
|
return 5;
|
||||||
|
|
|
@ -353,22 +353,22 @@ RawSource ersky9xToSource_v11(int8_t value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ersky9xCustomSwData_v10::operator CustomSwData ()
|
Ersky9xLogicalSwitchData_v10::operator LogicalSwitchData ()
|
||||||
{
|
{
|
||||||
CustomSwData c9x;
|
LogicalSwitchData c9x;
|
||||||
c9x.func = func;
|
c9x.func = func;
|
||||||
c9x.val1 = v1;
|
c9x.val1 = v1;
|
||||||
c9x.val2 = v2;
|
c9x.val2 = v2;
|
||||||
|
|
||||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val1 = ersky9xToSource_v10(v1).toValue();
|
c9x.val1 = ersky9xToSource_v10(v1).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_EQUAL) {
|
if (c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val2 = ersky9xToSource_v10(v2).toValue();
|
c9x.val2 = ersky9xToSource_v10(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||||
c9x.val1 = er9xToSwitch(v1).toValue();
|
c9x.val1 = er9xToSwitch(v1).toValue();
|
||||||
c9x.val2 = er9xToSwitch(v2).toValue();
|
c9x.val2 = er9xToSwitch(v2).toValue();
|
||||||
}
|
}
|
||||||
|
@ -376,22 +376,22 @@ Ersky9xCustomSwData_v10::operator CustomSwData ()
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ersky9xCustomSwData_v11::operator CustomSwData ()
|
Ersky9xLogicalSwitchData_v11::operator LogicalSwitchData ()
|
||||||
{
|
{
|
||||||
CustomSwData c9x;
|
LogicalSwitchData c9x;
|
||||||
c9x.func = func;
|
c9x.func = func;
|
||||||
c9x.val1 = v1;
|
c9x.val1 = v1;
|
||||||
c9x.val2 = v2;
|
c9x.val2 = v2;
|
||||||
|
|
||||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val1 = ersky9xToSource_v11(v1).toValue();
|
c9x.val1 = ersky9xToSource_v11(v1).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_EQUAL) {
|
if (c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val2 = ersky9xToSource_v11(v2).toValue();
|
c9x.val2 = ersky9xToSource_v11(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||||
c9x.val1 = er9xToSwitch(v1).toValue();
|
c9x.val1 = er9xToSwitch(v1).toValue();
|
||||||
c9x.val2 = er9xToSwitch(v2).toValue();
|
c9x.val2 = er9xToSwitch(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,25 +185,25 @@ PACK(typedef struct t_Ersky9xMixData_v11 {
|
||||||
t_Ersky9xMixData_v11();
|
t_Ersky9xMixData_v11();
|
||||||
}) Ersky9xMixData_v11;
|
}) Ersky9xMixData_v11;
|
||||||
|
|
||||||
PACK(typedef struct t_Ersky9xCustomSwData_v10 { // Custom Switches data
|
PACK(typedef struct t_Ersky9xLogicalSwitchData_v10 { // Custom Switches data
|
||||||
int8_t v1; //input
|
int8_t v1; //input
|
||||||
int8_t v2; //offset
|
int8_t v2; //offset
|
||||||
uint8_t func;
|
uint8_t func;
|
||||||
|
|
||||||
operator CustomSwData();
|
operator LogicalSwitchData();
|
||||||
t_Ersky9xCustomSwData_v10() { memset(this, 0, sizeof(t_Ersky9xCustomSwData_v10)); }
|
t_Ersky9xLogicalSwitchData_v10() { memset(this, 0, sizeof(t_Ersky9xLogicalSwitchData_v10)); }
|
||||||
}) Ersky9xCustomSwData_v10;
|
}) Ersky9xLogicalSwitchData_v10;
|
||||||
|
|
||||||
PACK(typedef struct t_Ersky9xCustomSwData_v11 { // Custom Switches data
|
PACK(typedef struct t_Ersky9xLogicalSwitchData_v11 { // Custom Switches data
|
||||||
int8_t v1; //input
|
int8_t v1; //input
|
||||||
int8_t v2; //offset
|
int8_t v2; //offset
|
||||||
uint8_t func;
|
uint8_t func;
|
||||||
uint8_t andsw;
|
uint8_t andsw;
|
||||||
uint8_t res ;
|
uint8_t res ;
|
||||||
|
|
||||||
operator CustomSwData();
|
operator LogicalSwitchData();
|
||||||
t_Ersky9xCustomSwData_v11() { memset(this, 0, sizeof(t_Ersky9xCustomSwData_v11)); }
|
t_Ersky9xLogicalSwitchData_v11() { memset(this, 0, sizeof(t_Ersky9xLogicalSwitchData_v11)); }
|
||||||
}) Ersky9xCustomSwData_v11;
|
}) Ersky9xLogicalSwitchData_v11;
|
||||||
|
|
||||||
PACK(typedef struct t_Ersky9xSafetySwData_v10 { // Custom Switches data
|
PACK(typedef struct t_Ersky9xSafetySwData_v10 { // Custom Switches data
|
||||||
int8_t swtch;
|
int8_t swtch;
|
||||||
|
@ -360,7 +360,7 @@ PACK(typedef struct t_Ersky9xModelData_v10 {
|
||||||
int8_t trim[4];
|
int8_t trim[4];
|
||||||
int8_t curves5[ERSKY9X_MAX_CURVE5][5];
|
int8_t curves5[ERSKY9X_MAX_CURVE5][5];
|
||||||
int8_t curves9[ERSKY9X_MAX_CURVE9][9];
|
int8_t curves9[ERSKY9X_MAX_CURVE9][9];
|
||||||
Ersky9xCustomSwData_v10 customSw[ERSKY9X_NUM_CSW_V10];
|
Ersky9xLogicalSwitchData_v10 customSw[ERSKY9X_NUM_CSW_V10];
|
||||||
uint8_t frSkyVoltThreshold ;
|
uint8_t frSkyVoltThreshold ;
|
||||||
uint8_t res3[2];
|
uint8_t res3[2];
|
||||||
Ersky9xSafetySwData_v10 safetySw[ERSKY9X_NUM_CHNOUT_V10];
|
Ersky9xSafetySwData_v10 safetySw[ERSKY9X_NUM_CHNOUT_V10];
|
||||||
|
@ -409,7 +409,7 @@ PACK(typedef struct t_Ersky9xModelData_v11 {
|
||||||
int8_t curves5[ERSKY9X_MAX_CURVE5][5];
|
int8_t curves5[ERSKY9X_MAX_CURVE5][5];
|
||||||
int8_t curves9[ERSKY9X_MAX_CURVE9][9];
|
int8_t curves9[ERSKY9X_MAX_CURVE9][9];
|
||||||
int8_t curvexy[18];
|
int8_t curvexy[18];
|
||||||
Ersky9xCustomSwData_v11 customSw[ERSKY9X_NUM_CSW_V11];
|
Ersky9xLogicalSwitchData_v11 customSw[ERSKY9X_NUM_CSW_V11];
|
||||||
uint8_t frSkyVoltThreshold ;
|
uint8_t frSkyVoltThreshold ;
|
||||||
uint8_t bt_telemetry;
|
uint8_t bt_telemetry;
|
||||||
uint8_t numVoice; // 0-16, rest are Safety switches
|
uint8_t numVoice; // 0-16, rest are Safety switches
|
||||||
|
|
|
@ -74,11 +74,11 @@ 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 (CustomSwData(model.customSw[i].func).getFunctionFamily()) {
|
switch (LogicalSwitchData(model.customSw[i].func).getFunctionFamily()) {
|
||||||
case CS_FAMILY_VCOMP:
|
case LS_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
|
||||||
case CS_FAMILY_VOFS:
|
case LS_FAMILY_VOFS:
|
||||||
model.customSw[i].v1 = applyStickMode(model.customSw[i].v1, mode);
|
model.customSw[i].v1 = applyStickMode(model.customSw[i].v1, mode);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -106,11 +106,11 @@ 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 (CustomSwData(model.customSw[i].func).getFunctionFamily()) {
|
switch (LogicalSwitchData(model.customSw[i].func).getFunctionFamily()) {
|
||||||
case CS_FAMILY_VCOMP:
|
case LS_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
|
||||||
case CS_FAMILY_VOFS:
|
case LS_FAMILY_VOFS:
|
||||||
model.customSw[i].v1 = applyStickMode(model.customSw[i].v1, mode);
|
model.customSw[i].v1 = applyStickMode(model.customSw[i].v1, mode);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -285,7 +285,7 @@ int Ersky9xInterface::getCapability(const Capability capability)
|
||||||
return 9;
|
return 9;
|
||||||
case CustomFunctions:
|
case CustomFunctions:
|
||||||
return 0;
|
return 0;
|
||||||
case CustomSwitches:
|
case LogicalSwitches:
|
||||||
return ERSKY9X_NUM_CSW_V11;
|
return ERSKY9X_NUM_CSW_V11;
|
||||||
case CustomAndSwitches:
|
case CustomAndSwitches:
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -301,22 +301,22 @@ RawSource gruvin9xToSource(int8_t value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Gruvin9xCustomSwData::operator CustomSwData ()
|
Gruvin9xLogicalSwitchData::operator LogicalSwitchData ()
|
||||||
{
|
{
|
||||||
CustomSwData c9x;
|
LogicalSwitchData c9x;
|
||||||
c9x.func = func;
|
c9x.func = func;
|
||||||
c9x.val1 = v1;
|
c9x.val1 = v1;
|
||||||
c9x.val2 = v2;
|
c9x.val2 = v2;
|
||||||
|
|
||||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val1 = gruvin9xToSource(v1).toValue();
|
c9x.val1 = gruvin9xToSource(v1).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_EQUAL) {
|
if (c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val2 = gruvin9xToSource(v2).toValue();
|
c9x.val2 = gruvin9xToSource(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||||
c9x.val1 = gruvin9xToSwitch(v1).toValue();
|
c9x.val1 = gruvin9xToSwitch(v1).toValue();
|
||||||
c9x.val2 = gruvin9xToSwitch(v2).toValue();
|
c9x.val2 = gruvin9xToSwitch(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,14 +186,14 @@ PACK(typedef struct t_Gruvin9xMixData {
|
||||||
t_Gruvin9xMixData();
|
t_Gruvin9xMixData();
|
||||||
}) Gruvin9xMixData;
|
}) Gruvin9xMixData;
|
||||||
|
|
||||||
PACK(typedef struct t_Gruvin9xCustomSwData { // Custom Switches data
|
PACK(typedef struct t_Gruvin9xLogicalSwitchData { // Custom Switches data
|
||||||
int8_t v1; //input
|
int8_t v1; //input
|
||||||
int8_t v2; //offset
|
int8_t v2; //offset
|
||||||
uint8_t func;
|
uint8_t func;
|
||||||
|
|
||||||
operator CustomSwData();
|
operator LogicalSwitchData();
|
||||||
t_Gruvin9xCustomSwData() { memset(this, 0, sizeof(t_Gruvin9xCustomSwData)); }
|
t_Gruvin9xLogicalSwitchData() { memset(this, 0, sizeof(t_Gruvin9xLogicalSwitchData)); }
|
||||||
}) Gruvin9xCustomSwData;
|
}) Gruvin9xLogicalSwitchData;
|
||||||
|
|
||||||
PACK(typedef struct t_Gruvin9xSafetySwData { // Safety Switches data
|
PACK(typedef struct t_Gruvin9xSafetySwData { // Safety Switches data
|
||||||
int8_t swtch;
|
int8_t swtch;
|
||||||
|
@ -309,7 +309,7 @@ PACK(typedef struct t_Gruvin9xModelData_v102 {
|
||||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||||
Gruvin9xCustomSwData customSw[G9X_NUM_CSW];
|
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
|
||||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||||
Gruvin9xSwashRingData swashR;
|
Gruvin9xSwashRingData swashR;
|
||||||
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_PHASES];
|
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_PHASES];
|
||||||
|
@ -341,7 +341,7 @@ PACK(typedef struct t_Gruvin9xModelData_v103 {
|
||||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||||
Gruvin9xCustomSwData customSw[G9X_NUM_CSW];
|
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
|
||||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||||
Gruvin9xSwashRingData swashR;
|
Gruvin9xSwashRingData swashR;
|
||||||
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_PHASES];
|
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_PHASES];
|
||||||
|
@ -373,7 +373,7 @@ PACK(typedef struct t_Gruvin9xModelData_v105 {
|
||||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||||
Gruvin9xCustomSwData customSw[G9X_NUM_CSW];
|
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
|
||||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||||
Gruvin9xFuncSwData funcSw[G9X_NUM_FSW];
|
Gruvin9xFuncSwData funcSw[G9X_NUM_FSW];
|
||||||
Gruvin9xSwashRingData swashR;
|
Gruvin9xSwashRingData swashR;
|
||||||
|
@ -405,7 +405,7 @@ PACK(typedef struct t_Gruvin9xModelData_v106 {
|
||||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||||
Gruvin9xCustomSwData customSw[G9X_NUM_CSW];
|
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
|
||||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||||
Gruvin9xFuncSwData funcSw[G9X_NUM_FSW];
|
Gruvin9xFuncSwData funcSw[G9X_NUM_FSW];
|
||||||
Gruvin9xSwashRingData swashR;
|
Gruvin9xSwashRingData swashR;
|
||||||
|
|
|
@ -237,7 +237,7 @@ int Gruvin9xInterface::getCapability(const Capability capability)
|
||||||
return 9;
|
return 9;
|
||||||
case CustomFunctions:
|
case CustomFunctions:
|
||||||
return 12;
|
return 12;
|
||||||
case CustomSwitches:
|
case LogicalSwitches:
|
||||||
return 12;
|
return 12;
|
||||||
case CSFunc:
|
case CSFunc:
|
||||||
return 13;
|
return 13;
|
||||||
|
|
|
@ -293,22 +293,22 @@ RawSource open9xV4209ToSource(int8_t value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Open9xGruvin9xCustomSwData_v207::operator CustomSwData ()
|
Open9xGruvin9xLogicalSwitchData_v207::operator LogicalSwitchData ()
|
||||||
{
|
{
|
||||||
CustomSwData c9x;
|
LogicalSwitchData c9x;
|
||||||
c9x.func = func;
|
c9x.func = func;
|
||||||
c9x.val1 = v1;
|
c9x.val1 = v1;
|
||||||
c9x.val2 = v2;
|
c9x.val2 = v2;
|
||||||
|
|
||||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val1 = open9xV4207ToSource(v1).toValue();
|
c9x.val1 = open9xV4207ToSource(v1).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_EQUAL) {
|
if (c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val2 = open9xV4207ToSource(v2).toValue();
|
c9x.val2 = open9xV4207ToSource(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||||
}
|
}
|
||||||
|
@ -316,22 +316,22 @@ Open9xGruvin9xCustomSwData_v207::operator CustomSwData ()
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
Open9xGruvin9xCustomSwData_v209::operator CustomSwData ()
|
Open9xGruvin9xLogicalSwitchData_v209::operator LogicalSwitchData ()
|
||||||
{
|
{
|
||||||
CustomSwData c9x;
|
LogicalSwitchData c9x;
|
||||||
c9x.func = func;
|
c9x.func = func;
|
||||||
c9x.val1 = v1;
|
c9x.val1 = v1;
|
||||||
c9x.val2 = v2;
|
c9x.val2 = v2;
|
||||||
|
|
||||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val1 = open9xV4209ToSource(v1).toValue();
|
c9x.val1 = open9xV4209ToSource(v1).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_EQUAL && c9x.func <= CS_FN_ELESS) {
|
if (c9x.func >= LS_FN_EQUAL && c9x.func <= LS_FN_ELESS) {
|
||||||
c9x.val2 = open9xV4209ToSource(v2).toValue();
|
c9x.val2 = open9xV4209ToSource(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,27 +110,27 @@ PACK(typedef struct t_Open9xGruvin9xMixData_v211 {
|
||||||
t_Open9xGruvin9xMixData_v211() { memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v211)); }
|
t_Open9xGruvin9xMixData_v211() { memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v211)); }
|
||||||
}) Open9xGruvin9xMixData_v211;
|
}) Open9xGruvin9xMixData_v211;
|
||||||
|
|
||||||
PACK(typedef struct t_Open9xGruvin9xCustomSwData_v207 { // Custom Switches data
|
PACK(typedef struct t_Open9xGruvin9xLogicalSwitchData_v207 { // Custom Switches data
|
||||||
int8_t v1; //input
|
int8_t v1; //input
|
||||||
int8_t v2; //offset
|
int8_t v2; //offset
|
||||||
uint8_t func;
|
uint8_t func;
|
||||||
|
|
||||||
operator CustomSwData();
|
operator LogicalSwitchData();
|
||||||
t_Open9xGruvin9xCustomSwData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xCustomSwData_v207)); }
|
t_Open9xGruvin9xLogicalSwitchData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xLogicalSwitchData_v207)); }
|
||||||
int8_t fromSource(RawSource source);
|
int8_t fromSource(RawSource source);
|
||||||
RawSource toSource(int8_t value);
|
RawSource toSource(int8_t value);
|
||||||
}) Open9xGruvin9xCustomSwData_v207;
|
}) Open9xGruvin9xLogicalSwitchData_v207;
|
||||||
|
|
||||||
PACK(typedef struct t_Open9xGruvin9xCustomSwData_v209 { // Custom Switches data
|
PACK(typedef struct t_Open9xGruvin9xLogicalSwitchData_v209 { // Custom Switches data
|
||||||
int8_t v1; //input
|
int8_t v1; //input
|
||||||
int8_t v2; //offset
|
int8_t v2; //offset
|
||||||
uint8_t func;
|
uint8_t func;
|
||||||
|
|
||||||
operator CustomSwData();
|
operator LogicalSwitchData();
|
||||||
t_Open9xGruvin9xCustomSwData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xCustomSwData_v209)); }
|
t_Open9xGruvin9xLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xLogicalSwitchData_v209)); }
|
||||||
int8_t fromSource(RawSource source);
|
int8_t fromSource(RawSource source);
|
||||||
RawSource toSource(int8_t value);
|
RawSource toSource(int8_t value);
|
||||||
}) Open9xGruvin9xCustomSwData_v209;
|
}) Open9xGruvin9xLogicalSwitchData_v209;
|
||||||
|
|
||||||
PACK(typedef struct t_Open9xGruvin9xFuncSwData_v203 { // Function Switches data
|
PACK(typedef struct t_Open9xGruvin9xFuncSwData_v203 { // Function Switches data
|
||||||
int8_t swtch; // input
|
int8_t swtch; // input
|
||||||
|
@ -194,7 +194,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v207 {
|
||||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||||
Open9xGruvin9xCustomSwData_v207 customSw[O9X_NUM_CSW];
|
Open9xGruvin9xLogicalSwitchData_v207 customSw[O9X_NUM_CSW];
|
||||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||||
Open9xGruvin9xSwashRingData_v208 swashR;
|
Open9xGruvin9xSwashRingData_v208 swashR;
|
||||||
Open9xGruvin9xPhaseData_v207 phaseData[O9X_MAX_PHASES];
|
Open9xGruvin9xPhaseData_v207 phaseData[O9X_MAX_PHASES];
|
||||||
|
@ -228,7 +228,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v208 {
|
||||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||||
Open9xGruvin9xCustomSwData_v207 customSw[O9X_NUM_CSW];
|
Open9xGruvin9xLogicalSwitchData_v207 customSw[O9X_NUM_CSW];
|
||||||
Open9xGruvin9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
Open9xGruvin9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||||
Open9xGruvin9xSwashRingData_v208 swashR;
|
Open9xGruvin9xSwashRingData_v208 swashR;
|
||||||
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
||||||
|
@ -267,7 +267,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v209 {
|
||||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||||
Open9xGruvin9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||||
Open9xGruvin9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
Open9xGruvin9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||||
Open9xGruvin9xSwashRingData_v209 swashR;
|
Open9xGruvin9xSwashRingData_v209 swashR;
|
||||||
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
||||||
|
@ -307,7 +307,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v210 {
|
||||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves[O9X_MAX_CURVES];
|
int8_t curves[O9X_MAX_CURVES];
|
||||||
int8_t points[O9X_NUM_POINTS];
|
int8_t points[O9X_NUM_POINTS];
|
||||||
Open9xGruvin9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||||
Open9xGruvin9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
Open9xGruvin9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
||||||
Open9xGruvin9xSwashRingData_v209 swashR;
|
Open9xGruvin9xSwashRingData_v209 swashR;
|
||||||
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
||||||
|
@ -345,7 +345,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v211 {
|
||||||
Open9xExpoData_v211 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v211 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves[O9X_MAX_CURVES];
|
int8_t curves[O9X_MAX_CURVES];
|
||||||
int8_t points[O9X_NUM_POINTS];
|
int8_t points[O9X_NUM_POINTS];
|
||||||
Open9xGruvin9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||||
Open9xGruvin9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
Open9xGruvin9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
||||||
Open9xGruvin9xSwashRingData_v209 swashR;
|
Open9xGruvin9xSwashRingData_v209 swashR;
|
||||||
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
||||||
|
|
|
@ -501,22 +501,22 @@ t_Open9xArmMixData_v212::operator MixData ()
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
t_Open9xArmCustomSwData_v208::operator CustomSwData ()
|
t_Open9xArmLogicalSwitchData_v208::operator LogicalSwitchData ()
|
||||||
{
|
{
|
||||||
CustomSwData c9x;
|
LogicalSwitchData c9x;
|
||||||
c9x.func = func;
|
c9x.func = func;
|
||||||
c9x.val1 = v1;
|
c9x.val1 = v1;
|
||||||
c9x.val2 = v2;
|
c9x.val2 = v2;
|
||||||
|
|
||||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val1 = open9xArm208ToSource(v1).toValue();
|
c9x.val1 = open9xArm208ToSource(v1).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_EQUAL) {
|
if (c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val2 = open9xArm208ToSource(v2).toValue();
|
c9x.val2 = open9xArm208ToSource(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||||
c9x.val1 = open9xArmToSwitch(v1).toValue();
|
c9x.val1 = open9xArmToSwitch(v1).toValue();
|
||||||
c9x.val2 = open9xArmToSwitch(v2).toValue();
|
c9x.val2 = open9xArmToSwitch(v2).toValue();
|
||||||
}
|
}
|
||||||
|
@ -524,22 +524,22 @@ t_Open9xArmCustomSwData_v208::operator CustomSwData ()
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
t_Open9xArmCustomSwData_v209::operator CustomSwData ()
|
t_Open9xArmLogicalSwitchData_v209::operator LogicalSwitchData ()
|
||||||
{
|
{
|
||||||
CustomSwData c9x;
|
LogicalSwitchData c9x;
|
||||||
c9x.func = func;
|
c9x.func = func;
|
||||||
c9x.val1 = v1;
|
c9x.val1 = v1;
|
||||||
c9x.val2 = v2;
|
c9x.val2 = v2;
|
||||||
|
|
||||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val1 = open9xArm209ToSource(v1).toValue();
|
c9x.val1 = open9xArm209ToSource(v1).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_EQUAL) {
|
if (c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val2 = open9xArm209ToSource(v2).toValue();
|
c9x.val2 = open9xArm209ToSource(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||||
c9x.val1 = open9xArmToSwitch(v1).toValue();
|
c9x.val1 = open9xArmToSwitch(v1).toValue();
|
||||||
c9x.val2 = open9xArmToSwitch(v2).toValue();
|
c9x.val2 = open9xArmToSwitch(v2).toValue();
|
||||||
}
|
}
|
||||||
|
@ -547,24 +547,24 @@ t_Open9xArmCustomSwData_v209::operator CustomSwData ()
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
t_Open9xArmCustomSwData_v210::operator CustomSwData ()
|
t_Open9xArmLogicalSwitchData_v210::operator LogicalSwitchData ()
|
||||||
{
|
{
|
||||||
CustomSwData c9x;
|
LogicalSwitchData c9x;
|
||||||
c9x.func = func;
|
c9x.func = func;
|
||||||
c9x.val1 = v1;
|
c9x.val1 = v1;
|
||||||
c9x.val2 = v2;
|
c9x.val2 = v2;
|
||||||
c9x.delay = delay;
|
c9x.delay = delay;
|
||||||
c9x.duration = duration;
|
c9x.duration = duration;
|
||||||
|
|
||||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val1 = open9xArm210ToSource(v1).toValue();
|
c9x.val1 = open9xArm210ToSource(v1).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_EQUAL && c9x.func <= CS_FN_ELESS) {
|
if (c9x.func >= LS_FN_EQUAL && c9x.func <= LS_FN_ELESS) {
|
||||||
c9x.val2 = open9xArm210ToSource(v2).toValue();
|
c9x.val2 = open9xArm210ToSource(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||||
c9x.val1 = open9xArmToSwitch(v1).toValue();
|
c9x.val1 = open9xArmToSwitch(v1).toValue();
|
||||||
c9x.val2 = open9xArmToSwitch(v2).toValue();
|
c9x.val2 = open9xArmToSwitch(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,34 +190,34 @@ PACK(typedef struct t_Open9xArmPhaseData_v212 {
|
||||||
t_Open9xArmPhaseData_v212() { memset(this, 0, sizeof(t_Open9xArmPhaseData_v212)); }
|
t_Open9xArmPhaseData_v212() { memset(this, 0, sizeof(t_Open9xArmPhaseData_v212)); }
|
||||||
}) Open9xArmPhaseData_v212;
|
}) Open9xArmPhaseData_v212;
|
||||||
|
|
||||||
PACK(typedef struct t_Open9xArmCustomSwData_v208 { // Custom Switches data
|
PACK(typedef struct t_Open9xArmLogicalSwitchData_v208 { // Custom Switches data
|
||||||
int8_t v1; //input
|
int8_t v1; //input
|
||||||
int8_t v2; //offset
|
int8_t v2; //offset
|
||||||
uint8_t func;
|
uint8_t func;
|
||||||
|
|
||||||
operator CustomSwData();
|
operator LogicalSwitchData();
|
||||||
t_Open9xArmCustomSwData_v208() { memset(this, 0, sizeof(t_Open9xArmCustomSwData_v208)); }
|
t_Open9xArmLogicalSwitchData_v208() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v208)); }
|
||||||
}) Open9xArmCustomSwData_v208;
|
}) Open9xArmLogicalSwitchData_v208;
|
||||||
|
|
||||||
PACK(typedef struct t_Open9xArmCustomSwData_v209 { // Custom Switches data
|
PACK(typedef struct t_Open9xArmLogicalSwitchData_v209 { // Custom Switches data
|
||||||
int8_t v1; //input
|
int8_t v1; //input
|
||||||
int8_t v2; //offset
|
int8_t v2; //offset
|
||||||
uint8_t func;
|
uint8_t func;
|
||||||
|
|
||||||
operator CustomSwData();
|
operator LogicalSwitchData();
|
||||||
t_Open9xArmCustomSwData_v209() { memset(this, 0, sizeof(t_Open9xArmCustomSwData_v209)); }
|
t_Open9xArmLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v209)); }
|
||||||
}) Open9xArmCustomSwData_v209;
|
}) Open9xArmLogicalSwitchData_v209;
|
||||||
|
|
||||||
PACK(typedef struct t_Open9xArmCustomSwData_v210 { // Custom Switches data
|
PACK(typedef struct t_Open9xArmLogicalSwitchData_v210 { // Custom Switches data
|
||||||
int8_t v1; //input
|
int8_t v1; //input
|
||||||
int8_t v2; //offset
|
int8_t v2; //offset
|
||||||
uint8_t func;
|
uint8_t func;
|
||||||
uint8_t delay;
|
uint8_t delay;
|
||||||
uint8_t duration;
|
uint8_t duration;
|
||||||
|
|
||||||
operator CustomSwData();
|
operator LogicalSwitchData();
|
||||||
t_Open9xArmCustomSwData_v210() { memset(this, 0, sizeof(t_Open9xArmCustomSwData_v210)); }
|
t_Open9xArmLogicalSwitchData_v210() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v210)); }
|
||||||
}) Open9xArmCustomSwData_v210;
|
}) Open9xArmLogicalSwitchData_v210;
|
||||||
|
|
||||||
PACK(typedef struct t_Open9xArmFuncSwData_v208 { // Function Switches data
|
PACK(typedef struct t_Open9xArmFuncSwData_v208 { // Function Switches data
|
||||||
int8_t swtch; // input
|
int8_t swtch; // input
|
||||||
|
@ -343,7 +343,7 @@ PACK(typedef struct t_Open9xArmModelData_v208 {
|
||||||
Open9xArmExpoData_v208 expoData[O9X_ARM_MAX_EXPOS];
|
Open9xArmExpoData_v208 expoData[O9X_ARM_MAX_EXPOS];
|
||||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||||
Open9xArmCustomSwData_v208 customSw[O9X_ARM_NUM_CSW];
|
Open9xArmLogicalSwitchData_v208 customSw[O9X_ARM_NUM_CSW];
|
||||||
Open9xArmFuncSwData_v208 funcSw[O9X_ARM_NUM_FSW];
|
Open9xArmFuncSwData_v208 funcSw[O9X_ARM_NUM_FSW];
|
||||||
Open9xArmSwashRingData_v208 swashR;
|
Open9xArmSwashRingData_v208 swashR;
|
||||||
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
||||||
|
@ -382,7 +382,7 @@ PACK(typedef struct t_Open9xArmModelData_v209 {
|
||||||
Open9xArmExpoData_v208 expoData[O9X_ARM_MAX_EXPOS];
|
Open9xArmExpoData_v208 expoData[O9X_ARM_MAX_EXPOS];
|
||||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||||
Open9xArmCustomSwData_v209 customSw[O9X_ARM_NUM_CSW];
|
Open9xArmLogicalSwitchData_v209 customSw[O9X_ARM_NUM_CSW];
|
||||||
Open9xArmFuncSwData_v208 funcSw[O9X_ARM_NUM_FSW];
|
Open9xArmFuncSwData_v208 funcSw[O9X_ARM_NUM_FSW];
|
||||||
Open9xArmSwashRingData_v209 swashR;
|
Open9xArmSwashRingData_v209 swashR;
|
||||||
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
||||||
|
@ -422,7 +422,7 @@ PACK(typedef struct t_Open9xArmModelData_v210 {
|
||||||
Open9xArmExpoData_v210 expoData[O9X_ARM_MAX_EXPOS];
|
Open9xArmExpoData_v210 expoData[O9X_ARM_MAX_EXPOS];
|
||||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||||
Open9xArmCustomSwData_v210 customSw[O9X_ARM_NUM_CSW];
|
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||||
Open9xArmFuncSwData_v210 funcSw[O9X_ARM_NUM_FSW];
|
Open9xArmFuncSwData_v210 funcSw[O9X_ARM_NUM_FSW];
|
||||||
Open9xArmSwashRingData_v209 swashR;
|
Open9xArmSwashRingData_v209 swashR;
|
||||||
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
||||||
|
@ -461,7 +461,7 @@ PACK(typedef struct t_Open9xArmModelData_v211 {
|
||||||
Open9xArmExpoData_v210 expoData[O9X_ARM_MAX_EXPOS];
|
Open9xArmExpoData_v210 expoData[O9X_ARM_MAX_EXPOS];
|
||||||
int16_t curves[O9X_ARM_MAX_CURVES];
|
int16_t curves[O9X_ARM_MAX_CURVES];
|
||||||
int8_t points[O9X_ARM_NUM_POINTS];
|
int8_t points[O9X_ARM_NUM_POINTS];
|
||||||
Open9xArmCustomSwData_v210 customSw[O9X_ARM_NUM_CSW];
|
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||||
Open9xArmFuncSwData_v211 funcSw[O9X_ARM_NUM_FSW];
|
Open9xArmFuncSwData_v211 funcSw[O9X_ARM_NUM_FSW];
|
||||||
Open9xArmSwashRingData_v209 swashR;
|
Open9xArmSwashRingData_v209 swashR;
|
||||||
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
||||||
|
@ -499,7 +499,7 @@ PACK(typedef struct t_Open9xArmModelData_v212 {
|
||||||
Open9xArmExpoData_v212 expoData[O9X_ARM_MAX_EXPOS];
|
Open9xArmExpoData_v212 expoData[O9X_ARM_MAX_EXPOS];
|
||||||
int16_t curves[O9X_ARM_MAX_CURVES];
|
int16_t curves[O9X_ARM_MAX_CURVES];
|
||||||
int8_t points[O9X_ARM_NUM_POINTS];
|
int8_t points[O9X_ARM_NUM_POINTS];
|
||||||
Open9xArmCustomSwData_v210 customSw[O9X_ARM_NUM_CSW];
|
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||||
Open9xArmFuncSwData_v211 funcSw[O9X_ARM_NUM_FSW];
|
Open9xArmFuncSwData_v211 funcSw[O9X_ARM_NUM_FSW];
|
||||||
Open9xArmSwashRingData_v210 swashR;
|
Open9xArmSwashRingData_v210 swashR;
|
||||||
Open9xArmPhaseData_v212 phaseData[O9X_ARM_MAX_PHASES];
|
Open9xArmPhaseData_v212 phaseData[O9X_ARM_MAX_PHASES];
|
||||||
|
|
|
@ -518,22 +518,22 @@ RawSource open9xStock209ToSource(int8_t value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Open9xCustomSwData_v208::operator CustomSwData ()
|
Open9xLogicalSwitchData_v208::operator LogicalSwitchData ()
|
||||||
{
|
{
|
||||||
CustomSwData c9x;
|
LogicalSwitchData c9x;
|
||||||
c9x.func = func;
|
c9x.func = func;
|
||||||
c9x.val1 = v1;
|
c9x.val1 = v1;
|
||||||
c9x.val2 = v2;
|
c9x.val2 = v2;
|
||||||
|
|
||||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val1 = open9x208ToSource(v1).toValue();
|
c9x.val1 = open9x208ToSource(v1).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_EQUAL) {
|
if (c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val2 = open9x208ToSource(v2).toValue();
|
c9x.val2 = open9x208ToSource(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||||
}
|
}
|
||||||
|
@ -541,22 +541,22 @@ Open9xCustomSwData_v208::operator CustomSwData ()
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
Open9xCustomSwData_v209::operator CustomSwData ()
|
Open9xLogicalSwitchData_v209::operator LogicalSwitchData ()
|
||||||
{
|
{
|
||||||
CustomSwData c9x;
|
LogicalSwitchData c9x;
|
||||||
c9x.func = func;
|
c9x.func = func;
|
||||||
c9x.val1 = v1;
|
c9x.val1 = v1;
|
||||||
c9x.val2 = v2;
|
c9x.val2 = v2;
|
||||||
|
|
||||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val1 = open9xStock209ToSource(v1).toValue();
|
c9x.val1 = open9xStock209ToSource(v1).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_EQUAL && c9x.func <= CS_FN_ELESS) {
|
if (c9x.func >= LS_FN_EQUAL && c9x.func <= LS_FN_ELESS) {
|
||||||
c9x.val2 = open9xStock209ToSource(v2).toValue();
|
c9x.val2 = open9xStock209ToSource(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,24 +221,24 @@ PACK(typedef struct t_Open9xMixData_v211 {
|
||||||
t_Open9xMixData_v211() { memset(this, 0, sizeof(t_Open9xMixData_v211)); }
|
t_Open9xMixData_v211() { memset(this, 0, sizeof(t_Open9xMixData_v211)); }
|
||||||
}) Open9xMixData_v211;
|
}) Open9xMixData_v211;
|
||||||
|
|
||||||
PACK(typedef struct t_Open9xCustomSwData_v208 { // Custom Switches data
|
PACK(typedef struct t_Open9xLogicalSwitchData_v208 { // Custom Switches data
|
||||||
int8_t v1; //input
|
int8_t v1; //input
|
||||||
int8_t v2; //offset
|
int8_t v2; //offset
|
||||||
uint8_t func;
|
uint8_t func;
|
||||||
|
|
||||||
operator CustomSwData();
|
operator LogicalSwitchData();
|
||||||
t_Open9xCustomSwData_v208() { memset(this, 0, sizeof(t_Open9xCustomSwData_v208)); }
|
t_Open9xLogicalSwitchData_v208() { memset(this, 0, sizeof(t_Open9xLogicalSwitchData_v208)); }
|
||||||
t_Open9xCustomSwData_v208(CustomSwData&);
|
t_Open9xLogicalSwitchData_v208(LogicalSwitchData&);
|
||||||
}) Open9xCustomSwData_v208;
|
}) Open9xLogicalSwitchData_v208;
|
||||||
|
|
||||||
PACK(typedef struct t_Open9xCustomSwData_v209 { // Custom Switches data
|
PACK(typedef struct t_Open9xLogicalSwitchData_v209 { // Custom Switches data
|
||||||
int8_t v1; //input
|
int8_t v1; //input
|
||||||
int8_t v2; //offset
|
int8_t v2; //offset
|
||||||
uint8_t func;
|
uint8_t func;
|
||||||
|
|
||||||
operator CustomSwData();
|
operator LogicalSwitchData();
|
||||||
t_Open9xCustomSwData_v209() { memset(this, 0, sizeof(t_Open9xCustomSwData_v209)); }
|
t_Open9xLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xLogicalSwitchData_v209)); }
|
||||||
}) Open9xCustomSwData_v209;
|
}) Open9xLogicalSwitchData_v209;
|
||||||
|
|
||||||
PACK(typedef struct t_Open9xSafetySwData { // Safety Switches data
|
PACK(typedef struct t_Open9xSafetySwData { // Safety Switches data
|
||||||
int8_t swtch;
|
int8_t swtch;
|
||||||
|
@ -516,7 +516,7 @@ PACK(typedef struct t_Open9xModelData_v201 {
|
||||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||||
Open9xSafetySwData safetySw[O9X_NUM_CHNOUT];
|
Open9xSafetySwData safetySw[O9X_NUM_CHNOUT];
|
||||||
Open9xFuncSwData_v201 funcSw[12];
|
Open9xFuncSwData_v201 funcSw[12];
|
||||||
Open9xSwashRingData_v208 swashR;
|
Open9xSwashRingData_v208 swashR;
|
||||||
|
@ -547,7 +547,7 @@ PACK(typedef struct t_Open9xModelData_v202 {
|
||||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||||
Open9xSafetySwData safetySw[O9X_NUM_CHNOUT];
|
Open9xSafetySwData safetySw[O9X_NUM_CHNOUT];
|
||||||
Open9xFuncSwData_v201 funcSw[12];
|
Open9xFuncSwData_v201 funcSw[12];
|
||||||
Open9xSwashRingData_v208 swashR;
|
Open9xSwashRingData_v208 swashR;
|
||||||
|
@ -581,7 +581,7 @@ PACK(typedef struct t_Open9xModelData_v203 {
|
||||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||||
Open9xSwashRingData_v208 swashR;
|
Open9xSwashRingData_v208 swashR;
|
||||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||||
|
@ -614,7 +614,7 @@ PACK(typedef struct t_Open9xModelData_v204 {
|
||||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||||
Open9xSwashRingData_v208 swashR;
|
Open9xSwashRingData_v208 swashR;
|
||||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||||
|
@ -647,7 +647,7 @@ PACK(typedef struct t_Open9xModelData_v205 {
|
||||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||||
Open9xSwashRingData_v208 swashR;
|
Open9xSwashRingData_v208 swashR;
|
||||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||||
|
@ -682,7 +682,7 @@ PACK(typedef struct t_Open9xModelData_v208 {
|
||||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||||
Open9xSwashRingData_v208 swashR;
|
Open9xSwashRingData_v208 swashR;
|
||||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||||
|
@ -721,7 +721,7 @@ PACK(typedef struct t_Open9xModelData_v209 {
|
||||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||||
Open9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||||
Open9xSwashRingData_v209 swashR;
|
Open9xSwashRingData_v209 swashR;
|
||||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||||
|
@ -761,7 +761,7 @@ PACK(typedef struct t_Open9xModelData_v210 {
|
||||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves[O9X_MAX_CURVES];
|
int8_t curves[O9X_MAX_CURVES];
|
||||||
int8_t points[O9X_NUM_POINTS];
|
int8_t points[O9X_NUM_POINTS];
|
||||||
Open9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||||
Open9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
Open9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
||||||
Open9xSwashRingData_v209 swashR;
|
Open9xSwashRingData_v209 swashR;
|
||||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||||
|
@ -799,7 +799,7 @@ PACK(typedef struct t_Open9xModelData_v211 {
|
||||||
Open9xExpoData_v211 expoData[O9X_MAX_EXPOS];
|
Open9xExpoData_v211 expoData[O9X_MAX_EXPOS];
|
||||||
int8_t curves[O9X_MAX_CURVES];
|
int8_t curves[O9X_MAX_CURVES];
|
||||||
int8_t points[O9X_NUM_POINTS];
|
int8_t points[O9X_NUM_POINTS];
|
||||||
Open9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||||
Open9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
Open9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
||||||
Open9xSwashRingData_v209 swashR;
|
Open9xSwashRingData_v209 swashR;
|
||||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||||
|
|
|
@ -1045,39 +1045,39 @@ class CurvesField: public TransformedField {
|
||||||
int _points[C9X_MAX_CURVES*C9X_MAX_POINTS*2];
|
int _points[C9X_MAX_CURVES*C9X_MAX_POINTS*2];
|
||||||
};
|
};
|
||||||
|
|
||||||
class CustomSwitchesFunctionsTable: public ConversionTable {
|
class LogicalSwitchesFunctionsTable: public ConversionTable {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CustomSwitchesFunctionsTable(BoardEnum board, unsigned int version)
|
LogicalSwitchesFunctionsTable(BoardEnum board, unsigned int version)
|
||||||
{
|
{
|
||||||
int val=0;
|
int val=0;
|
||||||
bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version);
|
bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version);
|
||||||
addConversion(CS_FN_OFF, val++);
|
addConversion(LS_FN_OFF, val++);
|
||||||
if (release21March2013)
|
if (release21March2013)
|
||||||
addConversion(CS_FN_VEQUAL, val++);
|
addConversion(LS_FN_VEQUAL, val++);
|
||||||
addConversion(CS_FN_VPOS, val++);
|
addConversion(LS_FN_VPOS, val++);
|
||||||
addConversion(CS_FN_VNEG, val++);
|
addConversion(LS_FN_VNEG, val++);
|
||||||
if (IS_ARM(board) && version >= 216) val++; // later RANGE
|
if (IS_ARM(board) && version >= 216) val++; // later RANGE
|
||||||
addConversion(CS_FN_APOS, val++);
|
addConversion(LS_FN_APOS, val++);
|
||||||
addConversion(CS_FN_ANEG, val++);
|
addConversion(LS_FN_ANEG, val++);
|
||||||
addConversion(CS_FN_AND, val++);
|
addConversion(LS_FN_AND, val++);
|
||||||
addConversion(CS_FN_OR, val++);
|
addConversion(LS_FN_OR, val++);
|
||||||
addConversion(CS_FN_XOR, val++);
|
addConversion(LS_FN_XOR, val++);
|
||||||
if (IS_ARM(board) && version >= 216) addConversion(CS_FN_STAY, val++);
|
if (IS_ARM(board) && version >= 216) addConversion(LS_FN_STAY, val++);
|
||||||
addConversion(CS_FN_EQUAL, val++);
|
addConversion(LS_FN_EQUAL, val++);
|
||||||
if (!release21March2013)
|
if (!release21March2013)
|
||||||
addConversion(CS_FN_NEQUAL, val++);
|
addConversion(LS_FN_NEQUAL, val++);
|
||||||
addConversion(CS_FN_GREATER, val++);
|
addConversion(LS_FN_GREATER, val++);
|
||||||
addConversion(CS_FN_LESS, val++);
|
addConversion(LS_FN_LESS, val++);
|
||||||
if (!release21March2013) {
|
if (!release21March2013) {
|
||||||
addConversion(CS_FN_EGREATER, val++);
|
addConversion(LS_FN_EGREATER, val++);
|
||||||
addConversion(CS_FN_ELESS, val++);
|
addConversion(LS_FN_ELESS, val++);
|
||||||
}
|
}
|
||||||
addConversion(CS_FN_DPOS, val++);
|
addConversion(LS_FN_DPOS, val++);
|
||||||
addConversion(CS_FN_DAPOS, val++);
|
addConversion(LS_FN_DAPOS, val++);
|
||||||
addConversion(CS_FN_TIMER, val++);
|
addConversion(LS_FN_TIMER, val++);
|
||||||
if (version >= 216)
|
if (version >= 216)
|
||||||
addConversion(CS_FN_STICKY, val++);
|
addConversion(LS_FN_STICKY, val++);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1153,11 +1153,11 @@ class AndSwitchesConversionTable: public ConversionTable {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CustomSwitchField: public TransformedField {
|
class LogicalSwitchField: public TransformedField {
|
||||||
public:
|
public:
|
||||||
CustomSwitchField(CustomSwData & csw, BoardEnum board, unsigned int version, unsigned int variant):
|
LogicalSwitchField(LogicalSwitchData & csw, BoardEnum board, unsigned int version, unsigned int variant):
|
||||||
TransformedField(internalField),
|
TransformedField(internalField),
|
||||||
internalField("CustomSwitch"),
|
internalField("LogicalSwitch"),
|
||||||
csw(csw),
|
csw(csw),
|
||||||
board(board),
|
board(board),
|
||||||
version(version),
|
version(version),
|
||||||
|
@ -1202,21 +1202,21 @@ class CustomSwitchField: public TransformedField {
|
||||||
|
|
||||||
virtual void beforeExport()
|
virtual void beforeExport()
|
||||||
{
|
{
|
||||||
if (csw.func == CS_FN_STAY) {
|
if (csw.func == LS_FN_STAY) {
|
||||||
switchesConversionTable->exportValue(csw.val1, v1);
|
switchesConversionTable->exportValue(csw.val1, v1);
|
||||||
v2 = csw.val2;
|
v2 = csw.val2;
|
||||||
v3 = csw.val3;
|
v3 = csw.val3;
|
||||||
}
|
}
|
||||||
else if ((csw.func >= CS_FN_AND && csw.func <= CS_FN_XOR) || csw.func == CS_FN_STICKY) {
|
else if ((csw.func >= LS_FN_AND && csw.func <= LS_FN_XOR) || csw.func == LS_FN_STICKY) {
|
||||||
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) {
|
else if (csw.func >= LS_FN_EQUAL && csw.func <= LS_FN_ELESS) {
|
||||||
sourcesConversionTable->exportValue(csw.val1, v1);
|
sourcesConversionTable->exportValue(csw.val1, v1);
|
||||||
sourcesConversionTable->exportValue(csw.val2, v2);
|
sourcesConversionTable->exportValue(csw.val2, v2);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((csw.func >= CS_FN_VPOS && csw.func <= CS_FN_ANEG) || (csw.func >= CS_FN_EQUAL && csw.func!=CS_FN_TIMER))
|
if ((csw.func >= LS_FN_VPOS && csw.func <= LS_FN_ANEG) || (csw.func >= LS_FN_EQUAL && csw.func!=LS_FN_TIMER))
|
||||||
sourcesConversionTable->exportValue(csw.val1, v1);
|
sourcesConversionTable->exportValue(csw.val1, v1);
|
||||||
else
|
else
|
||||||
v1 = csw.val1;
|
v1 = csw.val1;
|
||||||
|
@ -1226,21 +1226,21 @@ class CustomSwitchField: public TransformedField {
|
||||||
|
|
||||||
virtual void afterImport()
|
virtual void afterImport()
|
||||||
{
|
{
|
||||||
if (csw.func == CS_FN_STAY) {
|
if (csw.func == LS_FN_STAY) {
|
||||||
switchesConversionTable->importValue(v1, csw.val1);
|
switchesConversionTable->importValue(v1, csw.val1);
|
||||||
csw.val2 = v2;
|
csw.val2 = v2;
|
||||||
csw.val3 = v3;
|
csw.val3 = v3;
|
||||||
}
|
}
|
||||||
else if ((csw.func >= CS_FN_AND && csw.func <= CS_FN_XOR) || csw.func == CS_FN_STICKY) {
|
else if ((csw.func >= LS_FN_AND && csw.func <= LS_FN_XOR) || csw.func == LS_FN_STICKY) {
|
||||||
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) {
|
else if (csw.func >= LS_FN_EQUAL && csw.func <= LS_FN_ELESS) {
|
||||||
sourcesConversionTable->importValue(v1, csw.val1);
|
sourcesConversionTable->importValue(v1, csw.val1);
|
||||||
sourcesConversionTable->importValue(v2, csw.val2);
|
sourcesConversionTable->importValue(v2, csw.val2);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((csw.func >= CS_FN_VPOS && csw.func <= CS_FN_ANEG) || (csw.func >= CS_FN_EQUAL && csw.func!=CS_FN_TIMER))
|
if ((csw.func >= LS_FN_VPOS && csw.func <= LS_FN_ANEG) || (csw.func >= LS_FN_EQUAL && csw.func!=LS_FN_TIMER))
|
||||||
sourcesConversionTable->importValue(v1, csw.val1);
|
sourcesConversionTable->importValue(v1, csw.val1);
|
||||||
else
|
else
|
||||||
csw.val1 = v1;
|
csw.val1 = v1;
|
||||||
|
@ -1250,11 +1250,11 @@ class CustomSwitchField: public TransformedField {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
StructField internalField;
|
StructField internalField;
|
||||||
CustomSwData & csw;
|
LogicalSwitchData & csw;
|
||||||
BoardEnum board;
|
BoardEnum board;
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
unsigned int variant;
|
unsigned int variant;
|
||||||
CustomSwitchesFunctionsTable functionsConversionTable;
|
LogicalSwitchesFunctionsTable functionsConversionTable;
|
||||||
SourcesConversionTable * sourcesConversionTable;
|
SourcesConversionTable * sourcesConversionTable;
|
||||||
SwitchesConversionTable * switchesConversionTable;
|
SwitchesConversionTable * switchesConversionTable;
|
||||||
ConversionTable * andswitchesConversionTable;
|
ConversionTable * andswitchesConversionTable;
|
||||||
|
@ -2087,7 +2087,7 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
||||||
internalField.Append(new ExpoField(modelData.expoData[i], board, version));
|
internalField.Append(new ExpoField(modelData.expoData[i], board, version));
|
||||||
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 LogicalSwitchField(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++) {
|
||||||
if (IS_ARM(board))
|
if (IS_ARM(board))
|
||||||
internalField.Append(new ArmCustomFunctionField(modelData.funcSw[i], board, version, variant));
|
internalField.Append(new ArmCustomFunctionField(modelData.funcSw[i], board, version, variant));
|
||||||
|
|
|
@ -526,7 +526,7 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||||
return 24;
|
return 24;
|
||||||
else
|
else
|
||||||
return 16;
|
return 16;
|
||||||
case CustomSwitches:
|
case LogicalSwitches:
|
||||||
if (IS_ARM(board))
|
if (IS_ARM(board))
|
||||||
return 32;
|
return 32;
|
||||||
else if (board==BOARD_GRUVIN9X||board==BOARD_M128)
|
else if (board==BOARD_GRUVIN9X||board==BOARD_M128)
|
||||||
|
@ -535,10 +535,10 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||||
return 12;
|
return 12;
|
||||||
case CustomAndSwitches:
|
case CustomAndSwitches:
|
||||||
if (IS_ARM(board))
|
if (IS_ARM(board))
|
||||||
return getCapability(CustomSwitches);
|
return getCapability(LogicalSwitches);
|
||||||
else
|
else
|
||||||
return 15/*4bits*/-9/*sw positions*/;
|
return 15/*4bits*/-9/*sw positions*/;
|
||||||
case CustomSwitchesExt:
|
case LogicalSwitchesExt:
|
||||||
return (IS_ARM(board) ? true : false);
|
return (IS_ARM(board) ? true : false);
|
||||||
case RotaryEncoders:
|
case RotaryEncoders:
|
||||||
if (board == BOARD_GRUVIN9X)
|
if (board == BOARD_GRUVIN9X)
|
||||||
|
|
|
@ -169,22 +169,22 @@ t_Th9xMixData::operator MixData ()
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
t_Th9xCustomSwData::operator CustomSwData ()
|
t_Th9xLogicalSwitchData::operator LogicalSwitchData ()
|
||||||
{
|
{
|
||||||
CustomSwData c9x;
|
LogicalSwitchData c9x;
|
||||||
c9x.func = opCmp;
|
c9x.func = opCmp;
|
||||||
c9x.val1 = val1;
|
c9x.val1 = val1;
|
||||||
c9x.val2 = val2;
|
c9x.val2 = val2;
|
||||||
|
|
||||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val1 = toSource(val1).toValue();
|
c9x.val1 = toSource(val1).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_EQUAL) {
|
if (c9x.func >= LS_FN_EQUAL) {
|
||||||
c9x.val2 = toSource(val2).toValue();
|
c9x.val2 = toSource(val2).toValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||||
c9x.val1 = th9xToSwitch(val1).toValue();
|
c9x.val1 = th9xToSwitch(val1).toValue();
|
||||||
c9x.val2 = th9xToSwitch(val2).toValue();
|
c9x.val2 = th9xToSwitch(val2).toValue();
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ t_Th9xCustomSwData::operator CustomSwData ()
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t t_Th9xCustomSwData::fromSource(RawSource source)
|
int8_t t_Th9xLogicalSwitchData::fromSource(RawSource source)
|
||||||
{
|
{
|
||||||
int v1 = 0;
|
int v1 = 0;
|
||||||
if (source.type == SOURCE_TYPE_STICK)
|
if (source.type == SOURCE_TYPE_STICK)
|
||||||
|
@ -216,7 +216,7 @@ int8_t t_Th9xCustomSwData::fromSource(RawSource source)
|
||||||
return v1;
|
return v1;
|
||||||
}
|
}
|
||||||
|
|
||||||
RawSource t_Th9xCustomSwData::toSource(int8_t value)
|
RawSource t_Th9xLogicalSwitchData::toSource(int8_t value)
|
||||||
{
|
{
|
||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
return RawSource(SOURCE_TYPE_NONE);
|
return RawSource(SOURCE_TYPE_NONE);
|
||||||
|
|
|
@ -138,18 +138,18 @@ PACK(typedef struct t_Th9xMixData {
|
||||||
t_Th9xMixData();
|
t_Th9xMixData();
|
||||||
}) Th9xMixData;
|
}) Th9xMixData;
|
||||||
|
|
||||||
PACK(typedef struct t_Th9xCustomSwData {
|
PACK(typedef struct t_Th9xLogicalSwitchData {
|
||||||
uint8_t sw:3; // 0..7
|
uint8_t sw:3; // 0..7
|
||||||
uint8_t opCmp:2; // < & | ^
|
uint8_t opCmp:2; // < & | ^
|
||||||
uint8_t opRes:3; // 0 => 1=> 0=> !=> & | ^
|
uint8_t opRes:3; // 0 => 1=> 0=> !=> & | ^
|
||||||
int8_t val1;
|
int8_t val1;
|
||||||
int8_t val2;
|
int8_t val2;
|
||||||
|
|
||||||
operator CustomSwData();
|
operator LogicalSwitchData();
|
||||||
t_Th9xCustomSwData() { memset(this, 0, sizeof(t_Th9xCustomSwData)); }
|
t_Th9xLogicalSwitchData() { memset(this, 0, sizeof(t_Th9xLogicalSwitchData)); }
|
||||||
int8_t fromSource(RawSource source);
|
int8_t fromSource(RawSource source);
|
||||||
RawSource toSource(int8_t value);
|
RawSource toSource(int8_t value);
|
||||||
}) Th9xCustomSwData;
|
}) Th9xLogicalSwitchData;
|
||||||
|
|
||||||
PACK(typedef struct t_Th9xTrimData {
|
PACK(typedef struct t_Th9xTrimData {
|
||||||
int8_t itrim:6; //trim index
|
int8_t itrim:6; //trim index
|
||||||
|
@ -173,7 +173,7 @@ PACK(typedef struct t_Th9xModelData {
|
||||||
int8_t curves3[TH9X_MAX_CURVES3][3]; // 9 new143
|
int8_t curves3[TH9X_MAX_CURVES3][3]; // 9 new143
|
||||||
int8_t curves5[TH9X_MAX_CURVES5][5]; // 10
|
int8_t curves5[TH9X_MAX_CURVES5][5]; // 10
|
||||||
int8_t curves9[TH9X_MAX_CURVES9][9]; // 18
|
int8_t curves9[TH9X_MAX_CURVES9][9]; // 18
|
||||||
Th9xCustomSwData switchTab[TH9X_MAX_SWITCHES];//
|
Th9xLogicalSwitchData switchTab[TH9X_MAX_SWITCHES];//
|
||||||
Th9xTrimData trimData[NUM_STICKS]; // 3*4 -> 1*4
|
Th9xTrimData trimData[NUM_STICKS]; // 3*4 -> 1*4
|
||||||
operator ModelData();
|
operator ModelData();
|
||||||
t_Th9xModelData();
|
t_Th9xModelData();
|
||||||
|
|
|
@ -157,7 +157,7 @@ int Th9xInterface::getCapability(const Capability capability)
|
||||||
return 9;
|
return 9;
|
||||||
case CustomFunctions:
|
case CustomFunctions:
|
||||||
return 0;
|
return 0;
|
||||||
case CustomSwitches:
|
case LogicalSwitches:
|
||||||
return TH9X_MAX_SWITCHES;
|
return TH9X_MAX_SWITCHES;
|
||||||
case Outputs:
|
case Outputs:
|
||||||
return 8;
|
return 8;
|
||||||
|
|
|
@ -407,7 +407,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=-GetEepromInterface()->getCapability(CustomSwitches); i<0; i++) {
|
for (int i=-GetEepromInterface()->getCapability(LogicalSwitches); i<0; i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||||
|
@ -474,7 +474,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=1; i<=GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
for (int i=1; i<=GetEepromInterface()->getCapability(LogicalSwitches); i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||||
|
@ -582,7 +582,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
|
||||||
item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i);
|
item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||||
|
@ -656,33 +656,33 @@ int TimToVal(float value)
|
||||||
void populateCSWCB(QComboBox *b, int value)
|
void populateCSWCB(QComboBox *b, int value)
|
||||||
{
|
{
|
||||||
int order[] = {
|
int order[] = {
|
||||||
CS_FN_OFF,
|
LS_FN_OFF,
|
||||||
CS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
LS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
||||||
CS_FN_VPOS,
|
LS_FN_VPOS,
|
||||||
CS_FN_VNEG,
|
LS_FN_VNEG,
|
||||||
// CS_FN_RANGE,
|
// LS_FN_RANGE,
|
||||||
CS_FN_APOS,
|
LS_FN_APOS,
|
||||||
CS_FN_ANEG,
|
LS_FN_ANEG,
|
||||||
CS_FN_AND,
|
LS_FN_AND,
|
||||||
CS_FN_OR,
|
LS_FN_OR,
|
||||||
CS_FN_XOR,
|
LS_FN_XOR,
|
||||||
CS_FN_STAY,
|
LS_FN_STAY,
|
||||||
CS_FN_EQUAL,
|
LS_FN_EQUAL,
|
||||||
CS_FN_NEQUAL,
|
LS_FN_NEQUAL,
|
||||||
CS_FN_GREATER,
|
LS_FN_GREATER,
|
||||||
CS_FN_LESS,
|
LS_FN_LESS,
|
||||||
CS_FN_EGREATER,
|
LS_FN_EGREATER,
|
||||||
CS_FN_ELESS,
|
LS_FN_ELESS,
|
||||||
CS_FN_DPOS,
|
LS_FN_DPOS,
|
||||||
CS_FN_DAPOS,
|
LS_FN_DAPOS,
|
||||||
CS_FN_TIMER,
|
LS_FN_TIMER,
|
||||||
CS_FN_STICKY
|
LS_FN_STICKY
|
||||||
};
|
};
|
||||||
|
|
||||||
b->clear();
|
b->clear();
|
||||||
for (int i=0; i<CS_FN_MAX; i++) {
|
for (int i=0; i<LS_FN_MAX; i++) {
|
||||||
int func = order[i];
|
int func = order[i];
|
||||||
b->addItem(CustomSwData(func).funcToString(), func);
|
b->addItem(LogicalSwitchData(func).funcToString(), func);
|
||||||
// if (i>GetEepromInterface()->getCapability(CSFunc)) {
|
// if (i>GetEepromInterface()->getCapability(CSFunc)) {
|
||||||
// QModelIndex index = b->model()->index(i, 0);
|
// QModelIndex index = b->model()->index(i, 0);
|
||||||
// QVariant v(0);
|
// QVariant v(0);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include "eeprominterface.h"
|
#include "eeprominterface.h"
|
||||||
|
|
||||||
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(CustomSwitches)-1)
|
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(LogicalSwitches)-1)
|
||||||
|
|
||||||
//convert from mode 1 to mode generalSettings.stickMode
|
//convert from mode 1 to mode generalSettings.stickMode
|
||||||
//NOTICE! => 1..4 -> 1..4
|
//NOTICE! => 1..4 -> 1..4
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <QDoubleSpinBox>
|
#include <QDoubleSpinBox>
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model),
|
||||||
selectedSwitch(0)
|
selectedSwitch(0)
|
||||||
{
|
{
|
||||||
|
@ -18,13 +18,13 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||||
addLabel(gridLayout, tr("V1"), col++);
|
addLabel(gridLayout, tr("V1"), col++);
|
||||||
addLabel(gridLayout, tr("V2"), col++);
|
addLabel(gridLayout, tr("V2"), col++);
|
||||||
addLabel(gridLayout, tr("AND"), col++);
|
addLabel(gridLayout, tr("AND"), col++);
|
||||||
if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
|
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
|
||||||
addLabel(gridLayout, tr("Duration"), col++);
|
addLabel(gridLayout, tr("Duration"), col++);
|
||||||
addLabel(gridLayout, tr("Delay"), col++);
|
addLabel(gridLayout, tr("Delay"), col++);
|
||||||
}
|
}
|
||||||
|
|
||||||
lock = true;
|
lock = true;
|
||||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
|
||||||
// The label
|
// The label
|
||||||
QLabel * label = new QLabel(this);
|
QLabel * label = new QLabel(this);
|
||||||
label->setProperty("index", i);
|
label->setProperty("index", i);
|
||||||
|
@ -81,7 +81,7 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||||
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int)));
|
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int)));
|
||||||
gridLayout->addWidget(cswitchAnd[i], i+1, 4);
|
gridLayout->addWidget(cswitchAnd[i], i+1, 4);
|
||||||
|
|
||||||
if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
|
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
|
||||||
// Duration
|
// Duration
|
||||||
cswitchDuration[i] = new QDoubleSpinBox(this);
|
cswitchDuration[i] = new QDoubleSpinBox(this);
|
||||||
cswitchDuration[i]->setProperty("index", i);
|
cswitchDuration[i]->setProperty("index", i);
|
||||||
|
@ -109,19 +109,19 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomSwitchesPanel::~CustomSwitchesPanel()
|
LogicalSwitchesPanel::~LogicalSwitchesPanel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::v1Edited(int value)
|
void LogicalSwitchesPanel::v1Edited(int value)
|
||||||
{
|
{
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
int i = sender()->property("index").toInt();
|
int i = sender()->property("index").toInt();
|
||||||
model.customSw[i].val1 = cswitchSource1[i]->itemData(value).toInt();
|
model.customSw[i].val1 = cswitchSource1[i]->itemData(value).toInt();
|
||||||
if (model.customSw[i].getFunctionFamily() == CS_FAMILY_VOFS) {
|
if (model.customSw[i].getFunctionFamily() == LS_FAMILY_VOFS) {
|
||||||
RawSource source = RawSource(model.customSw[i].val1, &model);
|
RawSource source = RawSource(model.customSw[i].val1, &model);
|
||||||
if (source.type == SOURCE_TYPE_TELEMETRY) {
|
if (source.type == SOURCE_TYPE_TELEMETRY) {
|
||||||
if (model.customSw[i].func > CS_FN_ELESS && model.customSw[i].func < CS_FN_VEQUAL) {
|
if (model.customSw[i].func > LS_FN_ELESS && model.customSw[i].func < LS_FN_VEQUAL) {
|
||||||
model.customSw[i].val2 = 0;
|
model.customSw[i].val2 = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -130,7 +130,7 @@ void CustomSwitchesPanel::v1Edited(int value)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
RawSourceRange range = source.getRange();
|
RawSourceRange range = source.getRange();
|
||||||
if (model.customSw[i].func > CS_FN_ELESS && model.customSw[i].func < CS_FN_VEQUAL) {
|
if (model.customSw[i].func > LS_FN_ELESS && model.customSw[i].func < LS_FN_VEQUAL) {
|
||||||
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
|
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -143,7 +143,7 @@ void CustomSwitchesPanel::v1Edited(int value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::v2Edited(int value)
|
void LogicalSwitchesPanel::v2Edited(int value)
|
||||||
{
|
{
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
int i = sender()->property("index").toInt();
|
int i = sender()->property("index").toInt();
|
||||||
|
@ -152,7 +152,7 @@ void CustomSwitchesPanel::v2Edited(int value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::andEdited(int value)
|
void LogicalSwitchesPanel::andEdited(int value)
|
||||||
{
|
{
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
int index = sender()->property("index").toInt();
|
int index = sender()->property("index").toInt();
|
||||||
|
@ -161,34 +161,34 @@ void CustomSwitchesPanel::andEdited(int value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::durationEdited(double duration)
|
void LogicalSwitchesPanel::durationEdited(double duration)
|
||||||
{
|
{
|
||||||
int index = sender()->property("index").toInt();
|
int index = sender()->property("index").toInt();
|
||||||
model.customSw[index].duration = (uint8_t)round(duration*2);
|
model.customSw[index].duration = (uint8_t)round(duration*2);
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::delayEdited(double delay)
|
void LogicalSwitchesPanel::delayEdited(double delay)
|
||||||
{
|
{
|
||||||
int index = sender()->property("index").toInt();
|
int index = sender()->property("index").toInt();
|
||||||
model.customSw[index].delay = (uint8_t)round(delay*2);
|
model.customSw[index].delay = (uint8_t)round(delay*2);
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::edited()
|
void LogicalSwitchesPanel::edited()
|
||||||
{
|
{
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
lock = true;
|
lock = true;
|
||||||
int i = sender()->property("index").toInt();
|
int i = sender()->property("index").toInt();
|
||||||
int newFunc = csw[i]->itemData(csw[i]->currentIndex()).toInt();
|
int newFunc = csw[i]->itemData(csw[i]->currentIndex()).toInt();
|
||||||
bool chAr = (model.customSw[i].getFunctionFamily() != CustomSwData(newFunc).getFunctionFamily());
|
bool chAr = (model.customSw[i].getFunctionFamily() != LogicalSwitchData(newFunc).getFunctionFamily());
|
||||||
model.customSw[i].func = newFunc;
|
model.customSw[i].func = newFunc;
|
||||||
if (chAr) {
|
if (chAr) {
|
||||||
if (model.customSw[i].getFunctionFamily() == CS_FAMILY_TIMER) {
|
if (model.customSw[i].getFunctionFamily() == LS_FAMILY_TIMER) {
|
||||||
model.customSw[i].val1 = -119;
|
model.customSw[i].val1 = -119;
|
||||||
model.customSw[i].val2 = -119;
|
model.customSw[i].val2 = -119;
|
||||||
}
|
}
|
||||||
else if (model.customSw[i].getFunctionFamily() == CS_FAMILY_STAY) {
|
else if (model.customSw[i].getFunctionFamily() == LS_FAMILY_STAY) {
|
||||||
model.customSw[i].val1 = 0;
|
model.customSw[i].val1 = 0;
|
||||||
model.customSw[i].val2 = -129;
|
model.customSw[i].val2 = -129;
|
||||||
model.customSw[i].val3 = 0;
|
model.customSw[i].val3 = 0;
|
||||||
|
@ -204,11 +204,11 @@ void CustomSwitchesPanel::edited()
|
||||||
RawSource source;
|
RawSource source;
|
||||||
switch (model.customSw[i].getFunctionFamily())
|
switch (model.customSw[i].getFunctionFamily())
|
||||||
{
|
{
|
||||||
case CS_FAMILY_VOFS:
|
case LS_FAMILY_VOFS:
|
||||||
{
|
{
|
||||||
source = RawSource(model.customSw[i].val1, &model);
|
source = RawSource(model.customSw[i].val1, &model);
|
||||||
RawSourceRange range = source.getRange();
|
RawSourceRange range = source.getRange();
|
||||||
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
if (model.customSw[i].func>LS_FN_ELESS && model.customSw[i].func<LS_FN_VEQUAL) {
|
||||||
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
|
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
|
||||||
cswitchOffset[i]->setValue(model.customSw[i].val2*range.step);
|
cswitchOffset[i]->setValue(model.customSw[i].val2*range.step);
|
||||||
}
|
}
|
||||||
|
@ -218,13 +218,13 @@ void CustomSwitchesPanel::edited()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CS_FAMILY_TIMER:
|
case LS_FAMILY_TIMER:
|
||||||
model.customSw[i].val1 = TimToVal(cswitchValue[i]->value());
|
model.customSw[i].val1 = TimToVal(cswitchValue[i]->value());
|
||||||
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
||||||
updateTimerParam(cswitchValue[i], model.customSw[i].val1);
|
updateTimerParam(cswitchValue[i], model.customSw[i].val1);
|
||||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2);
|
updateTimerParam(cswitchOffset[i], model.customSw[i].val2);
|
||||||
break;
|
break;
|
||||||
case CS_FAMILY_STAY:
|
case LS_FAMILY_STAY:
|
||||||
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
||||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
|
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
|
||||||
break;
|
break;
|
||||||
|
@ -236,7 +236,7 @@ void CustomSwitchesPanel::edited()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, bool allowZero)
|
void LogicalSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, bool allowZero)
|
||||||
{
|
{
|
||||||
sb->setVisible(true);
|
sb->setVisible(true);
|
||||||
sb->setDecimals(1);
|
sb->setDecimals(1);
|
||||||
|
@ -252,7 +252,7 @@ void CustomSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, bool a
|
||||||
sb->setValue(value);
|
sb->setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||||
{
|
{
|
||||||
lock = true;
|
lock = true;
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||||
|
|
||||||
switch (model.customSw[i].getFunctionFamily())
|
switch (model.customSw[i].getFunctionFamily())
|
||||||
{
|
{
|
||||||
case CS_FAMILY_VOFS:
|
case LS_FAMILY_VOFS:
|
||||||
cswitchSource1[i]->setVisible(true);
|
cswitchSource1[i]->setVisible(true);
|
||||||
cswitchSource2[i]->setVisible(false);
|
cswitchSource2[i]->setVisible(false);
|
||||||
cswitchValue[i]->setVisible(false);
|
cswitchValue[i]->setVisible(false);
|
||||||
|
@ -269,7 +269,7 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||||
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||||
cswitchOffset[i]->setDecimals(range.decimals);
|
cswitchOffset[i]->setDecimals(range.decimals);
|
||||||
cswitchOffset[i]->setSingleStep(range.step);
|
cswitchOffset[i]->setSingleStep(range.step);
|
||||||
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
if (model.customSw[i].func>LS_FN_ELESS && model.customSw[i].func<LS_FN_VEQUAL) {
|
||||||
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);
|
||||||
|
@ -280,8 +280,8 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||||
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 LS_FAMILY_VBOOL:
|
||||||
case CS_FAMILY_STICKY:
|
case LS_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);
|
||||||
|
@ -289,14 +289,14 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
|
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
|
||||||
populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2));
|
populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2));
|
||||||
break;
|
break;
|
||||||
case CS_FAMILY_STAY:
|
case LS_FAMILY_STAY:
|
||||||
cswitchSource1[i]->setVisible(true);
|
cswitchSource1[i]->setVisible(true);
|
||||||
cswitchSource2[i]->setVisible(false);
|
cswitchSource2[i]->setVisible(false);
|
||||||
cswitchValue[i]->setVisible(false);
|
cswitchValue[i]->setVisible(false);
|
||||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
|
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
|
||||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
|
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
|
||||||
break;
|
break;
|
||||||
case CS_FAMILY_VCOMP:
|
case LS_FAMILY_VCOMP:
|
||||||
cswitchSource1[i]->setVisible(true);
|
cswitchSource1[i]->setVisible(true);
|
||||||
cswitchSource2[i]->setVisible(true);
|
cswitchSource2[i]->setVisible(true);
|
||||||
cswitchValue[i]->setVisible(false);
|
cswitchValue[i]->setVisible(false);
|
||||||
|
@ -304,7 +304,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_TIMER:
|
case LS_FAMILY_TIMER:
|
||||||
cswitchSource1[i]->setVisible(false);
|
cswitchSource1[i]->setVisible(false);
|
||||||
cswitchSource2[i]->setVisible(false);
|
cswitchSource2[i]->setVisible(false);
|
||||||
updateTimerParam(cswitchValue[i], model.customSw[i].val1);
|
updateTimerParam(cswitchValue[i], model.customSw[i].val1);
|
||||||
|
@ -315,16 +315,16 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::update()
|
void LogicalSwitchesPanel::update()
|
||||||
{
|
{
|
||||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
|
||||||
lock = true;
|
lock = true;
|
||||||
populateCSWCB(csw[i], model.customSw[i].func);
|
populateCSWCB(csw[i], model.customSw[i].func);
|
||||||
lock = false;
|
lock = false;
|
||||||
setSwitchWidgetVisibility(i);
|
setSwitchWidgetVisibility(i);
|
||||||
lock = true;
|
lock = true;
|
||||||
populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw));
|
populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw));
|
||||||
if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
|
if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) {
|
||||||
cswitchDuration[i]->setValue(model.customSw[i].duration/2.0);
|
cswitchDuration[i]->setValue(model.customSw[i].duration/2.0);
|
||||||
cswitchDelay[i]->setValue(model.customSw[i].delay/2.0);
|
cswitchDelay[i]->setValue(model.customSw[i].delay/2.0);
|
||||||
}
|
}
|
||||||
|
@ -332,37 +332,37 @@ void CustomSwitchesPanel::update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::cswPaste()
|
void LogicalSwitchesPanel::cswPaste()
|
||||||
{
|
{
|
||||||
const QClipboard *clipboard = QApplication::clipboard();
|
const QClipboard *clipboard = QApplication::clipboard();
|
||||||
const QMimeData *mimeData = clipboard->mimeData();
|
const QMimeData *mimeData = clipboard->mimeData();
|
||||||
if (mimeData->hasFormat("application/x-companion-csw")) {
|
if (mimeData->hasFormat("application/x-companion-csw")) {
|
||||||
QByteArray cswData = mimeData->data("application/x-companion-csw");
|
QByteArray cswData = mimeData->data("application/x-companion-csw");
|
||||||
|
|
||||||
CustomSwData *csw = &model.customSw[selectedSwitch];
|
LogicalSwitchData *csw = &model.customSw[selectedSwitch];
|
||||||
memcpy(csw, cswData.mid(0, sizeof(CustomSwData)).constData(), sizeof(CustomSwData));
|
memcpy(csw, cswData.mid(0, sizeof(LogicalSwitchData)).constData(), sizeof(LogicalSwitchData));
|
||||||
emit modified();
|
emit modified();
|
||||||
updateSelectedSwitch();
|
updateSelectedSwitch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::cswDelete()
|
void LogicalSwitchesPanel::cswDelete()
|
||||||
{
|
{
|
||||||
model.customSw[selectedSwitch].clear();
|
model.customSw[selectedSwitch].clear();
|
||||||
emit modified();
|
emit modified();
|
||||||
updateSelectedSwitch();
|
updateSelectedSwitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::cswCopy()
|
void LogicalSwitchesPanel::cswCopy()
|
||||||
{
|
{
|
||||||
QByteArray cswData;
|
QByteArray cswData;
|
||||||
cswData.append((char*)&model.customSw[selectedSwitch],sizeof(CustomSwData));
|
cswData.append((char*)&model.customSw[selectedSwitch],sizeof(LogicalSwitchData));
|
||||||
QMimeData *mimeData = new QMimeData;
|
QMimeData *mimeData = new QMimeData;
|
||||||
mimeData->setData("application/x-companion-csw", cswData);
|
mimeData->setData("application/x-companion-csw", cswData);
|
||||||
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::updateSelectedSwitch()
|
void LogicalSwitchesPanel::updateSelectedSwitch()
|
||||||
{
|
{
|
||||||
lock = true;
|
lock = true;
|
||||||
populateCSWCB(csw[selectedSwitch], model.customSw[selectedSwitch].func);
|
populateCSWCB(csw[selectedSwitch], model.customSw[selectedSwitch].func);
|
||||||
|
@ -370,14 +370,14 @@ void CustomSwitchesPanel::updateSelectedSwitch()
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomSwitchesPanel::cswCut()
|
void LogicalSwitchesPanel::cswCut()
|
||||||
{
|
{
|
||||||
cswCopy();
|
cswCopy();
|
||||||
cswDelete();
|
cswDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO make something generic here!
|
// TODO make something generic here!
|
||||||
void CustomSwitchesPanel::csw_customContextMenuRequested(QPoint pos)
|
void LogicalSwitchesPanel::csw_customContextMenuRequested(QPoint pos)
|
||||||
{
|
{
|
||||||
QLabel *label = (QLabel *)sender();
|
QLabel *label = (QLabel *)sender();
|
||||||
selectedSwitch = label->property("index").toInt();
|
selectedSwitch = label->property("index").toInt();
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDoubleSpinBox>
|
#include <QDoubleSpinBox>
|
||||||
|
|
||||||
class CustomSwitchesPanel : public ModelPanel
|
class LogicalSwitchesPanel : public ModelPanel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CustomSwitchesPanel(QWidget *parent, ModelData & model);
|
LogicalSwitchesPanel(QWidget *parent, ModelData & model);
|
||||||
virtual ~CustomSwitchesPanel();
|
virtual ~LogicalSwitchesPanel();
|
||||||
|
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i
|
||||||
addTab(new InputsPanel(this, model, radioData.generalSettings), tr("Inputs"));
|
addTab(new InputsPanel(this, model, radioData.generalSettings), tr("Inputs"));
|
||||||
addTab(new MixesPanel(this, model, radioData.generalSettings), tr("Mixes"));
|
addTab(new MixesPanel(this, model, radioData.generalSettings), tr("Mixes"));
|
||||||
addTab(new Channels(this, model), tr("Channels"));
|
addTab(new Channels(this, model), tr("Channels"));
|
||||||
addTab(new CustomSwitchesPanel(this, model), tr("Logical Switches"));
|
addTab(new LogicalSwitchesPanel(this, model), tr("Logical Switches"));
|
||||||
if (GetEepromInterface()->getCapability(CustomFunctions))
|
if (GetEepromInterface()->getCapability(CustomFunctions))
|
||||||
addTab(new CustomFunctionsPanel(this, model, radioData.generalSettings), tr("Switch Assignment"));
|
addTab(new CustomFunctionsPanel(this, model, radioData.generalSettings), tr("Switch Assignment"));
|
||||||
addTab(new Curves(this, model), tr("Curves"));
|
addTab(new Curves(this, model), tr("Curves"));
|
||||||
|
|
|
@ -584,8 +584,8 @@ void Templates::applyTemplate(uint8_t idx)
|
||||||
md=setDest(14); md->srcRaw=RawSource(SOURCE_TYPE_CH, 13); md->weight= 100; md->swtch=RawSwitch();
|
md=setDest(14); md->srcRaw=RawSource(SOURCE_TYPE_CH, 13); md->weight= 100; md->swtch=RawSwitch();
|
||||||
md=setDest(14); md->srcRaw=RawSource(SOURCE_TYPE_MAX); md->weight=-100; md->swtch=RawSwitch(SWITCH_TYPE_VIRTUAL, 11); md->mltpx=MLTPX_REP;
|
md=setDest(14); md->srcRaw=RawSource(SOURCE_TYPE_MAX); md->weight=-100; md->swtch=RawSwitch(SWITCH_TYPE_VIRTUAL, 11); md->mltpx=MLTPX_REP;
|
||||||
md=setDest(14); md->srcRaw=RawSource(SOURCE_TYPE_MAX); md->weight= 100; md->swtch=RawSwitch(SWITCH_TYPE_SWITCH,thrsw); md->mltpx=MLTPX_REP;
|
md=setDest(14); md->srcRaw=RawSource(SOURCE_TYPE_MAX); md->weight= 100; md->swtch=RawSwitch(SWITCH_TYPE_SWITCH,thrsw); md->mltpx=MLTPX_REP;
|
||||||
setSwitch(0xB, CS_FN_VNEG, RawSource(SOURCE_TYPE_STICK, 2).toValue(), -99);
|
setSwitch(0xB, LS_FN_VNEG, RawSource(SOURCE_TYPE_STICK, 2).toValue(), -99);
|
||||||
setSwitch(0xC, CS_FN_VPOS, RawSource(SOURCE_TYPE_CH, 13).toValue(), 0);
|
setSwitch(0xC, LS_FN_VPOS, RawSource(SOURCE_TYPE_CH, 13).toValue(), 0);
|
||||||
updateSwitchesTab();
|
updateSwitchesTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,9 +841,9 @@ void Templates::applyTemplate(uint8_t idx)
|
||||||
md=setDest(16); md->srcRaw=RawSource(SOURCE_TYPE_CUSTOM_SWITCH, 0); md->weight= 110; md->swtch=RawSwitch();
|
md=setDest(16); md->srcRaw=RawSource(SOURCE_TYPE_CUSTOM_SWITCH, 0); md->weight= 110; md->swtch=RawSwitch();
|
||||||
md=setDest(16); md->srcRaw=RawSource(SOURCE_TYPE_MAX); md->weight=-110; md->swtch=RawSwitch(SWITCH_TYPE_VIRTUAL, 2); md->mltpx=MLTPX_REP;
|
md=setDest(16); md->srcRaw=RawSource(SOURCE_TYPE_MAX); md->weight=-110; md->swtch=RawSwitch(SWITCH_TYPE_VIRTUAL, 2); md->mltpx=MLTPX_REP;
|
||||||
md=setDest(16); md->srcRaw=RawSource(SOURCE_TYPE_MAX); md->weight= 110; md->swtch=RawSwitch(SWITCH_TYPE_VIRTUAL, 3); md->mltpx=MLTPX_REP;
|
md=setDest(16); md->srcRaw=RawSource(SOURCE_TYPE_MAX); md->weight= 110; md->swtch=RawSwitch(SWITCH_TYPE_VIRTUAL, 3); md->mltpx=MLTPX_REP;
|
||||||
setSwitch(1, CS_FN_LESS, RawSource(SOURCE_TYPE_CH, 14).toValue(), RawSource(SOURCE_TYPE_CH, 15).toValue());
|
setSwitch(1, LS_FN_LESS, RawSource(SOURCE_TYPE_CH, 14).toValue(), RawSource(SOURCE_TYPE_CH, 15).toValue());
|
||||||
setSwitch(2, CS_FN_VPOS, RawSource(SOURCE_TYPE_CH, 14).toValue(), 105);
|
setSwitch(2, LS_FN_VPOS, RawSource(SOURCE_TYPE_CH, 14).toValue(), 105);
|
||||||
setSwitch(3, CS_FN_VNEG, RawSource(SOURCE_TYPE_CH, 14).toValue(), -105);
|
setSwitch(3, LS_FN_VNEG, RawSource(SOURCE_TYPE_CH, 14).toValue(), -105);
|
||||||
|
|
||||||
// redraw switches tab
|
// redraw switches tab
|
||||||
updateSwitchesTab();
|
updateSwitchesTab();
|
||||||
|
|
|
@ -642,7 +642,7 @@ void printDialog::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=0 cellspacing=0 cellpadding=3>");
|
str.append("<tr><td><table border=0 cellspacing=0 cellpadding=3>");
|
||||||
|
|
||||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
|
||||||
if (g_model->customSw[i].func) {
|
if (g_model->customSw[i].func) {
|
||||||
str.append("<tr>");
|
str.append("<tr>");
|
||||||
if (i<9) {
|
if (i<9) {
|
||||||
|
|
|
@ -356,7 +356,7 @@ void simulatorDialog::loadParams(RadioData &radioData, const int model_idx)
|
||||||
|
|
||||||
beepVal = 0;
|
beepVal = 0;
|
||||||
beepShow = 0;
|
beepShow = 0;
|
||||||
switches=txInterface->getCapability(CustomSwitches);
|
switches=txInterface->getCapability(LogicalSwitches);
|
||||||
if ( switches < 13) {
|
if ( switches < 13) {
|
||||||
ui->cswitch_13->hide();
|
ui->cswitch_13->hide();
|
||||||
ui->labelCSW_13->hide();
|
ui->labelCSW_13->hide();
|
||||||
|
|
|
@ -168,7 +168,7 @@ PACK(typedef struct {
|
||||||
int16_t curves[16];
|
int16_t curves[16];
|
||||||
int8_t points[NUM_POINTS];
|
int8_t points[NUM_POINTS];
|
||||||
|
|
||||||
CustomSwData customSw[NUM_CSW];
|
LogicalSwitchData customSw[NUM_CSW];
|
||||||
CustomFnData funcSw[NUM_CFN];
|
CustomFnData funcSw[NUM_CFN];
|
||||||
SwashRingData swashR;
|
SwashRingData swashR;
|
||||||
PhaseData_v215 phaseData[MAX_PHASES];
|
PhaseData_v215 phaseData[MAX_PHASES];
|
||||||
|
@ -379,13 +379,13 @@ void ConvertModel_215_to_216(ModelData &model)
|
||||||
for (uint8_t i=0; i<32; i++) {
|
for (uint8_t i=0; i<32; i++) {
|
||||||
g_model.customSw[i] = oldModel.customSw[i];
|
g_model.customSw[i] = oldModel.customSw[i];
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
CustomSwData * cs = &g_model.customSw[i];
|
LogicalSwitchData * cs = &g_model.customSw[i];
|
||||||
uint8_t cstate = cswFamily(cs->func);
|
uint8_t cstate = cswFamily(cs->func);
|
||||||
if (cstate == CS_FAMILY_OFS || cstate == CS_FAMILY_COMP || cstate == CS_FAMILY_DIFF) {
|
if (cstate == LS_FAMILY_OFS || cstate == LS_FAMILY_COMP || cstate == LS_FAMILY_DIFF) {
|
||||||
if (cs->v1 > 0) cs->v1 += MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
|
if (cs->v1 > 0) cs->v1 += MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
|
||||||
if (cs->v1 > MIXSRC_GVAR1+4) cs->v1 += 4;
|
if (cs->v1 > MIXSRC_GVAR1+4) cs->v1 += 4;
|
||||||
}
|
}
|
||||||
if (cstate == CS_FAMILY_OFS || cstate == CS_FAMILY_DIFF) {
|
if (cstate == LS_FAMILY_OFS || cstate == LS_FAMILY_DIFF) {
|
||||||
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
|
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
|
||||||
switch ((uint8_t)cs->v1) {
|
switch ((uint8_t)cs->v1) {
|
||||||
case MIXSRC_FIRST_TELEM + TELEM_TM1-1:
|
case MIXSRC_FIRST_TELEM + TELEM_TM1-1:
|
||||||
|
@ -429,7 +429,7 @@ void ConvertModel_215_to_216(ModelData &model)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cstate == CS_FAMILY_COMP) {
|
if (cstate == LS_FAMILY_COMP) {
|
||||||
if (cs->v2 > 0) cs->v2 += MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
|
if (cs->v2 > 0) cs->v2 += MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
|
||||||
if (cs->v2 > MIXSRC_GVAR1+4) cs->v2 += 4;
|
if (cs->v2 > MIXSRC_GVAR1+4) cs->v2 += 4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,8 +304,8 @@ TEST(getSwitch, circularCSW)
|
||||||
{
|
{
|
||||||
MODEL_RESET();
|
MODEL_RESET();
|
||||||
MIXER_RESET();
|
MIXER_RESET();
|
||||||
g_model.customSw[0] = { SWSRC_SW1, SWSRC_SW1, CS_OR };
|
g_model.customSw[0] = { SWSRC_SW1, SWSRC_SW1, LS_FUNC_OR };
|
||||||
g_model.customSw[1] = { SWSRC_SW1, SWSRC_SW1, CS_AND };
|
g_model.customSw[1] = { SWSRC_SW1, SWSRC_SW1, LS_FUNC_AND };
|
||||||
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
|
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
|
||||||
EXPECT_EQ(getSwitch(-SWSRC_SW1), true);
|
EXPECT_EQ(getSwitch(-SWSRC_SW1), true);
|
||||||
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
|
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
|
||||||
|
@ -324,8 +324,8 @@ TEST(getSwitch, recursiveSW)
|
||||||
MODEL_RESET();
|
MODEL_RESET();
|
||||||
MIXER_RESET();
|
MIXER_RESET();
|
||||||
|
|
||||||
g_model.customSw[0] = { SWSRC_RUD, -SWSRC_SW2, CS_OR };
|
g_model.customSw[0] = { SWSRC_RUD, -SWSRC_SW2, LS_FUNC_OR };
|
||||||
g_model.customSw[1] = { SWSRC_ELE, -SWSRC_SW1, CS_OR };
|
g_model.customSw[1] = { SWSRC_ELE, -SWSRC_SW1, LS_FUNC_OR };
|
||||||
|
|
||||||
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
|
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
|
||||||
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
|
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
|
||||||
|
|
|
@ -55,7 +55,7 @@ enum EnumTabModel {
|
||||||
#if LCD_W >= 212
|
#if LCD_W >= 212
|
||||||
IF_GVARS(e_GVars)
|
IF_GVARS(e_GVars)
|
||||||
#endif
|
#endif
|
||||||
e_CustomSwitches,
|
e_LogicalSwitches,
|
||||||
e_CustomFunctions,
|
e_CustomFunctions,
|
||||||
#if defined(LUA_MODEL_SCRIPTS)
|
#if defined(LUA_MODEL_SCRIPTS)
|
||||||
e_CustomScripts,
|
e_CustomScripts,
|
||||||
|
@ -74,7 +74,7 @@ void menuModelMixAll(uint8_t event);
|
||||||
void menuModelLimits(uint8_t event);
|
void menuModelLimits(uint8_t event);
|
||||||
void menuModelCurvesAll(uint8_t event);
|
void menuModelCurvesAll(uint8_t event);
|
||||||
void menuModelGVars(uint8_t event);
|
void menuModelGVars(uint8_t event);
|
||||||
void menuModelCustomSwitches(uint8_t event);
|
void menuModelLogicalSwitches(uint8_t event);
|
||||||
void menuModelCustomFunctions(uint8_t event);
|
void menuModelCustomFunctions(uint8_t event);
|
||||||
void menuModelCustomScripts(uint8_t event);
|
void menuModelCustomScripts(uint8_t event);
|
||||||
void menuModelTelemetry(uint8_t event);
|
void menuModelTelemetry(uint8_t event);
|
||||||
|
@ -93,7 +93,7 @@ const MenuFuncP_PROGMEM menuTabModel[] PROGMEM = {
|
||||||
#if LCD_W >= 212 && defined(GVARS) && defined(FLIGHT_MODES)
|
#if LCD_W >= 212 && defined(GVARS) && defined(FLIGHT_MODES)
|
||||||
IF_GVARS(menuModelGVars)
|
IF_GVARS(menuModelGVars)
|
||||||
#endif
|
#endif
|
||||||
menuModelCustomSwitches,
|
menuModelLogicalSwitches,
|
||||||
menuModelCustomFunctions,
|
menuModelCustomFunctions,
|
||||||
#if defined(LUA_MODEL_SCRIPTS)
|
#if defined(LUA_MODEL_SCRIPTS)
|
||||||
menuModelCustomScripts,
|
menuModelCustomScripts,
|
||||||
|
@ -4124,20 +4124,20 @@ void menuModelGVars(uint8_t event)
|
||||||
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, incdecFlag)
|
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, incdecFlag)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum CustomSwitchFields {
|
enum LogicalSwitchFields {
|
||||||
CSW_FIELD_FUNCTION,
|
LS_FIELD_FUNCTION,
|
||||||
CSW_FIELD_V1,
|
LS_FIELD_V1,
|
||||||
CSW_FIELD_V2,
|
LS_FIELD_V2,
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
CSW_FIELD_V3,
|
LS_FIELD_V3,
|
||||||
#endif
|
#endif
|
||||||
CSW_FIELD_ANDSW,
|
LS_FIELD_ANDSW,
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
CSW_FIELD_DURATION,
|
LS_FIELD_DURATION,
|
||||||
CSW_FIELD_DELAY,
|
LS_FIELD_DELAY,
|
||||||
#endif
|
#endif
|
||||||
CSW_FIELD_COUNT,
|
LS_FIELD_COUNT,
|
||||||
CSW_FIELD_LAST = CSW_FIELD_COUNT-1
|
LS_FIELD_LAST = LS_FIELD_COUNT-1
|
||||||
};
|
};
|
||||||
|
|
||||||
#if LCD_W >= 212
|
#if LCD_W >= 212
|
||||||
|
@ -4158,15 +4158,15 @@ enum CustomSwitchFields {
|
||||||
|
|
||||||
#define CSWONE_2ND_COLUMN (11*FW)
|
#define CSWONE_2ND_COLUMN (11*FW)
|
||||||
|
|
||||||
void menuModelCustomSwitchOne(uint8_t event)
|
void menuModelLogicalSwitchOne(uint8_t event)
|
||||||
{
|
{
|
||||||
TITLE(STR_MENUCUSTOMSWITCH);
|
TITLE(STR_MENUCUSTOMSWITCH);
|
||||||
|
|
||||||
CustomSwData * cs = cswAddress(s_currIdx);
|
LogicalSwitchData * cs = cswAddress(s_currIdx);
|
||||||
uint8_t sw = SWSRC_SW1+s_currIdx;
|
uint8_t sw = SWSRC_SW1+s_currIdx;
|
||||||
putsSwitches(14*FW, 0, sw, (getSwitch(sw) ? BOLD : 0));
|
putsSwitches(14*FW, 0, sw, (getSwitch(sw) ? BOLD : 0));
|
||||||
|
|
||||||
SUBMENU_NOTITLE(CSW_FIELD_COUNT, {0, 0, 1, 0 /*, 0...*/});
|
SUBMENU_NOTITLE(LS_FIELD_COUNT, {0, 0, 1, 0 /*, 0...*/});
|
||||||
|
|
||||||
int8_t sub = m_posVert;
|
int8_t sub = m_posVert;
|
||||||
|
|
||||||
|
@ -4176,17 +4176,17 @@ void menuModelCustomSwitchOne(uint8_t event)
|
||||||
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||||
uint8_t cstate = cswFamily(cs->func);
|
uint8_t cstate = cswFamily(cs->func);
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case CSW_FIELD_FUNCTION:
|
case LS_FIELD_FUNCTION:
|
||||||
lcd_putsLeft(y, STR_FUNC);
|
lcd_putsLeft(y, STR_FUNC);
|
||||||
lcd_putsiAtt(CSWONE_2ND_COLUMN, y, STR_VCSWFUNC, cs->func, attr);
|
lcd_putsiAtt(CSWONE_2ND_COLUMN, y, STR_VCSWFUNC, cs->func, attr);
|
||||||
if (attr) {
|
if (attr) {
|
||||||
cs->func = checkIncDec(event, cs->func, 0, CS_MAXF, EE_MODEL, isFunctionAvailable);
|
cs->func = checkIncDec(event, cs->func, 0, LS_FUNC_MAX, EE_MODEL, isLogicalSwitchFunctionAvailable);
|
||||||
uint8_t new_cstate = cswFamily(cs->func);
|
uint8_t new_cstate = cswFamily(cs->func);
|
||||||
if (cstate != new_cstate) {
|
if (cstate != new_cstate) {
|
||||||
if (new_cstate == CS_FAMILY_TIMER) {
|
if (new_cstate == LS_FAMILY_TIMER) {
|
||||||
cs->v1 = cs->v2 = -119;
|
cs->v1 = cs->v2 = -119;
|
||||||
}
|
}
|
||||||
else if (new_cstate == CS_FAMILY_STAY) {
|
else if (new_cstate == LS_FAMILY_STAY) {
|
||||||
cs->v1 = 0; cs->v2 = -129; cs->v3 = 0;
|
cs->v1 = 0; cs->v2 = -129; cs->v3 = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -4195,15 +4195,15 @@ void menuModelCustomSwitchOne(uint8_t event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CSW_FIELD_V1:
|
case LS_FIELD_V1:
|
||||||
{
|
{
|
||||||
lcd_putsLeft(y, STR_V1);
|
lcd_putsLeft(y, STR_V1);
|
||||||
int8_t v1_min=0, v1_max=MIXSRC_LAST_TELEM;
|
int8_t v1_min=0, v1_max=MIXSRC_LAST_TELEM;
|
||||||
if (cstate == CS_FAMILY_BOOL || cstate == CS_FAMILY_STICKY || cstate == CS_FAMILY_STAY) {
|
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY || cstate == LS_FAMILY_STAY) {
|
||||||
putsSwitches(CSWONE_2ND_COLUMN, y, cs->v1, attr);
|
putsSwitches(CSWONE_2ND_COLUMN, y, cs->v1, attr);
|
||||||
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
|
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
|
||||||
}
|
}
|
||||||
else if (cstate == CS_FAMILY_TIMER) {
|
else if (cstate == LS_FAMILY_TIMER) {
|
||||||
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->v1+1, LEFT|attr);
|
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->v1+1, LEFT|attr);
|
||||||
v1_max = 99;
|
v1_max = 99;
|
||||||
}
|
}
|
||||||
|
@ -4215,19 +4215,19 @@ void menuModelCustomSwitchOne(uint8_t event)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CSW_FIELD_V2:
|
case LS_FIELD_V2:
|
||||||
{
|
{
|
||||||
lcd_putsLeft(y, STR_V2);
|
lcd_putsLeft(y, STR_V2);
|
||||||
int16_t v2_min=0, v2_max=MIXSRC_LAST_TELEM;
|
int16_t v2_min=0, v2_max=MIXSRC_LAST_TELEM;
|
||||||
if (cstate == CS_FAMILY_BOOL || cstate == CS_FAMILY_STICKY) {
|
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
||||||
putsSwitches(CSWONE_2ND_COLUMN, y, cs->v2, attr);
|
putsSwitches(CSWONE_2ND_COLUMN, y, cs->v2, attr);
|
||||||
v2_min = SWSRC_OFF+1; v2_max = SWSRC_ON-1;
|
v2_min = SWSRC_OFF+1; v2_max = SWSRC_ON-1;
|
||||||
}
|
}
|
||||||
else if (cstate == CS_FAMILY_TIMER) {
|
else if (cstate == LS_FAMILY_TIMER) {
|
||||||
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->v2+1, LEFT|attr);
|
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->v2+1, LEFT|attr);
|
||||||
v2_max = 99;
|
v2_max = 99;
|
||||||
}
|
}
|
||||||
else if (cstate == CS_FAMILY_STAY) {
|
else if (cstate == LS_FAMILY_STAY) {
|
||||||
lcd_putc(CSWONE_2ND_COLUMN-4, y, '[');
|
lcd_putc(CSWONE_2ND_COLUMN-4, y, '[');
|
||||||
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cswTimerValue(cs->v2), LEFT|PREC1|(m_posHorz==0 ? attr : 0));
|
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cswTimerValue(cs->v2), LEFT|PREC1|(m_posHorz==0 ? attr : 0));
|
||||||
lcd_putc(lcdLastPos, y, ':');
|
lcd_putc(lcdLastPos, y, ':');
|
||||||
|
@ -4243,7 +4243,7 @@ void menuModelCustomSwitchOne(uint8_t event)
|
||||||
}
|
}
|
||||||
v2_min=-129; v2_max = 122;
|
v2_min=-129; v2_max = 122;
|
||||||
}
|
}
|
||||||
else if (cstate == CS_FAMILY_COMP) {
|
else if (cstate == LS_FAMILY_COMP) {
|
||||||
putsMixerSource(CSWONE_2ND_COLUMN, y, cs->v2, attr);
|
putsMixerSource(CSWONE_2ND_COLUMN, y, cs->v2, attr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -4251,7 +4251,7 @@ void menuModelCustomSwitchOne(uint8_t event)
|
||||||
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
|
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
|
||||||
putsTelemetryChannel(CSWONE_2ND_COLUMN, y, cs->v1 - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), attr|LEFT);
|
putsTelemetryChannel(CSWONE_2ND_COLUMN, y, cs->v1 - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), attr|LEFT);
|
||||||
v2_max = maxTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1);
|
v2_max = maxTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1);
|
||||||
if (cstate == CS_FAMILY_OFS) {
|
if (cstate == LS_FAMILY_OFS) {
|
||||||
v2_min = -128;
|
v2_min = -128;
|
||||||
v2_max -= 128;
|
v2_max -= 128;
|
||||||
}
|
}
|
||||||
|
@ -4277,34 +4277,34 @@ void menuModelCustomSwitchOne(uint8_t event)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CSW_FIELD_ANDSW:
|
case LS_FIELD_ANDSW:
|
||||||
lcd_putsLeft(y, STR_AND_SWITCH);
|
lcd_putsLeft(y, STR_AND_SWITCH);
|
||||||
putsSwitches(CSWONE_2ND_COLUMN, y, cs->andsw, attr);
|
putsSwitches(CSWONE_2ND_COLUMN, y, cs->andsw, attr);
|
||||||
if (attr) CHECK_INCDEC_MODELVAR(event, cs->andsw, -MAX_CSW_ANDSW, MAX_CSW_ANDSW);
|
if (attr) CHECK_INCDEC_MODELVAR(event, cs->andsw, -MAX_LS_ANDSW, MAX_LS_ANDSW);
|
||||||
break;
|
break;
|
||||||
case CSW_FIELD_DURATION:
|
case LS_FIELD_DURATION:
|
||||||
lcd_putsLeft(y, STR_DURATION);
|
lcd_putsLeft(y, STR_DURATION);
|
||||||
if (cs->duration > 0)
|
if (cs->duration > 0)
|
||||||
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, 5*cs->duration, attr|PREC1|LEFT);
|
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, 5*cs->duration, attr|PREC1|LEFT);
|
||||||
else
|
else
|
||||||
lcd_putsiAtt(CSWONE_2ND_COLUMN, y, STR_MMMINV, 0, attr);
|
lcd_putsiAtt(CSWONE_2ND_COLUMN, y, STR_MMMINV, 0, attr);
|
||||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, cs->duration, MAX_CSW_DURATION);
|
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, cs->duration, MAX_LS_DURATION);
|
||||||
break;
|
break;
|
||||||
case CSW_FIELD_DELAY:
|
case LS_FIELD_DELAY:
|
||||||
lcd_putsLeft(y, STR_DELAY);
|
lcd_putsLeft(y, STR_DELAY);
|
||||||
if (cs->delay > 0)
|
if (cs->delay > 0)
|
||||||
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, 5*cs->delay, attr|PREC1|LEFT);
|
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, 5*cs->delay, attr|PREC1|LEFT);
|
||||||
else
|
else
|
||||||
lcd_putsiAtt(CSWONE_2ND_COLUMN, y, STR_MMMINV, 0, attr);
|
lcd_putsiAtt(CSWONE_2ND_COLUMN, y, STR_MMMINV, 0, attr);
|
||||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, cs->delay, MAX_CSW_DELAY);
|
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, cs->delay, MAX_LS_DELAY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void menuModelCustomSwitches(uint8_t event)
|
void menuModelLogicalSwitches(uint8_t event)
|
||||||
{
|
{
|
||||||
SIMPLE_MENU(STR_MENUCUSTOMSWITCHES, menuTabModel, e_CustomSwitches, NUM_CSW+1);
|
SIMPLE_MENU(STR_MENUCUSTOMSWITCHES, menuTabModel, e_LogicalSwitches, NUM_CSW+1);
|
||||||
|
|
||||||
uint8_t y = 0;
|
uint8_t y = 0;
|
||||||
uint8_t k = 0;
|
uint8_t k = 0;
|
||||||
|
@ -4318,7 +4318,7 @@ void menuModelCustomSwitches(uint8_t event)
|
||||||
case EVT_KEY_FIRST(KEY_ENTER):
|
case EVT_KEY_FIRST(KEY_ENTER):
|
||||||
if (sub >= 0) {
|
if (sub >= 0) {
|
||||||
s_currIdx = sub;
|
s_currIdx = sub;
|
||||||
pushMenu(menuModelCustomSwitchOne);
|
pushMenu(menuModelLogicalSwitchOne);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4326,7 +4326,7 @@ void menuModelCustomSwitches(uint8_t event)
|
||||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||||
y = 1 + (i+1)*FH;
|
y = 1 + (i+1)*FH;
|
||||||
k = i+s_pgOfs;
|
k = i+s_pgOfs;
|
||||||
CustomSwData * cs = cswAddress(k);
|
LogicalSwitchData * cs = cswAddress(k);
|
||||||
|
|
||||||
// CSW name
|
// CSW name
|
||||||
uint8_t sw = SWSRC_SW1+k;
|
uint8_t sw = SWSRC_SW1+k;
|
||||||
|
@ -4340,15 +4340,15 @@ void menuModelCustomSwitches(uint8_t event)
|
||||||
// CSW params
|
// CSW params
|
||||||
uint8_t cstate = cswFamily(cs->func);
|
uint8_t cstate = cswFamily(cs->func);
|
||||||
|
|
||||||
if (cstate == CS_FAMILY_BOOL || cstate == CS_FAMILY_STICKY) {
|
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
||||||
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, 0);
|
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, 0);
|
||||||
putsSwitches(CSW_3RD_COLUMN, y, cs->v2, 0);
|
putsSwitches(CSW_3RD_COLUMN, y, cs->v2, 0);
|
||||||
}
|
}
|
||||||
else if (cstate == CS_FAMILY_COMP) {
|
else if (cstate == LS_FAMILY_COMP) {
|
||||||
putsMixerSource(CSW_2ND_COLUMN, y, cs->v1, 0);
|
putsMixerSource(CSW_2ND_COLUMN, y, cs->v1, 0);
|
||||||
putsMixerSource(CSW_3RD_COLUMN, y, cs->v2, 0);
|
putsMixerSource(CSW_3RD_COLUMN, y, cs->v2, 0);
|
||||||
}
|
}
|
||||||
else if (cstate == CS_FAMILY_STAY) {
|
else if (cstate == LS_FAMILY_STAY) {
|
||||||
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, 0);
|
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, 0);
|
||||||
lcd_putc(CSW_3RD_COLUMN-4, y, '[');
|
lcd_putc(CSW_3RD_COLUMN-4, y, '[');
|
||||||
lcd_outdezAtt(CSW_3RD_COLUMN, y, cswTimerValue(cs->v2), LEFT|PREC1);
|
lcd_outdezAtt(CSW_3RD_COLUMN, y, cswTimerValue(cs->v2), LEFT|PREC1);
|
||||||
|
@ -4359,7 +4359,7 @@ void menuModelCustomSwitches(uint8_t event)
|
||||||
lcd_outdezAtt(lcdLastPos+3, y, cswTimerValue(cs->v2+cs->v3), LEFT|PREC1);
|
lcd_outdezAtt(lcdLastPos+3, y, cswTimerValue(cs->v2+cs->v3), LEFT|PREC1);
|
||||||
lcd_putc(lcdLastPos-1, y, ']');
|
lcd_putc(lcdLastPos-1, y, ']');
|
||||||
}
|
}
|
||||||
else if (cstate == CS_FAMILY_TIMER) {
|
else if (cstate == LS_FAMILY_TIMER) {
|
||||||
lcd_outdezAtt(CSW_2ND_COLUMN, y, cs->v1+1, LEFT);
|
lcd_outdezAtt(CSW_2ND_COLUMN, y, cs->v1+1, LEFT);
|
||||||
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2+1, LEFT);
|
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2+1, LEFT);
|
||||||
}
|
}
|
||||||
|
@ -4391,17 +4391,17 @@ enum ClipboardType {
|
||||||
struct Clipboard {
|
struct Clipboard {
|
||||||
ClipboardType type;
|
ClipboardType type;
|
||||||
union {
|
union {
|
||||||
CustomSwData csw;
|
LogicalSwitchData csw;
|
||||||
CustomFnData cfn;
|
CustomFnData cfn;
|
||||||
} data;
|
} data;
|
||||||
};
|
};
|
||||||
|
|
||||||
Clipboard clipboard;
|
Clipboard clipboard;
|
||||||
|
|
||||||
void onCustomSwitchesMenu(const char *result)
|
void onLogicalSwitchesMenu(const char *result)
|
||||||
{
|
{
|
||||||
int8_t sub = m_posVert-1;
|
int8_t sub = m_posVert-1;
|
||||||
CustomSwData * cs = cswAddress(sub);
|
LogicalSwitchData * cs = cswAddress(sub);
|
||||||
|
|
||||||
if (result == STR_COPY) {
|
if (result == STR_COPY) {
|
||||||
clipboard.type = CLIPBOARD_TYPE_CUSTOM_SWITCH;
|
clipboard.type = CLIPBOARD_TYPE_CUSTOM_SWITCH;
|
||||||
|
@ -4412,17 +4412,17 @@ void onCustomSwitchesMenu(const char *result)
|
||||||
eeDirty(EE_MODEL);
|
eeDirty(EE_MODEL);
|
||||||
}
|
}
|
||||||
else if (result == STR_DELETE) {
|
else if (result == STR_DELETE) {
|
||||||
memset(cs, 0, sizeof(CustomSwData));
|
memset(cs, 0, sizeof(LogicalSwitchData));
|
||||||
eeDirty(EE_MODEL);
|
eeDirty(EE_MODEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void menuModelCustomSwitches(uint8_t event)
|
void menuModelLogicalSwitches(uint8_t event)
|
||||||
{
|
{
|
||||||
INCDEC_DECLARE_VARS();
|
INCDEC_DECLARE_VARS();
|
||||||
|
|
||||||
MENU(STR_MENUCUSTOMSWITCHES, menuTabModel, e_CustomSwitches, NUM_CSW+1, {0, NAVIGATION_LINE_BY_LINE|CSW_FIELD_LAST/*repeated...*/});
|
MENU(STR_MENUCUSTOMSWITCHES, menuTabModel, e_LogicalSwitches, NUM_CSW+1, {0, NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/});
|
||||||
|
|
||||||
uint8_t y = 0;
|
uint8_t y = 0;
|
||||||
uint8_t k = 0;
|
uint8_t k = 0;
|
||||||
|
@ -4438,12 +4438,12 @@ void menuModelCustomSwitches(uint8_t event)
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
if (sub>=0 && horz<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
if (sub>=0 && horz<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
CustomSwData * cs = cswAddress(sub);
|
LogicalSwitchData * cs = cswAddress(sub);
|
||||||
if (cs->func) MENU_ADD_ITEM(STR_COPY);
|
if (cs->func) MENU_ADD_ITEM(STR_COPY);
|
||||||
if (clipboard.type == CLIPBOARD_TYPE_CUSTOM_SWITCH)
|
if (clipboard.type == CLIPBOARD_TYPE_CUSTOM_SWITCH)
|
||||||
MENU_ADD_ITEM(STR_PASTE);
|
MENU_ADD_ITEM(STR_PASTE);
|
||||||
if (cs->func || cs->v1 || cs->v2 || cs->delay || cs->duration || cs->andsw) MENU_ADD_ITEM(STR_DELETE);
|
if (cs->func || cs->v1 || cs->v2 || cs->delay || cs->duration || cs->andsw) MENU_ADD_ITEM(STR_DELETE);
|
||||||
menuHandler = onCustomSwitchesMenu;
|
menuHandler = onLogicalSwitchesMenu;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -4453,7 +4453,7 @@ void menuModelCustomSwitches(uint8_t event)
|
||||||
uint8_t attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
uint8_t attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||||
uint8_t attr1 = (horz==1 ? attr : 0);
|
uint8_t attr1 = (horz==1 ? attr : 0);
|
||||||
uint8_t attr2 = (horz==2 ? attr : 0);
|
uint8_t attr2 = (horz==2 ? attr : 0);
|
||||||
CustomSwData * cs = cswAddress(k);
|
LogicalSwitchData * cs = cswAddress(k);
|
||||||
|
|
||||||
// CSW name
|
// CSW name
|
||||||
uint8_t sw = SWSRC_SW1+k;
|
uint8_t sw = SWSRC_SW1+k;
|
||||||
|
@ -4471,24 +4471,24 @@ void menuModelCustomSwitches(uint8_t event)
|
||||||
int8_t v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM;
|
int8_t v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (cstate == CS_FAMILY_BOOL || cstate == CS_FAMILY_STICKY) {
|
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
||||||
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
||||||
putsSwitches(CSW_3RD_COLUMN, y, cs->v2, attr2);
|
putsSwitches(CSW_3RD_COLUMN, y, cs->v2, attr2);
|
||||||
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
|
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
|
||||||
v2_min = SWSRC_OFF+1; v2_max = SWSRC_ON-1;
|
v2_min = SWSRC_OFF+1; v2_max = SWSRC_ON-1;
|
||||||
INCDEC_SET_FLAG(INCDEC_SWITCH);
|
INCDEC_SET_FLAG(INCDEC_SWITCH);
|
||||||
INCDEC_ENABLE_CHECK(isSwitchAvailableInCustomSwitches);
|
INCDEC_ENABLE_CHECK(isSwitchAvailableInLogicalSwitches);
|
||||||
}
|
}
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
else if (cstate == CS_FAMILY_STAY) {
|
else if (cstate == LS_FAMILY_STAY) {
|
||||||
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
||||||
lcd_putc(CSW_3RD_COLUMN-4, y, '[');
|
lcd_putc(CSW_3RD_COLUMN-4, y, '[');
|
||||||
lcd_outdezAtt(CSW_3RD_COLUMN, y, cswTimerValue(cs->v2), LEFT|PREC1|attr2);
|
lcd_outdezAtt(CSW_3RD_COLUMN, y, cswTimerValue(cs->v2), LEFT|PREC1|attr2);
|
||||||
lcd_putc(lcdLastPos, y, ':');
|
lcd_putc(lcdLastPos, y, ':');
|
||||||
if (cs->v3 == 0)
|
if (cs->v3 == 0)
|
||||||
lcd_putsAtt(lcdLastPos+3, y, "--", (horz==CSW_FIELD_V3 ? attr : 0));
|
lcd_putsAtt(lcdLastPos+3, y, "--", (horz==LS_FIELD_V3 ? attr : 0));
|
||||||
else
|
else
|
||||||
lcd_outdezAtt(lcdLastPos+3, y, cswTimerValue(cs->v2+cs->v3), LEFT|PREC1|(horz==CSW_FIELD_V3 ? attr : 0));
|
lcd_outdezAtt(lcdLastPos+3, y, cswTimerValue(cs->v2+cs->v3), LEFT|PREC1|(horz==LS_FIELD_V3 ? attr : 0));
|
||||||
lcd_putc(lcdLastPos, y, ']');
|
lcd_putc(lcdLastPos, y, ']');
|
||||||
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
|
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
|
||||||
v2_min=-129; v2_max = 122;
|
v2_min=-129; v2_max = 122;
|
||||||
|
@ -4503,13 +4503,13 @@ void menuModelCustomSwitches(uint8_t event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (cstate == CS_FAMILY_COMP) {
|
else if (cstate == LS_FAMILY_COMP) {
|
||||||
putsMixerSource(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
putsMixerSource(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
||||||
putsMixerSource(CSW_3RD_COLUMN, y, cs->v2, attr2);
|
putsMixerSource(CSW_3RD_COLUMN, y, cs->v2, attr2);
|
||||||
INCDEC_SET_FLAG(INCDEC_SOURCE);
|
INCDEC_SET_FLAG(INCDEC_SOURCE);
|
||||||
INCDEC_ENABLE_CHECK(isSourceAvailable);
|
INCDEC_ENABLE_CHECK(isSourceAvailable);
|
||||||
}
|
}
|
||||||
else if (cstate == CS_FAMILY_TIMER) {
|
else if (cstate == LS_FAMILY_TIMER) {
|
||||||
lcd_outdezAtt(CSW_2ND_COLUMN, y, cswTimerValue(cs->v1), LEFT|PREC1|attr1);
|
lcd_outdezAtt(CSW_2ND_COLUMN, y, cswTimerValue(cs->v1), LEFT|PREC1|attr1);
|
||||||
lcd_outdezAtt(CSW_3RD_COLUMN, y, cswTimerValue(cs->v2), LEFT|PREC1|attr2);
|
lcd_outdezAtt(CSW_3RD_COLUMN, y, cswTimerValue(cs->v2), LEFT|PREC1|attr2);
|
||||||
v1_min = v2_min = -128;
|
v1_min = v2_min = -128;
|
||||||
|
@ -4538,7 +4538,7 @@ void menuModelCustomSwitches(uint8_t event)
|
||||||
eeDirty(EE_MODEL);
|
eeDirty(EE_MODEL);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (cstate == CS_FAMILY_OFS) {
|
if (cstate == LS_FAMILY_OFS) {
|
||||||
v2_min = -128;
|
v2_min = -128;
|
||||||
v2_max -= 128;
|
v2_max -= 128;
|
||||||
}
|
}
|
||||||
|
@ -4570,37 +4570,37 @@ void menuModelCustomSwitches(uint8_t event)
|
||||||
|
|
||||||
// CSW AND switch
|
// CSW AND switch
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
putsSwitches(CSW_4TH_COLUMN, y, cs->andsw, horz==CSW_FIELD_ANDSW ? attr : 0);
|
putsSwitches(CSW_4TH_COLUMN, y, cs->andsw, horz==LS_FIELD_ANDSW ? attr : 0);
|
||||||
#else
|
#else
|
||||||
uint8_t andsw = cs->andsw;
|
uint8_t andsw = cs->andsw;
|
||||||
if (andsw > SWSRC_LAST_SWITCH) {
|
if (andsw > SWSRC_LAST_SWITCH) {
|
||||||
andsw += SWSRC_SW1-SWSRC_LAST_SWITCH-1;
|
andsw += SWSRC_SW1-SWSRC_LAST_SWITCH-1;
|
||||||
}
|
}
|
||||||
putsSwitches(CSW_4TH_COLUMN, y, andsw, horz==CSW_FIELD_ANDSW ? attr : 0);
|
putsSwitches(CSW_4TH_COLUMN, y, andsw, horz==LS_FIELD_ANDSW ? attr : 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
// CSW duration
|
// CSW duration
|
||||||
if (cs->duration > 0)
|
if (cs->duration > 0)
|
||||||
lcd_outdezAtt(CSW_5TH_COLUMN, y, 5*cs->duration, (horz==CSW_FIELD_DURATION ? attr : 0)|PREC1|LEFT);
|
lcd_outdezAtt(CSW_5TH_COLUMN, y, 5*cs->duration, (horz==LS_FIELD_DURATION ? attr : 0)|PREC1|LEFT);
|
||||||
else
|
else
|
||||||
lcd_putsiAtt(CSW_5TH_COLUMN, y, STR_MMMINV, 0, horz==CSW_FIELD_DURATION ? attr : 0);
|
lcd_putsiAtt(CSW_5TH_COLUMN, y, STR_MMMINV, 0, horz==LS_FIELD_DURATION ? attr : 0);
|
||||||
|
|
||||||
// CSW delay
|
// CSW delay
|
||||||
if (cstate == CS_FAMILY_STAY) {
|
if (cstate == LS_FAMILY_STAY) {
|
||||||
lcd_puts(CSW_6TH_COLUMN, y, "N/A");
|
lcd_puts(CSW_6TH_COLUMN, y, "N/A");
|
||||||
if (attr && horz == CSW_FIELD_DELAY) {
|
if (attr && horz == LS_FIELD_DELAY) {
|
||||||
REPEAT_LAST_CURSOR_MOVE();
|
REPEAT_LAST_CURSOR_MOVE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cs->delay > 0) {
|
else if (cs->delay > 0) {
|
||||||
lcd_outdezAtt(CSW_6TH_COLUMN, y, 5*cs->delay, (horz==CSW_FIELD_DELAY ? attr : 0)|PREC1|LEFT);
|
lcd_outdezAtt(CSW_6TH_COLUMN, y, 5*cs->delay, (horz==LS_FIELD_DELAY ? attr : 0)|PREC1|LEFT);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lcd_putsiAtt(CSW_6TH_COLUMN, y, STR_MMMINV, 0, horz==CSW_FIELD_DELAY ? attr : 0);
|
lcd_putsiAtt(CSW_6TH_COLUMN, y, STR_MMMINV, 0, horz==LS_FIELD_DELAY ? attr : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attr && horz == CSW_FIELD_V3 && cstate != CS_FAMILY_STAY) {
|
if (attr && horz == LS_FIELD_V3 && cstate != LS_FAMILY_STAY) {
|
||||||
REPEAT_LAST_CURSOR_MOVE();
|
REPEAT_LAST_CURSOR_MOVE();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -4608,38 +4608,38 @@ void menuModelCustomSwitches(uint8_t event)
|
||||||
|
|
||||||
if ((s_editMode>0 || p1valdiff) && attr) {
|
if ((s_editMode>0 || p1valdiff) && attr) {
|
||||||
switch (horz) {
|
switch (horz) {
|
||||||
case CSW_FIELD_FUNCTION:
|
case LS_FIELD_FUNCTION:
|
||||||
{
|
{
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
cs->func = checkIncDec(event, cs->func, 0, CS_MAXF, EE_MODEL, isFunctionAvailable);
|
cs->func = checkIncDec(event, cs->func, 0, LS_FUNC_MAX, EE_MODEL, isLogicalSwitchFunctionAvailable);
|
||||||
#else
|
#else
|
||||||
CHECK_INCDEC_MODELVAR_ZERO(event, cs->func, CS_MAXF);
|
CHECK_INCDEC_MODELVAR_ZERO(event, cs->func, LS_FUNC_MAX);
|
||||||
#endif
|
#endif
|
||||||
uint8_t new_cstate = cswFamily(cs->func);
|
uint8_t new_cstate = cswFamily(cs->func);
|
||||||
if (cstate != new_cstate) {
|
if (cstate != new_cstate) {
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
if (new_cstate == CS_FAMILY_TIMER) {
|
if (new_cstate == LS_FAMILY_TIMER) {
|
||||||
cs->v1 = cs->v2 = -119;
|
cs->v1 = cs->v2 = -119;
|
||||||
}
|
}
|
||||||
else if (new_cstate == CS_FAMILY_STAY) {
|
else if (new_cstate == LS_FAMILY_STAY) {
|
||||||
cs->v1 = 0; cs->v2 = -129; cs->v3 = 0;
|
cs->v1 = 0; cs->v2 = -129; cs->v3 = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cs->v1 = cs->v2 = 0;
|
cs->v1 = cs->v2 = 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
cs->v1 = cs->v2 = (new_cstate==CS_FAMILY_TIMER ? -119/*1.0*/ : 0);
|
cs->v1 = cs->v2 = (new_cstate==LS_FAMILY_TIMER ? -119/*1.0*/ : 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CSW_FIELD_V1:
|
case LS_FIELD_V1:
|
||||||
cs->v1 = CHECK_INCDEC_PARAM(event, cs->v1, v1_min, v1_max);
|
cs->v1 = CHECK_INCDEC_PARAM(event, cs->v1, v1_min, v1_max);
|
||||||
break;
|
break;
|
||||||
case CSW_FIELD_V2:
|
case LS_FIELD_V2:
|
||||||
cs->v2 = CHECK_INCDEC_PARAM(event, cs->v2, v2_min, v2_max);
|
cs->v2 = CHECK_INCDEC_PARAM(event, cs->v2, v2_min, v2_max);
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
if (cstate==CS_FAMILY_OFS && cs->v1!=0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
if (cstate==LS_FAMILY_OFS && cs->v1!=0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
getvalue_t x = getValue(cs->v1);
|
getvalue_t x = getValue(cs->v1);
|
||||||
if (cs->v1 < MIXSRC_GVAR1)
|
if (cs->v1 < MIXSRC_GVAR1)
|
||||||
|
@ -4651,25 +4651,25 @@ void menuModelCustomSwitches(uint8_t event)
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
case CSW_FIELD_V3:
|
case LS_FIELD_V3:
|
||||||
cs->v3 = CHECK_INCDEC_PARAM(event, cs->v3, v3_min, v3_max);
|
cs->v3 = CHECK_INCDEC_PARAM(event, cs->v3, v3_min, v3_max);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case CSW_FIELD_ANDSW:
|
case LS_FIELD_ANDSW:
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
INCDEC_SET_FLAG(INCDEC_SWITCH);
|
INCDEC_SET_FLAG(INCDEC_SWITCH);
|
||||||
INCDEC_ENABLE_CHECK(isSwitchAvailableInCustomSwitches);
|
INCDEC_ENABLE_CHECK(isSwitchAvailableInLogicalSwitches);
|
||||||
cs->andsw = CHECK_INCDEC_PARAM(event, cs->andsw, -MAX_CSW_ANDSW, MAX_CSW_ANDSW);
|
cs->andsw = CHECK_INCDEC_PARAM(event, cs->andsw, -MAX_LS_ANDSW, MAX_LS_ANDSW);
|
||||||
#else
|
#else
|
||||||
CHECK_INCDEC_MODELVAR_ZERO(event, cs->andsw, MAX_CSW_ANDSW);
|
CHECK_INCDEC_MODELVAR_ZERO(event, cs->andsw, MAX_LS_ANDSW);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
case CSW_FIELD_DURATION:
|
case LS_FIELD_DURATION:
|
||||||
CHECK_INCDEC_MODELVAR_ZERO(event, cs->duration, MAX_CSW_DURATION);
|
CHECK_INCDEC_MODELVAR_ZERO(event, cs->duration, MAX_LS_DURATION);
|
||||||
break;
|
break;
|
||||||
case CSW_FIELD_DELAY:
|
case LS_FIELD_DELAY:
|
||||||
CHECK_INCDEC_MODELVAR_ZERO(event, cs->delay, MAX_CSW_DELAY);
|
CHECK_INCDEC_MODELVAR_ZERO(event, cs->delay, MAX_LS_DELAY);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -1219,8 +1219,8 @@ bool isSourceAvailable(int16_t source)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source>=MIXSRC_SW1 && source<=MIXSRC_LAST_CSW) {
|
if (source>=MIXSRC_SW1 && source<=MIXSRC_LAST_CSW) {
|
||||||
CustomSwData * cs = cswAddress(source-MIXSRC_SW1);
|
LogicalSwitchData * cs = cswAddress(source-MIXSRC_SW1);
|
||||||
return (cs->func != CS_OFF);
|
return (cs->func != LS_FUNC_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(GVARS)
|
#if !defined(GVARS)
|
||||||
|
@ -1248,7 +1248,7 @@ bool isInputSourceAvailable(int16_t source)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSwitchAvailableInCustomSwitches(int16_t swtch)
|
bool isSwitchAvailableInLogicalSwitches(int16_t swtch)
|
||||||
{
|
{
|
||||||
if (swtch < 0) {
|
if (swtch < 0) {
|
||||||
if (swtch <= -SWSRC_ON)
|
if (swtch <= -SWSRC_ON)
|
||||||
|
@ -1279,22 +1279,35 @@ bool isSwitchAvailableInCustomSwitches(int16_t swtch)
|
||||||
|
|
||||||
bool isSwitchAvailable(int16_t swtch)
|
bool isSwitchAvailable(int16_t swtch)
|
||||||
{
|
{
|
||||||
if (!isSwitchAvailableInCustomSwitches(swtch)) {
|
if (!isSwitchAvailableInLogicalSwitches(swtch)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (swtch >= SWSRC_FIRST_CSW && swtch <= SWSRC_LAST_CSW) {
|
if (swtch >= SWSRC_FIRST_CSW && swtch <= SWSRC_LAST_CSW) {
|
||||||
CustomSwData * cs = cswAddress(swtch-SWSRC_FIRST_CSW);
|
LogicalSwitchData * cs = cswAddress(swtch-SWSRC_FIRST_CSW);
|
||||||
return (cs->func != CS_OFF);
|
return (cs->func != LS_FUNC_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not available yet, will be needed if we implement the Range function later...
|
// Not available yet, will be needed if we implement the Range function later...
|
||||||
bool isFunctionAvailable(int16_t function)
|
bool isLogicalSwitchFunctionAvailable(int16_t function)
|
||||||
{
|
{
|
||||||
return function != CS_RANGE;
|
return function != LS_FUNC_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isAssignableFunctionAvailable(int16_t function)
|
||||||
|
{
|
||||||
|
switch (function) {
|
||||||
|
|
||||||
|
#if !defined(HAPTIC)
|
||||||
|
case FUNC_HAPTIC:
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -190,9 +190,10 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||||
var = checkIncDecModelZero(event,var,max)
|
var = checkIncDecModelZero(event,var,max)
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
bool isFunctionAvailable(int16_t function);
|
bool isLogicalSwitchFunctionAvailable(int16_t function);
|
||||||
|
bool isAssignableFunctionAvailable(int16_t function);
|
||||||
bool isSwitchAvailable(int16_t swtch);
|
bool isSwitchAvailable(int16_t swtch);
|
||||||
bool isSwitchAvailableInCustomSwitches(int16_t swtch);
|
bool isSwitchAvailableInLogicalSwitches(int16_t swtch);
|
||||||
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
|
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
|
||||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max) \
|
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max) \
|
||||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SWITCH|NO_INCDEC_MARKS, isSwitchAvailable)
|
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SWITCH|NO_INCDEC_MARKS, isSwitchAvailable)
|
||||||
|
|
|
@ -668,39 +668,39 @@ PACK( union u_int8int16_t {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum CswFunctions {
|
enum LogicalSwitchesFunctions {
|
||||||
CS_OFF,
|
LS_FUNC_NONE,
|
||||||
CS_VEQUAL, // v==offset
|
LS_FUNC_VEQUAL, // v==offset
|
||||||
CS_VPOS, // v>offset
|
LS_FUNC_VPOS, // v>offset
|
||||||
CS_VNEG, // v<offset
|
LS_FUNC_VNEG, // v<offset
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
CS_RANGE,
|
LS_FUNC_RANGE,
|
||||||
#endif
|
#endif
|
||||||
CS_APOS, // |v|>offset
|
LS_FUNC_APOS, // |v|>offset
|
||||||
CS_ANEG, // |v|<offset
|
LS_FUNC_ANEG, // |v|<offset
|
||||||
CS_AND,
|
LS_FUNC_AND,
|
||||||
CS_OR,
|
LS_FUNC_OR,
|
||||||
CS_XOR,
|
LS_FUNC_XOR,
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
CS_STAY,
|
LS_FUNC_STAY,
|
||||||
#endif
|
#endif
|
||||||
CS_EQUAL,
|
LS_FUNC_EQUAL,
|
||||||
CS_GREATER,
|
LS_FUNC_GREATER,
|
||||||
CS_LESS,
|
LS_FUNC_LESS,
|
||||||
CS_DIFFEGREATER,
|
LS_FUNC_DIFFEGREATER,
|
||||||
CS_ADIFFEGREATER,
|
LS_FUNC_ADIFFEGREATER,
|
||||||
CS_TIMER,
|
LS_FUNC_TIMER,
|
||||||
CS_STICKY,
|
LS_FUNC_STICKY,
|
||||||
CS_COUNT,
|
LS_FUNC_COUNT,
|
||||||
CS_MAXF = CS_COUNT-1
|
LS_FUNC_MAX = LS_FUNC_COUNT-1
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
#define MAX_CSW_DURATION 120 /*60s*/
|
#define MAX_LS_DURATION 120 /*60s*/
|
||||||
#define MAX_CSW_DELAY 120 /*60s*/
|
#define MAX_LS_DELAY 120 /*60s*/
|
||||||
#define MAX_CSW_ANDSW SWSRC_LAST
|
#define MAX_LS_ANDSW SWSRC_LAST
|
||||||
typedef int16_t csw_telemetry_value_t;
|
typedef int16_t ls_telemetry_value_t;
|
||||||
PACK(typedef struct t_CustomSwData { // Custom Switches data
|
PACK(typedef struct t_LogicalSwitchData { // Custom Switches data
|
||||||
int8_t v1;
|
int8_t v1;
|
||||||
int16_t v2;
|
int16_t v2;
|
||||||
int16_t v3;
|
int16_t v3;
|
||||||
|
@ -708,16 +708,16 @@ PACK(typedef struct t_CustomSwData { // Custom Switches data
|
||||||
uint8_t delay;
|
uint8_t delay;
|
||||||
uint8_t duration;
|
uint8_t duration;
|
||||||
int8_t andsw;
|
int8_t andsw;
|
||||||
}) CustomSwData;
|
}) LogicalSwitchData;
|
||||||
#else
|
#else
|
||||||
typedef uint8_t csw_telemetry_value_t;
|
typedef uint8_t ls_telemetry_value_t;
|
||||||
#define MAX_CSW_ANDSW 15
|
#define MAX_LS_ANDSW 15
|
||||||
PACK(typedef struct t_CustomSwData { // Custom Switches data
|
PACK(typedef struct t_LogicalSwitchData { // Custom Switches data
|
||||||
int8_t v1; //input
|
int8_t v1; //input
|
||||||
int8_t v2; //offset
|
int8_t v2; //offset
|
||||||
uint8_t func:4;
|
uint8_t func:4;
|
||||||
uint8_t andsw:4;
|
uint8_t andsw:4;
|
||||||
}) CustomSwData;
|
}) LogicalSwitchData;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum Functions {
|
enum Functions {
|
||||||
|
@ -1536,7 +1536,7 @@ PACK(typedef struct t_ModelData {
|
||||||
CURVDATA curves[MAX_CURVES];
|
CURVDATA curves[MAX_CURVES];
|
||||||
int8_t points[NUM_POINTS];
|
int8_t points[NUM_POINTS];
|
||||||
|
|
||||||
CustomSwData customSw[NUM_CSW];
|
LogicalSwitchData customSw[NUM_CSW];
|
||||||
CustomFnData funcSw[NUM_CFN];
|
CustomFnData funcSw[NUM_CFN];
|
||||||
SwashRingData swashR;
|
SwashRingData swashR;
|
||||||
PhaseData phaseData[MAX_PHASES];
|
PhaseData phaseData[MAX_PHASES];
|
||||||
|
|
|
@ -441,27 +441,27 @@ CurveInfo curveInfo(uint8_t idx)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CustomSwData *cswAddress(uint8_t idx)
|
LogicalSwitchData *cswAddress(uint8_t idx)
|
||||||
{
|
{
|
||||||
return &g_model.customSw[idx];
|
return &g_model.customSw[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t cswFamily(uint8_t func)
|
uint8_t cswFamily(uint8_t func)
|
||||||
{
|
{
|
||||||
if (func <= CS_ANEG)
|
if (func <= LS_FUNC_ANEG)
|
||||||
return CS_FAMILY_OFS;
|
return LS_FAMILY_OFS;
|
||||||
else if (func <= CS_XOR)
|
else if (func <= LS_FUNC_XOR)
|
||||||
return CS_FAMILY_BOOL;
|
return LS_FAMILY_BOOL;
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
else if (func == CS_STAY)
|
else if (func == LS_FUNC_STAY)
|
||||||
return CS_FAMILY_STAY;
|
return LS_FAMILY_STAY;
|
||||||
#endif
|
#endif
|
||||||
else if (func <= CS_LESS)
|
else if (func <= LS_FUNC_LESS)
|
||||||
return CS_FAMILY_COMP;
|
return LS_FAMILY_COMP;
|
||||||
else if (func <= CS_ADIFFEGREATER)
|
else if (func <= LS_FUNC_ADIFFEGREATER)
|
||||||
return CS_FAMILY_DIFF;
|
return LS_FAMILY_DIFF;
|
||||||
else
|
else
|
||||||
return CS_FAMILY_TIMER+func-CS_TIMER;
|
return LS_FAMILY_TIMER+func-LS_FUNC_TIMER;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t cswTimerValue(delayval_t val)
|
int16_t cswTimerValue(delayval_t val)
|
||||||
|
@ -1423,7 +1423,7 @@ bool getSwitch(int8_t swtch)
|
||||||
else {
|
else {
|
||||||
s_last_switch_used |= mask;
|
s_last_switch_used |= mask;
|
||||||
|
|
||||||
CustomSwData * cs = cswAddress(cs_idx);
|
LogicalSwitchData * cs = cswAddress(cs_idx);
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
int8_t s = cs->andsw;
|
int8_t s = cs->andsw;
|
||||||
#else
|
#else
|
||||||
|
@ -1432,48 +1432,48 @@ bool getSwitch(int8_t swtch)
|
||||||
s += SWSRC_SW1-SWSRC_LAST_SWITCH-1;
|
s += SWSRC_SW1-SWSRC_LAST_SWITCH-1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (cs->func == CS_OFF || (s && !getSwitch(s))) {
|
if (cs->func == LS_FUNC_NONE || (s && !getSwitch(s))) {
|
||||||
csLastValue[cs_idx] = CS_LAST_VALUE_INIT;
|
csLastValue[cs_idx] = CS_LAST_VALUE_INIT;
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
else if ((s=cswFamily(cs->func)) == CS_FAMILY_BOOL) {
|
else if ((s=cswFamily(cs->func)) == LS_FAMILY_BOOL) {
|
||||||
bool res1 = getSwitch(cs->v1);
|
bool res1 = getSwitch(cs->v1);
|
||||||
bool res2 = getSwitch(cs->v2);
|
bool res2 = getSwitch(cs->v2);
|
||||||
switch (cs->func) {
|
switch (cs->func) {
|
||||||
case CS_AND:
|
case LS_FUNC_AND:
|
||||||
result = (res1 && res2);
|
result = (res1 && res2);
|
||||||
break;
|
break;
|
||||||
case CS_OR:
|
case LS_FUNC_OR:
|
||||||
result = (res1 || res2);
|
result = (res1 || res2);
|
||||||
break;
|
break;
|
||||||
// case CS_XOR:
|
// case LS_FUNC_XOR:
|
||||||
default:
|
default:
|
||||||
result = (res1 ^ res2);
|
result = (res1 ^ res2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (s == CS_FAMILY_TIMER) {
|
else if (s == LS_FAMILY_TIMER) {
|
||||||
result = (csLastValue[cs_idx] <= 0);
|
result = (csLastValue[cs_idx] <= 0);
|
||||||
}
|
}
|
||||||
else if (s == CS_FAMILY_STICKY) {
|
else if (s == LS_FAMILY_STICKY) {
|
||||||
result = (csLastValue[cs_idx] & (1<<0));
|
result = (csLastValue[cs_idx] & (1<<0));
|
||||||
}
|
}
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
else if (s == CS_FAMILY_STAY) {
|
else if (s == LS_FAMILY_STAY) {
|
||||||
result = (csLastValue[cs_idx] & (1<<0));
|
result = (csLastValue[cs_idx] & (1<<0));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
getvalue_t x = getValue(cs->v1);
|
getvalue_t x = getValue(cs->v1);
|
||||||
getvalue_t y;
|
getvalue_t y;
|
||||||
if (s == CS_FAMILY_COMP) {
|
if (s == LS_FAMILY_COMP) {
|
||||||
y = getValue(cs->v2);
|
y = getValue(cs->v2);
|
||||||
|
|
||||||
switch (cs->func) {
|
switch (cs->func) {
|
||||||
case CS_EQUAL:
|
case LS_FUNC_EQUAL:
|
||||||
result = (x==y);
|
result = (x==y);
|
||||||
break;
|
break;
|
||||||
case CS_GREATER:
|
case LS_FUNC_GREATER:
|
||||||
result = (x>y);
|
result = (x>y);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1491,7 +1491,7 @@ bool getSwitch(int8_t swtch)
|
||||||
y = convertCswTelemValue(cs);
|
y = convertCswTelemValue(cs);
|
||||||
|
|
||||||
#if defined(FRSKY_HUB) && defined(GAUGES)
|
#if defined(FRSKY_HUB) && defined(GAUGES)
|
||||||
if (s == CS_FAMILY_OFS) {
|
if (s == LS_FAMILY_OFS) {
|
||||||
uint8_t idx = cs->v1-MIXSRC_FIRST_TELEM+1-TELEM_ALT;
|
uint8_t idx = cs->v1-MIXSRC_FIRST_TELEM+1-TELEM_ALT;
|
||||||
if (idx < THLD_MAX) {
|
if (idx < THLD_MAX) {
|
||||||
// Fill the threshold array
|
// Fill the threshold array
|
||||||
|
@ -1519,7 +1519,7 @@ bool getSwitch(int8_t swtch)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (cs->func) {
|
switch (cs->func) {
|
||||||
case CS_VEQUAL:
|
case LS_FUNC_VEQUAL:
|
||||||
#if defined(GVARS)
|
#if defined(GVARS)
|
||||||
if (cs->v1 >= MIXSRC_GVAR1 && cs->v1 <= MIXSRC_LAST_GVAR)
|
if (cs->v1 >= MIXSRC_GVAR1 && cs->v1 <= MIXSRC_LAST_GVAR)
|
||||||
result = (x==y);
|
result = (x==y);
|
||||||
|
@ -1527,16 +1527,16 @@ bool getSwitch(int8_t swtch)
|
||||||
#endif
|
#endif
|
||||||
result = (abs(x-y) < (1024 / STICK_TOLERANCE));
|
result = (abs(x-y) < (1024 / STICK_TOLERANCE));
|
||||||
break;
|
break;
|
||||||
case CS_VPOS:
|
case LS_FUNC_VPOS:
|
||||||
result = (x>y);
|
result = (x>y);
|
||||||
break;
|
break;
|
||||||
case CS_VNEG:
|
case LS_FUNC_VNEG:
|
||||||
result = (x<y);
|
result = (x<y);
|
||||||
break;
|
break;
|
||||||
case CS_APOS:
|
case LS_FUNC_APOS:
|
||||||
result = (abs(x)>y);
|
result = (abs(x)>y);
|
||||||
break;
|
break;
|
||||||
case CS_ANEG:
|
case LS_FUNC_ANEG:
|
||||||
result = (abs(x)<y);
|
result = (abs(x)<y);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1544,7 +1544,7 @@ bool getSwitch(int8_t swtch)
|
||||||
if (csLastValue[cs_idx] == CS_LAST_VALUE_INIT)
|
if (csLastValue[cs_idx] == CS_LAST_VALUE_INIT)
|
||||||
csLastValue[cs_idx] = x;
|
csLastValue[cs_idx] = x;
|
||||||
int16_t diff = x - csLastValue[cs_idx];
|
int16_t diff = x - csLastValue[cs_idx];
|
||||||
if (cs->func == CS_DIFFEGREATER)
|
if (cs->func == LS_FUNC_DIFFEGREATER)
|
||||||
result = (y >= 0 ? (diff >= y) : (diff <= y));
|
result = (y >= 0 ? (diff >= y) : (diff <= y));
|
||||||
else
|
else
|
||||||
result = (abs(diff) >= y);
|
result = (abs(diff) >= y);
|
||||||
|
@ -1578,7 +1578,7 @@ bool getSwitch(int8_t swtch)
|
||||||
if (cswDurations[cs_idx] > get_tmr10ms()) {
|
if (cswDurations[cs_idx] > get_tmr10ms()) {
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
else if (s == CS_FAMILY_STICKY) {
|
else if (s == LS_FAMILY_STICKY) {
|
||||||
csLastValue[cs_idx] &= ~(1<<0);
|
csLastValue[cs_idx] &= ~(1<<0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1925,7 +1925,7 @@ void setGVarValue(uint8_t idx, int16_t value, int8_t phase)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FRSKY)
|
#if defined(FRSKY)
|
||||||
csw_telemetry_value_t minTelemValue(uint8_t channel)
|
ls_telemetry_value_t minTelemValue(uint8_t channel)
|
||||||
{
|
{
|
||||||
switch (channel) {
|
switch (channel) {
|
||||||
case TELEM_FUEL:
|
case TELEM_FUEL:
|
||||||
|
@ -1944,7 +1944,7 @@ csw_telemetry_value_t minTelemValue(uint8_t channel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
csw_telemetry_value_t maxTelemValue(uint8_t channel)
|
ls_telemetry_value_t maxTelemValue(uint8_t channel)
|
||||||
{
|
{
|
||||||
switch (channel) {
|
switch (channel) {
|
||||||
case TELEM_FUEL:
|
case TELEM_FUEL:
|
||||||
|
@ -1965,7 +1965,7 @@ csw_telemetry_value_t maxTelemValue(uint8_t channel)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
getvalue_t convert16bitsTelemValue(uint8_t channel, csw_telemetry_value_t value)
|
getvalue_t convert16bitsTelemValue(uint8_t channel, ls_telemetry_value_t value)
|
||||||
{
|
{
|
||||||
getvalue_t result;
|
getvalue_t result;
|
||||||
switch (channel) {
|
switch (channel) {
|
||||||
|
@ -1979,13 +1979,13 @@ getvalue_t convert16bitsTelemValue(uint8_t channel, csw_telemetry_value_t value)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
csw_telemetry_value_t max8bitsTelemValue(uint8_t channel)
|
ls_telemetry_value_t max8bitsTelemValue(uint8_t channel)
|
||||||
{
|
{
|
||||||
return min<csw_telemetry_value_t>(255, maxTelemValue(channel));
|
return min<ls_telemetry_value_t>(255, maxTelemValue(channel));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
getvalue_t convert8bitsTelemValue(uint8_t channel, csw_telemetry_value_t value)
|
getvalue_t convert8bitsTelemValue(uint8_t channel, ls_telemetry_value_t value)
|
||||||
{
|
{
|
||||||
getvalue_t result;
|
getvalue_t result;
|
||||||
switch (channel) {
|
switch (channel) {
|
||||||
|
@ -2037,13 +2037,13 @@ getvalue_t convert8bitsTelemValue(uint8_t channel, csw_telemetry_value_t value)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
getvalue_t convertCswTelemValue(CustomSwData * cs)
|
getvalue_t convertCswTelemValue(LogicalSwitchData * cs)
|
||||||
{
|
{
|
||||||
getvalue_t val;
|
getvalue_t val;
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
val = convert16bitsTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, cs->v2);
|
val = convert16bitsTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, cs->v2);
|
||||||
#else
|
#else
|
||||||
if (cswFamily(cs->func)==CS_FAMILY_OFS)
|
if (cswFamily(cs->func)==LS_FAMILY_OFS)
|
||||||
val = convert8bitsTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2);
|
val = convert8bitsTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2);
|
||||||
else
|
else
|
||||||
val = convert8bitsTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2) - convert8bitsTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128);
|
val = convert8bitsTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2) - convert8bitsTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128);
|
||||||
|
@ -4051,8 +4051,8 @@ void doMixerCalculations()
|
||||||
s_cnt_1s += 1;
|
s_cnt_1s += 1;
|
||||||
|
|
||||||
for (uint8_t i=0; i<NUM_CSW; i++) {
|
for (uint8_t i=0; i<NUM_CSW; i++) {
|
||||||
CustomSwData * cs = cswAddress(i);
|
LogicalSwitchData * cs = cswAddress(i);
|
||||||
if (cs->func == CS_TIMER) {
|
if (cs->func == LS_FUNC_TIMER) {
|
||||||
int16_t *lastValue = &csLastValue[i];
|
int16_t *lastValue = &csLastValue[i];
|
||||||
if (*lastValue == 0 || *lastValue == CS_LAST_VALUE_INIT) {
|
if (*lastValue == 0 || *lastValue == CS_LAST_VALUE_INIT) {
|
||||||
*lastValue = -cswTimerValue(cs->v1);
|
*lastValue = -cswTimerValue(cs->v1);
|
||||||
|
@ -4065,7 +4065,7 @@ void doMixerCalculations()
|
||||||
*lastValue -= 1;
|
*lastValue -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cs->func == CS_STICKY) {
|
else if (cs->func == LS_FUNC_STICKY) {
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
bool state;
|
bool state;
|
||||||
bool last;
|
bool last;
|
||||||
|
@ -4092,7 +4092,7 @@ void doMixerCalculations()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
else if (cs->func == CS_STAY) {
|
else if (cs->func == LS_FUNC_STAY) {
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
uint8_t state:1;
|
uint8_t state:1;
|
||||||
uint16_t duration:15;
|
uint16_t duration:15;
|
||||||
|
|
|
@ -1225,7 +1225,7 @@ ExpoData *expoAddress(uint8_t idx);
|
||||||
MixData *mixAddress(uint8_t idx);
|
MixData *mixAddress(uint8_t idx);
|
||||||
LimitData *limitAddress(uint8_t idx);
|
LimitData *limitAddress(uint8_t idx);
|
||||||
int8_t *curveAddress(uint8_t idx);
|
int8_t *curveAddress(uint8_t idx);
|
||||||
CustomSwData *cswAddress(uint8_t idx);
|
LogicalSwitchData *cswAddress(uint8_t idx);
|
||||||
|
|
||||||
#if !defined(PCBTARANIS)
|
#if !defined(PCBTARANIS)
|
||||||
struct CurveInfo {
|
struct CurveInfo {
|
||||||
|
@ -1290,14 +1290,14 @@ extern int24_t act [MAX_MIXERS];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum CswFunctionFamilies {
|
enum CswFunctionFamilies {
|
||||||
CS_FAMILY_OFS,
|
LS_FAMILY_OFS,
|
||||||
CS_FAMILY_BOOL,
|
LS_FAMILY_BOOL,
|
||||||
CS_FAMILY_COMP,
|
LS_FAMILY_COMP,
|
||||||
CS_FAMILY_DIFF,
|
LS_FAMILY_DIFF,
|
||||||
CS_FAMILY_TIMER,
|
LS_FAMILY_TIMER,
|
||||||
CS_FAMILY_STICKY,
|
LS_FAMILY_STICKY,
|
||||||
CS_FAMILY_RANGE,
|
LS_FAMILY_RANGE,
|
||||||
CS_FAMILY_STAY
|
LS_FAMILY_STAY
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t cswFamily(uint8_t func);
|
uint8_t cswFamily(uint8_t func);
|
||||||
|
@ -1646,20 +1646,20 @@ extern uint8_t barsThresholds[THLD_MAX];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FRSKY)
|
#if defined(FRSKY)
|
||||||
csw_telemetry_value_t minTelemValue(uint8_t channel);
|
ls_telemetry_value_t minTelemValue(uint8_t channel);
|
||||||
csw_telemetry_value_t maxTelemValue(uint8_t channel);
|
ls_telemetry_value_t maxTelemValue(uint8_t channel);
|
||||||
#else
|
#else
|
||||||
#define minTelemValue(channel) 255
|
#define minTelemValue(channel) 255
|
||||||
#define maxTelemValue(channel) 255
|
#define maxTelemValue(channel) 255
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
getvalue_t convert16bitsTelemValue(uint8_t channel, csw_telemetry_value_t value);
|
getvalue_t convert16bitsTelemValue(uint8_t channel, ls_telemetry_value_t value);
|
||||||
csw_telemetry_value_t max8bitsTelemValue(uint8_t channel);
|
ls_telemetry_value_t max8bitsTelemValue(uint8_t channel);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
getvalue_t convert8bitsTelemValue(uint8_t channel, csw_telemetry_value_t value);
|
getvalue_t convert8bitsTelemValue(uint8_t channel, ls_telemetry_value_t value);
|
||||||
getvalue_t convertCswTelemValue(CustomSwData * cs);
|
getvalue_t convertCswTelemValue(LogicalSwitchData * cs);
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
#define convertTelemValue(channel, value) convert16bitsTelemValue(channel, value)
|
#define convertTelemValue(channel, value) convert16bitsTelemValue(channel, value)
|
||||||
|
|
|
@ -146,7 +146,7 @@ void setCurve(uint8_t c, const pm_int8_t ar[])
|
||||||
|
|
||||||
void setSwitch(uint8_t idx, uint8_t func, int8_t v1, int8_t v2)
|
void setSwitch(uint8_t idx, uint8_t func, int8_t v1, int8_t v2)
|
||||||
{
|
{
|
||||||
CustomSwData *cs = cswAddress(idx-1);
|
LogicalSwitchData *cs = cswAddress(idx-1);
|
||||||
cs->func = func;
|
cs->func = func;
|
||||||
cs->v1 = v1;
|
cs->v1 = v1;
|
||||||
cs->v2 = v2;
|
cs->v2 = v2;
|
||||||
|
@ -198,8 +198,8 @@ void applyTemplate(uint8_t idx)
|
||||||
md=setDest(13, MIXSRC_CH14); // md->weight= 100; done by setDest anyway
|
md=setDest(13, MIXSRC_CH14); // md->weight= 100; done by setDest anyway
|
||||||
md=setDest(13, MIXSRC_MAX); mixSetWeight(md, -100); md->swtch=SWSRC_SWB; md->mltpx=MLTPX_REP;
|
md=setDest(13, MIXSRC_MAX); mixSetWeight(md, -100); md->swtch=SWSRC_SWB; md->mltpx=MLTPX_REP;
|
||||||
md=setDest(13, MIXSRC_MAX); /* md->weight= 100;*/ md->swtch=SWSRC_THR; md->mltpx=MLTPX_REP;
|
md=setDest(13, MIXSRC_MAX); /* md->weight= 100;*/ md->swtch=SWSRC_THR; md->mltpx=MLTPX_REP;
|
||||||
setSwitch(11, CS_VNEG, STK_THR, -99);
|
setSwitch(11, LS_FUNC_VNEG, STK_THR, -99);
|
||||||
setSwitch(12, CS_VPOS, MIXSRC_CH14, 0);
|
setSwitch(12, LS_FUNC_VPOS, MIXSRC_CH14, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// V-Tail
|
// V-Tail
|
||||||
|
@ -283,7 +283,7 @@ void applyTemplate(uint8_t idx)
|
||||||
// Servo Test
|
// Servo Test
|
||||||
case TMPL_SERVO_TEST:
|
case TMPL_SERVO_TEST:
|
||||||
md=setDest(NUM_CHNOUT-1, MIXSRC_SW1, true); md->weight=110; md->mltpx=MLTPX_ADD; md->delayUp = 6; md->delayDown = 6; md->speedUp = 8; md->speedDown = 8;
|
md=setDest(NUM_CHNOUT-1, MIXSRC_SW1, true); md->weight=110; md->mltpx=MLTPX_ADD; md->delayUp = 6; md->delayDown = 6; md->speedUp = 8; md->speedDown = 8;
|
||||||
setSwitch(1, CS_VNEG, MIXSRC_LAST_CH, 0);
|
setSwitch(1, LS_FUNC_VNEG, MIXSRC_LAST_CH, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue