mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 12:25:20 +03:00
coding style // refactor
This commit is contained in:
parent
69e2c991e3
commit
bd04f4d22b
2 changed files with 10 additions and 13 deletions
|
@ -930,15 +930,15 @@ void stopInTestMode(void)
|
|||
*/
|
||||
bool inMotorTestMode(void) {
|
||||
static uint32_t resetTime = 0;
|
||||
uint16_t activeMinimumCommand = (feature(FEATURE_3D) ? masterConfig.flight3DConfig.neutral3d : masterConfig.escAndServoConfig.mincommand);
|
||||
uint16_t inactiveMotorCommand = (feature(FEATURE_3D) ? masterConfig.flight3DConfig.neutral3d : masterConfig.escAndServoConfig.mincommand);
|
||||
int i;
|
||||
bool motorsNotAtMin = false;
|
||||
bool atLeastOneMotorActivated = false;
|
||||
|
||||
// set disarmed motor values
|
||||
for (i = 0; i < MAX_SUPPORTED_MOTORS; i++)
|
||||
motorsNotAtMin |= (motor_disarmed[i] != activeMinimumCommand);
|
||||
for (i = 0; i < MAX_SUPPORTED_MOTORS; i++)
|
||||
atLeastOneMotorActivated |= (motor_disarmed[i] != inactiveMotorCommand);
|
||||
|
||||
if(motorsNotAtMin) {
|
||||
if(atLeastOneMotorActivated) {
|
||||
resetTime = millis() + 5000; // add 5 seconds
|
||||
return true;
|
||||
} else {
|
||||
|
@ -1625,14 +1625,12 @@ void handleBlackbox(void)
|
|||
if(masterConfig.blackbox_on_motor_test) {
|
||||
// Handle Motor Test Mode
|
||||
if(inMotorTestMode()) {
|
||||
if(blackboxState==BLACKBOX_STATE_STOPPED) {
|
||||
if(blackboxState==BLACKBOX_STATE_STOPPED)
|
||||
startInTestMode();
|
||||
}
|
||||
} else {
|
||||
if(blackboxState!=BLACKBOX_STATE_STOPPED) {
|
||||
stopInTestMode();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(blackboxState!=BLACKBOX_STATE_STOPPED)
|
||||
stopInTestMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -886,7 +886,6 @@ const clivalue_t valueTable[] = {
|
|||
{ "blackbox_rate_denom", VAR_UINT8 | MASTER_VALUE, &masterConfig.blackbox_rate_denom, .config.minmax = { 1, 32 } },
|
||||
{ "blackbox_device", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.blackbox_device, .config.lookup = { TABLE_BLACKBOX_DEVICE } },
|
||||
{ "blackbox_on_motor_test", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.blackbox_on_motor_test, .config.lookup = { TABLE_OFF_ON } },
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef VTX
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue