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
5356
obj/baseflight.hex
5356
obj/baseflight.hex
File diff suppressed because it is too large
Load Diff
|
@ -136,7 +136,7 @@ enum {
|
||||||
TYPE_IP = 0x10,
|
TYPE_IP = 0x10,
|
||||||
TYPE_IW = 0x20,
|
TYPE_IW = 0x20,
|
||||||
TYPE_M = 0x40,
|
TYPE_M = 0x40,
|
||||||
TYPE_S = 0x80,
|
TYPE_S = 0x80
|
||||||
};
|
};
|
||||||
|
|
||||||
static pwmPortData_t pwmPorts[MAX_PORTS];
|
static pwmPortData_t pwmPorts[MAX_PORTS];
|
||||||
|
@ -477,6 +477,10 @@ bool pwmInit(drv_pwm_config_t *init)
|
||||||
if (setup[i] == 0xFF) // terminator
|
if (setup[i] == 0xFF) // terminator
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// skip UART ports for GPS
|
||||||
|
if (init->useUART && (port == PWM3 || port == PWM4))
|
||||||
|
continue;
|
||||||
|
|
||||||
// hacks to allow current functionality
|
// hacks to allow current functionality
|
||||||
if (mask & (TYPE_IP | TYPE_IW) && !init->enableInput)
|
if (mask & (TYPE_IP | TYPE_IW) && !init->enableInput)
|
||||||
mask = 0;
|
mask = 0;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
typedef struct drv_pwm_config_t {
|
typedef struct drv_pwm_config_t {
|
||||||
bool enableInput;
|
bool enableInput;
|
||||||
bool usePPM;
|
bool usePPM;
|
||||||
|
bool useUART;
|
||||||
bool useServos;
|
bool useServos;
|
||||||
bool extraServos; // configure additional 4 channels in PPM mode as servos, not motors
|
bool extraServos; // configure additional 4 channels in PPM mode as servos, not motors
|
||||||
bool airplane; // fixed wing hardware config, lots of servos etc
|
bool airplane; // fixed wing hardware config, lots of servos etc
|
||||||
|
|
34
src/main.c
34
src/main.c
|
@ -57,12 +57,30 @@ int main(void)
|
||||||
sensorsSet(SENSOR_ACC);
|
sensorsSet(SENSOR_ACC);
|
||||||
#endif
|
#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
|
mixerInit(); // this will set useServo var depending on mixer type
|
||||||
// when using airplane/wing mixer, servo/motor outputs are remapped
|
// when using airplane/wing mixer, servo/motor outputs are remapped
|
||||||
if (cfg.mixerConfiguration == MULTITYPE_AIRPLANE || cfg.mixerConfiguration == MULTITYPE_FLYING_WING)
|
if (cfg.mixerConfiguration == MULTITYPE_AIRPLANE || cfg.mixerConfiguration == MULTITYPE_FLYING_WING)
|
||||||
pwm_params.airplane = true;
|
pwm_params.airplane = true;
|
||||||
else
|
else
|
||||||
pwm_params.airplane = false;
|
pwm_params.airplane = false;
|
||||||
|
pwm_params.useUART = feature(FEATURE_GPS);
|
||||||
pwm_params.usePPM = feature(FEATURE_PPM);
|
pwm_params.usePPM = feature(FEATURE_PPM);
|
||||||
pwm_params.enableInput = !feature(FEATURE_SPEKTRUM); // disable inputs if using spektrum
|
pwm_params.enableInput = !feature(FEATURE_SPEKTRUM); // disable inputs if using spektrum
|
||||||
pwm_params.useServos = useServo;
|
pwm_params.useServos = useServo;
|
||||||
|
@ -96,22 +114,6 @@ int main(void)
|
||||||
if (feature(FEATURE_VBAT))
|
if (feature(FEATURE_VBAT))
|
||||||
batteryInit();
|
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();
|
previousTime = micros();
|
||||||
if (cfg.mixerConfiguration == MULTITYPE_GIMBAL)
|
if (cfg.mixerConfiguration == MULTITYPE_GIMBAL)
|
||||||
calibratingA = 400;
|
calibratingA = 400;
|
||||||
|
|
Loading…
Reference in New Issue