1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

coding style // refactor

This commit is contained in:
borisbstyle 2016-08-18 01:19:30 +02:00
parent 69e2c991e3
commit bd04f4d22b
2 changed files with 10 additions and 13 deletions

View file

@ -930,15 +930,15 @@ void stopInTestMode(void)
*/ */
bool inMotorTestMode(void) { bool inMotorTestMode(void) {
static uint32_t resetTime = 0; 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; int i;
bool motorsNotAtMin = false; bool atLeastOneMotorActivated = false;
// set disarmed motor values // set disarmed motor values
for (i = 0; i < MAX_SUPPORTED_MOTORS; i++) for (i = 0; i < MAX_SUPPORTED_MOTORS; i++)
motorsNotAtMin |= (motor_disarmed[i] != activeMinimumCommand); atLeastOneMotorActivated |= (motor_disarmed[i] != inactiveMotorCommand);
if(motorsNotAtMin) { if(atLeastOneMotorActivated) {
resetTime = millis() + 5000; // add 5 seconds resetTime = millis() + 5000; // add 5 seconds
return true; return true;
} else { } else {
@ -1625,17 +1625,15 @@ void handleBlackbox(void)
if(masterConfig.blackbox_on_motor_test) { if(masterConfig.blackbox_on_motor_test) {
// Handle Motor Test Mode // Handle Motor Test Mode
if(inMotorTestMode()) { if(inMotorTestMode()) {
if(blackboxState==BLACKBOX_STATE_STOPPED) { if(blackboxState==BLACKBOX_STATE_STOPPED)
startInTestMode(); startInTestMode();
}
} else { } else {
if(blackboxState!=BLACKBOX_STATE_STOPPED) { if(blackboxState!=BLACKBOX_STATE_STOPPED)
stopInTestMode(); stopInTestMode();
} }
} }
} }
} }
}
static bool canUseBlackboxWithCurrentConfiguration(void) static bool canUseBlackboxWithCurrentConfiguration(void)
{ {

View file

@ -886,7 +886,6 @@ const clivalue_t valueTable[] = {
{ "blackbox_rate_denom", VAR_UINT8 | MASTER_VALUE, &masterConfig.blackbox_rate_denom, .config.minmax = { 1, 32 } }, { "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_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 } }, { "blackbox_on_motor_test", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.blackbox_on_motor_test, .config.lookup = { TABLE_OFF_ON } },
#endif #endif
#ifdef VTX #ifdef VTX