mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 00:05:17 +03:00
re #1334 - added Lua script outputs to: mixer soruces list, logical switches V1 and V2 list
This commit is contained in:
parent
5fcba6e193
commit
d0edbacf37
8 changed files with 132 additions and 111 deletions
|
@ -357,6 +357,8 @@ QString RawSource::toString(const ModelData & model)
|
|||
}
|
||||
return result;
|
||||
}
|
||||
case SOURCE_TYPE_LUA_OUTPUT:
|
||||
return QObject::tr("[S%1]%2").arg(index/16+1).arg(index%16+1);
|
||||
case SOURCE_TYPE_STICK:
|
||||
return AnalogString(index);
|
||||
case SOURCE_TYPE_TRIM:
|
||||
|
|
|
@ -286,7 +286,7 @@ enum TelemetrySource {
|
|||
enum RawSourceType {
|
||||
SOURCE_TYPE_NONE,
|
||||
SOURCE_TYPE_VIRTUAL_INPUT,
|
||||
SOURCE_TYPE_LUA_INPUT,
|
||||
SOURCE_TYPE_LUA_OUTPUT,
|
||||
SOURCE_TYPE_STICK, // and POTS
|
||||
SOURCE_TYPE_ROTARY_ENCODER,
|
||||
SOURCE_TYPE_TRIM,
|
||||
|
@ -1141,7 +1141,9 @@ enum Capability {
|
|||
HasDisplayText,
|
||||
VirtualInputs,
|
||||
TrainerInputs,
|
||||
LuaInputs,
|
||||
LuaScripts,
|
||||
LuaInputsPerScript,
|
||||
LuaOutputsPerScript,
|
||||
LimitsPer1000,
|
||||
EnhancedCurves,
|
||||
HasFasOffset,
|
||||
|
|
|
@ -187,9 +187,9 @@ class SourcesConversionTable: public ConversionTable {
|
|||
if (IS_TARANIS(board) && version >= 216) {
|
||||
for (int i=0; i<32; i++)
|
||||
addConversion(RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i), val++);
|
||||
for (int i=0; i<7; i++) {
|
||||
for (int j=0; j<6; j++) {
|
||||
addConversion(RawSource(SOURCE_TYPE_LUA_INPUT, i*16+j), val++);
|
||||
for (int i=0; i<GetCurrentFirmware()->getCapability(LuaScripts); i++) {
|
||||
for (int j=0; j<GetCurrentFirmware()->getCapability(LuaOutputsPerScript); j++) {
|
||||
addConversion(RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j), val++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -678,7 +678,12 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
|||
return IS_TARANIS(board) ? 32 : 0;
|
||||
case TrainerInputs:
|
||||
return IS_ARM(board) ? 16 : 8;
|
||||
case LuaInputs:
|
||||
case LuaScripts:
|
||||
return IS_TARANIS(board) ? 7 : 0;
|
||||
case LuaInputsPerScript:
|
||||
return IS_TARANIS(board) ? 10 : 0;
|
||||
case LuaOutputsPerScript:
|
||||
return IS_TARANIS(board) ? 6 : 0;
|
||||
case LimitsPer1000:
|
||||
case EnhancedCurves:
|
||||
return IS_TARANIS(board);
|
||||
|
|
|
@ -519,6 +519,17 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
|
|||
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
if (flags & POPULATE_SCRIPT_OUTPUTS) {
|
||||
for (int i=0; i<GetCurrentFirmware()->getCapability(LuaScripts); i++) {
|
||||
for (int j=0; j<GetCurrentFirmware()->getCapability(LuaOutputsPerScript); j++) {
|
||||
item = RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (flags & POPULATE_VIRTUAL_INPUTS) {
|
||||
int virtualInputs = GetCurrentFirmware()->getCapability(VirtualInputs);
|
||||
for (int i=0; i<virtualInputs; i++) {
|
||||
|
|
|
@ -89,13 +89,14 @@ void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
|||
QString getProtocolStr(const int proto);
|
||||
QString getPhasesStr(unsigned int phases, ModelData & model);
|
||||
|
||||
#define POPULATE_SOURCES 1
|
||||
#define POPULATE_TRIMS 2
|
||||
#define POPULATE_SWITCHES 4
|
||||
#define POPULATE_GVARS 8
|
||||
#define POPULATE_TELEMETRY 16
|
||||
#define POPULATE_TELEMETRYEXT 32
|
||||
#define POPULATE_VIRTUAL_INPUTS 64
|
||||
#define POPULATE_SOURCES (1<<0)
|
||||
#define POPULATE_TRIMS (1<<1)
|
||||
#define POPULATE_SWITCHES (1<<2)
|
||||
#define POPULATE_GVARS (1<<3)
|
||||
#define POPULATE_TELEMETRY (1<<4)
|
||||
#define POPULATE_TELEMETRYEXT (1<<5)
|
||||
#define POPULATE_VIRTUAL_INPUTS (1<<6)
|
||||
#define POPULATE_SCRIPT_OUTPUTS (1<<7)
|
||||
|
||||
#define GVARS_VARIANT 0x0001
|
||||
#define FRSKY_VARIANT 0x0002
|
||||
|
|
|
@ -286,7 +286,7 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
|||
{
|
||||
case LS_FAMILY_VOFS:
|
||||
mask |= SOURCE1_VISIBLE;
|
||||
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
cswitchOffset[i]->setDecimals(range.decimals);
|
||||
cswitchOffset[i]->setSingleStep(range.step);
|
||||
if (source.isTimeBased()) {
|
||||
|
@ -326,8 +326,8 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
|||
break;
|
||||
case LS_FAMILY_VCOMP:
|
||||
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
|
||||
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->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 | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
break;
|
||||
case LS_FAMILY_TIMER:
|
||||
mask |= VALUE1_VISIBLE | VALUE2_VISIBLE;
|
||||
|
|
|
@ -19,7 +19,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
|
|||
|
||||
this->setWindowTitle(tr("DEST -> CH%1").arg(md->destCh));
|
||||
|
||||
populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
ui->sourceCB->removeItem(0);
|
||||
|
||||
int limit = firmware->getCapability(OffsetWeight);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue