Also provides a lua function to retrieve module settings
This commit is contained in:
bsongis
2015-05-05 20:02:02 +02:00
parent f4c3610a8c
commit eb6ba88f5a
18 changed files with 109 additions and 57 deletions
+1 -1
View File
@@ -1366,7 +1366,7 @@ void ModelData::setDefaultValues(unsigned int id, const GeneralSettings & settin
clear();
used = true;
sprintf(name, "MODEL%02d", id+1);
modelId = id+1;
moduleData[0].modelId = id+1;
setDefaultMixes(settings);
}
+1 -1
View File
@@ -814,6 +814,7 @@ enum Protocol {
class ModuleData {
public:
ModuleData() { clear(); }
unsigned int modelId;
int protocol;
unsigned int channelsStart;
int channelsCount; // 0=8 channels
@@ -973,7 +974,6 @@ class ModelData {
CustomFunctionData customFn[C9X_MAX_CUSTOM_FUNCTIONS];
SwashRingData swashRingData;
unsigned int thrTraceSrc;
unsigned int modelId;
uint64_t switchWarningStates;
unsigned int switchWarningEnable;
unsigned int potsWarningMode;
@@ -501,7 +501,7 @@ t_Open9xGruvin9xModelData_v207::operator ModelData ()
c9x.frsky = frsky;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
for (int line=0; line<4; line++) {
for (int col=0; col<2; col++) {
c9x.frsky.screens[1].body.lines[line].source[col] = (col==0 ? (frskyLines[line] & 0x0f) : ((frskyLines[line] & 0xf0) / 16));
@@ -587,7 +587,7 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
c9x.frsky.varioCenterMin = varioSpeedDownMin;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
for (int line=0; line<4; line++) {
for (int col=0; col<2; col++) {
c9x.frsky.screens[1].body.lines[line].source[col] = (col==0 ? (frskyLines[line] & 0x0f) : ((frskyLines[line] & 0xf0) / 16));
@@ -677,7 +677,7 @@ t_Open9xGruvin9xModelData_v209::operator ModelData ()
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
for (int line=0; line<4; line++) {
for (int col=0; col<2; col++) {
c9x.frsky.screens[1].body.lines[line].source[col] = (col==0 ? (frskyLines[line] & 0x0f) : ((frskyLines[line] & 0xf0) / 16));
@@ -767,7 +767,7 @@ t_Open9xGruvin9xModelData_v210::operator ModelData ()
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
@@ -854,6 +854,6 @@ t_Open9xGruvin9xModelData_v211::operator ModelData ()
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
return c9x;
}
@@ -808,7 +808,7 @@ t_Open9xArmModelData_v208::operator ModelData ()
c9x.frsky.varioCenterMin = varioSpeedDownMin;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
for (int line=0; line<4; line++) {
for (int col=0; col<2; col++) {
c9x.frsky.screens[1].body.lines[line].source[col] = (col==0 ? (frskyLines[line] & 0x0f) : ((frskyLines[line] & 0xf0) / 16));
@@ -898,7 +898,7 @@ t_Open9xArmModelData_v209::operator ModelData ()
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
for (int line=0; line<4; line++) {
for (int col=0; col<2; col++) {
c9x.frsky.screens[1].body.lines[line].source[col] = (col==0 ? (frskyLines[line] & 0x0f) : ((frskyLines[line] & 0xf0) / 16));
@@ -988,7 +988,7 @@ t_Open9xArmModelData_v210::operator ModelData ()
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
@@ -1072,7 +1072,7 @@ t_Open9xArmModelData_v211::operator ModelData ()
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
@@ -1159,6 +1159,6 @@ t_Open9xArmModelData_v212::operator ModelData ()
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
return c9x;
}
@@ -1060,7 +1060,7 @@ t_Open9xModelData_v202::operator ModelData ()
c9x.frsky = frsky;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId=modelId;
c9x.moduleData[0].modelId = modelId;
return c9x;
}
@@ -1134,7 +1134,7 @@ t_Open9xModelData_v203::operator ModelData ()
c9x.frsky = frsky;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
return c9x;
}
@@ -1210,7 +1210,7 @@ t_Open9xModelData_v204::operator ModelData ()
c9x.frsky.rssiAlarms[1] = frskyRssiAlarms[1].get(1);
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
return c9x;
}
@@ -1287,7 +1287,7 @@ t_Open9xModelData_v205::operator ModelData ()
c9x.frsky = frsky;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0]. modelId = modelId;
c9x.frsky.screens[1].type = 0;
for (int line=0; line<4; line++) {
for (int col=0; col<2; col++) {
@@ -1377,7 +1377,7 @@ t_Open9xModelData_v208::operator ModelData ()
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
c9x.frsky.screens[1].type = 0;
for (int line=0; line<4; line++) {
for (int col=0; col<2; col++) {
@@ -1471,7 +1471,7 @@ t_Open9xModelData_v209::operator ModelData ()
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
c9x.frsky.screens[1].type = 0;
for (int line=0; line<4; line++) {
for (int col=0; col<2; col++) {
@@ -1565,7 +1565,7 @@ t_Open9xModelData_v210::operator ModelData ()
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter=servoCenter[i];
@@ -1653,7 +1653,7 @@ t_Open9xModelData_v211::operator ModelData ()
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
c9x.moduleData[0].modelId = modelId;
return c9x;
}
@@ -2781,8 +2781,12 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
bool afterrelease21March2013 = IS_AFTER_RELEASE_21_MARCH_2013(board, version);
if (afterrelease21March2013)
internalField.Append(new UnsignedField<8>(modelData.modelId));
if (afterrelease21March2013) {
internalField.Append(new UnsignedField<8>(modelData.moduleData[0].modelId));
}
if (IS_ARM(board) && version >= 217) {
internalField.Append(new UnsignedField<8>(modelData.moduleData[1].modelId));
}
if (IS_TARANIS(board) && version >= 215) {
internalField.Append(new CharField<10>(modelData.bitmap));
@@ -2902,7 +2906,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
internalField.Append(new ConversionField< UnsignedField<8> >(modelData.thrTraceSrc, &throttleSourceConversionTable, "Throttle Source"));
if (!afterrelease21March2013) {
internalField.Append(new UnsignedField<8>(modelData.modelId));
internalField.Append(new UnsignedField<8>(modelData.moduleData[0].modelId));
}
if (IS_TARANIS_X9E(board) && version >= 217)
@@ -73,7 +73,6 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
}
}
}
qDebug() << tracksSet;
}
if (IS_TARANIS(firmware->getBoard())) {
@@ -86,7 +85,6 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
}
}
}
qDebug() << scriptsSet;
}
CompanionIcon playIcon("play.png");
+2 -2
View File
@@ -249,7 +249,7 @@ void ModulePanel::update()
ui->label_rxNumber->setVisible(mask & MASK_RX_NUMBER);
ui->rxNumber->setVisible(mask & MASK_RX_NUMBER);
ui->rxNumber->setMaximum(max_rx_num);
ui->rxNumber->setValue(model->modelId);
ui->rxNumber->setValue(module.modelId);
ui->label_channelsStart->setVisible(mask & MASK_CHANNELS_RANGE);
ui->channelsStart->setVisible(mask & MASK_CHANNELS_RANGE);
ui->channelsStart->setValue(module.channelsStart+1);
@@ -348,7 +348,7 @@ void ModulePanel::on_ppmDelay_editingFinished()
void ModulePanel::on_rxNumber_editingFinished()
{
model->modelId = ui->rxNumber->value();
module.modelId = ui->rxNumber->value();
emit modified();
}
+1 -1
View File
@@ -86,7 +86,7 @@ WizMix::operator ModelData()
ModelData model;
model.used = true;
model.modelId = modelId;
model.moduleData[0].modelId = modelId;
model.setDefaultInputs(settings);
int mixIndex = 0;