1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +03:00

fixed mag calibration stuff as reported by multiwii dudes

added (untested) support for additional PWM output channels incase of PPM input - 4 more, so total of 10 outputs in this mode.
added (mostly untested) support for throttle calibration - short out PPM input connector with a bind plug and power up.

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@122 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
timecop 2012-03-23 03:59:15 +00:00
parent c526d2f3b9
commit 8318331f27
8 changed files with 2892 additions and 2466 deletions

View file

@ -3,6 +3,26 @@
extern uint8_t useServo;
void throttleCalibration(void)
{
uint8_t offset = useServo ? 2 : 0;
uint8_t len = pwmGetNumOutputChannels() - offset;
uint8_t i;
LED1_ON;
for (i = offset; i < len; i++)
pwmWrite(i, cfg.maxthrottle);
delay(3000); // 3s delay on high
for (i = offset; i < len; i++)
pwmWrite(i, cfg.minthrottle);
// blink leds to show we're calibrated and time to remove bind plug
failureMode(4);
}
int main(void)
{
uint8_t i;
@ -25,7 +45,9 @@ int main(void)
sensorsSet(SENSOR_ACC | SENSOR_BARO | SENSOR_MAG);
mixerInit(); // this will set useServo var depending on mixer type
pwmInit(feature(FEATURE_PPM), useServo, feature(FEATURE_DIGITAL_SERVO));
// pwmInit returns true if throttle calibration is requested. if so, do it here. throttleCalibration() does NOT return - for safety.
if (pwmInit(feature(FEATURE_PPM), useServo, feature(FEATURE_DIGITAL_SERVO)))
throttleCalibration(); // noreturn
LED1_ON;
LED0_OFF;