mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 06:15:10 +03:00
Issue #813 - S3 skipped when not available
This commit is contained in:
parent
05e2c8bdf3
commit
e3fb62b33e
5 changed files with 28 additions and 2 deletions
|
@ -725,7 +725,7 @@ void ConvertModel_215_to_216(ModelData &model)
|
|||
g_model.thrTraceSrc = oldModel.thrTraceSrc;
|
||||
#if defined(PCBTARANIS)
|
||||
// S3 added
|
||||
if (g_model.thrTraceSrc >= 3)
|
||||
if (g_model.thrTraceSrc >= THROTTLE_SOURCE_S3)
|
||||
g_model.thrTraceSrc += 1;
|
||||
#endif
|
||||
g_model.switchWarningStates = oldModel.switchWarningStates >> 1;
|
||||
|
|
|
@ -1134,7 +1134,7 @@ void menuModelSetup(uint8_t event)
|
|||
case ITEM_MODEL_THROTTLE_TRACE:
|
||||
{
|
||||
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;
|
||||
if (idx > MIXSRC_Thr)
|
||||
idx += 1;
|
||||
|
|
|
@ -1473,6 +1473,15 @@ bool isSwitchAvailable(int swtch)
|
|||
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)
|
||||
{
|
||||
return function != LS_FUNC_RANGE;
|
||||
|
|
|
@ -202,6 +202,7 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
|||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool isThrottleSourceAvailable(int source);
|
||||
bool isLogicalSwitchFunctionAvailable(int function);
|
||||
bool isAssignableFunctionAvailable(int function);
|
||||
bool isSwitchAvailable(int swtch);
|
||||
|
|
|
@ -1605,6 +1605,22 @@ PACK(typedef struct {
|
|||
#define AVR_FIELD(x) x;
|
||||
#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 {
|
||||
ModelHeader header;
|
||||
TimerData timers[MAX_TIMERS];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue