1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 17:25:13 +03:00

Merge pull request #2957 from opentx/projectkk2glider/issue_2936_sh_sf_two_pos

Fixes #2936: 3POS type removed from SH and SF switches (hw only suppo…
This commit is contained in:
Bertrand Songis 2015-10-11 00:19:33 +02:00
commit e8680c32b0
4 changed files with 15 additions and 7 deletions

View file

@ -1,7 +1,7 @@
#include "calibration.h" #include "calibration.h"
#include "ui_calibration.h" #include "ui_calibration.h"
void CalibrationPanel::setupSwitchConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type) void CalibrationPanel::setupSwitchConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type, bool threePos = true)
{ {
bool enabled = false; bool enabled = false;
@ -18,7 +18,7 @@ void CalibrationPanel::setupSwitchConfig(int index, QLabel *label, AutoLineEdit
if (enabled) { if (enabled) {
type->addItem(tr("2 Positions Toggle"), GeneralSettings::SWITCH_TOGGLE); type->addItem(tr("2 Positions Toggle"), GeneralSettings::SWITCH_TOGGLE);
type->addItem(tr("2 Positions"), GeneralSettings::SWITCH_2POS); type->addItem(tr("2 Positions"), GeneralSettings::SWITCH_2POS);
type->addItem(tr("3 Positions"), GeneralSettings::SWITCH_3POS); if (threePos) type->addItem(tr("3 Positions"), GeneralSettings::SWITCH_3POS);
name->setField(generalSettings.switchName[index], 3, this); name->setField(generalSettings.switchName[index], 3, this);
type->setField(generalSettings.switchConfig[index], this); type->setField(generalSettings.switchConfig[index], this);
} }
@ -130,9 +130,9 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
setupSwitchConfig(2, ui->scLabel, ui->scName, ui->scType); setupSwitchConfig(2, ui->scLabel, ui->scName, ui->scType);
setupSwitchConfig(3, ui->sdLabel, ui->sdName, ui->sdType); setupSwitchConfig(3, ui->sdLabel, ui->sdName, ui->sdType);
setupSwitchConfig(4, ui->seLabel, ui->seName, ui->seType); setupSwitchConfig(4, ui->seLabel, ui->seName, ui->seType);
setupSwitchConfig(5, ui->sfLabel, ui->sfName, ui->sfType); setupSwitchConfig(5, ui->sfLabel, ui->sfName, ui->sfType, false); //switch does not support 3POS
setupSwitchConfig(6, ui->sgLabel, ui->sgName, ui->sgType); setupSwitchConfig(6, ui->sgLabel, ui->sgName, ui->sgType);
setupSwitchConfig(7, ui->shLabel, ui->shName, ui->shType); setupSwitchConfig(7, ui->shLabel, ui->shName, ui->shType, false); //switch does not support 3POS
setupSwitchConfig(8, ui->siLabel, ui->siName, ui->siType); setupSwitchConfig(8, ui->siLabel, ui->siName, ui->siType);
setupSwitchConfig(9, ui->sjLabel, ui->sjName, ui->sjType); setupSwitchConfig(9, ui->sjLabel, ui->sjName, ui->sjType);
setupSwitchConfig(10, ui->skLabel, ui->skName, ui->skType); setupSwitchConfig(10, ui->skLabel, ui->skName, ui->skType);

View file

@ -63,7 +63,7 @@ class CalibrationPanel : public GeneralPanel
protected: protected:
void setupPotConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type); void setupPotConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type);
void setupSliderConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type); void setupSliderConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type);
void setupSwitchConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type); void setupSwitchConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type, bool threePos);
private: private:
Ui::Calibration *ui; Ui::Calibration *ui;

View file

@ -1,6 +1,11 @@
<h2>Version 2.1.4 / <set date></h2> <h2>Version 2.1.4 / <set date></h2>
[AVR boards] [Taranis]
<ul>
<li>Switches SF and SH limited to 2-position type in Hardware setup (<a href=https://github.com/opentx/opentx/issues/2936>#2936</a>)</li>
</ul>
[ARM boards]
<ul> <ul>
<li>Fixed several problems with automatic playing of Physical and Logical Switches changes (eg LS15-on.wav, SG-mid.wav) (<a href=https://github.com/opentx/opentx/issues/2855>#2855</a>)</li> <li>Fixed several problems with automatic playing of Physical and Logical Switches changes (eg LS15-on.wav, SG-mid.wav) (<a href=https://github.com/opentx/opentx/issues/2855>#2855</a>)</li>
<li>Source selector did not work in Telemetry screen for Bars (<a href=https://github.com/opentx/opentx/issues/2843>#2843</a>)</li> <li>Source selector did not work in Telemetry screen for Bars (<a href=https://github.com/opentx/opentx/issues/2843>#2843</a>)</li>

View file

@ -93,6 +93,9 @@ enum menuGeneralHwItems {
#define BLUETOOTH_ROWS #define BLUETOOTH_ROWS
#endif #endif
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
void menuGeneralHardware(uint8_t event) void menuGeneralHardware(uint8_t event)
{ {
MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 }); MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 });
@ -201,7 +204,7 @@ void menuGeneralHardware(uint8_t event)
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, m_posHorz == 0 ? attr : 0); editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, m_posHorz == 0 ? attr : 0);
else else
lcd_putsiAtt(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); lcd_putsiAtt(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
config = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_3POS, m_posHorz == 1 ? attr : 0, event); config = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), m_posHorz == 1 ? attr : 0, event);
if (attr && checkIncDec_Ret) { if (attr && checkIncDec_Ret) {
swconfig_t mask = (swconfig_t)0x03 << (2*index); swconfig_t mask = (swconfig_t)0x03 << (2*index);
g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(config) & 0x03) << (2*index)); g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(config) & 0x03) << (2*index));