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

Merge pull request #1896 from DieHertz/mine/main-c-pg-migration

switch main.c to use PG preprocessor macros
This commit is contained in:
Martin Budden 2016-12-27 13:20:29 +01:00 committed by GitHub
commit 1aaa3a3d8d

View file

@ -239,7 +239,7 @@ void init(void)
// Spektrum satellite binding if enabled on startup. // Spektrum satellite binding if enabled on startup.
// Must be called before that 100ms sleep so that we don't lose satellite's binding window after startup. // Must be called before that 100ms sleep so that we don't lose satellite's binding window after startup.
// The rest of Spektrum initialization will happen later - via spektrumInit() // The rest of Spektrum initialization will happen later - via spektrumInit()
spektrumBind(&masterConfig.rxConfig); spektrumBind(rxConfig());
break; break;
} }
} }
@ -250,16 +250,16 @@ void init(void)
timerInit(); // timer must be initialized before any channel is allocated timerInit(); // timer must be initialized before any channel is allocated
#if defined(AVOID_UART1_FOR_PWM_PPM) #if defined(AVOID_UART1_FOR_PWM_PPM)
serialInit(&masterConfig.serialConfig, feature(FEATURE_SOFTSERIAL), serialInit(serialConfig(), feature(FEATURE_SOFTSERIAL),
feature(FEATURE_RX_PPM) || feature(FEATURE_RX_PARALLEL_PWM) ? SERIAL_PORT_USART1 : SERIAL_PORT_NONE); feature(FEATURE_RX_PPM) || feature(FEATURE_RX_PARALLEL_PWM) ? SERIAL_PORT_USART1 : SERIAL_PORT_NONE);
#elif defined(AVOID_UART2_FOR_PWM_PPM) #elif defined(AVOID_UART2_FOR_PWM_PPM)
serialInit(&masterConfig.serialConfig, feature(FEATURE_SOFTSERIAL), serialInit(serialConfig(), feature(FEATURE_SOFTSERIAL),
feature(FEATURE_RX_PPM) || feature(FEATURE_RX_PARALLEL_PWM) ? SERIAL_PORT_USART2 : SERIAL_PORT_NONE); feature(FEATURE_RX_PPM) || feature(FEATURE_RX_PARALLEL_PWM) ? SERIAL_PORT_USART2 : SERIAL_PORT_NONE);
#elif defined(AVOID_UART3_FOR_PWM_PPM) #elif defined(AVOID_UART3_FOR_PWM_PPM)
serialInit(&masterConfig.serialConfig, feature(FEATURE_SOFTSERIAL), serialInit(serialConfig(), feature(FEATURE_SOFTSERIAL),
feature(FEATURE_RX_PPM) || feature(FEATURE_RX_PARALLEL_PWM) ? SERIAL_PORT_USART3 : SERIAL_PORT_NONE); feature(FEATURE_RX_PPM) || feature(FEATURE_RX_PARALLEL_PWM) ? SERIAL_PORT_USART3 : SERIAL_PORT_NONE);
#else #else
serialInit(&masterConfig.serialConfig, feature(FEATURE_SOFTSERIAL), SERIAL_PORT_NONE); serialInit(serialConfig(), feature(FEATURE_SOFTSERIAL), SERIAL_PORT_NONE);
#endif #endif
mixerInit(mixerConfig()->mixerMode, masterConfig.customMotorMixer); mixerInit(mixerConfig()->mixerMode, masterConfig.customMotorMixer);
@ -278,13 +278,13 @@ void init(void)
} }
mixerConfigureOutput(); mixerConfigureOutput();
motorInit(&masterConfig.motorConfig, idlePulse, getMotorCount()); motorInit(motorConfig(), idlePulse, getMotorCount());
#ifdef USE_SERVOS #ifdef USE_SERVOS
servoConfigureOutput(); servoConfigureOutput();
if (isMixerUsingServos()) { if (isMixerUsingServos()) {
//pwm_params.useChannelForwarding = feature(FEATURE_CHANNEL_FORWARDING); //pwm_params.useChannelForwarding = feature(FEATURE_CHANNEL_FORWARDING);
servoInit(&masterConfig.servoConfig); servoInit(servoConfig());
} }
#endif #endif
@ -386,7 +386,7 @@ void init(void)
if (feature(FEATURE_OSD)) { if (feature(FEATURE_OSD)) {
#ifdef USE_MAX7456 #ifdef USE_MAX7456
// if there is a max7456 chip for the OSD then use it, otherwise use MSP // if there is a max7456 chip for the OSD then use it, otherwise use MSP
displayPort_t *osdDisplayPort = max7456DisplayPortInit(&masterConfig.vcdProfile); displayPort_t *osdDisplayPort = max7456DisplayPortInit(vcdProfile());
#else #else
displayPort_t *osdDisplayPort = displayPortMspInit(); displayPort_t *osdDisplayPort = displayPortMspInit();
#endif #endif
@ -395,7 +395,7 @@ void init(void)
#endif #endif
#ifdef SONAR #ifdef SONAR
const sonarConfig_t *sonarConfig = &masterConfig.sonarConfig; const sonarConfig_t *sonarConfig = sonarConfig();
#else #else
const void *sonarConfig = NULL; const void *sonarConfig = NULL;
#endif #endif
@ -446,11 +446,11 @@ void init(void)
#ifdef GPS #ifdef GPS
if (feature(FEATURE_GPS)) { if (feature(FEATURE_GPS)) {
gpsInit( gpsInit(
&masterConfig.serialConfig, serialConfig(),
&masterConfig.gpsConfig gpsConfig()
); );
navigationInit( navigationInit(
&masterConfig.gpsProfile, gpsProfile(),
&currentProfile->pidProfile &currentProfile->pidProfile
); );
} }
@ -491,7 +491,7 @@ void init(void)
#ifdef USE_FLASHFS #ifdef USE_FLASHFS
#if defined(USE_FLASH_M25P16) #if defined(USE_FLASH_M25P16)
m25p16_init(&masterConfig.flashConfig); m25p16_init(flashConfig());
#endif #endif
flashfsInit(); flashfsInit();
@ -536,7 +536,7 @@ void init(void)
// Now that everything has powered up the voltage and cell count be determined. // Now that everything has powered up the voltage and cell count be determined.
if (feature(FEATURE_VBAT | FEATURE_CURRENT_METER)) if (feature(FEATURE_VBAT | FEATURE_CURRENT_METER))
batteryInit(&masterConfig.batteryConfig); batteryInit(batteryConfig());
#ifdef USE_DASHBOARD #ifdef USE_DASHBOARD
if (feature(FEATURE_DASHBOARD)) { if (feature(FEATURE_DASHBOARD)) {