mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 14:25:11 +03:00
Fixes #1107
This commit is contained in:
parent
0a53e2e6b3
commit
6c17fee19b
10 changed files with 37 additions and 19 deletions
|
@ -408,6 +408,8 @@ QString RawSwitch::toString()
|
||||||
return QObject::tr("ON");
|
return QObject::tr("ON");
|
||||||
case SWITCH_TYPE_OFF:
|
case SWITCH_TYPE_OFF:
|
||||||
return QObject::tr("OFF");
|
return QObject::tr("OFF");
|
||||||
|
case SWITCH_TYPE_ONE:
|
||||||
|
return QObject::tr("One");
|
||||||
case SWITCH_TYPE_FLIGHT_MODE:
|
case SWITCH_TYPE_FLIGHT_MODE:
|
||||||
return CHECK_IN_ARRAY(flightModes, index-1);
|
return CHECK_IN_ARRAY(flightModes, index-1);
|
||||||
case SWITCH_TYPE_NONE:
|
case SWITCH_TYPE_NONE:
|
||||||
|
|
|
@ -385,6 +385,7 @@ enum RawSwitchType {
|
||||||
SWITCH_TYPE_ROTARY_ENCODER,
|
SWITCH_TYPE_ROTARY_ENCODER,
|
||||||
SWITCH_TYPE_ON,
|
SWITCH_TYPE_ON,
|
||||||
SWITCH_TYPE_OFF,
|
SWITCH_TYPE_OFF,
|
||||||
|
SWITCH_TYPE_ONE,
|
||||||
SWITCH_TYPE_FLIGHT_MODE,
|
SWITCH_TYPE_FLIGHT_MODE,
|
||||||
SWITCH_TYPE_TIMER_MODE
|
SWITCH_TYPE_TIMER_MODE
|
||||||
};
|
};
|
||||||
|
|
|
@ -89,12 +89,15 @@ class SwitchesConversionTable: public ConversionTable {
|
||||||
if (!(flags & POPULATE_TIMER_MODES)) {
|
if (!(flags & POPULATE_TIMER_MODES)) {
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_OFF), -val+offset);
|
addConversion(RawSwitch(SWITCH_TYPE_OFF), -val+offset);
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_ON), val++);
|
addConversion(RawSwitch(SWITCH_TYPE_ON), val++);
|
||||||
}
|
if (version >= 216) {
|
||||||
|
addConversion(RawSwitch(SWITCH_TYPE_ONE, -1), -val+offset);
|
||||||
if (IS_ARM(board)) {
|
addConversion(RawSwitch(SWITCH_TYPE_ONE, 1), val++);
|
||||||
for (int i=1; i<=MAX_FLIGHT_MODES(board, version); i++) {
|
if (IS_ARM(board)) {
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, -i), -val+offset);
|
for (int i=1; i<=MAX_FLIGHT_MODES(board, version); i++) {
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i), val++);
|
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, -i), -val+offset);
|
||||||
|
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i), val++);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -400,6 +400,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||||
b->clear();
|
b->clear();
|
||||||
|
|
||||||
if (attr & POPULATE_ONOFF) {
|
if (attr & POPULATE_ONOFF) {
|
||||||
|
// !FMx
|
||||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||||
for (int i=-GetCurrentFirmware()->getCapability(FlightModes); i<0; i++) {
|
for (int i=-GetCurrentFirmware()->getCapability(FlightModes); i<0; i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
|
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
|
||||||
|
@ -407,6 +408,11 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// !One
|
||||||
|
item = RawSwitch(SWITCH_TYPE_ONE, 1);
|
||||||
|
b->addItem(item.toString(), item.toValue());
|
||||||
|
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||||
|
// OFF
|
||||||
item = RawSwitch(SWITCH_TYPE_OFF);
|
item = RawSwitch(SWITCH_TYPE_OFF);
|
||||||
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);
|
||||||
|
@ -494,9 +500,15 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attr & POPULATE_ONOFF) {
|
if (attr & POPULATE_ONOFF) {
|
||||||
|
// ON
|
||||||
item = RawSwitch(SWITCH_TYPE_ON);
|
item = RawSwitch(SWITCH_TYPE_ON);
|
||||||
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);
|
||||||
|
// One
|
||||||
|
item = RawSwitch(SWITCH_TYPE_ONE, 1);
|
||||||
|
b->addItem(item.toString(), item.toValue());
|
||||||
|
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||||
|
// FMx
|
||||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||||
for (int i=1; i<=GetCurrentFirmware()->getCapability(FlightModes); i++) {
|
for (int i=1; i<=GetCurrentFirmware()->getCapability(FlightModes); i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
|
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
|
||||||
|
|
|
@ -307,7 +307,7 @@ void getSwitchAudioFile(char * filename, int index)
|
||||||
{
|
{
|
||||||
char * str = getModelPath(filename);
|
char * str = getModelPath(filename);
|
||||||
int len = STR_VSWITCHES[0];
|
int len = STR_VSWITCHES[0];
|
||||||
strncpy(str, &STR_VSWITCHES[1+len*index], len);
|
strncpy(str, &STR_VSWITCHES[1+len*(index+1)], len);
|
||||||
str += len-1;
|
str += len-1;
|
||||||
if (*str == '\300') {
|
if (*str == '\300') {
|
||||||
strcpy(str, "-up");
|
strcpy(str, "-up");
|
||||||
|
@ -331,7 +331,7 @@ void getLogicalSwitchAudioFile(char * filename, int index, unsigned int event)
|
||||||
{
|
{
|
||||||
char * str = getModelPath(filename);
|
char * str = getModelPath(filename);
|
||||||
int len = STR_VSWITCHES[0];
|
int len = STR_VSWITCHES[0];
|
||||||
strncpy(str, &STR_VSWITCHES[1+len*(index+SWSRC_FIRST_LOGICAL_SWITCH-1)], len);
|
strncpy(str, &STR_VSWITCHES[1+len*(index+SWSRC_FIRST_LOGICAL_SWITCH)], len);
|
||||||
str += len;
|
str += len;
|
||||||
strcpy(str, suffixes[event]);
|
strcpy(str, suffixes[event]);
|
||||||
strcat(str, SOUNDS_EXT);
|
strcat(str, SOUNDS_EXT);
|
||||||
|
|
|
@ -1279,7 +1279,7 @@ void menuModelSetup(uint8_t event)
|
||||||
else {
|
else {
|
||||||
if ((states & 0x01) && swactive)
|
if ((states & 0x01) && swactive)
|
||||||
attr = INVERS;
|
attr = INVERS;
|
||||||
c = pgm_read_byte(STR_VSWITCHES - 2 + 9 + (3*i));
|
c = pgm_read_byte(STR_VSWITCHES - 2 + 9 + (3*(i+1)));
|
||||||
states >>= 1;
|
states >>= 1;
|
||||||
}
|
}
|
||||||
if (line && (m_posHorz == i)) {
|
if (line && (m_posHorz == i)) {
|
||||||
|
|
|
@ -1042,22 +1042,18 @@ void putsModelName(xcoord_t x, uint8_t y, char *name, uint8_t id, LcdFlags att)
|
||||||
|
|
||||||
void putsSwitches(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
|
void putsSwitches(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
|
||||||
{
|
{
|
||||||
if (idx == SWSRC_NONE)
|
|
||||||
return lcd_putsiAtt(x, y, STR_MMMINV, 0, att);
|
|
||||||
if (idx == SWSRC_ON)
|
|
||||||
return lcd_putsiAtt(x, y, STR_OFFON, 1, att);
|
|
||||||
if (idx == SWSRC_OFF)
|
if (idx == SWSRC_OFF)
|
||||||
return lcd_putsiAtt(x, y, STR_OFFON, 0, att);
|
return lcd_putsiAtt(x, y, STR_OFFON, 0, att);
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
lcd_putcAtt(x-2, y, '!', att);
|
lcd_putcAtt(x-2, y, '!', att);
|
||||||
idx = -idx;
|
idx = 1-idx;
|
||||||
}
|
}
|
||||||
#if defined(CPUARM) && defined(FLIGHT_MODES)
|
#if defined(CPUARM) && defined(FLIGHT_MODES)
|
||||||
if (idx >= SWSRC_FIRST_FLIGHT_MODE)
|
if (idx >= SWSRC_FIRST_FLIGHT_MODE)
|
||||||
putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
|
putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
lcd_putsiAtt(x, y, STR_VSWITCHES, idx-1, att);
|
lcd_putsiAtt(x, y, STR_VSWITCHES, idx, att);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FLIGHT_MODES)
|
#if defined(FLIGHT_MODES)
|
||||||
|
|
|
@ -1389,6 +1389,7 @@ enum SwitchSources {
|
||||||
SWSRC_LAST_LOGICAL_SWITCH = SWSRC_FIRST_LOGICAL_SWITCH+NUM_LOGICAL_SWITCH-1,
|
SWSRC_LAST_LOGICAL_SWITCH = SWSRC_FIRST_LOGICAL_SWITCH+NUM_LOGICAL_SWITCH-1,
|
||||||
|
|
||||||
SWSRC_ON,
|
SWSRC_ON,
|
||||||
|
SWSRC_One,
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
SWSRC_FIRST_FLIGHT_MODE,
|
SWSRC_FIRST_FLIGHT_MODE,
|
||||||
|
|
|
@ -169,7 +169,10 @@ bool getSwitch(int8_t swtch)
|
||||||
|
|
||||||
uint8_t cs_idx = abs(swtch);
|
uint8_t cs_idx = abs(swtch);
|
||||||
|
|
||||||
if (cs_idx == SWSRC_ON) {
|
if (cs_idx == SWSRC_One) {
|
||||||
|
result = !s_mixer_first_run_done;
|
||||||
|
}
|
||||||
|
else if (cs_idx == SWSRC_ON) {
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
else if (cs_idx <= SWSRC_LAST_SWITCH) {
|
else if (cs_idx <= SWSRC_LAST_SWITCH) {
|
||||||
|
|
|
@ -412,11 +412,11 @@
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36"
|
#define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36"
|
||||||
#define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW
|
#define TR_VSWITCHES "---""SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0" "One"
|
||||||
#elif defined(CPUARM)
|
#elif defined(CPUARM)
|
||||||
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW
|
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0" "One"
|
||||||
#else
|
#else
|
||||||
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW
|
#define TR_VSWITCHES "---" TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0" "One"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HELI)
|
#if defined(HELI)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue