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:
parent
3215346a1b
commit
cac6314ce1
5 changed files with 13 additions and 13 deletions
|
@ -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 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 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)
|
if (index < 4)
|
||||||
return CHECK_IN_ARRAY(sticks, index);
|
return CHECK_IN_ARRAY(sticks, index);
|
||||||
else
|
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)
|
QString RotaryEncoderString(int index)
|
||||||
|
@ -316,7 +316,8 @@ QString RawSwitch::toString()
|
||||||
|
|
||||||
static const QString multiposPots[] = {
|
static const QString multiposPots[] = {
|
||||||
QObject::tr("S11"), QObject::tr("S12"), QObject::tr("S13"), QObject::tr("S14"), QObject::tr("S15"), QObject::tr("S16"),
|
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[] = {
|
static const QString trimsSwitches[] = {
|
||||||
|
|
|
@ -159,8 +159,7 @@ enum HeliSwashTypes {
|
||||||
|
|
||||||
#define NUM_STICKS 4
|
#define NUM_STICKS 4
|
||||||
#define BOARD_9X_NUM_POTS 3
|
#define BOARD_9X_NUM_POTS 3
|
||||||
#define BOARD_X9D_NUM_POTS 4
|
#define C9X_NUM_POTS 5
|
||||||
#define C9X_NUM_POTS 4
|
|
||||||
#define NUM_CAL_PPM 4
|
#define NUM_CAL_PPM 4
|
||||||
#define NUM_CYC 3
|
#define NUM_CYC 3
|
||||||
#define C9X_NUM_SWITCHES 10
|
#define C9X_NUM_SWITCHES 10
|
||||||
|
|
|
@ -148,7 +148,7 @@ inline int geteepromsize() {
|
||||||
#include "radio/src/lua/src/lcorolib.c"
|
#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)
|
uint16_t anaIn(uint8_t chan)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#define HAS_PERSISTENT_TIMERS(board) (IS_ARM(board) || board == BOARD_GRUVIN9X)
|
#define HAS_PERSISTENT_TIMERS(board) (IS_ARM(board) || board == BOARD_GRUVIN9X)
|
||||||
#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) ? 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(board) (IS_TARANIS(board) ? 8 : 7)
|
||||||
#define MAX_SWITCHES_POSITION(board) (IS_TARANIS(board) ? 22 : 9)
|
#define MAX_SWITCHES_POSITION(board) (IS_TARANIS(board) ? 22 : 9)
|
||||||
#define MAX_ROTARY_ENCODERS(board) (board==BOARD_GRUVIN9X ? 2 : (board==BOARD_SKY9X ? 1 : 0))
|
#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++);
|
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val++);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version >= 216) {
|
if (IS_TARANIS(board) && version >= 216) {
|
||||||
for (int i=1; i<=GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i++) {
|
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+offset);
|
||||||
addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i), val++);
|
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++);
|
addConversion(RawSource(SOURCE_TYPE_STICK, i), val++);
|
||||||
|
|
||||||
for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++)
|
for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++)
|
||||||
|
@ -2380,7 +2380,7 @@ Open9xGeneralDataNew::Open9xGeneralDataNew(GeneralSettings & generalData, BoardE
|
||||||
generalData(generalData),
|
generalData(generalData),
|
||||||
board(board),
|
board(board),
|
||||||
version(version),
|
version(version),
|
||||||
inputsCount(IS_TARANIS(board) ? 8 : 7)
|
inputsCount(4 + MAX_POTS(board, version))
|
||||||
{
|
{
|
||||||
generalData.version = version;
|
generalData.version = version;
|
||||||
generalData.variant = variant;
|
generalData.variant = variant;
|
||||||
|
|
|
@ -511,7 +511,7 @@ int OpenTxInterface::getCapability(const Capability capability)
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
case Pots:
|
case Pots:
|
||||||
return (IS_TARANIS(board) ? 4 : 3);
|
return (IS_TARANIS(board) ? 5 : 3);
|
||||||
case Switches:
|
case Switches:
|
||||||
return (IS_TARANIS(board) ? 8 : 7);
|
return (IS_TARANIS(board) ? 8 : 7);
|
||||||
case SwitchesPositions:
|
case SwitchesPositions:
|
||||||
|
@ -683,7 +683,7 @@ int OpenTxInterface::getCapability(const Capability capability)
|
||||||
case HasMahPersistent:
|
case HasMahPersistent:
|
||||||
return (IS_ARM(board) ? true : false);
|
return (IS_ARM(board) ? true : false);
|
||||||
case MultiposPots:
|
case MultiposPots:
|
||||||
return IS_TARANIS(board) ? 2 : 0;
|
return IS_TARANIS(board) ? 3 : 0;
|
||||||
case MultiposPotsPositions:
|
case MultiposPotsPositions:
|
||||||
return IS_TARANIS(board) ? 6 : 0;
|
return IS_TARANIS(board) ? 6 : 0;
|
||||||
case SimulatorVariant:
|
case SimulatorVariant:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue