1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 22:35:12 +03:00

Issue #813 - S3 skipped when not available

This commit is contained in:
bsongis 2014-03-20 12:56:14 +01:00
parent 05e2c8bdf3
commit e3fb62b33e
5 changed files with 28 additions and 2 deletions

View file

@ -725,7 +725,7 @@ void ConvertModel_215_to_216(ModelData &model)
g_model.thrTraceSrc = oldModel.thrTraceSrc; g_model.thrTraceSrc = oldModel.thrTraceSrc;
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
// S3 added // S3 added
if (g_model.thrTraceSrc >= 3) if (g_model.thrTraceSrc >= THROTTLE_SOURCE_S3)
g_model.thrTraceSrc += 1; g_model.thrTraceSrc += 1;
#endif #endif
g_model.switchWarningStates = oldModel.switchWarningStates >> 1; g_model.switchWarningStates = oldModel.switchWarningStates >> 1;

View file

@ -1134,7 +1134,7 @@ void menuModelSetup(uint8_t event)
case ITEM_MODEL_THROTTLE_TRACE: case ITEM_MODEL_THROTTLE_TRACE:
{ {
lcd_putsLeft(y, STR_TTRACE); lcd_putsLeft(y, STR_TTRACE);
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.thrTraceSrc, NUM_POTS+NUM_CHNOUT); if (attr) CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, g_model.thrTraceSrc, NUM_POTS+NUM_CHNOUT, isThrottleSourceAvailable);
uint8_t idx = g_model.thrTraceSrc + MIXSRC_Thr; uint8_t idx = g_model.thrTraceSrc + MIXSRC_Thr;
if (idx > MIXSRC_Thr) if (idx > MIXSRC_Thr)
idx += 1; idx += 1;

View file

@ -1473,6 +1473,15 @@ bool isSwitchAvailable(int swtch)
return true; return true;
} }
bool isThrottleSourceAvailable(int source)
{
#if defined(PCBTARANIS)
if (source == THROTTLE_SOURCE_S3 && !IS_POT_AVAILABLE(POT3))
return false;
#endif
return true;
}
bool isLogicalSwitchFunctionAvailable(int function) bool isLogicalSwitchFunctionAvailable(int function)
{ {
return function != LS_FUNC_RANGE; return function != LS_FUNC_RANGE;

View file

@ -202,6 +202,7 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
#endif #endif
#if defined(CPUARM) #if defined(CPUARM)
bool isThrottleSourceAvailable(int source);
bool isLogicalSwitchFunctionAvailable(int function); bool isLogicalSwitchFunctionAvailable(int function);
bool isAssignableFunctionAvailable(int function); bool isAssignableFunctionAvailable(int function);
bool isSwitchAvailable(int swtch); bool isSwitchAvailable(int swtch);

View file

@ -1605,6 +1605,22 @@ PACK(typedef struct {
#define AVR_FIELD(x) x; #define AVR_FIELD(x) x;
#endif #endif
enum ThrottleSources {
THROTTLE_SOURCE_THR,
#if defined(PCBTARANIS)
THROTTLE_SOURCE_S1,
THROTTLE_SOURCE_S2,
THROTTLE_SOURCE_S3,
THROTTLE_SOURCE_LS,
THROTTLE_SOURCE_RS,
#else
THROTTLE_SOURCE_P1,
THROTTLE_SOURCE_P2,
THROTTLE_SOURCE_P3,
#endif
THROTTLE_SOURCE_CH1,
};
PACK(typedef struct t_ModelData { PACK(typedef struct t_ModelData {
ModelHeader header; ModelHeader header;
TimerData timers[MAX_TIMERS]; TimerData timers[MAX_TIMERS];