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

Rateprofiles added to profiles

This commit is contained in:
KiteAnton 2016-02-20 12:50:13 +01:00
parent 0d2bf3184c
commit 076ac6d0e7
6 changed files with 86 additions and 26 deletions

View file

@ -651,7 +651,6 @@ void applyStepAdjustment(controlRateConfig_t *controlRateConfig, uint8_t adjustm
};
}
/* Is this needed ?
void applySelectAdjustment(uint8_t adjustmentFunction, uint8_t position)
{
bool applied = false;
@ -659,7 +658,7 @@ void applySelectAdjustment(uint8_t adjustmentFunction, uint8_t position)
switch(adjustmentFunction) {
case ADJUSTMENT_RATE_PROFILE:
if (getCurrentControlRateProfile() != position) {
changeProfile(position); // Is this safe to change profile "in flight" ?
changeControlRateProfile(position);
blackboxLogInflightAdjustmentEvent(ADJUSTMENT_RATE_PROFILE, position);
applied = true;
}
@ -670,7 +669,7 @@ void applySelectAdjustment(uint8_t adjustmentFunction, uint8_t position)
beeperConfirmationBeeps(position + 1);
}
}
*/
#define RESET_FREQUENCY_2HZ (1000 / 2)
void processRcAdjustments(controlRateConfig_t *controlRateConfig, rxConfig_t *rxConfig)
@ -724,10 +723,10 @@ void processRcAdjustments(controlRateConfig_t *controlRateConfig, rxConfig_t *rx
applyStepAdjustment(controlRateConfig, adjustmentFunction, delta);
} else if (adjustmentState->config->mode == ADJUSTMENT_MODE_SELECT) {
//uint16_t rangeWidth = ((2100 - 900) / adjustmentState->config->data.selectConfig.switchPositions); TODO - cleanup
//uint8_t position = (constrain(rcData[channelIndex], 900, 2100 - 1) - 900) / rangeWidth; TODO - cleanup
uint16_t rangeWidth = ((2100 - 900) / adjustmentState->config->data.selectConfig.switchPositions);
uint8_t position = (constrain(rcData[channelIndex], 900, 2100 - 1) - 900) / rangeWidth;
// applySelectAdjustment(adjustmentFunction, position);
applySelectAdjustment(adjustmentFunction, position);
}
MARK_ADJUSTMENT_FUNCTION_AS_BUSY(adjustmentIndex);
}