Massive clean thanks to Schwabe : unifdef -m -DCPUARM -UCPUM64 -UCPUM2560 -UPCBSTD -UPCBMEGA2560 -UPCBGRUVIN9X -UPCB9X $(find . -name "*.cpp" -or -name "*.h")

This commit is contained in:
3djc
2018-07-05 08:04:55 +02:00
parent c032b30247
commit dd632969f3
106 changed files with 27 additions and 6626 deletions
@@ -145,11 +145,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
{
int8_t sub = menuVerticalPosition - HEADER_LINE;
#if defined(CPUARM)
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
#elif !defined(CPUM64) || defined(AUTOSWITCH)
uint8_t eeFlags = EE_MODEL;
#endif
#if defined(PCBTARANIS)
#if defined(PCBXLITE)
@@ -193,7 +189,6 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
uint8_t active = (attr && (s_editMode>0 || p1valdiff));
switch (j) {
case 0:
#if defined(CPUARM)
if (sub==k && menuHorizontalPosition < 1 && CFN_SWITCH(cfn) == SWSRC_NONE) {
drawSwitch(MODEL_SPECIAL_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | INVERS | ((functionsContext->activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
if (active) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
@@ -202,26 +197,16 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
drawSwitch(MODEL_SPECIAL_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext->activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
}
#else
drawSwitch(MODEL_SPECIAL_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext->activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
#endif //CPUARM
#if defined(CPUARM)
if (func == FUNC_OVERRIDE_CHANNEL && functions != g_model.customFn) {
func = CFN_FUNC(cfn) = func+1;
}
#endif
break;
case 1:
if (CFN_SWITCH(cfn)) {
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_2ND_COLUMN, y, STR_VFSWFUNC, func, attr);
if (active) {
#if defined(CPUARM)
CFN_FUNC(cfn) = checkIncDec(event, CFN_FUNC(cfn), 0, FUNC_MAX-1, eeFlags, isAssignableFunctionAvailable);
#else
CHECK_INCDEC_MODELVAR_ZERO(event, CFN_FUNC(cfn), FUNC_MAX-1);
#endif
if (checkIncDec_Ret) CFN_RESET(cfn);
}
}
@@ -244,32 +229,22 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
#endif
if (func == FUNC_TRAINER) {
maxParam = 4;
#if defined(CPUARM)
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, CFN_CH_INDEX(cfn)==0 ? 0 : MIXSRC_Rud+CFN_CH_INDEX(cfn)-1, attr);
#else
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, MIXSRC_Rud+CFN_CH_INDEX(cfn)-1, attr);
#endif
}
#if defined(GVARS)
else if (func == FUNC_ADJUST_GVAR) {
maxParam = MAX_GVARS-1;
drawStringWithIndex(lcdNextPos, y, STR_GV, CFN_GVAR_INDEX(cfn)+1, attr);
#if defined(CPUARM)
if (active) CFN_GVAR_INDEX(cfn) = checkIncDec(event, CFN_GVAR_INDEX(cfn), 0, maxParam, eeFlags);
#else
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_GVAR_INDEX(cfn), maxParam);
#endif
break;
}
#endif // GVARS
#if defined(CPUARM)
else if (func == FUNC_SET_TIMER) {
maxParam = MAX_TIMERS-1;
lcdDrawTextAtIndex(lcdNextPos, y, STR_VFSWRESET, CFN_TIMER_INDEX(cfn), attr);
if (active) CFN_TIMER_INDEX(cfn) = checkIncDec(event, CFN_TIMER_INDEX(cfn), 0, maxParam, eeFlags);
break;
}
#endif // CPUARM
else if (attr) {
REPEAT_LAST_CURSOR_MOVE();
}
@@ -281,15 +256,9 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
{
INCDEC_DECLARE_VARS(eeFlags);
int16_t val_displayed = CFN_PARAM(cfn);
#if defined(CPUARM)
int16_t val_min = 0;
int16_t val_max = 255;
#else
int8_t val_min = 0;
uint8_t val_max = 255;
#endif
if (func == FUNC_RESET) {
#if defined (CPUARM)
val_max = FUNC_RESET_PARAM_FIRST_TELEM+lastUsedTelemetryIndex();
int param = CFN_PARAM(cfn);
if (param < FUNC_RESET_PARAM_FIRST_TELEM) {
@@ -300,23 +269,13 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
lcdDrawSizedText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, sensor->label, TELEM_LABEL_LEN, attr|ZCHAR);
}
if (active) INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalResetSpecialFunction : isSourceAvailableInResetSpecialFunction);
#else
val_max = FUNC_RESET_PARAM_LAST;
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_VFSWRESET, CFN_PARAM(cfn), attr);
#endif // CPUARM
}
#if defined(OVERRIDE_CHANNEL_FUNCTION)
else if (func == FUNC_OVERRIDE_CHANNEL) {
#if defined(CPUARM)
getMixSrcRange(MIXSRC_FIRST_CH, val_min, val_max);
#else
val_displayed = (int8_t)CFN_PARAM(cfn);
val_min = -LIMIT_EXT_PERCENT; val_max = +LIMIT_EXT_PERCENT;
#endif
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
}
#endif // OVERRIDE_CHANNEL_FUNCTION
#if defined(CPUARM)
else if (func >= FUNC_SET_FAILSAFE && func <= FUNC_BIND) {
val_max = NUM_MODULES-1;
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, "\004Int.Ext.", CFN_PARAM(cfn), attr);
@@ -325,7 +284,6 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
getMixSrcRange(MIXSRC_FIRST_TIMER, val_min, val_max);
drawTimer(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT, attr);
}
#endif
#if defined(AUDIO)
else if (func == FUNC_PLAY_SOUND) {
val_max = AU_SPECIAL_SOUND_LAST-AU_SPECIAL_SOUND_FIRST-1;
@@ -373,7 +331,6 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
}
}
#endif // CPUARM && SDCARD
#if defined(CPUARM)
else if (func == FUNC_VOLUME) {
val_max = MIXSRC_LAST_CH;
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr);
@@ -382,36 +339,6 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
INCDEC_ENABLE_CHECK(isSourceAvailable);
}
}
#elif defined(VOICE)
else if (func == FUNC_PLAY_TRACK) {
#if defined(GVARS)
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
s_editMode = !s_editMode;
active = true;
val_displayed = (val_displayed > 250 ? 0 : 251);
}
if (val_displayed > 250) {
drawStringWithIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_GV, val_displayed-250, attr);
}
else {
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed+PROMPT_CUSTOM_BASE, attr|LEFT);
}
#else
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed+PROMPT_CUSTOM_BASE, attr|LEFT);
#endif // GVARS
}
else if (func == FUNC_PLAY_BOTH) {
lcdDrawChar(MODEL_SPECIAL_FUNC_3RD_COLUMN+3*FWNUM, y, '|', attr);
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN+3*FWNUM, y, val_displayed+PROMPT_CUSTOM_BASE, attr);
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN+2+3*FWNUM, y, (val_displayed+PROMPT_CUSTOM_BASE+1)%10, attr|LEFT);
}
else if (func == FUNC_PLAY_VALUE) {
val_max = MIXSRC_FIRST_TELEM + TELEM_DISPLAY_MAX - 1;
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr);
INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalFunctions : isSourceAvailable);
}
#endif // CPUARM
#if defined(SDCARD)
else if (func == FUNC_LOGS) {
if (val_displayed) {
@@ -428,13 +355,8 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
switch (CFN_GVAR_MODE(cfn)) {
case FUNC_ADJUST_GVAR_CONSTANT:
val_displayed = (int16_t)CFN_PARAM(cfn);
#if defined(CPUARM)
getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min, val_max);
drawGVarValue(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, CFN_GVAR_INDEX(cfn), val_displayed, attr|LEFT);
#else
val_min = -CFN_GVAR_CST_MAX; val_max = +CFN_GVAR_CST_MAX;
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
#endif // CPUARM
break;
case FUNC_ADJUST_GVAR_SOURCE:
val_max = MIXSRC_LAST_CH;
@@ -449,14 +371,9 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
drawStringWithIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_GV, val_displayed+1, attr);
break;
default: // FUNC_ADJUST_GVAR_INC
#if defined(CPUARM)
getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min, val_max);
lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, (val_displayed < 0 ? "-= " : "+= "), attr);
drawGVarValue(lcdNextPos, y, CFN_GVAR_INDEX(cfn), abs(val_displayed), attr|LEFT);
#else
val_max = 1;
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, PSTR("\003-=1+=1"), val_displayed, attr);
#endif // CPUARM
break;
}
@@ -465,9 +382,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
s_editMode = !s_editMode;
active = true;
CFN_GVAR_MODE(cfn) += 1;
#if defined(CPUARM)
CFN_GVAR_MODE(cfn) &= 0x03;
#endif
val_displayed = 0;
}
}
@@ -502,29 +417,19 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
case 4:
if (HAS_ENABLE_PARAM(func)) {
drawCheckBox(MODEL_SPECIAL_FUNC_4TH_COLUMN_ONOFF, y, CFN_ACTIVE(cfn), attr);
#if defined(CPUARM)
if (active) CFN_ACTIVE(cfn) = checkIncDec(event, CFN_ACTIVE(cfn), 0, 1, eeFlags);
#else
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_ACTIVE(cfn), 1);
#endif
}
else if (HAS_REPEAT_PARAM(func)) {
if (CFN_PLAY_REPEAT(cfn) == 0) {
lcdDrawChar(MODEL_SPECIAL_FUNC_4TH_COLUMN_ONOFF+3, y, '-', attr);
}
#if defined(CPUARM)
else if (CFN_PLAY_REPEAT(cfn) == CFN_PLAY_REPEAT_NOSTART) {
lcdDrawText(MODEL_SPECIAL_FUNC_4TH_COLUMN_ONOFF+1, y, "!-", attr);
}
#endif
else {
lcdDrawNumber(MODEL_SPECIAL_FUNC_4TH_COLUMN+2+FW, y, CFN_PLAY_REPEAT(cfn)*CFN_PLAY_REPEAT_MUL, RIGHT | attr);
}
#if defined(CPUARM)
if (active) CFN_PLAY_REPEAT(cfn) = checkIncDec(event, CFN_PLAY_REPEAT(cfn)==CFN_PLAY_REPEAT_NOSTART?-1:CFN_PLAY_REPEAT(cfn), -1, 60/CFN_PLAY_REPEAT_MUL, eeFlags);
#else
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_PLAY_REPEAT(cfn), 60/CFN_PLAY_REPEAT_MUL);
#endif
}
else if (attr) {
REPEAT_LAST_CURSOR_MOVE();