mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
S3 Configuration inside Companion
This commit is contained in:
parent
cdde00286a
commit
dccfbb61d7
8 changed files with 189 additions and 108 deletions
|
@ -791,13 +791,21 @@ QString FuncSwData::repeatToString()
|
|||
GeneralSettings::GeneralSettings()
|
||||
{
|
||||
memset(this, 0, sizeof(GeneralSettings));
|
||||
|
||||
contrast = 25;
|
||||
vBatWarn = 90;
|
||||
for (int i=0; i<(NUM_STICKS+C9X_NUM_POTS ); ++i) {
|
||||
|
||||
for (int i=0; i<NUM_STICKS+C9X_NUM_POTS; ++i) {
|
||||
calibMid[i] = 0x200;
|
||||
calibSpanNeg[i] = 0x180;
|
||||
calibSpanPos[i] = 0x180;
|
||||
}
|
||||
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
potsType[0] = 1;
|
||||
potsType[1] = 1;
|
||||
}
|
||||
|
||||
templateSetup = g.profile[g.id()].channelOrder();
|
||||
stickMode = g.profile[g.id()].defaultMode();
|
||||
|
||||
|
@ -899,7 +907,6 @@ GeneralSettings::GeneralSettings()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RawSource GeneralSettings::getDefaultSource(unsigned int channel)
|
||||
|
|
|
@ -2595,8 +2595,8 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
|
|||
}
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
internalField.Append(new UnsignedField<8>(generalData.hw_uartMode));
|
||||
for (int i=0; i<8; i++) {
|
||||
internalField.Append(new UnsignedField<1>(generalData.potsType[i]));
|
||||
for (int i=0; i<4; i++) {
|
||||
internalField.Append(new UnsignedField<2>(potsType[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2615,6 +2615,11 @@ void OpenTxGeneralData::beforeExport()
|
|||
sum += generalData.calibSpanPos[i];
|
||||
if (++count == 12) break;
|
||||
}
|
||||
for (int i=0; i<4; i++) {
|
||||
potsType[i] = generalData.potsType[i];
|
||||
if (i<2 && potsType[i] == 1)
|
||||
potsType[i] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i=0; i<inputsCount; i++)
|
||||
|
@ -2627,4 +2632,8 @@ void OpenTxGeneralData::beforeExport()
|
|||
|
||||
void OpenTxGeneralData::afterImport()
|
||||
{
|
||||
for (int i=0; i<4; i++) {
|
||||
if (i<2 && generalData.potsType[i] == 0)
|
||||
generalData.potsType[i] = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ class OpenTxGeneralData: public TransformedField {
|
|||
unsigned int version;
|
||||
int inputsCount;
|
||||
unsigned int chkSum;
|
||||
unsigned int potsType[4];
|
||||
};
|
||||
|
||||
class ProtocolsConversionTable: public ConversionTable
|
||||
|
|
|
@ -369,6 +369,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
|||
if (GetEepromInterface()->getCapability(MultiposPots)) {
|
||||
ui->pot1Type->setCurrentIndex(g_eeGeneral.potsType[0]);
|
||||
ui->pot2Type->setCurrentIndex(g_eeGeneral.potsType[1]);
|
||||
ui->pot3Type->setCurrentIndex(g_eeGeneral.potsType[2]);
|
||||
}
|
||||
else {
|
||||
ui->potsTypeSeparator->hide();
|
||||
|
@ -376,6 +377,8 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
|||
ui->pot1TypeLabel->hide();
|
||||
ui->pot2Type->hide();
|
||||
ui->pot2TypeLabel->hide();
|
||||
ui->pot3Type->hide();
|
||||
ui->pot3TypeLabel->hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -396,6 +399,12 @@ void GeneralEdit::on_pot2Type_currentIndexChanged(int index)
|
|||
updateSettings();
|
||||
}
|
||||
|
||||
void GeneralEdit::on_pot3Type_currentIndexChanged(int index)
|
||||
{
|
||||
g_eeGeneral.potsType[2] = index;
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
void GeneralEdit::unlockSwitchEdited()
|
||||
{
|
||||
int i=0;
|
||||
|
|
|
@ -121,6 +121,7 @@ private slots:
|
|||
|
||||
void on_pot1Type_currentIndexChanged(int index);
|
||||
void on_pot2Type_currentIndexChanged(int index);
|
||||
void on_pot3Type_currentIndexChanged(int index);
|
||||
|
||||
void on_stickmodeCB_currentIndexChanged(int index);
|
||||
void on_channelorderCB_currentIndexChanged(int index);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>795</width>
|
||||
<width>804</width>
|
||||
<height>912</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -1555,10 +1555,10 @@ Acceptable values are 5v..10v</string>
|
|||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
|
@ -3520,6 +3520,11 @@ p, li { white-space: pre-wrap; }
|
|||
3 - Loud.
|
||||
4 - Extra loud.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot (normal)</string>
|
||||
|
@ -3556,6 +3561,11 @@ p, li { white-space: pre-wrap; }
|
|||
3 - Loud.
|
||||
4 - Extra loud.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot (normal)</string>
|
||||
|
@ -3575,6 +3585,47 @@ p, li { white-space: pre-wrap; }
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="pot3TypeLabel">
|
||||
<property name="text">
|
||||
<string>S3 Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QComboBox" name="pot3Type">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Beeper volume
|
||||
|
||||
0 - Quiet. No beeps at all.
|
||||
1 - No Keys. Normal beeps but menu keys do not beep.
|
||||
2 - Normal.
|
||||
3 - Loud.
|
||||
4 - Extra loud.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot (normal)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Multipos Switch</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
|
|
@ -68,6 +68,7 @@ MdiChild::MdiChild():
|
|||
fileChanged(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
this->setWindowIcon(CompanionIcon("open.png"));
|
||||
ui->SimulateTxButton->setIcon(CompanionIcon("simulate.png"));
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
@ -166,7 +167,8 @@ void MdiChild::OpenEditWindow(bool wizard=false)
|
|||
ret = QMessageBox::question(this, tr("Companion"), tr("Do you want to use model wizard? "), QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret == QMessageBox::Yes) {
|
||||
wizard=true;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
qSleep(500);
|
||||
ret = QMessageBox::question(this, tr("Companion"), tr("Ask this question again ? "), QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret == QMessageBox::No) {
|
||||
|
@ -496,7 +498,8 @@ void MdiChild::writeEeprom() // write to Tx
|
|||
}
|
||||
backupEnable=false;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
backupEnable=false;
|
||||
}
|
||||
QString stickCal=g.profile[g.id()].stickPotCalib();
|
||||
|
@ -632,7 +635,8 @@ void MdiChild::print(int model, QString filename)
|
|||
|
||||
printDialog *pd = new printDialog(this, &radioData.generalSettings, &radioData.models[model], filename);
|
||||
pd->show();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if(ui->modelsList->currentRow()<1) return;
|
||||
printDialog *pd = new printDialog(this, &radioData.generalSettings, &radioData.models[ui->modelsList->currentRow()-1]);
|
||||
pd->show();
|
||||
|
@ -671,9 +675,8 @@ bool MdiChild::loadBackup()
|
|||
.arg(file.errorString()));
|
||||
return false;
|
||||
}
|
||||
uint8_t *eeprom = (uint8_t *)malloc(eeprom_size);
|
||||
memset(eeprom, 0, eeprom_size);
|
||||
long result = file.read((char*)eeprom, eeprom_size);
|
||||
QByteArray eeprom(eeprom_size, 0);
|
||||
long result = file.read((char*)eeprom.data(), eeprom_size);
|
||||
file.close();
|
||||
|
||||
if (result != eeprom_size) {
|
||||
|
@ -685,7 +688,7 @@ bool MdiChild::loadBackup()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!LoadBackup(radioData, eeprom, eeprom_size, index)) {
|
||||
if (!LoadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index)) {
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Invalid binary backup File %1")
|
||||
.arg(fileName));
|
||||
|
@ -693,6 +696,6 @@ bool MdiChild::loadBackup()
|
|||
}
|
||||
|
||||
ui->modelsList->refreshList();
|
||||
free(eeprom);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1213,10 +1213,10 @@ void menuGeneralHardware(uint8_t event)
|
|||
putsMixerSource(sizeof(TR_TYPE)*FW, y, MIXSRC_FIRST_POT+idx);
|
||||
uint8_t potType = (g_eeGeneral.potsType & mask) >> shift;
|
||||
if (potType == POT_TYPE_NONE && i < 2)
|
||||
potType = 1;
|
||||
potType = POT_TYPE_POT;
|
||||
potType = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_TYPE, STR_POTTYPES, potType, 0, POT_TYPE_MAX, attr, event);
|
||||
if (potType == POT_TYPE_POT && i < 2)
|
||||
potType = 0;
|
||||
potType = POT_TYPE_NONE;
|
||||
g_eeGeneral.potsType &= ~mask;
|
||||
g_eeGeneral.potsType |= (potType << shift);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue