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

Issue #767 - Companion part

This commit is contained in:
bsongis 2014-03-01 22:18:43 +01:00
parent 3215346a1b
commit cac6314ce1
5 changed files with 13 additions and 13 deletions

View file

@ -195,12 +195,12 @@ QString AnalogString(int index)
{
static const QString sticks[] = { QObject::tr("Rud"), QObject::tr("Ele"), QObject::tr("Thr"), QObject::tr("Ail") };
static const QString pots9X[] = { QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3") };
static const QString potsX9D[] = { QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS") };
static const QString potsTaranis[] = { QObject::tr("S1"), QObject::tr("S2"), QObject::tr("S3"), QObject::tr("LS"), QObject::tr("RS") };
if (index < 4)
return CHECK_IN_ARRAY(sticks, index);
else
return (IS_TARANIS(GetEepromInterface()->getBoard()) ? CHECK_IN_ARRAY(potsX9D, index-4) : CHECK_IN_ARRAY(pots9X, index-4));
return (IS_TARANIS(GetEepromInterface()->getBoard()) ? CHECK_IN_ARRAY(potsTaranis, index-4) : CHECK_IN_ARRAY(pots9X, index-4));
}
QString RotaryEncoderString(int index)
@ -316,7 +316,8 @@ QString RawSwitch::toString()
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")
QObject::tr("S21"), QObject::tr("S22"), QObject::tr("S23"), QObject::tr("S24"), QObject::tr("S25"), QObject::tr("S26"),
QObject::tr("S31"), QObject::tr("S32"), QObject::tr("S33"), QObject::tr("S34"), QObject::tr("S35"), QObject::tr("S36")
};
static const QString trimsSwitches[] = {

View file

@ -159,8 +159,7 @@ enum HeliSwashTypes {
#define NUM_STICKS 4
#define BOARD_9X_NUM_POTS 3
#define BOARD_X9D_NUM_POTS 4
#define C9X_NUM_POTS 4
#define C9X_NUM_POTS 5
#define NUM_CAL_PPM 4
#define NUM_CYC 3
#define C9X_NUM_SWITCHES 10

View file

@ -148,7 +148,7 @@ inline int geteepromsize() {
#include "radio/src/lua/src/lcorolib.c"
int16_t g_anas[NUM_STICKS+BOARD_X9D_NUM_POTS];
int16_t g_anas[NUM_STICKS+5];
uint16_t anaIn(uint8_t chan)
{

View file

@ -11,7 +11,7 @@
#define HAS_PERSISTENT_TIMERS(board) (IS_ARM(board) || board == BOARD_GRUVIN9X)
#define HAS_LARGE_LCD(board) IS_TARANIS(board)
#define MAX_VIEWS(board) (HAS_LARGE_LCD(board) ? 2 : 256)
#define MAX_POTS(board) (IS_TARANIS(board) ? 4 : 3)
#define MAX_POTS(board, version) (IS_TARANIS(board) ? (version>=216 ? 5 : 4) : 3)
#define MAX_SWITCHES(board) (IS_TARANIS(board) ? 8 : 7)
#define MAX_SWITCHES_POSITION(board) (IS_TARANIS(board) ? 22 : 9)
#define MAX_ROTARY_ENCODERS(board) (board==BOARD_GRUVIN9X ? 2 : (board==BOARD_SKY9X ? 1 : 0))
@ -60,8 +60,8 @@ class SwitchesConversionTable: public ConversionTable {
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val++);
}
if (version >= 216) {
for (int i=1; i<=GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i++) {
if (IS_TARANIS(board) && version >= 216) {
for (int i=1; i<=3*6; i++) {
addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i), -val+offset);
addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i), val++);
}
@ -172,7 +172,7 @@ class SourcesConversionTable: public ConversionTable {
}
}
for (int i=0; i<4+MAX_POTS(board); i++)
for (int i=0; i<4+MAX_POTS(board, version); i++)
addConversion(RawSource(SOURCE_TYPE_STICK, i), val++);
for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++)
@ -2380,7 +2380,7 @@ Open9xGeneralDataNew::Open9xGeneralDataNew(GeneralSettings & generalData, BoardE
generalData(generalData),
board(board),
version(version),
inputsCount(IS_TARANIS(board) ? 8 : 7)
inputsCount(4 + MAX_POTS(board, version))
{
generalData.version = version;
generalData.variant = variant;

View file

@ -511,7 +511,7 @@ int OpenTxInterface::getCapability(const Capability capability)
else
return 0;
case Pots:
return (IS_TARANIS(board) ? 4 : 3);
return (IS_TARANIS(board) ? 5 : 3);
case Switches:
return (IS_TARANIS(board) ? 8 : 7);
case SwitchesPositions:
@ -683,7 +683,7 @@ int OpenTxInterface::getCapability(const Capability capability)
case HasMahPersistent:
return (IS_ARM(board) ? true : false);
case MultiposPots:
return IS_TARANIS(board) ? 2 : 0;
return IS_TARANIS(board) ? 3 : 0;
case MultiposPotsPositions:
return IS_TARANIS(board) ? 6 : 0;
case SimulatorVariant: