Some reserve in telemetry sources added
This commit is contained in:
@@ -1815,7 +1815,7 @@ enum FlightModesItems {
|
||||
ITEM_PHASES_LAST = ITEM_PHASES_COUNT-1
|
||||
};
|
||||
|
||||
bool isTrimModeAvailable(int16_t mode)
|
||||
bool isTrimModeAvailable(int mode)
|
||||
{
|
||||
return (mode == TRIM_MODE_NONE || (mode%2) == 0 || (mode/2) != (m_posVert-1));
|
||||
}
|
||||
@@ -5738,7 +5738,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
bar.source = checkIncDecModel(event, barSource, 0, TELEM_DISPLAY_MAX);
|
||||
bar.source = CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, barSource, TELEM_DISPLAY_MAX, isTelemetrySourceAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
bar.barMin = 0;
|
||||
bar.barMax = 255 - maxBarTelemValue(bar.source);
|
||||
@@ -5766,7 +5766,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
#endif
|
||||
lcd_putsiAtt(pos[c], y, STR_VTELEMCHNS, value, cellAttr);
|
||||
if (cellAttr && (s_editMode>0 || p1valdiff)) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, value, (lineIndex==3 && c==0) ? TELEM_STATUS_MAX : TELEM_DISPLAY_MAX);
|
||||
CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, value, (lineIndex==3 && c==0) ? TELEM_STATUS_MAX : TELEM_DISPLAY_MAX, isTelemetrySourceAvailable);
|
||||
}
|
||||
}
|
||||
if (attr && m_posHorz == NUM_LINE_ITEMS) {
|
||||
|
||||
+22
-9
@@ -113,7 +113,7 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
|
||||
#endif
|
||||
{
|
||||
int16_t newval = val;
|
||||
|
||||
|
||||
#if defined(DBLKEYS)
|
||||
uint8_t in = KEYS_PRESSED();
|
||||
if (EVT_KEY_MASK(event)) {
|
||||
@@ -1185,7 +1185,7 @@ void drawStatusLine()
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool isSourceAvailable(int16_t source)
|
||||
bool isSourceAvailable(int source)
|
||||
{
|
||||
#if defined(PCBTARANIS)
|
||||
if (source>=MIXSRC_FIRST_INPUT && source<=MIXSRC_LAST_INPUT) {
|
||||
@@ -1228,10 +1228,24 @@ bool isSourceAvailable(int16_t source)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM)
|
||||
return isTelemetrySourceAvailable(source-MIXSRC_FIRST_TELEM+1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isInputSourceAvailable(int16_t source)
|
||||
bool isTelemetrySourceAvailable(int source)
|
||||
{
|
||||
if (source >= TELEM_RESERVE1 && source <= TELEM_RESERVE5)
|
||||
return false;
|
||||
|
||||
if (source >= TELEM_RESERVE6 && source <= TELEM_RESERVE10)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isInputSourceAvailable(int source)
|
||||
{
|
||||
if (source>=MIXSRC_Rud && source<=MIXSRC_MAX)
|
||||
return true;
|
||||
@@ -1243,12 +1257,12 @@ bool isInputSourceAvailable(int16_t source)
|
||||
return true;
|
||||
|
||||
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM)
|
||||
return true;
|
||||
return isTelemetrySourceAvailable(source-MIXSRC_FIRST_TELEM+1);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isSwitchAvailableInLogicalSwitches(int16_t swtch)
|
||||
bool isSwitchAvailableInLogicalSwitches(int swtch)
|
||||
{
|
||||
if (swtch < 0) {
|
||||
if (swtch <= -SWSRC_ON)
|
||||
@@ -1277,7 +1291,7 @@ bool isSwitchAvailableInLogicalSwitches(int16_t swtch)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isSwitchAvailable(int16_t swtch)
|
||||
bool isSwitchAvailable(int swtch)
|
||||
{
|
||||
if (!isSwitchAvailableInLogicalSwitches(swtch)) {
|
||||
return false;
|
||||
@@ -1291,13 +1305,12 @@ bool isSwitchAvailable(int16_t swtch)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Not available yet, will be needed if we implement the Range function later...
|
||||
bool isLogicalSwitchFunctionAvailable(int16_t function)
|
||||
bool isLogicalSwitchFunctionAvailable(int function)
|
||||
{
|
||||
return function != LS_FUNC_RANGE;
|
||||
}
|
||||
|
||||
bool isAssignableFunctionAvailable(int16_t function)
|
||||
bool isAssignableFunctionAvailable(int function)
|
||||
{
|
||||
switch (function) {
|
||||
|
||||
|
||||
+16
-7
@@ -167,7 +167,7 @@ extern int8_t s_editMode; // global editmode
|
||||
#define HIDDEN_ROW ((uint8_t)-2)
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef bool (*IsValueAvailable)(int16_t);
|
||||
typedef bool (*IsValueAvailable)(int);
|
||||
int16_t checkIncDec(uint8_t event, int16_t i_pval, int16_t i_min, int16_t i_max, uint8_t i_flags=0, IsValueAvailable isValueAvailable=NULL);
|
||||
#else
|
||||
int16_t checkIncDec(uint8_t event, int16_t i_pval, int16_t i_min, int16_t i_max, uint8_t i_flags=0);
|
||||
@@ -190,10 +190,18 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
var = checkIncDecModelZero(event,var,max)
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool isLogicalSwitchFunctionAvailable(int16_t function);
|
||||
bool isAssignableFunctionAvailable(int16_t function);
|
||||
bool isSwitchAvailable(int16_t swtch);
|
||||
bool isSwitchAvailableInLogicalSwitches(int16_t swtch);
|
||||
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
|
||||
var = checkIncDec(event, var, 0, max, EE_MODEL, check)
|
||||
#else
|
||||
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, var, max)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool isLogicalSwitchFunctionAvailable(int function);
|
||||
bool isAssignableFunctionAvailable(int function);
|
||||
bool isSwitchAvailable(int swtch);
|
||||
bool isSwitchAvailableInLogicalSwitches(int swtch);
|
||||
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max) \
|
||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SWITCH|NO_INCDEC_MARKS, isSwitchAvailable)
|
||||
@@ -207,8 +215,9 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool isSourceAvailable(int16_t source);
|
||||
bool isInputSourceAvailable(int16_t source);
|
||||
bool isSourceAvailable(int source);
|
||||
bool isTelemetrySourceAvailable(int source);
|
||||
bool isInputSourceAvailable(int source);
|
||||
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
|
||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable)
|
||||
#elif defined(AUTOSOURCE)
|
||||
|
||||
Reference in New Issue
Block a user