Merge pull request #630 from opentx/bsongis/Taranis_6Positions_Pot

Bsongis/taranis 6 positions pot
This commit is contained in:
Andre Bernet
2014-02-01 01:24:21 -08:00
30 changed files with 552 additions and 127 deletions
+29 -19
View File
@@ -67,7 +67,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
case TELEMETRY_SOURCE_A1: case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A2: case TELEMETRY_SOURCE_A2:
if (model) { if (model) {
FrSkyChannelData channel = model->frsky.channels[index-TELEMETRY_SOURCE_A1]; // TODO const & const FrSkyChannelData & channel = model->frsky.channels[index-TELEMETRY_SOURCE_A1];
float ratio = channel.getRatio(); float ratio = channel.getRatio();
if (channel.type==0 || channel.type==1 || channel.type==2) if (channel.type==0 || channel.type==1 || channel.type==2)
result.decimals = 2; result.decimals = 2;
@@ -239,26 +239,34 @@ QString SwitchDn(const char sw)
QString RawSwitch::toString() QString RawSwitch::toString()
{ {
static const QString switches9X[] = { QObject::tr("THR"), QObject::tr("RUD"), QObject::tr("ELE"), static const QString switches9X[] = {
QObject::tr("ID0"), QObject::tr("ID1"), QObject::tr("ID2"), QString("THR"), QString("RUD"), QString("ELE"),
QObject::tr("AIL"), QObject::tr("GEA"), QObject::tr("TRN") QString("ID0"), QString("ID1"), QString("ID2"),
}; QString("AIL"), QString("GEA"), QString("TRN")
};
static const QString switchesX9D[] = { SwitchUp('A'), QString::fromUtf8("SA-"), SwitchDn('A'), static const QString switchesX9D[] = {
SwitchUp('B'), QString::fromUtf8("SB-"), SwitchDn('B'), SwitchUp('A'), QString::fromUtf8("SA-"), SwitchDn('A'),
SwitchUp('C'), QString::fromUtf8("SC-"), SwitchDn('C'), SwitchUp('B'), QString::fromUtf8("SB-"), SwitchDn('B'),
SwitchUp('D'), QString::fromUtf8("SD-"), SwitchDn('D'), SwitchUp('C'), QString::fromUtf8("SC-"), SwitchDn('C'),
SwitchUp('E'), QString::fromUtf8("SE-"), SwitchDn('E'), SwitchUp('D'), QString::fromUtf8("SD-"), SwitchDn('D'),
SwitchUp('F'), SwitchDn('F'), SwitchUp('E'), QString::fromUtf8("SE-"), SwitchDn('E'),
SwitchUp('G'), QString::fromUtf8("SG-"), SwitchDn('G'), SwitchUp('F'), SwitchDn('F'),
SwitchUp('H'), SwitchDn('H'), SwitchUp('G'), QString::fromUtf8("SG-"), SwitchDn('G'),
}; SwitchUp('H'), SwitchDn('H'),
};
static const QString virtualSwitches[] = { QObject::tr("LS1"), QObject::tr("LS2"), QObject::tr("LS3"), QObject::tr("LS4"), QObject::tr("LS5"), QObject::tr("LS6"), QObject::tr("LS7"), QObject::tr("LS8"), QObject::tr("LS9"), QObject::tr("LSA"), static const QString virtualSwitches[] = {
QObject::tr("LSB"), QObject::tr("LSC"), QObject::tr("LSD"), QObject::tr("LSE"), QObject::tr("LSF"), QObject::tr("LSG"), QObject::tr("LSH"), QObject::tr("LSI"), QObject::tr("LSJ"), QObject::tr("LSK"), QObject::tr("LS1"), QObject::tr("LS2"), QObject::tr("LS3"), QObject::tr("LS4"), QObject::tr("LS5"), QObject::tr("LS6"), QObject::tr("LS7"), QObject::tr("LS8"), QObject::tr("LS9"), QObject::tr("LSA"),
QObject::tr("LSL"), QObject::tr("LSM"), QObject::tr("LSN"), QObject::tr("LSO"), QObject::tr("LSP"), QObject::tr("LSQ"), QObject::tr("LSR"), QObject::tr("LSS"), QObject::tr("LST"), QObject::tr("LSU"), QObject::tr("LSB"), QObject::tr("LSC"), QObject::tr("LSD"), QObject::tr("LSE"), QObject::tr("LSF"), QObject::tr("LSG"), QObject::tr("LSH"), QObject::tr("LSI"), QObject::tr("LSJ"), QObject::tr("LSK"),
QObject::tr("LSV"), QObject::tr("LSW") QObject::tr("LSL"), QObject::tr("LSM"), QObject::tr("LSN"), QObject::tr("LSO"), QObject::tr("LSP"), QObject::tr("LSQ"), QObject::tr("LSR"), QObject::tr("LSS"), QObject::tr("LST"), QObject::tr("LSU"),
}; QObject::tr("LSV"), QObject::tr("LSW")
};
static const QString multiposPots[] = {
QObject::tr("S11"), QObject::tr("S12"), QObject::tr("S13"), QObject::tr("S14"), QObject::tr("S15"), QObject::tr("S16"),
QObject::tr("S21"), QObject::tr("S22"), QObject::tr("S23"), QObject::tr("S24"), QObject::tr("S25"), QObject::tr("S26")
};
switch(type) { switch(type) {
case SWITCH_TYPE_SWITCH: case SWITCH_TYPE_SWITCH:
@@ -268,6 +276,8 @@ QString RawSwitch::toString()
return index > 0 ? CHECK_IN_ARRAY(switches9X, index-1) : QString("!") + CHECK_IN_ARRAY(switches9X, -index-1); return index > 0 ? CHECK_IN_ARRAY(switches9X, index-1) : QString("!") + CHECK_IN_ARRAY(switches9X, -index-1);
case SWITCH_TYPE_VIRTUAL: case SWITCH_TYPE_VIRTUAL:
return index > 0 ? CHECK_IN_ARRAY(virtualSwitches, index-1) : QString("!") + CHECK_IN_ARRAY(virtualSwitches, -index-1); return index > 0 ? CHECK_IN_ARRAY(virtualSwitches, index-1) : QString("!") + CHECK_IN_ARRAY(virtualSwitches, -index-1);
case SWITCH_TYPE_MULTIPOS_POT:
return CHECK_IN_ARRAY(multiposPots, index);
case SWITCH_TYPE_ON: case SWITCH_TYPE_ON:
return QObject::tr("ON"); return QObject::tr("ON");
case SWITCH_TYPE_ONM: case SWITCH_TYPE_ONM:
+6 -2
View File
@@ -356,6 +356,7 @@ enum RawSwitchType {
SWITCH_TYPE_NONE, SWITCH_TYPE_NONE,
SWITCH_TYPE_SWITCH, SWITCH_TYPE_SWITCH,
SWITCH_TYPE_VIRTUAL, SWITCH_TYPE_VIRTUAL,
SWITCH_TYPE_MULTIPOS_POT,
SWITCH_TYPE_MOMENT_SWITCH, SWITCH_TYPE_MOMENT_SWITCH,
SWITCH_TYPE_MOMENT_VIRTUAL, SWITCH_TYPE_MOMENT_VIRTUAL,
SWITCH_TYPE_ON, SWITCH_TYPE_ON,
@@ -503,6 +504,7 @@ class GeneralSettings {
unsigned int mavbaud; unsigned int mavbaud;
unsigned int switchUnlockStates; unsigned int switchUnlockStates;
unsigned int hw_uartMode; unsigned int hw_uartMode;
unsigned int potsType[8];
}; };
class CurveReference { class CurveReference {
@@ -737,7 +739,7 @@ class FrSkyChannelData {
unsigned int multiplier; unsigned int multiplier;
FrSkyAlarmData alarms[2]; FrSkyAlarmData alarms[2];
float getRatio() float getRatio() const
{ {
if (type==0 || type==1 || type==2) if (type==0 || type==1 || type==2)
return float(ratio << multiplier) / 10.0; return float(ratio << multiplier) / 10.0;
@@ -1052,7 +1054,9 @@ enum Capability {
EnhancedCurves, EnhancedCurves,
TelemetryInternalAlarms, TelemetryInternalAlarms,
HasFasOffset, HasFasOffset,
HasMahPersistent HasMahPersistent,
MultiposPots,
MultiposPotsPositions
}; };
enum UseContext { enum UseContext {
+30 -10
View File
@@ -56,21 +56,29 @@ class SwitchesConversionTable: public ConversionTable {
addConversion(RawSwitch(SWITCH_TYPE_VIRTUAL, i), val++); addConversion(RawSwitch(SWITCH_TYPE_VIRTUAL, i), val++);
} }
if (IS_TARANIS(board) && version >= 216) {
for (int i=0; i<2; i++) {
for (int j=0; j<6; j++) {
addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*6+j), val++);
}
}
}
addConversion(RawSwitch(SWITCH_TYPE_OFF), -val); addConversion(RawSwitch(SWITCH_TYPE_OFF), -val);
addConversion(RawSwitch(SWITCH_TYPE_ON), val++); addConversion(RawSwitch(SWITCH_TYPE_ON), val++);
for (int i=1; i<=MAX_SWITCHES_POSITION(board); i++) { for (int i=1; i<=MAX_SWITCHES_POSITION(board); i++) {
int s = switchIndex(i, board, version); int s = switchIndex(i, board, version);
addConversion(RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, -s), -val); // addConversion(RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, -s), -val);
addConversion(RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, s), val++); addConversion(RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, s), val++);
} }
for (int i=1; i<=MAX_CUSTOM_SWITCHES(board, version); i++) { for (int i=1; i<=MAX_CUSTOM_SWITCHES(board, version); i++) {
addConversion(RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, -i), -val); // addConversion(RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, -i), -val);
addConversion(RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, i), val++); addConversion(RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, i), val++);
} }
addConversion(RawSwitch(SWITCH_TYPE_ONM, 1 ), -val); // addConversion(RawSwitch(SWITCH_TYPE_ONM, 1 ), -val);
addConversion(RawSwitch(SWITCH_TYPE_ONM, 0 ), val++); addConversion(RawSwitch(SWITCH_TYPE_ONM, 0 ), val++);
addConversion(RawSwitch(SWITCH_TYPE_TRN, 0), val++); addConversion(RawSwitch(SWITCH_TYPE_TRN, 0), val++);
addConversion(RawSwitch(SWITCH_TYPE_TRN, 1), val++); addConversion(RawSwitch(SWITCH_TYPE_TRN, 1), val++);
@@ -2011,12 +2019,21 @@ Open9xGeneralDataNew::Open9xGeneralDataNew(GeneralSettings & generalData, BoardE
if (version >= 213 || (!IS_ARM(board) && version >= 212)) if (version >= 213 || (!IS_ARM(board) && version >= 212))
internalField.Append(new UnsignedField<16>(generalData.variant)); internalField.Append(new UnsignedField<16>(generalData.variant));
for (int i=0; i<inputsCount; i++) if (version >= 216) {
internalField.Append(new SignedField<16>(generalData.calibMid[i])); for (int i=0; i<inputsCount; i++) {
for (int i=0; i<inputsCount; i++) internalField.Append(new SignedField<16>(generalData.calibMid[i]));
internalField.Append(new SignedField<16>(generalData.calibSpanNeg[i])); internalField.Append(new SignedField<16>(generalData.calibSpanNeg[i]));
for (int i=0; i<inputsCount; i++) internalField.Append(new SignedField<16>(generalData.calibSpanPos[i]));
internalField.Append(new SignedField<16>(generalData.calibSpanPos[i])); }
}
else {
for (int i=0; i<inputsCount; i++)
internalField.Append(new SignedField<16>(generalData.calibMid[i]));
for (int i=0; i<inputsCount; i++)
internalField.Append(new SignedField<16>(generalData.calibSpanNeg[i]));
for (int i=0; i<inputsCount; i++)
internalField.Append(new SignedField<16>(generalData.calibSpanPos[i]));
}
internalField.Append(new UnsignedField<16>(chkSum)); internalField.Append(new UnsignedField<16>(chkSum));
internalField.Append(new UnsignedField<8>(generalData.currModel)); internalField.Append(new UnsignedField<8>(generalData.currModel));
@@ -2110,8 +2127,11 @@ Open9xGeneralDataNew::Open9xGeneralDataNew(GeneralSettings & generalData, BoardE
internalField.Append(new SignedField<8>(generalData.varioVolume)); internalField.Append(new SignedField<8>(generalData.varioVolume));
internalField.Append(new SignedField<8>(generalData.backgroundVolume)); internalField.Append(new SignedField<8>(generalData.backgroundVolume));
} }
if (version >= 216) { if (IS_TARANIS(board) && version >= 216) {
internalField.Append(new UnsignedField<8>(generalData.hw_uartMode)); internalField.Append(new UnsignedField<8>(generalData.hw_uartMode));
for (int i=0; i<8; i++) {
internalField.Append(new UnsignedField<1>(generalData.potsType[i]));
}
} }
} }
} }
@@ -682,6 +682,10 @@ int Open9xInterface::getCapability(const Capability capability)
return (IS_STOCK(board) ? false : true); return (IS_STOCK(board) ? false : true);
case HasMahPersistent: case HasMahPersistent:
return (IS_ARM(board) ? true : false); return (IS_ARM(board) ? true : false);
case MultiposPots:
return IS_TARANIS(board) ? 2 : 0;
case MultiposPotsPositions:
return IS_TARANIS(board) ? 6 : 0;
default: default:
return 0; return 0;
} }
+26 -1
View File
@@ -64,7 +64,8 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
} }
this->layout()->removeItem(ui->TaranisReadOnlyUnlock); this->layout()->removeItem(ui->TaranisReadOnlyUnlock);
} }
} else { }
else {
for (int i=0; pmsl[i]; i++) { for (int i=0; pmsl[i]; i++) {
pmsl[i]->hide(); pmsl[i]->hide();
} }
@@ -373,6 +374,18 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
for (int i=0; tpmsld[i]; i++) { for (int i=0; tpmsld[i]; i++) {
connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(unlockSwitchEdited())); connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(unlockSwitchEdited()));
} }
if (GetEepromInterface()->getCapability(MultiposPots)) {
ui->pot1Type->setCurrentIndex(g_eeGeneral.potsType[0]);
ui->pot2Type->setCurrentIndex(g_eeGeneral.potsType[1]);
}
else {
ui->potsTypeSeparator->hide();
ui->pot1Type->hide();
ui->pot1TypeLabel->hide();
ui->pot2Type->hide();
ui->pot2TypeLabel->hide();
}
} }
GeneralEdit::~GeneralEdit() GeneralEdit::~GeneralEdit()
@@ -380,6 +393,18 @@ GeneralEdit::~GeneralEdit()
delete ui; delete ui;
} }
void GeneralEdit::on_pot1Type_currentIndexChanged(int index)
{
g_eeGeneral.potsType[0] = index;
updateSettings();
}
void GeneralEdit::on_pot2Type_currentIndexChanged(int index)
{
g_eeGeneral.potsType[1] = index;
updateSettings();
}
void GeneralEdit::unlockSwitchEdited() void GeneralEdit::unlockSwitchEdited()
{ {
int i=0; int i=0;
+3
View File
@@ -119,6 +119,9 @@ private slots:
void on_varioVolume_SL_valueChanged(); void on_varioVolume_SL_valueChanged();
void on_wavVolume_SL_valueChanged(); void on_wavVolume_SL_valueChanged();
void on_pot1Type_currentIndexChanged(int index);
void on_pot2Type_currentIndexChanged(int index);
void on_stickmodeCB_currentIndexChanged(int index); void on_stickmodeCB_currentIndexChanged(int index);
void on_channelorderCB_currentIndexChanged(int index); void on_channelorderCB_currentIndexChanged(int index);
void on_beeperCB_currentIndexChanged(int index); void on_beeperCB_currentIndexChanged(int index);
+86 -1
View File
@@ -110,7 +110,7 @@
These will be relevant for all models in the same EEPROM.</string> These will be relevant for all models in the same EEPROM.</string>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="tabSetup"> <widget class="QWidget" name="tabSetup">
<attribute name="title"> <attribute name="title">
@@ -3494,6 +3494,91 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="4">
<widget class="Line" name="potsTypeSeparator">
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="pot1Type">
<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>Pot (normal)</string>
</property>
</item>
<item>
<property name="text">
<string>Multipos Switch</string>
</property>
</item>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="pot1TypeLabel">
<property name="text">
<string>S1 Type</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="pot2Type">
<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>Pot (normal)</string>
</property>
</item>
<item>
<property name="text">
<string>Multipos Switch</string>
</property>
</item>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="pot2TypeLabel">
<property name="text">
<string>S2 Type</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
+13 -1
View File
@@ -842,6 +842,8 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr,
return; return;
} }
#if 0
// TODO check ... I removed negative toggle switches in the FW, no?
if (attr & POPULATE_MSWITCHES) { if (attr & POPULATE_MSWITCHES) {
if (attr & POPULATE_ONOFF) { if (attr & POPULATE_ONOFF) {
item = RawSwitch(SWITCH_TYPE_ONM, 1); item = RawSwitch(SWITCH_TYPE_ONM, 1);
@@ -860,6 +862,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr,
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
} }
} }
#endif
if (attr & POPULATE_ONOFF) { if (attr & POPULATE_ONOFF) {
item = RawSwitch(SWITCH_TYPE_OFF); item = RawSwitch(SWITCH_TYPE_OFF);
@@ -905,6 +908,14 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr,
if (item == value) b->setCurrentIndex(b->count()-1); if (item == value) b->setCurrentIndex(b->count()-1);
} }
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
for (int i=0; i<GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i++) {
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
}
if (attr & POPULATE_ONOFF) { if (attr & POPULATE_ONOFF) {
item = RawSwitch(SWITCH_TYPE_ON); item = RawSwitch(SWITCH_TYPE_ON);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
@@ -1086,7 +1097,8 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1); if (item == source) b->setCurrentIndex(b->count()-1);
} }
} else if (flags & POPULATE_TELEMETRY) { }
else if (flags & POPULATE_TELEMETRY) {
for (int i=0; i<TELEMETRY_SOURCES_COUNT; i++) { for (int i=0; i<TELEMETRY_SOURCES_COUNT; i++) {
item = RawSource(SOURCE_TYPE_TELEMETRY, i); item = RawSource(SOURCE_TYPE_TELEMETRY, i);
b->addItem(item.toString(), item.toValue()); b->addItem(item.toString(), item.toValue());
+1
View File
@@ -6,3 +6,4 @@
/opentx.map /opentx.map
/simu.d /simu.d
/snapshot_*.png /snapshot_*.png
/*.sh
+18 -2
View File
@@ -193,6 +193,21 @@ void ConvertGeneralSettings_215_to_216(EEGeneral &settings)
settings.version = 216; settings.version = 216;
} }
#if defined(PCBTARANIS)
int ConvertSwitch_215_to_216(int swtch)
{
if (swtch < SWSRC_ON)
return swtch;
else
return swtch + (2*6); // 2 * 6-pos pots added as switches
}
#else
inline int ConvertSwitch_215_to_216(int swtch)
{
return swtch;
}
#endif
void ConvertModel_215_to_216(ModelData &model) void ConvertModel_215_to_216(ModelData &model)
{ {
// Virtual inputs added instead of Expo/DR // Virtual inputs added instead of Expo/DR
@@ -204,6 +219,7 @@ void ConvertModel_215_to_216(ModelData &model)
// Custom Switches: better precision for x when A comes from telemetry // Custom Switches: better precision for x when A comes from telemetry
// Main View: altitude in top bar // Main View: altitude in top bar
// Mixes: GVARS in weight moved from 512 to 4096 and -512 to -4096, because GVARS may be used in limits [-1250:1250] // Mixes: GVARS in weight moved from 512 to 4096 and -512 to -4096, because GVARS may be used in limits [-1250:1250]
// Switches: two 6-pos pots added
TRACE("Model conversion from v215 to v216"); TRACE("Model conversion from v215 to v216");
@@ -237,7 +253,7 @@ void ConvertModel_215_to_216(ModelData &model)
g_model.mixData[i].phases = oldModel.mixData[i].phases; g_model.mixData[i].phases = oldModel.mixData[i].phases;
g_model.mixData[i].mltpx = oldModel.mixData[i].mltpx; g_model.mixData[i].mltpx = oldModel.mixData[i].mltpx;
g_model.mixData[i].weight = oldModel.mixData[i].weight; g_model.mixData[i].weight = oldModel.mixData[i].weight;
g_model.mixData[i].swtch = oldModel.mixData[i].swtch; g_model.mixData[i].swtch = ConvertSwitch_215_to_216(oldModel.mixData[i].swtch);
if (oldModel.mixData[i].curveMode==0/*differential*/) { if (oldModel.mixData[i].curveMode==0/*differential*/) {
g_model.mixData[i].curve.type = CURVE_REF_DIFF; g_model.mixData[i].curve.type = CURVE_REF_DIFF;
g_model.mixData[i].curve.value = oldModel.mixData[i].curveParam; g_model.mixData[i].curve.value = oldModel.mixData[i].curveParam;
@@ -297,7 +313,7 @@ void ConvertModel_215_to_216(ModelData &model)
} }
g_model.expoData[i].srcRaw = MIXSRC_Rud+chn; g_model.expoData[i].srcRaw = MIXSRC_Rud+chn;
g_model.expoData[i].chn = chn; g_model.expoData[i].chn = chn;
g_model.expoData[i].swtch = oldModel.expoData[i].swtch; g_model.expoData[i].swtch = ConvertSwitch_215_to_216(oldModel.expoData[i].swtch);
g_model.expoData[i].phases = oldModel.expoData[i].phases; g_model.expoData[i].phases = oldModel.expoData[i].phases;
g_model.expoData[i].weight = oldModel.expoData[i].weight; g_model.expoData[i].weight = oldModel.expoData[i].weight;
memcpy(&g_model.expoData[i].name, &oldModel.expoData[i].name, LEN_EXPOMIX_NAME); memcpy(&g_model.expoData[i].name, &oldModel.expoData[i].name, LEN_EXPOMIX_NAME);
+2 -2
View File
@@ -295,8 +295,8 @@ TEST(FrSkySPORT, checkCrc)
TEST(getSwitch, undefCSW) TEST(getSwitch, undefCSW)
{ {
MODEL_RESET(); MODEL_RESET();
EXPECT_EQ(getSwitch(MAX_PSWITCH), false); EXPECT_EQ(getSwitch(NUM_PSWITCH), false);
EXPECT_EQ(getSwitch(-MAX_PSWITCH), true); // no good answer there! EXPECT_EQ(getSwitch(-NUM_PSWITCH), true); // no good answer there!
} }
#endif #endif
+96 -12
View File
@@ -1168,6 +1168,8 @@ void menuGeneralDiagAna(uint8_t event)
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
enum menuGeneralHwItems { enum menuGeneralHwItems {
ITEM_SETUP_HW_POT1,
ITEM_SETUP_HW_POT2,
ITEM_SETUP_HW_UART3_MODE, ITEM_SETUP_HW_UART3_MODE,
ITEM_SETUP_HW_MAX ITEM_SETUP_HW_MAX
}; };
@@ -1181,9 +1183,22 @@ void menuGeneralHardware(uint8_t event)
uint8_t sub = m_posVert - 1; uint8_t sub = m_posVert - 1;
for (uint8_t i=0; i<ITEM_SETUP_HW_MAX; i++) { for (uint8_t i=0; i<ITEM_SETUP_HW_MAX; i++) {
uint8_t y = 1 + 1*FH + i*FH; uint8_t y = 1 + 1*FH + i*FH;
uint8_t attr = (sub == i ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); uint8_t attr = (sub == i ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
switch(i) { switch(i) {
case ITEM_SETUP_HW_POT1:
case ITEM_SETUP_HW_POT2:
{
int idx = i - ITEM_SETUP_HW_POT1;
uint8_t mask = (1<<idx);
uint8_t potType = selectMenuItem(HW_SETTINGS_COLUMN, y, i==ITEM_SETUP_HW_POT1 ? STR_POT1TYPE : STR_POT2TYPE, STR_POTTYPES, (g_eeGeneral.potsType & mask) >> idx, 0, 1, attr, event);
if (potType)
g_eeGeneral.potsType |= mask;
else
g_eeGeneral.potsType &= ~mask;
break;
}
case ITEM_SETUP_HW_UART3_MODE: case ITEM_SETUP_HW_UART3_MODE:
g_eeGeneral.hw_uartMode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.hw_uartMode, 0, 2, attr, event); g_eeGeneral.hw_uartMode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.hw_uartMode, 0, 2, attr, event);
break; break;
@@ -1265,19 +1280,48 @@ void menuGeneralHardware(uint8_t event)
} }
#endif #endif
#define XPOT_DELTA 5
void menuCommonCalib(uint8_t event) void menuCommonCalib(uint8_t event)
{ {
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { //get low and high vals for sticks and trims for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { // get low and high vals for sticks and trims
int16_t vt = anaIn(i); int16_t vt = anaIn(i);
reusableBuffer.calib.loVals[i] = min(vt, reusableBuffer.calib.loVals[i]); reusableBuffer.calib.loVals[i] = min(vt, reusableBuffer.calib.loVals[i]);
reusableBuffer.calib.hiVals[i] = max(vt, reusableBuffer.calib.hiVals[i]); reusableBuffer.calib.hiVals[i] = max(vt, reusableBuffer.calib.hiVals[i]);
#if defined(PCBTARANIS) if (i >= POT1 && i <= POT_LAST) {
if(i >= NUM_STICKS && i < NUM_STICKS+NUM_POTS-2) {
#else
if (i >= NUM_STICKS) {
#endif
reusableBuffer.calib.midVals[i] = (reusableBuffer.calib.hiVals[i] + reusableBuffer.calib.loVals[i]) / 2; reusableBuffer.calib.midVals[i] = (reusableBuffer.calib.hiVals[i] + reusableBuffer.calib.loVals[i]) / 2;
#if defined(PCBTARANIS)
uint8_t idx = i - POT1;
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
if (IS_MULTIPOS_POT(i) && count <= POTS_POS_COUNT) {
if (reusableBuffer.calib.xpotsCalib[idx].lastCount == 0 || vt < reusableBuffer.calib.xpotsCalib[idx].lastPosition - XPOT_DELTA || vt > reusableBuffer.calib.xpotsCalib[idx].lastPosition + XPOT_DELTA) {
reusableBuffer.calib.xpotsCalib[idx].lastPosition = vt;
reusableBuffer.calib.xpotsCalib[idx].lastCount = 1;
}
else {
if (reusableBuffer.calib.xpotsCalib[idx].lastCount < 255) reusableBuffer.calib.xpotsCalib[idx].lastCount++;
}
if (reusableBuffer.calib.xpotsCalib[idx].lastCount == 8/*80ms*/) {
int16_t position = reusableBuffer.calib.xpotsCalib[idx].lastPosition;
bool found = false;
for (int j=0; j<count; j++) {
if (position >= reusableBuffer.calib.xpotsCalib[idx].steps[j]-XPOT_DELTA && position <= reusableBuffer.calib.xpotsCalib[idx].steps[j]+XPOT_DELTA) {
found = true;
break;
}
}
if (!found) {
if (count < POTS_POS_COUNT) {
reusableBuffer.calib.xpotsCalib[idx].steps[count] = position;
}
else {
g_eeGeneral.potsType &= !(1<<idx);
}
reusableBuffer.calib.xpotsCalib[idx].stepsCount += 1;
}
}
}
#endif
} }
} }
@@ -1311,6 +1355,12 @@ void menuCommonCalib(uint8_t event)
reusableBuffer.calib.loVals[i] = 15000; reusableBuffer.calib.loVals[i] = 15000;
reusableBuffer.calib.hiVals[i] = -15000; reusableBuffer.calib.hiVals[i] = -15000;
reusableBuffer.calib.midVals[i] = anaIn(i); reusableBuffer.calib.midVals[i] = anaIn(i);
#if defined(PCBTARANIS)
if (i<NUM_XPOTS) {
reusableBuffer.calib.xpotsCalib[i].stepsCount = 0;
reusableBuffer.calib.xpotsCalib[i].lastCount = 0;
}
#endif
} }
break; break;
@@ -1321,17 +1371,37 @@ void menuCommonCalib(uint8_t event)
lcd_putsLeft(3*FH, STR_MENUWHENDONE); lcd_putsLeft(3*FH, STR_MENUWHENDONE);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i])>50) { if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) {
g_eeGeneral.calibMid[i] = reusableBuffer.calib.midVals[i]; g_eeGeneral.calib[i].mid = reusableBuffer.calib.midVals[i];
int16_t v = reusableBuffer.calib.midVals[i] - reusableBuffer.calib.loVals[i]; int16_t v = reusableBuffer.calib.midVals[i] - reusableBuffer.calib.loVals[i];
g_eeGeneral.calibSpanNeg[i] = v - v/STICK_TOLERANCE; g_eeGeneral.calib[i].spanNeg = v - v/STICK_TOLERANCE;
v = reusableBuffer.calib.hiVals[i] - reusableBuffer.calib.midVals[i]; v = reusableBuffer.calib.hiVals[i] - reusableBuffer.calib.midVals[i];
g_eeGeneral.calibSpanPos[i] = v - v/STICK_TOLERANCE; g_eeGeneral.calib[i].spanPos = v - v/STICK_TOLERANCE;
} }
} }
break; break;
case 3: case 3:
#if defined(PCBTARANIS)
for (uint8_t i=POT1; i<=POT_LAST; i++) {
int idx = i - POT1;
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
if (IS_MULTIPOS_POT(i) && count > 1 && count <= POTS_POS_COUNT) {
for (int j=0; j<count; j++) {
for (int k=j+1; k<count; k++) {
if (reusableBuffer.calib.xpotsCalib[idx].steps[k] < reusableBuffer.calib.xpotsCalib[idx].steps[j]) {
swap(reusableBuffer.calib.xpotsCalib[idx].steps[j], reusableBuffer.calib.xpotsCalib[idx].steps[k]);
}
}
}
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[i];
calib->count = count - 1;
for (int j=0; j<calib->count; j++) {
calib->steps[j] = (reusableBuffer.calib.xpotsCalib[idx].steps[j+1] + reusableBuffer.calib.xpotsCalib[idx].steps[j]) >> 5;
}
}
}
#endif
g_eeGeneral.chkSum = evalChkSum(); g_eeGeneral.chkSum = evalChkSum();
eeDirty(EE_GENERAL); eeDirty(EE_GENERAL);
reusableBuffer.calib.state = 4; reusableBuffer.calib.state = 4;
@@ -1343,8 +1413,22 @@ void menuCommonCalib(uint8_t event)
} }
doMainScreenGraphics(); doMainScreenGraphics();
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
drawPotsBars(); drawPotsBars();
for (int i=POT1; i<=POT_LAST; i++) {
uint8_t steps = 0;
if (reusableBuffer.calib.state == 2) {
steps = reusableBuffer.calib.xpotsCalib[i-POT1].stepsCount;
}
else if (IS_MULTIPOS_POT(i)) {
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[i];
steps = calib->count + 1;
}
if (steps > 0 && steps <= POTS_POS_COUNT) {
lcd_outdezAtt(LCD_W/2-2+(i-POT1)*5, LCD_H-6, steps, TINSIZE);
}
}
#endif #endif
} }
+3 -3
View File
@@ -1060,7 +1060,7 @@ void menuModelSetup(uint8_t event)
div_t qr = div(timer->start, 60); div_t qr = div(timer->start, 60);
switch (m_posHorz) { switch (m_posHorz) {
case 0: case 0:
CHECK_INCDEC_MODELVAR(event, timer->mode, -2*(MAX_PSWITCH+NUM_CSW), TMR_VAROFS-1+2*(MAX_PSWITCH+NUM_CSW)); CHECK_INCDEC_MODELVAR(event, timer->mode, -2*(NUM_PSWITCH+NUM_CSW), TMR_VAROFS-1+2*(NUM_PSWITCH+NUM_CSW));
break; break;
case 1: case 1:
CHECK_INCDEC_MODELVAR_ZERO(event, qr.quot, 59); CHECK_INCDEC_MODELVAR_ZERO(event, qr.quot, 59);
@@ -1840,7 +1840,7 @@ void menuModelFlightModesAll(uint8_t event)
} }
else { else {
putsSwitches((5+LEN_FP_NAME)*FW+FW/2, y, p->swtch, attr); putsSwitches((5+LEN_FP_NAME)*FW+FW/2, y, p->swtch, attr);
if (active) CHECK_INCDEC_MODELSWITCH(event, p->swtch, -MAX_SWITCH, MAX_SWITCH); if (active) CHECK_INCDEC_MODELSWITCH(event, p->swtch, -NUM_SWITCH, NUM_SWITCH);
} }
break; break;
@@ -4297,7 +4297,7 @@ void menuModelCustomSwitchOne(uint8_t event)
case CSW_FIELD_ANDSW: case CSW_FIELD_ANDSW:
lcd_putsLeft(y, STR_AND_SWITCH); lcd_putsLeft(y, STR_AND_SWITCH);
putsSwitches(CSWONE_2ND_COLUMN, y, cs->andsw, attr); putsSwitches(CSWONE_2ND_COLUMN, y, cs->andsw, attr);
if (attr) CHECK_INCDEC_MODELVAR(event, cs->andsw, -MAX_SWITCH, MAX_SWITCH); if (attr) CHECK_INCDEC_MODELVAR(event, cs->andsw, -NUM_SWITCH, NUM_SWITCH);
break; break;
case CSW_FIELD_DURATION: case CSW_FIELD_DURATION:
lcd_putsLeft(y, STR_DURATION); lcd_putsLeft(y, STR_DURATION);
+19 -6
View File
@@ -232,13 +232,13 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
if (event == EVT_KEY_LONG(KEY_ENTER) && i_max > SWSRC_ON) { if (event == EVT_KEY_LONG(KEY_ENTER) && i_max > SWSRC_ON) {
s_editMode = !s_editMode; s_editMode = !s_editMode;
if (newval > SWSRC_ON) if (newval > SWSRC_ON)
newval -= (MAX_SWITCH+1); newval -= (NUM_SWITCH+1);
else if (newval > 0) else if (newval > 0)
newval += (MAX_SWITCH+1); newval += (NUM_SWITCH+1);
else if (newval < SWSRC_OFF) else if (newval < SWSRC_OFF)
newval += (MAX_SWITCH+1); newval += (NUM_SWITCH+1);
else if (newval < 0) else if (newval < 0)
newval -= (MAX_SWITCH+1); newval -= (NUM_SWITCH+1);
} }
} }
#endif #endif
@@ -976,7 +976,7 @@ int8_t switchMenuItem(uint8_t x, uint8_t y, int8_t value, LcdFlags attr, uint8_t
{ {
lcd_putsColumnLeft(x, y, STR_SWITCH); lcd_putsColumnLeft(x, y, STR_SWITCH);
putsSwitches(x, y, value, attr); putsSwitches(x, y, value, attr);
if (attr) CHECK_INCDEC_MODELSWITCH(event, value, -MAX_SWITCH, MAX_SWITCH); if (attr) CHECK_INCDEC_MODELSWITCH(event, value, -NUM_SWITCH, NUM_SWITCH);
return value; return value;
} }
@@ -1263,7 +1263,20 @@ bool isSwitchAvailable(int16_t swtch)
swtch = -swtch; swtch = -swtch;
} }
if (swtch>=SWSRC_FIRST_CSW && swtch<=SWSRC_LAST_CSW) { #if defined(PCBTARANIS)
if (swtch >= SWSRC_P11 && swtch <= SWSRC_P26) {
int index = (swtch - SWSRC_P11) / POTS_POS_COUNT;
if (g_eeGeneral.potsType & (1<<index)) {
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[POT1+index];
return (calib->count >= ((swtch - SWSRC_P11) % POTS_POS_COUNT));
}
else {
return false;
}
}
#endif
if (swtch >= SWSRC_FIRST_CSW && swtch <= SWSRC_LAST_CSW) {
CustomSwData * cs = cswAddress(swtch-SWSRC_FIRST_CSW); CustomSwData * cs = cswAddress(swtch-SWSRC_FIRST_CSW);
return (cs->func != CS_OFF); return (cs->func != CS_OFF);
} }
+3 -3
View File
@@ -120,9 +120,9 @@
void drawPotsBars() void drawPotsBars()
{ {
// Optimization by Mike Blandford // Optimization by Mike Blandford
uint8_t x, y, len ; // declare temporary variables uint8_t x, i, len ; // declare temporary variables
for (x=LCD_W/2-5, y=NUM_STICKS; y<NUM_STICKS+NUM_POTS; x+=5, y++) { for (x=LCD_W/2-5, i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; x+=5, i++) {
len = ((calibratedStick[y]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop len = ((calibratedStick[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
V_BAR(x, LCD_H-8, len) V_BAR(x, LCD_H-8, len)
} }
} }
+1 -1
View File
@@ -1155,7 +1155,7 @@ void putsTmrMode(xcoord_t x, uint8_t y, int8_t mode, LcdFlags att)
return; return;
} }
if (mode >= TMR_VAROFS+MAX_PSWITCH+NUM_CSW) { if (mode >= TMR_VAROFS+NUM_PSWITCH+NUM_CSW) {
mode++; mode++;
} }
+37 -8
View File
@@ -221,7 +221,7 @@ enum BeeperMode {
}; };
#if defined(CPUARM) #if defined(CPUARM)
#define EXTRA_GENERAL_FIELDS \ #define EXTRA_GENERAL_FIELDS_ARM \
uint8_t backlightBright; \ uint8_t backlightBright; \
int8_t currentCalib; \ int8_t currentCalib; \
int8_t temperatureWarn; \ int8_t temperatureWarn; \
@@ -239,8 +239,16 @@ enum BeeperMode {
int8_t beepVolume; \ int8_t beepVolume; \
int8_t wavVolume; \ int8_t wavVolume; \
int8_t varioVolume; \ int8_t varioVolume; \
int8_t backgroundVolume; \ int8_t backgroundVolume;
uint8_t hw_uartMode; #endif
#if defined(PCBTARANIS)
#define EXTRA_GENERAL_FIELDS \
EXTRA_GENERAL_FIELDS_ARM \
uint8_t hw_uartMode; \
uint8_t potsType;
#elif defined(CPUARM)
#define EXTRA_GENERAL_FIELDS EXTRA_GENERAL_FIELDS_ARM
#elif defined(PXX) #elif defined(PXX)
#define EXTRA_GENERAL_FIELDS uint8_t countryCode; #define EXTRA_GENERAL_FIELDS uint8_t countryCode;
#else #else
@@ -304,13 +312,25 @@ enum BacklightMode {
#define SPLASH_MODE uint8_t splashMode:1; uint8_t spare4:2 #define SPLASH_MODE uint8_t splashMode:1; uint8_t spare4:2
#endif #endif
#if defined(PCBTARANIS)
#define POTS_POS_COUNT 6
PACK(typedef struct {
uint8_t count;
uint8_t steps[POTS_POS_COUNT-1];
}) StepsCalibData;
#endif
PACK(typedef struct {
int16_t mid;
int16_t spanNeg;
int16_t spanPos;
}) CalibData;
#define ALTERNATE_VIEW 0x10 #define ALTERNATE_VIEW 0x10
PACK(typedef struct t_EEGeneral { PACK(typedef struct t_EEGeneral {
uint8_t version; uint8_t version;
uint16_t variant; uint16_t variant;
int16_t calibMid[NUM_STICKS+NUM_POTS]; CalibData calib[NUM_STICKS+NUM_POTS];
int16_t calibSpanNeg[NUM_STICKS+NUM_POTS];
int16_t calibSpanPos[NUM_STICKS+NUM_POTS];
uint16_t chkSum; uint16_t chkSum;
int8_t currModel; int8_t currModel;
uint8_t contrast; uint8_t contrast;
@@ -640,7 +660,7 @@ PACK( union u_int8int16_t {
#if defined(CPUARM) #if defined(CPUARM)
#define MAX_CSW_DURATION 120 /*60s*/ #define MAX_CSW_DURATION 120 /*60s*/
#define MAX_CSW_DELAY 120 /*60s*/ #define MAX_CSW_DELAY 120 /*60s*/
#define MAX_CSW_ANDSW MAX_SWITCH #define MAX_CSW_ANDSW NUM_SWITCH
typedef int16_t csw_telemetry_value_t; typedef int16_t csw_telemetry_value_t;
PACK(typedef struct t_CustomSwData { // Custom Switches data PACK(typedef struct t_CustomSwData { // Custom Switches data
int16_t v1; int16_t v1;
@@ -1143,6 +1163,8 @@ enum SwitchSources {
#endif #endif
SWSRC_FIRST_CSW, SWSRC_FIRST_CSW,
SWSRC_LAST_SWITCH = SWSRC_FIRST_CSW-1,
SWSRC_SW1 = SWSRC_FIRST_CSW, SWSRC_SW1 = SWSRC_FIRST_CSW,
SWSRC_SW2, SWSRC_SW2,
SWSRC_SW3, SWSRC_SW3,
@@ -1157,10 +1179,17 @@ enum SwitchSources {
SWSRC_SWC, SWSRC_SWC,
SWSRC_LAST_CSW = SWSRC_SW1+NUM_CSW-1, SWSRC_LAST_CSW = SWSRC_SW1+NUM_CSW-1,
#if defined(PCBTARANIS)
SWSRC_P11,
SWSRC_P16 = SWSRC_P11+5,
SWSRC_P21,
SWSRC_P26 = SWSRC_P21+5,
#endif
SWSRC_ON, SWSRC_ON,
SWSRC_FIRST_MOMENT_SWITCH, SWSRC_FIRST_MOMENT_SWITCH,
SWSRC_LAST_MOMENT_SWITCH = SWSRC_FIRST_MOMENT_SWITCH+SWSRC_ON-1, SWSRC_LAST_MOMENT_SWITCH = SWSRC_FIRST_MOMENT_SWITCH+SWSRC_LAST_CSW,
#if !defined(PCBSTD) #if !defined(PCBSTD)
SWSRC_TRAINER_SHORT, SWSRC_TRAINER_SHORT,
+79 -30
View File
@@ -503,7 +503,7 @@ void generalDefault()
uint16_t evalChkSum() uint16_t evalChkSum()
{ {
uint16_t sum = 0; uint16_t sum = 0;
const int16_t *calibValues = &g_eeGeneral.calibMid[0]; const int16_t *calibValues = (const int16_t *) &g_eeGeneral.calib[0];
for (int i=0; i<NUM_STICKS+NUM_POTS+5; i++) for (int i=0; i<NUM_STICKS+NUM_POTS+5; i++)
sum += calibValues[i]; sum += calibValues[i];
return sum; return sum;
@@ -1308,6 +1308,8 @@ uint8_t cswStates[NUM_CSW];
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
tmr10ms_t switchesMidposStart[6] = { 0 }; tmr10ms_t switchesMidposStart[6] = { 0 };
uint32_t switchesPos = 0; uint32_t switchesPos = 0;
tmr10ms_t potsLastposStart[NUM_XPOTS];
uint8_t potsPos[NUM_XPOTS];
#define DELAY_SWITCH_3POS 10/*100ms*/ #define DELAY_SWITCH_3POS 10/*100ms*/
#define CHECK_2POS(sw) newPos |= (switchState(sw ## 0) ? (1 << (sw ## 0 - SW_SA0)) : (1 << (sw ## 0 - SW_SA0 + 1))) #define CHECK_2POS(sw) newPos |= (switchState(sw ## 0) ? (1 << (sw ## 0 - SW_SA0)) : (1 << (sw ## 0 - SW_SA0 + 1)))
#define CHECK_3POS(idx, sw) if (switchState(sw ## 0)) { \ #define CHECK_3POS(idx, sw) if (switchState(sw ## 0)) { \
@@ -1328,8 +1330,7 @@ uint32_t switchesPos = 0;
} \ } \
newPos |= (switchesPos & (0x7 << (sw ## 0 - SW_SA0))); \ newPos |= (switchesPos & (0x7 << (sw ## 0 - SW_SA0))); \
} }
#define SWITCH_POSITION(sw) (switchesPos & (1<<(sw))) void getSwitchesPosition()
void get3POSSwitchesPosition()
{ {
uint32_t newPos = 0; uint32_t newPos = 0;
CHECK_3POS(0, SW_SA); CHECK_3POS(0, SW_SA);
@@ -1341,9 +1342,32 @@ void get3POSSwitchesPosition()
CHECK_3POS(5, SW_SG); CHECK_3POS(5, SW_SG);
CHECK_2POS(SW_SH); CHECK_2POS(SW_SH);
switchesPos = newPos; switchesPos = newPos;
#if defined(PCBTARANIS)
for (int i=0; i<NUM_XPOTS; i++) {
if (g_eeGeneral.potsType & (1 << i)) {
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[POT1+i];
if (calib->count>0 && calib->count<POTS_POS_COUNT) {
uint8_t pos = anaIn(POT1+i) / (2*RESX/calib->count);
uint8_t previousPos = potsPos[i] >> 4;
if (pos != previousPos) {
potsLastposStart[i] = get_tmr10ms();
potsPos[i] = (pos << 4) | (potsPos[i] & 0x0f);
}
else if ((tmr10ms_t)(get_tmr10ms() - potsLastposStart[i]) > DELAY_SWITCH_3POS) {
potsLastposStart[i] = 0;
potsPos[i] = (pos << 4) | (pos);
}
}
}
}
#endif
} }
#define SWITCH_POSITION(sw) (switchesPos & (1<<(sw)))
#define POT_POSITION(sw) ((potsPos[(sw)/POTS_POS_COUNT] & 0x0f) == ((sw) % POTS_POS_COUNT))
#else #else
#define get3POSSwitchesPosition() #define getSwitchesPosition()
#define SWITCH_POSITION(idx) switchState((EnumKeys)(SW_BASE+(idx)))
#endif #endif
int16_t csLastValue[NUM_CSW]; int16_t csLastValue[NUM_CSW];
@@ -1360,15 +1384,16 @@ bool getSwitch(int8_t swtch)
if (cs_idx == SWSRC_ON) { if (cs_idx == SWSRC_ON) {
result = true; result = true;
} }
else if (cs_idx <= MAX_PSWITCH) { else if (cs_idx <= SWSRC_LAST_SWITCH) {
#if defined(PCBTARANIS) result = SWITCH_POSITION(cs_idx-SWSRC_FIRST_SWITCH);
result = SWITCH_POSITION(cs_idx-SWSRC_SA0);
#else
result = switchState((EnumKeys)(SW_BASE+cs_idx-1));
#endif
} }
#if defined(PCBTARANIS)
else if (cs_idx >= SWSRC_P11 && cs_idx <= SWSRC_P26) {
result = POT_POSITION(cs_idx-SWSRC_P11);
}
#endif
else { else {
cs_idx -= MAX_PSWITCH+1; cs_idx -= SWSRC_FIRST_CSW;
GETSWITCH_RECURSIVE_TYPE mask = ((GETSWITCH_RECURSIVE_TYPE)1 << cs_idx); GETSWITCH_RECURSIVE_TYPE mask = ((GETSWITCH_RECURSIVE_TYPE)1 << cs_idx);
if (s_last_switch_used & mask) { if (s_last_switch_used & mask) {
@@ -1552,7 +1577,7 @@ int8_t getMovedSwitch()
} }
} }
#else #else
for (uint8_t i=MAX_PSWITCH; i>0; i--) { for (uint8_t i=NUM_PSWITCH; i>0; i--) {
bool prev; bool prev;
swstate_t mask = 0; swstate_t mask = 0;
if (i <= 3) { if (i <= 3) {
@@ -1564,7 +1589,7 @@ int8_t getMovedSwitch()
} }
bool next = getSwitch(i); bool next = getSwitch(i);
if (prev != next) { if (prev != next) {
if (i!=MAX_PSWITCH || next==true) if (i!=NUM_PSWITCH || next==true)
result = next ? i : -i; result = next ? i : -i;
if (mask) if (mask)
switches_states ^= mask; switches_states ^= mask;
@@ -2148,8 +2173,9 @@ void checkTHR()
int16_t lowLim = THRCHK_DEADBAND - 1024 ; int16_t lowLim = THRCHK_DEADBAND - 1024 ;
#else #else
getADC(); // if thr is down - do not display warning at all getADC(); // if thr is down - do not display warning at all
int16_t lowLim = g_eeGeneral.calibMid[thrchn]; CalibData * calib = &g_eeGeneral.calib[thrchn];
lowLim = (g_model.throttleReversed ? - lowLim - g_eeGeneral.calibSpanPos[thrchn] : lowLim - g_eeGeneral.calibSpanNeg[thrchn]); int16_t lowLim = calib->mid;
lowLim = (g_model.throttleReversed ? - lowLim - calib->spanPos : lowLim - calib->spanNeg);
lowLim += THRCHK_DEADBAND; lowLim += THRCHK_DEADBAND;
#endif #endif
int16_t v = thrAnaIn(thrchn); int16_t v = thrAnaIn(thrchn);
@@ -2214,7 +2240,7 @@ void checkSwitches()
} }
#else #else
uint8_t x = 2; uint8_t x = 2;
for (uint8_t i=1; i<MAX_PSWITCH-1; i++) { for (uint8_t i=1; i<NUM_PSWITCH-1; i++) {
uint8_t attr = (states & (1 << i)) == (switches_states & (1 << i)) ? 0 : INVERS; uint8_t attr = (states & (1 << i)) == (switches_states & (1 << i)) ? 0 : INVERS;
putsSwitches(x, 5*FH, (i>2?(i+1):1+((states>>1)&0x3)), attr); putsSwitches(x, 5*FH, (i>2?(i+1):1+((states>>1)&0x3)), attr);
if (i == 1 && attr) i++; if (i == 1 && attr) i++;
@@ -2483,10 +2509,29 @@ void getADC()
for (uint32_t x=0; x<NUMBER_ANALOG; x++) { for (uint32_t x=0; x<NUMBER_ANALOG; x++) {
temp[x] += Analog_values[x]; temp[x] += Analog_values[x];
} }
#if defined(PCBTARANIS)
if (s_noScroll) break;
#endif
} }
for (uint32_t x=0; x<NUMBER_ANALOG; x++) { for (uint32_t x=0; x<NUMBER_ANALOG; x++) {
s_anaFilt[x] = temp[x] >> 3; uint16_t v = temp[x] >> 3;
#if defined(PCBTARANIS)
if (s_noScroll) v = temp[x] >> 1;
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[x];
if (IS_MULTIPOS_POT(x) && calib->count>0 && calib->count<POTS_POS_COUNT) {
uint8_t vShifted = (v >> 4);
s_anaFilt[x] = 2*RESX;
for (int i=0; i<calib->count; i++) {
if (vShifted < calib->steps[i]) {
s_anaFilt[x] = i*2*RESX/calib->count;
break;
}
}
}
else
#endif
s_anaFilt[x] = v;
} }
} }
#else #else
@@ -2734,10 +2779,14 @@ void evalInputs(uint8_t mode)
#ifndef SIMU #ifndef SIMU
if (i < NUM_STICKS+NUM_POTS) { if (i < NUM_STICKS+NUM_POTS) {
v -= g_eeGeneral.calibMid[i]; if (IS_MULTIPOS_POT(i)) {
v = v * (int32_t)RESX / (max((int16_t)100,(v>0 ? v -= RESX;
g_eeGeneral.calibSpanPos[i] : }
g_eeGeneral.calibSpanNeg[i]))); else {
CalibData * calib = &g_eeGeneral.calib[i];
v -= calib->mid;
v = v * (int32_t)RESX / (max((int16_t)100, (v>0 ? calib->spanPos : calib->spanNeg)));
}
} }
#endif #endif
@@ -3063,13 +3112,13 @@ void evalFunctions()
#endif #endif
if (swtch > MAX_SWITCH+1) { if (swtch > NUM_SWITCH+1) {
momentary = 1; momentary = 1;
swtch -= MAX_SWITCH+1; swtch -= NUM_SWITCH+1;
} }
if (swtch < -MAX_SWITCH-1) { if (swtch < -NUM_SWITCH-1) {
momentary = 1; momentary = 1;
swtch += MAX_SWITCH+1; swtch += NUM_SWITCH+1;
} }
bool active = getSwitch(swtch); bool active = getSwitch(swtch);
@@ -3697,10 +3746,10 @@ void doMixerCalculations()
// therefore forget the exact calculation and use only 1 instead; good compromise // therefore forget the exact calculation and use only 1 instead; good compromise
lastTMR = tmr10ms; lastTMR = tmr10ms;
get3POSSwitchesPosition();
getADC(); getADC();
getSwitchesPosition();
#if defined(PCBSKY9X) && !defined(REVA) && !defined(SIMU) #if defined(PCBSKY9X) && !defined(REVA) && !defined(SIMU)
Current_analogue = (Current_analogue*31 + s_anaFilt[8] ) >> 5 ; Current_analogue = (Current_analogue*31 + s_anaFilt[8] ) >> 5 ;
if (Current_analogue > Current_max) if (Current_analogue > Current_max)
@@ -3884,9 +3933,9 @@ void doMixerCalculations()
timerState->sum+=val; timerState->sum+=val;
} }
if (atm>=(TMR_VAROFS+MAX_SWITCH)){ // toggeled switch if (atm>=(TMR_VAROFS+NUM_SWITCH)){ // toggeled switch
if(!(timerState->toggled | timerState->sum | timerState->cnt | timerState->lastPos)) { timerState->lastPos = tm < 0; timerState->sum = 1; } // if initializing then init the lastPos if(!(timerState->toggled | timerState->sum | timerState->cnt | timerState->lastPos)) { timerState->lastPos = tm < 0; timerState->sum = 1; } // if initializing then init the lastPos
uint8_t swPos = getSwitch(tm>0 ? tm-(TMR_VAROFS+MAX_SWITCH-1) : tm+MAX_SWITCH); uint8_t swPos = getSwitch(tm>0 ? tm-(TMR_VAROFS+NUM_SWITCH-1) : tm+NUM_SWITCH);
if (swPos && !timerState->lastPos) timerState->toggled = !timerState->toggled; // if switch is flipped first time -> change counter state if (swPos && !timerState->lastPos) timerState->toggled = !timerState->toggled; // if switch is flipped first time -> change counter state
timerState->lastPos = swPos; timerState->lastPos = swPos;
} }
@@ -3923,7 +3972,7 @@ void doMixerCalculations()
newTimerVal++; newTimerVal++;
} }
else { else {
if (atm<(TMR_VAROFS+MAX_SWITCH)) if (atm<(TMR_VAROFS+NUM_SWITCH))
timerState->toggled = tm>0 ? getSwitch(tm-(TMR_VAROFS-1)) : !getSwitch(-tm); // normal switch timerState->toggled = tm>0 ? getSwitch(tm-(TMR_VAROFS-1)) : !getSwitch(-tm); // normal switch
if (timerState->toggled) if (timerState->toggled)
newTimerVal++; newTimerVal++;
+29 -10
View File
@@ -376,8 +376,8 @@ enum EnumKeys {
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#define NUM_SWITCHES 8 #define NUM_SWITCHES 8
#define IS_3POS(sw) ((sw) != 5 && (sw) != 7) #define IS_3POS(sw) ((sw) != 5 && (sw) != 7)
#define MAX_PSWITCH (SW_SH2-SW_SA0+1)
#define NUM_POTS 4 #define NUM_POTS 4
#define NUM_XPOTS 2
#define NUM_SW_SRCRAW 8 #define NUM_SW_SRCRAW 8
#define SWSRC_THR SWSRC_SF2 #define SWSRC_THR SWSRC_SF2
#define SWSRC_GEA SWSRC_SG2 #define SWSRC_GEA SWSRC_SG2
@@ -389,27 +389,35 @@ enum EnumKeys {
#define NUM_SWITCHES 7 #define NUM_SWITCHES 7
#define IS_3POS(sw) ((sw) == 0) #define IS_3POS(sw) ((sw) == 0)
#define IS_MOMENTARY(sw) (sw == SWSRC_TRN) #define IS_MOMENTARY(sw) (sw == SWSRC_TRN)
#define MAX_PSWITCH (SW_TRN-SW_ID0+1) // 9 physical switches
#define NUM_POTS 3 #define NUM_POTS 3
#define NUM_XPOTS 0
#define NUM_SW_SRCRAW 1 #define NUM_SW_SRCRAW 1
#define SW_DSM2_BIND SW_TRN #define SW_DSM2_BIND SW_TRN
#endif #endif
#define MAX_SWITCH (MAX_PSWITCH+NUM_CSW) #define NUM_PSWITCH (SWSRC_LAST_SWITCH-SWSRC_FIRST_SWITCH+1)
#define NUM_POTSSW (NUM_XPOTS*6)
#define NUM_SWITCH (NUM_PSWITCH+NUM_CSW+NUM_POTSSW)
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#define KEY_RIGHT KEY_PLUS #define KEY_RIGHT KEY_PLUS
#define KEY_LEFT KEY_MINUS #define KEY_LEFT KEY_MINUS
#define KEY_UP KEY_PLUS #define KEY_UP KEY_PLUS
#define KEY_DOWN KEY_MINUS #define KEY_DOWN KEY_MINUS
#else #else
#define KEY_ENTER KEY_MENU #define KEY_ENTER KEY_MENU
#define KEY_PLUS KEY_RIGHT #define KEY_PLUS KEY_RIGHT
#define KEY_MINUS KEY_LEFT #define KEY_MINUS KEY_LEFT
#endif #endif
#include "myeeprom.h" #include "myeeprom.h"
#if defined(PCBTARANIS)
#define IS_MULTIPOS_POT(x) ((x)>=POT1 && (x)<=POT_LAST && (g_eeGeneral.potsType & (1 << ((x)-POT1))))
#else
#define IS_MULTIPOS_POT(x) (false)
#endif
#if ROTARY_ENCODERS > 0 #if ROTARY_ENCODERS > 0
#define IF_ROTARY_ENCODERS(x) x, #define IF_ROTARY_ENCODERS(x) x,
#else #else
@@ -1041,12 +1049,14 @@ enum Analogs {
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
POT1, POT1,
POT2, POT2,
POT_LAST = POT2,
SLIDER1, SLIDER1,
SLIDER2, SLIDER2,
#else #else
POT1, POT1,
POT2, POT2,
POT3, POT3,
POT_LAST = POT3,
#endif #endif
TX_VOLTAGE, TX_VOLTAGE,
#if defined(PCBSKY9X) && !defined(REVA) #if defined(PCBSKY9X) && !defined(REVA)
@@ -1094,6 +1104,7 @@ template<class t> FORCEINLINE t min(t a, t b) { return a<b?a:b; }
template<class t> FORCEINLINE t max(t a, t b) { return a>b?a:b; } template<class t> FORCEINLINE t max(t a, t b) { return a>b?a:b; }
template<class t> FORCEINLINE t sgn(t a) { return a>0 ? 1 : (a < 0 ? -1 : 0); } template<class t> FORCEINLINE t sgn(t a) { return a>0 ? 1 : (a < 0 ? -1 : 0); }
template<class t> FORCEINLINE t limit(t mi, t x, t ma) { return min(max(mi,x),ma); } template<class t> FORCEINLINE t limit(t mi, t x, t ma) { return min(max(mi,x),ma); }
template<class t> void swap(t & a, t & b) { t tmp = b; b = a; a = tmp; }
#if defined(HELI) || defined(FRSKY_HUB) #if defined(HELI) || defined(FRSKY_HUB)
uint16_t isqrt32(uint32_t n); uint16_t isqrt32(uint32_t n);
@@ -1564,6 +1575,14 @@ union ReusableBuffer
int16_t loVals[NUM_STICKS+NUM_POTS]; int16_t loVals[NUM_STICKS+NUM_POTS];
int16_t hiVals[NUM_STICKS+NUM_POTS]; int16_t hiVals[NUM_STICKS+NUM_POTS];
uint8_t state; uint8_t state;
#if defined(PCBTARANIS)
struct {
uint8_t stepsCount;
int16_t steps[POTS_POS_COUNT];
uint8_t lastCount;
int16_t lastPosition;
} xpotsCalib[NUM_XPOTS];
#endif
} calib; } calib;
#if defined(SDCARD) #if defined(SDCARD)
+3
View File
@@ -57,6 +57,7 @@ const pm_char STR_OPEN9X[] PROGMEM =
ISTR(TRNCHN) ISTR(TRNCHN)
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
ISTR(UART3MODES) ISTR(UART3MODES)
ISTR(POTTYPES)
#endif #endif
ISTR(VTRIMINC) ISTR(VTRIMINC)
ISTR(RETA123) ISTR(RETA123)
@@ -496,6 +497,8 @@ const pm_char STR_VIEW_TEXT[] PROGMEM = "View text";
const pm_char STR_VIEW_CHANNELS[] PROGMEM = "View Channels"; const pm_char STR_VIEW_CHANNELS[] PROGMEM = "View Channels";
const pm_char STR_VIEW_NOTES[] PROGMEM = "View Notes"; const pm_char STR_VIEW_NOTES[] PROGMEM = "View Notes";
const pm_char STR_UART3MODE[] PROGMEM = TR_UART3MODE; const pm_char STR_UART3MODE[] PROGMEM = TR_UART3MODE;
const pm_char STR_POT1TYPE[] PROGMEM = TR_POT1TYPE;
const pm_char STR_POT2TYPE[] PROGMEM = TR_POT2TYPE;
#endif #endif
#if MENUS_LOCK == 1 #if MENUS_LOCK == 1
+7 -3
View File
@@ -100,10 +100,11 @@ extern const pm_char STR_OPEN9X[];
#endif #endif
#define OFS_TRNCHN (OFS_TRNMODE + sizeof(TR_TRNMODE)) #define OFS_TRNCHN (OFS_TRNMODE + sizeof(TR_TRNMODE))
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#define OFS_UART3MODES (OFS_TRNCHN + sizeof(TR_TRNCHN)) #define OFS_UART3MODES (OFS_TRNCHN + sizeof(TR_TRNCHN))
#define OFS_VTRIMINC (OFS_UART3MODES + sizeof(TR_UART3MODES)) #define OFS_POTTYPES (OFS_UART3MODES + sizeof(TR_UART3MODES))
#define OFS_VTRIMINC (OFS_POTTYPES + sizeof(TR_POTTYPES))
#else #else
#define OFS_VTRIMINC (OFS_TRNCHN + sizeof(TR_TRNCHN)) #define OFS_VTRIMINC (OFS_TRNCHN + sizeof(TR_TRNCHN))
#endif #endif
#define OFS_RETA123 (OFS_VTRIMINC + sizeof(TR_VTRIMINC)) #define OFS_RETA123 (OFS_VTRIMINC + sizeof(TR_VTRIMINC))
#define OFS_VPROTOS (OFS_RETA123 + sizeof(TR_RETA123)) #define OFS_VPROTOS (OFS_RETA123 + sizeof(TR_RETA123))
@@ -196,6 +197,7 @@ extern const pm_char STR_OPEN9X[];
#define STR_TRNMODE (STR_OPEN9X + OFS_TRNMODE) #define STR_TRNMODE (STR_OPEN9X + OFS_TRNMODE)
#define STR_TRNCHN (STR_OPEN9X + OFS_TRNCHN) #define STR_TRNCHN (STR_OPEN9X + OFS_TRNCHN)
#define STR_UART3MODES (STR_OPEN9X + OFS_UART3MODES) #define STR_UART3MODES (STR_OPEN9X + OFS_UART3MODES)
#define STR_POTTYPES (STR_OPEN9X + OFS_POTTYPES)
#define STR_VTRIMINC (STR_OPEN9X + OFS_VTRIMINC) #define STR_VTRIMINC (STR_OPEN9X + OFS_VTRIMINC)
#define STR_RETA123 (STR_OPEN9X + OFS_RETA123) #define STR_RETA123 (STR_OPEN9X + OFS_RETA123)
#define STR_VPROTOS (STR_OPEN9X + OFS_VPROTOS) #define STR_VPROTOS (STR_OPEN9X + OFS_VPROTOS)
@@ -683,6 +685,8 @@ extern const pm_char STR_VIEW_TEXT[];
extern const pm_char STR_VIEW_CHANNELS[]; extern const pm_char STR_VIEW_CHANNELS[];
extern const pm_char STR_VIEW_NOTES[]; extern const pm_char STR_VIEW_NOTES[];
extern const pm_char STR_UART3MODE[]; extern const pm_char STR_UART3MODE[];
extern const pm_char STR_POT1TYPE[];
extern const pm_char STR_POT2TYPE[];
#endif #endif
#if MENUS_LOCK == 1 #if MENUS_LOCK == 1
+2 -1
View File
@@ -331,7 +331,8 @@
#endif #endif
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#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_CUSTOMSW "*1 " #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
#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_CUSTOMSW TR_6POS_POTS "*1 "
#else #else
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "*1 " #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "*1 "
#endif #endif
+7 -1
View File
@@ -71,6 +71,9 @@
#define LEN_UART3MODES "\017" #define LEN_UART3MODES "\017"
#define TR_UART3MODES "OFF\0 ""SPORT Mirror\0 ""Virtual SP2UART" #define TR_UART3MODES "OFF\0 ""SPORT Mirror\0 ""Virtual SP2UART"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "Pot\0 ""Multipos Switch"
#define LEN_DATETIME "\005" #define LEN_DATETIME "\005"
#define TR_DATETIME "DATE:""ZEIT:" #define TR_DATETIME "DATE:""ZEIT:"
@@ -331,7 +334,8 @@
#endif #endif
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#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_CUSTOMSW "ONE" #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
#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_CUSTOMSW TR_6POS_POTS "ONE"
#else #else
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "ONE" #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "ONE"
#endif #endif
@@ -679,6 +683,8 @@
#define TR_PERSISTENT_MAH INDENT "Store mAh" #define TR_PERSISTENT_MAH INDENT "Store mAh"
#define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset") #define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset")
#define TR_UART3MODE "Serial port" #define TR_UART3MODE "Serial port"
#define TR_POT1TYPE "S1 Type"
#define TR_POT2TYPE "S2 Type"
#if defined(MAVLINK) #if defined(MAVLINK)
#define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI"
+7 -1
View File
@@ -71,6 +71,9 @@
#define LEN_UART3MODES "\017" #define LEN_UART3MODES "\017"
#define TR_UART3MODES "OFF\0 ""SPORT Mirror\0 ""Virtual SP2UART" #define TR_UART3MODES "OFF\0 ""SPORT Mirror\0 ""Virtual SP2UART"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "Pot\0 ""Multipos Switch"
#define LEN_DATETIME "\005" #define LEN_DATETIME "\005"
#define TR_DATETIME "DATE:""TIME:" #define TR_DATETIME "DATE:""TIME:"
@@ -331,7 +334,8 @@
#endif #endif
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#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_CUSTOMSW "One" #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
#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_CUSTOMSW TR_6POS_POTS "One"
#else #else
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "One" #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "One"
#endif #endif
@@ -679,6 +683,8 @@
#define TR_PERSISTENT_MAH INDENT "Store mAh" #define TR_PERSISTENT_MAH INDENT "Store mAh"
#define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset") #define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset")
#define TR_UART3MODE "Serial port" #define TR_UART3MODE "Serial port"
#define TR_POT1TYPE "S1 Type"
#define TR_POT2TYPE "S2 Type"
#if defined(MAVLINK) #if defined(MAVLINK)
#define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI"
+8 -2
View File
@@ -1,4 +1,4 @@
/* /*
* Authors (alphabetical order) * Authors (alphabetical order)
* - Bertrand Songis <bsongis@gmail.com> * - Bertrand Songis <bsongis@gmail.com>
* - Bernet Andre <bernet.andre@gmail.com> * - Bernet Andre <bernet.andre@gmail.com>
@@ -71,6 +71,9 @@
#define LEN_UART3MODES "\017" #define LEN_UART3MODES "\017"
#define TR_UART3MODES "OFF\0 ""SPORT Mirror\0 ""Virtual SP2UART" #define TR_UART3MODES "OFF\0 ""SPORT Mirror\0 ""Virtual SP2UART"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "Pot\0 ""Multipos Switch"
#define LEN_DATETIME "\005" #define LEN_DATETIME "\005"
#define TR_DATETIME "DATA:""HORA:" #define TR_DATETIME "DATA:""HORA:"
@@ -331,7 +334,8 @@
#endif #endif
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#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_CUSTOMSW "Uno" #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
#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_CUSTOMSW TR_6POS_POTS "Uno"
#else #else
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "ACE""DIR""ELE""ALE""GEA""TRN" TR_CUSTOMSW "Uno" #define TR_VSWITCHES TR_9X_3POS_SWITCHES "ACE""DIR""ELE""ALE""GEA""TRN" TR_CUSTOMSW "Uno"
#endif #endif
@@ -679,6 +683,8 @@
#define TR_PERSISTENT_MAH INDENT "Valor mAh" #define TR_PERSISTENT_MAH INDENT "Valor mAh"
#define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset") #define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset")
#define TR_UART3MODE "Serial port" #define TR_UART3MODE "Serial port"
#define TR_POT1TYPE "S1 Type"
#define TR_POT2TYPE "S2 Type"
#if defined(MAVLINK) #if defined(MAVLINK)
#define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI"
+8 -2
View File
@@ -1,4 +1,4 @@
/* /*
* Authors (alphabetical order) * Authors (alphabetical order)
* - Bertrand Songis <bsongis@gmail.com> * - Bertrand Songis <bsongis@gmail.com>
* - Bernet Andre <bernet.andre@gmail.com> * - Bernet Andre <bernet.andre@gmail.com>
@@ -71,6 +71,9 @@
#define LEN_UART3MODES "\017" #define LEN_UART3MODES "\017"
#define TR_UART3MODES "OFF\0 ""SPORT Mirror\0 ""Virtual SP2UART" #define TR_UART3MODES "OFF\0 ""SPORT Mirror\0 ""Virtual SP2UART"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "Pot\0 ""Multipos Switch"
#define LEN_DATETIME "\005" #define LEN_DATETIME "\005"
#define TR_DATETIME "DATE:""HEURE" #define TR_DATETIME "DATE:""HEURE"
@@ -331,7 +334,8 @@
#endif #endif
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#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_CUSTOMSW "1*\0" #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
#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_CUSTOMSW TR_6POS_POTS "1*\0"
#else #else
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "1*\0" #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "1*\0"
#endif #endif
@@ -679,6 +683,8 @@
#define TR_PERSISTENT_MAH TR(INDENT "Enr. mAh",INDENT "Enregistrer mAh") #define TR_PERSISTENT_MAH TR(INDENT "Enr. mAh",INDENT "Enregistrer mAh")
#define TR_FAS_OFFSET TR(INDENT "Corr FAS", INDENT "Correction FAS") #define TR_FAS_OFFSET TR(INDENT "Corr FAS", INDENT "Correction FAS")
#define TR_UART3MODE "Port série" #define TR_UART3MODE "Port série"
#define TR_POT1TYPE "S1 Type"
#define TR_POT2TYPE "S2 Type"
#if defined(MAVLINK) #if defined(MAVLINK)
#define TR_MAVLINK_RC_RSSI_SCALE_LABEL "RSSI Max" #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "RSSI Max"
+9 -3
View File
@@ -71,14 +71,17 @@
#define LEN_UART3MODES "\017" #define LEN_UART3MODES "\017"
#define TR_UART3MODES "OFF\0 ""SPORT Mirror\0 ""Virtual SP2UART" #define TR_UART3MODES "OFF\0 ""SPORT Mirror\0 ""Virtual SP2UART"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "Pot\0 ""Multipos Switch"
#define LEN_DATETIME "\005" #define LEN_DATETIME "\005"
#define TR_DATETIME "DATA:""ORA :" #define TR_DATETIME "DATA:""ORA :"
#define LEN_VLCD "\006" #define LEN_VLCD "\006"
#define TR_VLCD "NormalOptrex" #define TR_VLCD "NormalOptrex"
#define LEN_COUNTRYCODES TR("\002", "\007") #define LEN_COUNTRYCODES TR("\002", "\007")
#define TR_COUNTRYCODES TR("US""JP""EU", "America""Japan\0 ""Europe\0") #define TR_COUNTRYCODES TR("US""JP""EU", "America""Japan\0 ""Europe\0")
#define LEN_VTRIMINC "\006" #define LEN_VTRIMINC "\006"
#define TR_VTRIMINC "Exp ""ExFine""Fine ""Medio ""Ampio " #define TR_VTRIMINC "Exp ""ExFine""Fine ""Medio ""Ampio "
@@ -331,7 +334,8 @@
#endif #endif
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#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_CUSTOMSW "One" #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
#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_CUSTOMSW TR_6POS_POTS "1*\0"
#else #else
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "One" #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "One"
#endif #endif
@@ -679,6 +683,8 @@
#define TR_PERSISTENT_MAH INDENT "Store mAh" #define TR_PERSISTENT_MAH INDENT "Store mAh"
#define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset") #define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset")
#define TR_UART3MODE "Serial port" #define TR_UART3MODE "Serial port"
#define TR_POT1TYPE "S1 Type"
#define TR_POT2TYPE "S2 Type"
#if defined(MAVLINK) #if defined(MAVLINK)
#define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI"
+2 -1
View File
@@ -331,7 +331,8 @@
#endif #endif
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#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_CUSTOMSW " * " #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
#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_CUSTOMSW TR_6POS_POTS " * "
#else #else
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "GAZ""SK ""LOT""SW ""GEA""TRN" TR_CUSTOMSW " * " #define TR_VSWITCHES TR_9X_3POS_SWITCHES "GAZ""SK ""LOT""SW ""GEA""TRN" TR_CUSTOMSW " * "
#endif #endif
+7 -1
View File
@@ -71,6 +71,9 @@
#define LEN_UART3MODES "\017" #define LEN_UART3MODES "\017"
#define TR_UART3MODES "OFF\0 ""SPORT Mirror\0 ""Virtual SP2UART" #define TR_UART3MODES "OFF\0 ""SPORT Mirror\0 ""Virtual SP2UART"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "Pot\0 ""Multipos Switch"
#define LEN_DATETIME "\005" #define LEN_DATETIME "\005"
#define TR_DATETIME "DATA:""HORA:" #define TR_DATETIME "DATA:""HORA:"
@@ -331,7 +334,8 @@
#endif #endif
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#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_CUSTOMSW "1*\0" #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
#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_CUSTOMSW TR_6POS_POTS "1*\0"
#else #else
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "1*\0" #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "1*\0"
#endif #endif
@@ -679,6 +683,8 @@
#define TR_PERSISTENT_MAH INDENT "Store mAh" #define TR_PERSISTENT_MAH INDENT "Store mAh"
#define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset") #define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset")
#define TR_UART3MODE "Serial port" #define TR_UART3MODE "Serial port"
#define TR_POT1TYPE "S1 Type"
#define TR_POT2TYPE "S2 Type"
#if defined(MAVLINK) #if defined(MAVLINK)
#define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI"
+7 -1
View File
@@ -71,6 +71,9 @@
#define LEN_UART3MODES "\017" #define LEN_UART3MODES "\017"
#define TR_UART3MODES "Av\0 ""SPORT-spegel\0 ""VirtuellSP2UART" #define TR_UART3MODES "Av\0 ""SPORT-spegel\0 ""VirtuellSP2UART"
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "Pot\0 ""Multipos Switch"
#define LEN_DATETIME "\005" #define LEN_DATETIME "\005"
#define TR_DATETIME "DAG: ""TID: " #define TR_DATETIME "DAG: ""TID: "
@@ -331,7 +334,8 @@
#endif #endif
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#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_CUSTOMSW "One" #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26"
#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_CUSTOMSW TR_6POS_POTS "One"
#else #else
#define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "One" #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "One"
#endif #endif
@@ -679,6 +683,8 @@
#define TR_PERSISTENT_MAH INDENT "Store mAh" #define TR_PERSISTENT_MAH INDENT "Store mAh"
#define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset") #define TR_FAS_OFFSET TR(INDENT "FAS Ofs", INDENT "FAS Offset")
#define TR_UART3MODE "Serieport" #define TR_UART3MODE "Serieport"
#define TR_POT1TYPE "S1 Type"
#define TR_POT2TYPE "S2 Type"
#if defined(MAVLINK) #if defined(MAVLINK)
#define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI"