mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
allow using GPS in PWM input mode. This (obviously) reduces number of available channels by 2.
I heard thats not a problem since tarduino only allows 4RC+2AUX channels anyway! If you want more, upgrade to PPM. So you use RC3/4 for GPS, and connect the rest of the channels as usual. Channels used for GPS uart are skipped, so no changes to 'map' are necessary. Simply connect in order. git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@212 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
4ed57b2696
commit
b94c13b1c5
4 changed files with 2703 additions and 2694 deletions
34
src/main.c
34
src/main.c
|
@ -57,12 +57,30 @@ int main(void)
|
|||
sensorsSet(SENSOR_ACC);
|
||||
#endif
|
||||
|
||||
if (feature(FEATURE_SPEKTRUM)) {
|
||||
spektrumInit();
|
||||
rcReadRawFunc = spektrumReadRawRC;
|
||||
} else {
|
||||
// spektrum and GPS are mutually exclusive
|
||||
// Optional GPS - available in both PPM and PWM input mode, in PWM input, reduces number of available channels by 2.
|
||||
if (feature(FEATURE_GPS))
|
||||
gpsInit(cfg.gps_baudrate);
|
||||
}
|
||||
#ifdef SONAR
|
||||
// sonar stuff only works with PPM
|
||||
if (feature(FEATURE_PPM)) {
|
||||
if (feature(FEATURE_SONAR))
|
||||
Sonar_init();
|
||||
}
|
||||
#endif
|
||||
|
||||
mixerInit(); // this will set useServo var depending on mixer type
|
||||
// when using airplane/wing mixer, servo/motor outputs are remapped
|
||||
if (cfg.mixerConfiguration == MULTITYPE_AIRPLANE || cfg.mixerConfiguration == MULTITYPE_FLYING_WING)
|
||||
pwm_params.airplane = true;
|
||||
else
|
||||
pwm_params.airplane = false;
|
||||
pwm_params.useUART = feature(FEATURE_GPS);
|
||||
pwm_params.usePPM = feature(FEATURE_PPM);
|
||||
pwm_params.enableInput = !feature(FEATURE_SPEKTRUM); // disable inputs if using spektrum
|
||||
pwm_params.useServos = useServo;
|
||||
|
@ -96,22 +114,6 @@ int main(void)
|
|||
if (feature(FEATURE_VBAT))
|
||||
batteryInit();
|
||||
|
||||
if (feature(FEATURE_SPEKTRUM)) {
|
||||
spektrumInit();
|
||||
rcReadRawFunc = spektrumReadRawRC;
|
||||
} else {
|
||||
// spektrum and GPS are mutually exclusive
|
||||
// Optional GPS - available only when using PPM, otherwise required pins won't be usable
|
||||
if (feature(FEATURE_PPM)) {
|
||||
if (feature(FEATURE_GPS))
|
||||
gpsInit(cfg.gps_baudrate);
|
||||
#ifdef SONAR
|
||||
if (feature(FEATURE_SONAR))
|
||||
Sonar_init();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
previousTime = micros();
|
||||
if (cfg.mixerConfiguration == MULTITYPE_GIMBAL)
|
||||
calibratingA = 400;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue