Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup some switch-case-s #11810

Merged
merged 1 commit into from Sep 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/main/drivers/dshot_command.c
Expand Up @@ -160,18 +160,14 @@ bool dshotStreamingCommandsAreEnabled(void)
static bool dshotCommandsAreEnabled(dshotCommandType_e commandType)
{
bool ret = false;

switch (commandType) {
case DSHOT_CMD_TYPE_BLOCKING:
ret = !motorIsEnabled();

break;
case DSHOT_CMD_TYPE_INLINE:
ret = dshotStreamingCommandsAreEnabled();

break;
default:

break;
}

Expand Down
3 changes: 0 additions & 3 deletions src/main/drivers/motor.c
Expand Up @@ -111,7 +111,6 @@ bool checkMotorProtocolEnabled(const motorDevConfig_t *motorDevConfig, bool *isP
case PWM_TYPE_MULTISHOT:
case PWM_TYPE_BRUSHED:
enabled = true;

break;

#ifdef USE_DSHOT
Expand All @@ -121,11 +120,9 @@ bool checkMotorProtocolEnabled(const motorDevConfig_t *motorDevConfig, bool *isP
case PWM_TYPE_PROSHOT1000:
enabled = true;
isDshot = true;

break;
#endif
default:

break;
}

Expand Down
8 changes: 1 addition & 7 deletions src/main/drivers/pwm_output_dshot_hal_hal.c
Expand Up @@ -81,18 +81,15 @@ void pwmChannelDMAStart(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pDa
case TIM_CHANNEL_1:
HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, Length);
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1);
break;

break;
case TIM_CHANNEL_2:
HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, Length);
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2);
break;

case TIM_CHANNEL_3:
HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3,Length);
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3);
break;

case TIM_CHANNEL_4:
HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)pData, (uint32_t)&htim->Instance->CCR4, Length);
__HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC4);
Expand All @@ -110,15 +107,12 @@ void pwmChannelDMAStop(TIM_HandleTypeDef *htim, uint32_t Channel)
case TIM_CHANNEL_1:
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1);
break;

case TIM_CHANNEL_2:
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2);
break;

case TIM_CHANNEL_3:
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3);
break;

case TIM_CHANNEL_4:
__HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC4);
break;
Expand Down
3 changes: 1 addition & 2 deletions src/main/drivers/rx/rx_sx1280.c
Expand Up @@ -423,8 +423,7 @@ void sx1280SetMode(const sx1280OperatingModes_e opMode)
buf[2] = 0xFF; // TODO dynamic timeout based on expected onairtime
sx1280WriteCommandBurst(SX1280_RADIO_SET_TX, buf, 3);
break;
case SX1280_MODE_CAD:
break;
case SX1280_MODE_CAD: // not implemented yet
default:
break;
}
Expand Down
5 changes: 0 additions & 5 deletions src/main/fc/rc.c
Expand Up @@ -705,23 +705,18 @@ void initRcProcessing(void)
case RATES_TYPE_BETAFLIGHT:
default:
applyRates = applyBetaflightRates;

break;
case RATES_TYPE_RACEFLIGHT:
applyRates = applyRaceFlightRates;

break;
case RATES_TYPE_KISS:
applyRates = applyKissRates;

break;
case RATES_TYPE_ACTUAL:
applyRates = applyActualRates;

break;
case RATES_TYPE_QUICK:
applyRates = applyQuickRates;

break;
}

Expand Down
2 changes: 0 additions & 2 deletions src/main/flight/mixer_init.c
Expand Up @@ -445,11 +445,9 @@ bool mixerModeIsFixedWing(mixerMode_e mixerMode)
case MIXER_AIRPLANE:
case MIXER_CUSTOM_AIRPLANE:
return true;

break;
default:
return false;

break;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/main/flight/servos.c
Expand Up @@ -249,7 +249,6 @@ static void servoConfigureOutput(void)
case MIXER_CUSTOM_AIRPLANE:
case MIXER_CUSTOM_TRI:
loadCustomServoMixer();

break;
default:
break;
Expand Down