mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-25 01:05:08 +03:00
Companion switches / anas names configuration
This commit is contained in:
parent
06437b2954
commit
50978c15c5
21 changed files with 1206 additions and 297 deletions
|
@ -519,7 +519,7 @@ void burnDialog::on_BurnFlashButton_clicked()
|
||||||
|
|
||||||
byte8u=(uint8_t)BeeperSet.mid(0,2).toUInt(&ok,16);
|
byte8u=(uint8_t)BeeperSet.mid(0,2).toUInt(&ok,16);
|
||||||
if (ok)
|
if (ok)
|
||||||
radioData.generalSettings.beeperMode=(BeeperMode)byte8u;
|
radioData.generalSettings.beeperMode=(GeneralSettings::BeeperMode)byte8u;
|
||||||
|
|
||||||
byte8=(int8_t)BeeperSet.mid(2,2).toInt(&ok,16);
|
byte8=(int8_t)BeeperSet.mid(2,2).toInt(&ok,16);
|
||||||
if (ok)
|
if (ok)
|
||||||
|
@ -527,7 +527,7 @@ void burnDialog::on_BurnFlashButton_clicked()
|
||||||
|
|
||||||
byte8u=(uint8_t)HapticSet.mid(0,2).toUInt(&ok,16);
|
byte8u=(uint8_t)HapticSet.mid(0,2).toUInt(&ok,16);
|
||||||
if (ok)
|
if (ok)
|
||||||
radioData.generalSettings.hapticMode=(BeeperMode)byte8u;
|
radioData.generalSettings.hapticMode=(GeneralSettings::BeeperMode)byte8u;
|
||||||
|
|
||||||
byte8u=(uint8_t)HapticSet.mid(2,2).toUInt(&ok,16);
|
byte8u=(uint8_t)HapticSet.mid(2,2).toUInt(&ok,16);
|
||||||
if (ok)
|
if (ok)
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
std::list<QString> EEPROMWarnings;
|
std::list<QString> EEPROMWarnings;
|
||||||
|
|
||||||
const char * switches9X[] = { "3POS", "THR", "RUD", "ELE", "AIL", "GEA", "TRN" };
|
const char * switches9X[] = { "3POS", "THR", "RUD", "ELE", "AIL", "GEA", "TRN" };
|
||||||
const char * switchesX9D[] = { "SA", "SB", "SC", "SD", "SE", "SF", "SG", "SH" };
|
const char * switchesX9D[] = { "SA", "SB", "SC", "SD", "SE", "SF", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN" };
|
||||||
const char leftArrow[] = {(char)0xE2, (char)0x86, (char)0x90, 0};
|
const char leftArrow[] = {(char)0xE2, (char)0x86, (char)0x90, 0};
|
||||||
const char rightArrow[] = {(char)0xE2, (char)0x86, (char)0x92, 0};
|
const char rightArrow[] = {(char)0xE2, (char)0x86, (char)0x92, 0};
|
||||||
const char upArrow[] = {(char)0xE2, (char)0x86, (char)0x91, 0};
|
const char upArrow[] = {(char)0xE2, (char)0x86, (char)0x91, 0};
|
||||||
|
@ -531,6 +531,12 @@ QString RawSwitch::toString()
|
||||||
SwitchUp('F'), SwitchDn('F'),
|
SwitchUp('F'), SwitchDn('F'),
|
||||||
SwitchUp('G'), QString::fromUtf8("SG-"), SwitchDn('G'),
|
SwitchUp('G'), QString::fromUtf8("SG-"), SwitchDn('G'),
|
||||||
SwitchUp('H'), SwitchDn('H'),
|
SwitchUp('H'), SwitchDn('H'),
|
||||||
|
SwitchUp('I'), SwitchDn('I'),
|
||||||
|
SwitchUp('J'), SwitchDn('J'),
|
||||||
|
SwitchUp('K'), SwitchDn('K'),
|
||||||
|
SwitchUp('L'), SwitchDn('L'),
|
||||||
|
SwitchUp('M'), SwitchDn('M'),
|
||||||
|
SwitchUp('N'), SwitchDn('N'),
|
||||||
};
|
};
|
||||||
|
|
||||||
static const QString logicalSwitches[] = {
|
static const QString logicalSwitches[] = {
|
||||||
|
@ -976,6 +982,33 @@ void LimitData::clear()
|
||||||
max = +1000;
|
max = +1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GeneralSettings::SwitchInfo GeneralSettings::switchInfoFromSwitchPositionTaranis(unsigned int index)
|
||||||
|
{
|
||||||
|
if (index <= 3*5)
|
||||||
|
return SwitchInfo((index-1)/3, (index-1)%3);
|
||||||
|
else if (index <= 17)
|
||||||
|
return SwitchInfo(5, index==17 ? 2 : 0);
|
||||||
|
else if (index <= 20)
|
||||||
|
return SwitchInfo(6, index-18);
|
||||||
|
else
|
||||||
|
return SwitchInfo(7+(index-21)/2, 2*((index-21)%2));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GeneralSettings::switchPositionAllowedTaranis(int index) const
|
||||||
|
{
|
||||||
|
if (index == 0)
|
||||||
|
return true;
|
||||||
|
SwitchInfo info = switchInfoFromSwitchPositionTaranis(abs(index));
|
||||||
|
if (index < 0 && switchConfigTaranis(info.index) != SWITCH_3POS)
|
||||||
|
return false;
|
||||||
|
else if (info.index >= 8)
|
||||||
|
return switchConfigTaranis(info.index-8) == SWITCH_2x2POS;
|
||||||
|
else if (info.position == 1)
|
||||||
|
return switchConfigTaranis(info.index) == SWITCH_3POS;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
GeneralSettings::GeneralSettings()
|
GeneralSettings::GeneralSettings()
|
||||||
{
|
{
|
||||||
memset(this, 0, sizeof(GeneralSettings));
|
memset(this, 0, sizeof(GeneralSettings));
|
||||||
|
|
|
@ -126,7 +126,14 @@ enum Switches {
|
||||||
SWITCH_SG1,
|
SWITCH_SG1,
|
||||||
SWITCH_SG2,
|
SWITCH_SG2,
|
||||||
SWITCH_SH0,
|
SWITCH_SH0,
|
||||||
SWITCH_SH1
|
SWITCH_SH2,
|
||||||
|
SWITCH_SI0,
|
||||||
|
SWITCH_SI2,
|
||||||
|
SWITCH_SJ0,
|
||||||
|
SWITCH_SJ2,
|
||||||
|
SWITCH_SK0,
|
||||||
|
SWITCH_SK2,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TimerModes {
|
enum TimerModes {
|
||||||
|
@ -1007,7 +1014,7 @@ class ModelData {
|
||||||
unsigned int thrTraceSrc;
|
unsigned int thrTraceSrc;
|
||||||
unsigned int modelId;
|
unsigned int modelId;
|
||||||
unsigned int switchWarningStates;
|
unsigned int switchWarningStates;
|
||||||
unsigned int nSwToWarn;
|
unsigned int switchWarningEnable;
|
||||||
unsigned int nPotsToWarn;
|
unsigned int nPotsToWarn;
|
||||||
int potPosition[C9X_NUM_POTS];
|
int potPosition[C9X_NUM_POTS];
|
||||||
bool displayChecklist;
|
bool displayChecklist;
|
||||||
|
@ -1070,15 +1077,24 @@ class TrainerData {
|
||||||
void clear() { memset(this, 0, sizeof(TrainerData)); }
|
void clear() { memset(this, 0, sizeof(TrainerData)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
enum BeeperMode {
|
|
||||||
e_quiet = -2,
|
|
||||||
e_alarms_only = -1,
|
|
||||||
e_no_keys = 0,
|
|
||||||
e_all = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
class GeneralSettings {
|
class GeneralSettings {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
enum BeeperMode {
|
||||||
|
BEEPER_QUIET = -2,
|
||||||
|
BEEPER_ALARMS_ONLY = -1,
|
||||||
|
BEEPER_NOKEYS = 0,
|
||||||
|
BEEPER_ALL = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SwitchConfig {
|
||||||
|
SWITCH_DEFAULT,
|
||||||
|
SWITCH_TOGGLE,
|
||||||
|
SWITCH_2POS,
|
||||||
|
SWITCH_3POS,
|
||||||
|
SWITCH_2x2POS
|
||||||
|
};
|
||||||
|
|
||||||
GeneralSettings();
|
GeneralSettings();
|
||||||
|
|
||||||
int getDefaultStick(unsigned int channel) const;
|
int getDefaultStick(unsigned int channel) const;
|
||||||
|
@ -1166,6 +1182,49 @@ class GeneralSettings {
|
||||||
unsigned int potsType[8];
|
unsigned int potsType[8];
|
||||||
unsigned int backlightColor;
|
unsigned int backlightColor;
|
||||||
CustomFunctionData customFn[C9X_MAX_CUSTOM_FUNCTIONS];
|
CustomFunctionData customFn[C9X_MAX_CUSTOM_FUNCTIONS];
|
||||||
|
unsigned int switchConfig[8];
|
||||||
|
char switchNames[32][3+1];
|
||||||
|
char anaNames[32][3+1];
|
||||||
|
|
||||||
|
struct SwitchInfo {
|
||||||
|
SwitchInfo(unsigned int index, unsigned int position):
|
||||||
|
index(index),
|
||||||
|
position(position)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
unsigned int index;
|
||||||
|
unsigned int position;
|
||||||
|
};
|
||||||
|
|
||||||
|
static SwitchInfo switchInfoFromSwitchPositionTaranis(unsigned int index);
|
||||||
|
bool switchPositionAllowedTaranis(int index) const;
|
||||||
|
|
||||||
|
static unsigned int switchDefaultConfigTaranis(unsigned int index)
|
||||||
|
{
|
||||||
|
if (index == 5)
|
||||||
|
return SWITCH_2POS;
|
||||||
|
else if (index == 7)
|
||||||
|
return SWITCH_TOGGLE;
|
||||||
|
else
|
||||||
|
return SWITCH_3POS;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int switchConfigTaranis(unsigned int index) const
|
||||||
|
{
|
||||||
|
unsigned int result = switchConfig[index];
|
||||||
|
if (result == SWITCH_DEFAULT)
|
||||||
|
result = switchDefaultConfigTaranis(index);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isSwitchWarningAllowedTaranis(unsigned int index) const
|
||||||
|
{
|
||||||
|
if (index < 8)
|
||||||
|
return switchConfigTaranis(index) != SWITCH_TOGGLE;
|
||||||
|
else
|
||||||
|
return switchConfig[index-8] == SWITCH_2x2POS;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RadioData {
|
class RadioData {
|
||||||
|
|
|
@ -85,13 +85,13 @@ Er9xGeneral::operator GeneralSettings ()
|
||||||
|
|
||||||
switch (beeperVal) {
|
switch (beeperVal) {
|
||||||
case 0:
|
case 0:
|
||||||
result.beeperMode = e_quiet;
|
result.beeperMode = GeneralSettings::BEEPER_QUIET;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
result.beeperMode = e_no_keys;
|
result.beeperMode = GeneralSettings::BEEPER_NOKEYS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result.beeperMode = e_all;
|
result.beeperMode = GeneralSettings::BEEPER_ALL;
|
||||||
result.beeperLength = beeperVal - 4;
|
result.beeperLength = beeperVal - 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,13 +105,13 @@ Ersky9xGeneral::operator GeneralSettings ()
|
||||||
|
|
||||||
switch (beeperVal) {
|
switch (beeperVal) {
|
||||||
case 0:
|
case 0:
|
||||||
result.beeperMode = e_quiet;
|
result.beeperMode = GeneralSettings::BEEPER_QUIET;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
result.beeperMode = e_no_keys;
|
result.beeperMode = GeneralSettings::BEEPER_NOKEYS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result.beeperMode = e_all;
|
result.beeperMode = GeneralSettings::BEEPER_ALL;
|
||||||
result.beeperLength = beeperVal - 4;
|
result.beeperLength = beeperVal - 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,13 +88,13 @@ Gruvin9xGeneral_v103::operator GeneralSettings ()
|
||||||
|
|
||||||
switch (beeperVal) {
|
switch (beeperVal) {
|
||||||
case 0:
|
case 0:
|
||||||
result.beeperMode = e_quiet;
|
result.beeperMode = GeneralSettings::BEEPER_QUIET;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
result.beeperMode = e_no_keys;
|
result.beeperMode = GeneralSettings::BEEPER_NOKEYS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result.beeperMode = e_all;
|
result.beeperMode = GeneralSettings::BEEPER_ALL;
|
||||||
result.beeperLength = beeperVal - 4;
|
result.beeperLength = beeperVal - 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ Gruvin9xGeneral_v104::operator GeneralSettings ()
|
||||||
result.view = view;
|
result.view = view;
|
||||||
result.disableThrottleWarning = disableThrottleWarning;
|
result.disableThrottleWarning = disableThrottleWarning;
|
||||||
result.switchWarning = switchWarning;
|
result.switchWarning = switchWarning;
|
||||||
result.beeperMode = (BeeperMode)beeperVal;
|
result.beeperMode = (GeneralSettings::BeeperMode)beeperVal;
|
||||||
result.disableMemoryWarning = disableMemoryWarning;
|
result.disableMemoryWarning = disableMemoryWarning;
|
||||||
result.disableAlarmWarning = disableAlarmWarning;
|
result.disableAlarmWarning = disableAlarmWarning;
|
||||||
result.stickMode = stickMode;
|
result.stickMode = stickMode;
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
#define HAS_LARGE_LCD(board) IS_TARANIS(board)
|
#define HAS_LARGE_LCD(board) IS_TARANIS(board)
|
||||||
#define MAX_VIEWS(board) (HAS_LARGE_LCD(board) ? 2 : 256)
|
#define MAX_VIEWS(board) (HAS_LARGE_LCD(board) ? 2 : 256)
|
||||||
#define MAX_POTS(board) (IS_TARANIS(board) ? 5 : 3)
|
#define MAX_POTS(board) (IS_TARANIS(board) ? 5 : 3)
|
||||||
#define MAX_SWITCHES(board) (IS_TARANIS(board) ? 8 : 7)
|
#define MAX_SWITCHES(board, version) (version >= 217 ? (IS_TARANIS(board) ? 8+6 : 7) : (IS_TARANIS(board) ? 8 : 7))
|
||||||
#define MAX_SWITCHES_POSITION(board) (IS_TARANIS(board) ? 22 : 9)
|
#define MAX_SWITCHES_POSITION(board, version) (IS_TARANIS(board) ? (version >= 217 ? 22+12 : 22) : 9)
|
||||||
#define MAX_ROTARY_ENCODERS(board) (board==BOARD_GRUVIN9X ? 2 : (IS_SKY9X(board) ? 1 : 0))
|
#define MAX_ROTARY_ENCODERS(board) (board==BOARD_GRUVIN9X ? 2 : (IS_SKY9X(board) ? 1 : 0))
|
||||||
#define MAX_FLIGHT_MODES(board, version) (IS_ARM(board) ? 9 : (IS_DBLRAM(board, version) ? 6 : 5))
|
#define MAX_FLIGHT_MODES(board, version) (IS_ARM(board) ? 9 : (IS_DBLRAM(board, version) ? 6 : 5))
|
||||||
#define MAX_TIMERS(board, version) ((IS_ARM(board) && version >= 217) ? 3 : 2)
|
#define MAX_TIMERS(board, version) ((IS_ARM(board) && version >= 217) ? 3 : 2)
|
||||||
|
@ -56,7 +56,7 @@ class SwitchesConversionTable: public ConversionTable {
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_NONE), val++);
|
addConversion(RawSwitch(SWITCH_TYPE_NONE), val++);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=1; i<=MAX_SWITCHES_POSITION(board); i++) {
|
for (int i=1; i<=MAX_SWITCHES_POSITION(board, version); i++) {
|
||||||
int s = switchIndex(i, board, version);
|
int s = switchIndex(i, board, version);
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val);
|
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val);
|
||||||
if (IS_TARANIS(board) && s>=21/*SHup/SHdown*/) {
|
if (IS_TARANIS(board) && s>=21/*SHup/SHdown*/) {
|
||||||
|
@ -110,7 +110,7 @@ class SwitchesConversionTable: public ConversionTable {
|
||||||
|
|
||||||
if (version < 216) {
|
if (version < 216) {
|
||||||
// previous "moment" switches
|
// previous "moment" switches
|
||||||
for (int i=1; i<=MAX_SWITCHES_POSITION(board); i++) {
|
for (int i=1; i<=MAX_SWITCHES_POSITION(board, version); i++) {
|
||||||
int s = switchIndex(i, board, version);
|
int s = switchIndex(i, board, version);
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val++);
|
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val++);
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ class SourcesConversionTable: public ConversionTable {
|
||||||
|
|
||||||
if (!(flags & FLAG_NOSWITCHES)) {
|
if (!(flags & FLAG_NOSWITCHES)) {
|
||||||
if (afterrelease21March2013) {
|
if (afterrelease21March2013) {
|
||||||
for (int i=1; i<MAX_SWITCHES(board); i++)
|
for (int i=1; i<MAX_SWITCHES(board, version); i++)
|
||||||
addConversion(RawSource(SOURCE_TYPE_SWITCH, i), val++);
|
addConversion(RawSource(SOURCE_TYPE_SWITCH, i), val++);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1548,7 +1548,7 @@ class AndSwitchesConversionTable: public ConversionTable {
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_NONE), val++);
|
addConversion(RawSwitch(SWITCH_TYPE_NONE), val++);
|
||||||
|
|
||||||
if (IS_TARANIS(board)) {
|
if (IS_TARANIS(board)) {
|
||||||
for (int i=1; i<=MAX_SWITCHES_POSITION(board); i++) {
|
for (int i=1; i<=MAX_SWITCHES_POSITION(board, version); i++) {
|
||||||
int s = switchIndex(i, board, version);
|
int s = switchIndex(i, board, version);
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, -s), -val);
|
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, -s), -val);
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val++);
|
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val++);
|
||||||
|
@ -2856,14 +2856,18 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||||
internalField.Append(new UnsignedField<8>(modelData.modelId));
|
internalField.Append(new UnsignedField<8>(modelData.modelId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_TARANIS(board))
|
if (IS_TARANIS(board) && version >= 217)
|
||||||
|
internalField.Append(new SwitchesWarningField<32>(modelData.switchWarningStates, board, version));
|
||||||
|
else if (IS_TARANIS(board))
|
||||||
internalField.Append(new SwitchesWarningField<16>(modelData.switchWarningStates, board, version));
|
internalField.Append(new SwitchesWarningField<16>(modelData.switchWarningStates, board, version));
|
||||||
else
|
else
|
||||||
internalField.Append(new SwitchesWarningField<8>(modelData.switchWarningStates, board, version));
|
internalField.Append(new SwitchesWarningField<8>(modelData.switchWarningStates, board, version));
|
||||||
|
|
||||||
if (version >= 216) {
|
|
||||||
internalField.Append(new UnsignedField<8>(modelData.nSwToWarn));
|
if (IS_TARANIS(board) && version >= 217)
|
||||||
}
|
internalField.Append(new UnsignedField<16>(modelData.switchWarningEnable));
|
||||||
|
else if (version >= 216)
|
||||||
|
internalField.Append(new UnsignedField<8>(modelData.switchWarningEnable));
|
||||||
|
|
||||||
if ((board == BOARD_STOCK || (board == BOARD_M128 && version >= 215)) && (variant & GVARS_VARIANT)) {
|
if ((board == BOARD_STOCK || (board == BOARD_M128 && version >= 215)) && (variant & GVARS_VARIANT)) {
|
||||||
for (int i=0; i<MAX_GVARS(board, version); i++) {
|
for (int i=0; i<MAX_GVARS(board, version); i++) {
|
||||||
|
@ -3174,14 +3178,31 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
|
||||||
}
|
}
|
||||||
internalField.Append(new UnsignedField<8>(generalData.backlightColor));
|
internalField.Append(new UnsignedField<8>(generalData.backlightColor));
|
||||||
}
|
}
|
||||||
if (version >= 216) {
|
|
||||||
internalField.Append(new SpareBitsField<16>());
|
if (IS_TARANIS(board)) {
|
||||||
|
if (version >= 217)
|
||||||
|
internalField.Append(new SpareBitsField<32>());
|
||||||
|
else
|
||||||
|
internalField.Append(new SpareBitsField<16>());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version >= 217) {
|
if (version >= 217) {
|
||||||
for (int i=0; i<MAX_CUSTOM_FUNCTIONS(board, version); i++) {
|
for (int i=0; i<MAX_CUSTOM_FUNCTIONS(board, version); i++) {
|
||||||
internalField.Append(new ArmCustomFunctionField(generalData.customFn[i], board, version, variant));
|
internalField.Append(new ArmCustomFunctionField(generalData.customFn[i], board, version, variant));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IS_TARANIS(board) && version >= 217) {
|
||||||
|
for (int i=0; i<8; i++) {
|
||||||
|
internalField.Append(new UnsignedField<4>(generalData.switchConfig[i]));
|
||||||
|
}
|
||||||
|
for (int i=0; i<MAX_SWITCHES(board, version); ++i) {
|
||||||
|
internalField.Append(new ZCharField<3>(generalData.switchNames[i]));
|
||||||
|
}
|
||||||
|
for (int i=0; i<NUM_STICKS+MAX_POTS(board); ++i) {
|
||||||
|
internalField.Append(new ZCharField<3>(generalData.anaNames[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -571,9 +571,9 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||||
case Pots:
|
case Pots:
|
||||||
return (IS_TARANIS(board) ? 5 : 3);
|
return (IS_TARANIS(board) ? 5 : 3);
|
||||||
case Switches:
|
case Switches:
|
||||||
return (IS_TARANIS(board) ? 8 : 7);
|
return (IS_TARANIS(board) ? 8+6 : 7);
|
||||||
case SwitchesPositions:
|
case SwitchesPositions:
|
||||||
return (IS_TARANIS(board) ? 22 : 9);
|
return (IS_TARANIS(board) ? 22+12 : 9);
|
||||||
case CustomFunctions:
|
case CustomFunctions:
|
||||||
if (IS_TARANIS(board))
|
if (IS_TARANIS(board))
|
||||||
return 64;
|
return 64;
|
||||||
|
|
|
@ -71,16 +71,16 @@ Th9xGeneral::operator GeneralSettings ()
|
||||||
result.disableMemoryWarning = disableMemoryWarning;
|
result.disableMemoryWarning = disableMemoryWarning;
|
||||||
switch (beeperVal) {
|
switch (beeperVal) {
|
||||||
case 0:
|
case 0:
|
||||||
result.beeperMode = e_quiet;
|
result.beeperMode = GeneralSettings::BEEPER_QUIET;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
result.beeperMode = e_no_keys;
|
result.beeperMode = GeneralSettings::BEEPER_NOKEYS;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
result.beeperMode = e_all;
|
result.beeperMode = GeneralSettings::BEEPER_ALL;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
result.beeperMode = e_all;
|
result.beeperMode = GeneralSettings::BEEPER_ALL;
|
||||||
result.beeperLength = 2;
|
result.beeperLength = 2;
|
||||||
}
|
}
|
||||||
result.stickMode = stickMode;
|
result.stickMode = stickMode;
|
||||||
|
|
|
@ -20,6 +20,93 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
|
||||||
ui->pot2TypeLabel->hide();
|
ui->pot2TypeLabel->hide();
|
||||||
ui->pot3Type->hide();
|
ui->pot3Type->hide();
|
||||||
ui->pot3TypeLabel->hide();
|
ui->pot3TypeLabel->hide();
|
||||||
|
ui->pot4Label->hide();
|
||||||
|
ui->pot5Label->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IS_TARANIS(firmware->getBoard())) {
|
||||||
|
ui->rudName->setField(generalSettings.anaNames[0], 3, this);
|
||||||
|
ui->eleName->setField(generalSettings.anaNames[1], 3, this);
|
||||||
|
ui->thrName->setField(generalSettings.anaNames[2], 3, this);
|
||||||
|
ui->ailName->setField(generalSettings.anaNames[3], 3, this);
|
||||||
|
ui->pot1Name->setField(generalSettings.anaNames[4], 3, this);
|
||||||
|
ui->pot2Name->setField(generalSettings.anaNames[5], 3, this);
|
||||||
|
ui->pot3Name->setField(generalSettings.anaNames[6], 3, this);
|
||||||
|
ui->pot4Name->setField(generalSettings.anaNames[7], 3, this);
|
||||||
|
ui->pot5Name->setField(generalSettings.anaNames[8], 3, this);
|
||||||
|
ui->saName->setField(generalSettings.switchNames[0], 3, this);
|
||||||
|
ui->saType->setField(generalSettings.switchConfig[0], this);
|
||||||
|
ui->sbName->setField(generalSettings.switchNames[1], 3, this);
|
||||||
|
ui->sbType->setField(generalSettings.switchConfig[1], this);
|
||||||
|
ui->scName->setField(generalSettings.switchNames[2], 3, this);
|
||||||
|
ui->scType->setField(generalSettings.switchConfig[2], this);
|
||||||
|
ui->sdName->setField(generalSettings.switchNames[3], 3, this);
|
||||||
|
ui->sdType->setField(generalSettings.switchConfig[3], this);
|
||||||
|
ui->seName->setField(generalSettings.switchNames[4], 3, this);
|
||||||
|
ui->seType->setField(generalSettings.switchConfig[4], this);
|
||||||
|
ui->sfName->setField(generalSettings.switchNames[5], 3, this);
|
||||||
|
ui->sfType->setField(generalSettings.switchConfig[5], this);
|
||||||
|
ui->sgName->setField(generalSettings.switchNames[6], 3, this);
|
||||||
|
ui->sgType->setField(generalSettings.switchConfig[6], this);
|
||||||
|
ui->shName->setField(generalSettings.switchNames[7], 3, this);
|
||||||
|
ui->shType->setField(generalSettings.switchConfig[7], this);
|
||||||
|
ui->siName->setField(generalSettings.switchNames[8], 3, this);
|
||||||
|
ui->sjName->setField(generalSettings.switchNames[9], 3, this);
|
||||||
|
ui->skName->setField(generalSettings.switchNames[10], 3, this);
|
||||||
|
ui->slName->setField(generalSettings.switchNames[11], 3, this);
|
||||||
|
ui->smName->setField(generalSettings.switchNames[12], 3, this);
|
||||||
|
ui->snName->setField(generalSettings.switchNames[13], 3, this);
|
||||||
|
connect(ui->saType, SIGNAL(currentIndexChanged(int)), this, SLOT(update()));
|
||||||
|
connect(ui->sbType, SIGNAL(currentIndexChanged(int)), this, SLOT(update()));
|
||||||
|
connect(ui->scType, SIGNAL(currentIndexChanged(int)), this, SLOT(update()));
|
||||||
|
connect(ui->sdType, SIGNAL(currentIndexChanged(int)), this, SLOT(update()));
|
||||||
|
connect(ui->seType, SIGNAL(currentIndexChanged(int)), this, SLOT(update()));
|
||||||
|
connect(ui->sgType, SIGNAL(currentIndexChanged(int)), this, SLOT(update()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->rudLabel->hide();
|
||||||
|
ui->rudName->hide();
|
||||||
|
ui->eleLabel->hide();
|
||||||
|
ui->eleName->hide();
|
||||||
|
ui->thrLabel->hide();
|
||||||
|
ui->thrName->hide();
|
||||||
|
ui->ailLabel->hide();
|
||||||
|
ui->ailName->hide();
|
||||||
|
ui->pot1Name->hide();
|
||||||
|
ui->pot2Name->hide();
|
||||||
|
ui->pot3Name->hide();
|
||||||
|
ui->pot4Name->hide();
|
||||||
|
ui->pot5Name->hide();
|
||||||
|
ui->saLabel->hide();
|
||||||
|
ui->saName->hide();
|
||||||
|
ui->saType->hide();
|
||||||
|
ui->sbLabel->hide();
|
||||||
|
ui->sbName->hide();
|
||||||
|
ui->sbType->hide();
|
||||||
|
ui->scLabel->hide();
|
||||||
|
ui->scName->hide();
|
||||||
|
ui->scType->hide();
|
||||||
|
ui->sdLabel->hide();
|
||||||
|
ui->sdName->hide();
|
||||||
|
ui->sdType->hide();
|
||||||
|
ui->seLabel->hide();
|
||||||
|
ui->seName->hide();
|
||||||
|
ui->seType->hide();
|
||||||
|
ui->sfLabel->hide();
|
||||||
|
ui->sfName->hide();
|
||||||
|
ui->sfType->hide();
|
||||||
|
ui->sgLabel->hide();
|
||||||
|
ui->sgName->hide();
|
||||||
|
ui->sgType->hide();
|
||||||
|
ui->shLabel->hide();
|
||||||
|
ui->shName->hide();
|
||||||
|
ui->shType->hide();
|
||||||
|
ui->siName->hide();
|
||||||
|
ui->sjName->hide();
|
||||||
|
ui->skName->hide();
|
||||||
|
ui->slName->hide();
|
||||||
|
ui->smName->hide();
|
||||||
|
ui->snName->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
int potsCount = GetCurrentFirmware()->getCapability(Pots);
|
int potsCount = GetCurrentFirmware()->getCapability(Pots);
|
||||||
|
@ -46,6 +133,22 @@ CalibrationPanel::~CalibrationPanel()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CalibrationPanel::update()
|
||||||
|
{
|
||||||
|
ui->siLabel->setVisible(generalSettings.switchConfig[0] == GeneralSettings::SWITCH_2x2POS);
|
||||||
|
ui->siName->setVisible(generalSettings.switchConfig[0] == GeneralSettings::SWITCH_2x2POS);
|
||||||
|
ui->sjLabel->setVisible(generalSettings.switchConfig[1] == GeneralSettings::SWITCH_2x2POS);
|
||||||
|
ui->sjName->setVisible(generalSettings.switchConfig[1] == GeneralSettings::SWITCH_2x2POS);
|
||||||
|
ui->skLabel->setVisible(generalSettings.switchConfig[2] == GeneralSettings::SWITCH_2x2POS);
|
||||||
|
ui->skName->setVisible(generalSettings.switchConfig[2] == GeneralSettings::SWITCH_2x2POS);
|
||||||
|
ui->slLabel->setVisible(generalSettings.switchConfig[3] == GeneralSettings::SWITCH_2x2POS);
|
||||||
|
ui->slName->setVisible(generalSettings.switchConfig[3] == GeneralSettings::SWITCH_2x2POS);
|
||||||
|
ui->smLabel->setVisible(generalSettings.switchConfig[4] == GeneralSettings::SWITCH_2x2POS);
|
||||||
|
ui->smName->setVisible(generalSettings.switchConfig[4] == GeneralSettings::SWITCH_2x2POS);
|
||||||
|
ui->snLabel->setVisible(generalSettings.switchConfig[6] == GeneralSettings::SWITCH_2x2POS);
|
||||||
|
ui->snName->setVisible(generalSettings.switchConfig[6] == GeneralSettings::SWITCH_2x2POS);
|
||||||
|
}
|
||||||
|
|
||||||
void CalibrationPanel::on_PPM_MultiplierDSB_editingFinished()
|
void CalibrationPanel::on_PPM_MultiplierDSB_editingFinished()
|
||||||
{
|
{
|
||||||
generalSettings.PPM_Multiplier = (int)(ui->PPM_MultiplierDSB->value()*10)-10;
|
generalSettings.PPM_Multiplier = (int)(ui->PPM_MultiplierDSB->value()*10)-10;
|
||||||
|
|
|
@ -14,6 +14,7 @@ class CalibrationPanel : public GeneralPanel
|
||||||
public:
|
public:
|
||||||
CalibrationPanel(QWidget *parent, GeneralSettings & generalSettings, FirmwareInterface * firmware);
|
CalibrationPanel(QWidget *parent, GeneralSettings & generalSettings, FirmwareInterface * firmware);
|
||||||
virtual ~CalibrationPanel();
|
virtual ~CalibrationPanel();
|
||||||
|
virtual void update();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_battCalibDSB_editingFinished();
|
void on_battCalibDSB_editingFinished();
|
||||||
|
@ -52,10 +53,10 @@ class CalibrationPanel : public GeneralPanel
|
||||||
void on_ana7Pos_editingFinished();
|
void on_ana7Pos_editingFinished();
|
||||||
void on_ana8Pos_editingFinished();
|
void on_ana8Pos_editingFinished();
|
||||||
|
|
||||||
|
|
||||||
void on_pot1Type_currentIndexChanged(int index);
|
void on_pot1Type_currentIndexChanged(int index);
|
||||||
void on_pot2Type_currentIndexChanged(int index);
|
void on_pot2Type_currentIndexChanged(int index);
|
||||||
void on_pot3Type_currentIndexChanged(int index);
|
void on_pot3Type_currentIndexChanged(int index);
|
||||||
|
|
||||||
void on_serialPortMode_currentIndexChanged(int index);
|
void on_serialPortMode_currentIndexChanged(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -142,13 +142,13 @@ void GeneralEdit::on_calretrieve_PB_clicked()
|
||||||
generalSettings.backlightBright=byte8u;
|
generalSettings.backlightBright=byte8u;
|
||||||
byte8=(int8_t)BeeperSet.mid(0,2).toUInt(&ok,16);
|
byte8=(int8_t)BeeperSet.mid(0,2).toUInt(&ok,16);
|
||||||
if (ok)
|
if (ok)
|
||||||
generalSettings.beeperMode=(BeeperMode)byte8;
|
generalSettings.beeperMode = (GeneralSettings::BeeperMode)byte8;
|
||||||
byte8=(int8_t)BeeperSet.mid(2,2).toInt(&ok,16);
|
byte8=(int8_t)BeeperSet.mid(2,2).toInt(&ok,16);
|
||||||
if (ok)
|
if (ok)
|
||||||
generalSettings.beeperLength=byte8;
|
generalSettings.beeperLength=byte8;
|
||||||
byte8=(int8_t)HapticSet.mid(0,2).toUInt(&ok,16);
|
byte8=(int8_t)HapticSet.mid(0,2).toUInt(&ok,16);
|
||||||
if (ok)
|
if (ok)
|
||||||
generalSettings.hapticMode=(BeeperMode)byte8;
|
generalSettings.hapticMode=(GeneralSettings::BeeperMode)byte8;
|
||||||
byte8=(int8_t)HapticSet.mid(2,2).toInt(&ok,16);
|
byte8=(int8_t)HapticSet.mid(2,2).toInt(&ok,16);
|
||||||
if (ok)
|
if (ok)
|
||||||
generalSettings.hapticStrength=byte8;
|
generalSettings.hapticStrength=byte8;
|
||||||
|
|
|
@ -553,7 +553,7 @@ void GeneralSetupPanel::on_alarmwarnChkB_stateChanged(int )
|
||||||
|
|
||||||
void GeneralSetupPanel::on_beeperCB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_beeperCB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.beeperMode = (BeeperMode)(index-2);
|
generalSettings.beeperMode = (GeneralSettings::BeeperMode)(index-2);
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,7 +565,7 @@ void GeneralSetupPanel::on_displayTypeCB_currentIndexChanged(int index)
|
||||||
|
|
||||||
void GeneralSetupPanel::on_hapticmodeCB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_hapticmodeCB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.hapticMode = (BeeperMode)(index-2);
|
generalSettings.hapticMode = (GeneralSettings::BeeperMode)(index-2);
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -412,11 +412,9 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=-GetCurrentFirmware()->getCapability(SwitchesPositions); i<0; i++) {
|
for (int i=-GetCurrentFirmware()->getCapability(SwitchesPositions); i<0; i++) {
|
||||||
|
if (IS_TARANIS(GetCurrentFirmware()->getBoard()) && !generalSettings.switchPositionAllowedTaranis(i))
|
||||||
|
continue;
|
||||||
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
|
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
|
||||||
if (IS_TARANIS(GetCurrentFirmware()->getBoard())) {
|
|
||||||
//hide up and down for !SH and !SF, because they are redundant (!SFup == SFdown)
|
|
||||||
if (item.toString().contains("H") || item.toString().contains("F")) continue;
|
|
||||||
}
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -435,6 +433,8 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=1; i<=GetCurrentFirmware()->getCapability(SwitchesPositions); i++) {
|
for (int i=1; i<=GetCurrentFirmware()->getCapability(SwitchesPositions); i++) {
|
||||||
|
if (IS_TARANIS(GetCurrentFirmware()->getBoard()) && !generalSettings.switchPositionAllowedTaranis(i))
|
||||||
|
continue;
|
||||||
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
|
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
|
||||||
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);
|
||||||
|
|
|
@ -453,15 +453,22 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
|
||||||
connect(checkbox, SIGNAL(toggled(bool)), this, SLOT(onBeepCenterToggled(bool)));
|
connect(checkbox, SIGNAL(toggled(bool)), this, SLOT(onBeepCenterToggled(bool)));
|
||||||
centerBeepCheckboxes << checkbox;
|
centerBeepCheckboxes << checkbox;
|
||||||
if (!IS_TARANIS_PLUS(board) && i==6) {
|
if (!IS_TARANIS_PLUS(board) && i==6) {
|
||||||
checkbox->hide();
|
checkbox->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Startup switches warnings
|
// Startup switches warnings
|
||||||
for (int i=0; i<firmware->getCapability(Switches)-1; i++) {
|
for (int i=0; i<firmware->getCapability(Switches); i++) {
|
||||||
|
if (!IS_TARANIS(firmware->getBoard()) && i==firmware->getCapability(Switches)-1)
|
||||||
|
continue;
|
||||||
QLabel * label = new QLabel(this);
|
QLabel * label = new QLabel(this);
|
||||||
QSlider * slider = new QSlider(this);
|
QSlider * slider = new QSlider(this);
|
||||||
QCheckBox * cb = new QCheckBox(this);
|
QCheckBox * cb = new QCheckBox(this);
|
||||||
|
if (IS_TARANIS(firmware->getBoard()) && !generalSettings.isSwitchWarningAllowedTaranis(i)) {
|
||||||
|
label->hide();
|
||||||
|
slider->hide();
|
||||||
|
cb->hide();
|
||||||
|
}
|
||||||
slider->setProperty("index", i+1);
|
slider->setProperty("index", i+1);
|
||||||
slider->setOrientation(Qt::Vertical);
|
slider->setOrientation(Qt::Vertical);
|
||||||
slider->setMinimum(0);
|
slider->setMinimum(0);
|
||||||
|
@ -474,7 +481,7 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
|
||||||
slider->setMaximumSize(QSize(50, 50));
|
slider->setMaximumSize(QSize(50, 50));
|
||||||
if (IS_TARANIS(board)) {
|
if (IS_TARANIS(board)) {
|
||||||
label->setText(switchesX9D[i]);
|
label->setText(switchesX9D[i]);
|
||||||
slider->setMaximum(i==5 ? 1 : 2);
|
slider->setMaximum((i==5 || i>=7) ? 1 : 2);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
label->setText(switches9X[i]);
|
label->setText(switches9X[i]);
|
||||||
|
@ -677,17 +684,21 @@ void SetupPanel::updateStartupSwitches()
|
||||||
|
|
||||||
unsigned int switchStates = model->switchWarningStates;
|
unsigned int switchStates = model->switchWarningStates;
|
||||||
|
|
||||||
for (int i=0; i<firmware->getCapability(Switches)-1; i++) {
|
for (int i=0; i<firmware->getCapability(Switches); i++) {
|
||||||
QSlider * slider = startupSwitchesSliders[i];
|
QSlider * slider = startupSwitchesSliders[i];
|
||||||
QCheckBox * cb = startupSwitchesCheckboxes[i];
|
QCheckBox * cb = startupSwitchesCheckboxes[i];
|
||||||
bool enabled = !(model->nSwToWarn & (1 << i));
|
bool enabled = !(model->switchWarningEnable & (1 << i));
|
||||||
slider->setEnabled(enabled);
|
slider->setEnabled(enabled);
|
||||||
cb->setChecked(enabled);
|
cb->setChecked(enabled);
|
||||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||||
slider->setValue(i==5 ? (switchStates & 0x3)/2 : switchStates & 0x3);
|
slider->setValue((i==5 || i>=7) ? (switchStates & 0x3)/2 : switchStates & 0x3);
|
||||||
switchStates >>= 2;
|
switchStates >>= 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (i == firmware->getCapability(Switches)-1) {
|
||||||
|
// Trainer switch, no switch warning
|
||||||
|
continue;
|
||||||
|
}
|
||||||
slider->setValue(i==0 ? switchStates & 0x3 : switchStates & 0x1);
|
slider->setValue(i==0 ? switchStates & 0x3 : switchStates & 0x1);
|
||||||
switchStates >>= (i==0 ? 2 : 1);
|
switchStates >>= (i==0 ? 2 : 1);
|
||||||
}
|
}
|
||||||
|
@ -704,7 +715,7 @@ void SetupPanel::startupSwitchEdited(int value)
|
||||||
int index = sender()->property("index").toInt();
|
int index = sender()->property("index").toInt();
|
||||||
|
|
||||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||||
if (index == 6) {
|
if (index == 6 || index >= 8) {
|
||||||
shift = (index - 1) * 2;
|
shift = (index - 1) * 2;
|
||||||
mask = 0x02 << shift;
|
mask = 0x02 << shift;
|
||||||
shift++;
|
shift++;
|
||||||
|
@ -741,9 +752,9 @@ void SetupPanel::startupSwitchToggled(bool checked)
|
||||||
int index = sender()->property("index").toInt()-1;
|
int index = sender()->property("index").toInt()-1;
|
||||||
|
|
||||||
if (checked)
|
if (checked)
|
||||||
model->nSwToWarn &= ~(1 << index);
|
model->switchWarningEnable &= ~(1 << index);
|
||||||
else
|
else
|
||||||
model->nSwToWarn |= (1 << index);
|
model->switchWarningEnable |= (1 << index);
|
||||||
|
|
||||||
updateStartupSwitches();
|
updateStartupSwitches();
|
||||||
emit modified();
|
emit modified();
|
||||||
|
|
|
@ -12,6 +12,7 @@ set(shared_HDRS
|
||||||
autocombobox.h
|
autocombobox.h
|
||||||
autodoublespinbox.h
|
autodoublespinbox.h
|
||||||
autohexspinbox.h
|
autohexspinbox.h
|
||||||
|
autolineedit.h
|
||||||
genericpanel.h
|
genericpanel.h
|
||||||
hexspinbox.h
|
hexspinbox.h
|
||||||
verticalscrollarea.h
|
verticalscrollarea.h
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define AUTOCOMBOBOX_H_
|
#define AUTOCOMBOBOX_H_
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include "modeledit/modeledit.h"
|
#include "genericpanel.h"
|
||||||
|
|
||||||
class AutoComboBox: public QComboBox
|
class AutoComboBox: public QComboBox
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ class AutoComboBox: public QComboBox
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setField(unsigned int & field, ModelPanel * panel=NULL)
|
void setField(unsigned int & field, GenericPanel * panel=NULL)
|
||||||
{
|
{
|
||||||
this->field = (int *)&field;
|
this->field = (int *)&field;
|
||||||
this->panel = panel;
|
this->panel = panel;
|
||||||
|
@ -46,7 +46,7 @@ class AutoComboBox: public QComboBox
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setField(int & field, ModelPanel * panel=NULL)
|
void setField(int & field, GenericPanel * panel=NULL)
|
||||||
{
|
{
|
||||||
this->field = &field;
|
this->field = &field;
|
||||||
this->panel = panel;
|
this->panel = panel;
|
||||||
|
@ -70,7 +70,7 @@ class AutoComboBox: public QComboBox
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int * field;
|
int * field;
|
||||||
ModelPanel * panel;
|
GenericPanel * panel;
|
||||||
bool lock;
|
bool lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
60
companion/src/shared/autolineedit.h
Executable file
60
companion/src/shared/autolineedit.h
Executable file
|
@ -0,0 +1,60 @@
|
||||||
|
#ifndef AUTOLINEEDIT_H_
|
||||||
|
#define AUTOLINEEDIT_H_
|
||||||
|
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QRegExpValidator>
|
||||||
|
#include "genericpanel.h"
|
||||||
|
|
||||||
|
#define CHAR_FOR_NAMES_REGEX "[ A-Za-z0-9_.-,]*"
|
||||||
|
|
||||||
|
class AutoLineEdit: public QLineEdit
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit AutoLineEdit(QWidget *parent = 0):
|
||||||
|
QLineEdit(parent),
|
||||||
|
field(NULL),
|
||||||
|
panel(NULL),
|
||||||
|
lock(false)
|
||||||
|
{
|
||||||
|
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||||
|
setValidator(new QRegExpValidator(rx, this));
|
||||||
|
connect(this, SIGNAL(editingFinished()), this, SLOT(onEdited()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void setField(char * field, int len, GenericPanel * panel=NULL)
|
||||||
|
{
|
||||||
|
this->field = field;
|
||||||
|
this->panel = panel;
|
||||||
|
setMaxLength(len);
|
||||||
|
updateValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateValue()
|
||||||
|
{
|
||||||
|
lock = true;
|
||||||
|
if (field) {
|
||||||
|
setText(field);
|
||||||
|
}
|
||||||
|
lock = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void onEdited()
|
||||||
|
{
|
||||||
|
if (field && !lock) {
|
||||||
|
strcpy(field, text().toAscii());
|
||||||
|
if (panel) {
|
||||||
|
emit panel->modified();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
char * field;
|
||||||
|
GenericPanel * panel;
|
||||||
|
bool lock;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* AUTOLINEEDIT_H_ */
|
|
@ -17,6 +17,7 @@ class GenericPanel : public QWidget
|
||||||
friend class AutoDoubleSpinBox;
|
friend class AutoDoubleSpinBox;
|
||||||
friend class AutoCheckBox;
|
friend class AutoCheckBox;
|
||||||
friend class AutoHexSpinBox;
|
friend class AutoHexSpinBox;
|
||||||
|
friend class AutoLineEdit;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GenericPanel(QWidget *parent, ModelData * model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
|
GenericPanel(QWidget *parent, ModelData * model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
|
||||||
|
|
|
@ -90,6 +90,20 @@
|
||||||
#define AVR_FIELD(x) x;
|
#define AVR_FIELD(x) x;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBSTD)
|
||||||
|
#define N_PCBSTD_FIELD(x)
|
||||||
|
#else
|
||||||
|
#define N_PCBSTD_FIELD(x) x;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBTARANIS)
|
||||||
|
#define N_TARANIS_FIELD(x)
|
||||||
|
#define TARANIS_FIELD(x) x;
|
||||||
|
#else
|
||||||
|
#define N_TARANIS_FIELD(x) x;
|
||||||
|
#define TARANIS_FIELD(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define NUM_STICKS 4
|
#define NUM_STICKS 4
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
|
@ -623,18 +637,6 @@ enum SwitchConfig {
|
||||||
#define LEN_SWITCH_NAME 3
|
#define LEN_SWITCH_NAME 3
|
||||||
#define LEN_ANA_NAME 3
|
#define LEN_ANA_NAME 3
|
||||||
|
|
||||||
#if defined(PCBSTD)
|
|
||||||
#define N_PCBSTD_FIELD(x)
|
|
||||||
#else
|
|
||||||
#define N_PCBSTD_FIELD(x) x;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
|
||||||
#define N_TARANIS_FIELD(x)
|
|
||||||
#else
|
|
||||||
#define N_TARANIS_FIELD(x) x;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ALTERNATE_VIEW 0x10
|
#define ALTERNATE_VIEW 0x10
|
||||||
PACK(typedef struct t_EEGeneral {
|
PACK(typedef struct t_EEGeneral {
|
||||||
uint8_t version;
|
uint8_t version;
|
||||||
|
@ -681,15 +683,15 @@ PACK(typedef struct t_EEGeneral {
|
||||||
|
|
||||||
EXTRA_GENERAL_FIELDS
|
EXTRA_GENERAL_FIELDS
|
||||||
|
|
||||||
ARM_FIELD(swarnstate_t switchUnlockStates)
|
TARANIS_FIELD(swarnstate_t switchUnlockStates)
|
||||||
|
|
||||||
ARM_FIELD(CustomFunctionData customFn[NUM_CFN])
|
ARM_FIELD(CustomFunctionData customFn[NUM_CFN])
|
||||||
|
|
||||||
ARM_FIELD(uint32_t switchConfig)
|
TARANIS_FIELD(uint32_t switchConfig)
|
||||||
|
|
||||||
ARM_FIELD(char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME])
|
TARANIS_FIELD(char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME])
|
||||||
|
|
||||||
ARM_FIELD(char anaNames[NUM_STICKS+NUM_POTS][LEN_ANA_NAME])
|
TARANIS_FIELD(char anaNames[NUM_STICKS+NUM_POTS][LEN_ANA_NAME])
|
||||||
|
|
||||||
}) EEGeneral;
|
}) EEGeneral;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue