mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-25 23:46:04 +08:00
[airborne] only print config messages at compile time if PRINT_CONFIG is defined
This commit is contained in:
@@ -27,6 +27,9 @@
|
||||
<define name="AHRS_GRAVITY_UPDATE_NORM_HEURISTIC" value="TRUE"/>
|
||||
</subsystem>
|
||||
<subsystem name="ins"/>
|
||||
|
||||
<!-- print the configuration during compiling -->
|
||||
<define name="PRINT_CONFIG"/>
|
||||
</firmware>
|
||||
|
||||
<firmware name="setup">
|
||||
|
||||
@@ -36,16 +36,18 @@
|
||||
#include <libopencm3/stm32/f1/flash.h>
|
||||
#include <libopencm3/cm3/scb.h>
|
||||
|
||||
#include "std.h"
|
||||
|
||||
void mcu_arch_init(void) {
|
||||
#if LUFTBOOT
|
||||
#pragma message "We are running luftboot, the interrupt vector is being relocated."
|
||||
PRINT_CONFIG_MSG("We are running luftboot, the interrupt vector is being relocated.")
|
||||
SCB_VTOR = 0x00002000;
|
||||
#endif
|
||||
#if EXT_CLK == 8000000
|
||||
#pragma message "Using 8MHz external clock to PLL it to 72MHz."
|
||||
PRINT_CONFIG_MSG("Using 8MHz external clock to PLL it to 72MHz.")
|
||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||
#elif EXT_CLK == 12000000
|
||||
#pragma message "Using 12MHz external clock to PLL it to 72MHz."
|
||||
PRINT_CONFIG_MSG("Using 12MHz external clock to PLL it to 72MHz.")
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
#else
|
||||
#error EXT_CLK is either set to an unsupported frequency or not defined at all. Please check!
|
||||
|
||||
@@ -374,13 +374,13 @@ static inline void adc_init_single(uint32_t adc,
|
||||
adc_set_injected_sequence(adc, num_channels, channels);
|
||||
|
||||
#if USE_AD_TIM4
|
||||
#pragma message "Info: Using TIM4 for ADC"
|
||||
PRINT_CONFIG_MSG("Info: Using TIM4 for ADC")
|
||||
adc_enable_external_trigger_injected(adc, ADC_CR2_JEXTSEL_TIM4_TRGO);
|
||||
#elif USE_AD_TIM1
|
||||
#pragma message "Info: Using TIM1 for ADC"
|
||||
PRINT_CONFIG_MSG("Info: Using TIM1 for ADC")
|
||||
adc_enable_external_trigger_injected(adc, ADC_CR2_JEXTSEL_TIM1_TRGO);
|
||||
#else
|
||||
#pragma message "Info: Using default TIM2 for ADC"
|
||||
PRINT_CONFIG_MSG("Info: Using default TIM2 for ADC")
|
||||
adc_enable_external_trigger_injected(adc, ADC_CR2_JEXTSEL_TIM2_TRGO);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -176,10 +176,10 @@ void actuators_pwm_arch_init(void) {
|
||||
|
||||
#if (!REMAP_SERVOS_5AND6 || USE_SERVOS_7AND8)
|
||||
#if !REMAP_SERVOS_5AND6
|
||||
#pragma message "Not remapping servos 5 and 6 using PB8 and PB9 -> TIM4"
|
||||
PRINT_CONFIG_MSG("Not remapping servos 5 and 6 using PB8 and PB9 -> TIM4")
|
||||
#endif
|
||||
#if USE_SERVOS_7AND8
|
||||
#pragma message "Enabeling sevros 7 and 8 on PB6, PB7 -> TIM4"
|
||||
PRINT_CONFIG_MSG("Enabling sevros 7 and 8 on PB6, PB7 -> TIM4")
|
||||
#endif
|
||||
/*---------------
|
||||
* Timer 4 setup
|
||||
@@ -255,7 +255,7 @@ void actuators_pwm_arch_init(void) {
|
||||
#endif
|
||||
|
||||
#if REMAP_SERVOS_5AND6
|
||||
#pragma message "Remapping servo outputs 5 and 6 to PA0,PA1 -> TIM5"
|
||||
PRINT_CONFIG_MSG("Remapping servo outputs 5 and 6 to PA0,PA1 -> TIM5")
|
||||
/*---------------
|
||||
* Timer 5 setup
|
||||
*---------------*/
|
||||
|
||||
@@ -82,10 +82,10 @@ typedef struct SpektrumStateStruct SpektrumStateType;
|
||||
|
||||
SpektrumStateType PrimarySpektrumState = {1,0,0,0,0,0,0,0,0};
|
||||
#ifdef RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT
|
||||
#pragma message "Using secondary spektrum receiver."
|
||||
PRINT_CONFIG_MSG("Using secondary spektrum receiver.")
|
||||
SpektrumStateType SecondarySpektrumState = {1,0,0,0,0,0,0,0,0};
|
||||
#else
|
||||
#pragma message "NOT using secondary spektrum receiver."
|
||||
PRINT_CONFIG_MSG("NOT using secondary spektrum receiver.")
|
||||
#endif
|
||||
|
||||
int16_t SpektrumBuf[SPEKTRUM_CHANNELS_PER_FRAME*MAX_SPEKTRUM_FRAMES];
|
||||
|
||||
@@ -53,7 +53,7 @@ PRINT_CONFIG_VAR(UMARIM_ACCEL_RATE)
|
||||
#if !defined UMARIM_GYRO_LOWPASS && !defined UMARIM_GYRO_SMPLRT_DIV
|
||||
#define UMARIM_GYRO_LOWPASS ITG3200_DLPF_20HZ
|
||||
#define UMARIM_GYRO_SMPLRT_DIV 19
|
||||
INFO("Gyro output rate is 50Hz")
|
||||
PRINT_CONFIG_MSG("Gyro output rate is 50Hz")
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(UMARIM_GYRO_LOWPASS)
|
||||
PRINT_CONFIG_VAR(UMARIM_GYRO_SMPLRT_DIV)
|
||||
|
||||
@@ -125,7 +125,7 @@ extern bool_t power_switch;
|
||||
#ifndef CONTROL_FREQUENCY
|
||||
#ifdef CONTROL_RATE
|
||||
#define CONTROL_FREQUENCY CONTROL_RATE
|
||||
#pragma message "CONTROL_RATE is deprecated. Please use CONTROL_FREQUENCY instead. Defaults to 60Hz if not defined."
|
||||
#warning "CONTROL_RATE is deprecated. Please use CONTROL_FREQUENCY instead. Defaults to 60Hz if not defined."
|
||||
#else
|
||||
#define CONTROL_FREQUENCY 60
|
||||
#endif // CONTROL_RATE
|
||||
|
||||
@@ -263,7 +263,7 @@ static inline uint8_t pprz_mode_update( void ) {
|
||||
#ifndef RADIO_AUTO_MODE
|
||||
return ModeUpdate(pprz_mode, PPRZ_MODE_OF_PULSE(fbw_state->channels[RADIO_MODE]));
|
||||
#else
|
||||
#pragma message "Using RADIO_AUTO_MODE to switch between AUTO1 and AUTO2."
|
||||
INFO("Using RADIO_AUTO_MODE to switch between AUTO1 and AUTO2.")
|
||||
/* If RADIO_AUTO_MODE is enabled mode swithing will be seperated between two switches/channels
|
||||
* RADIO_MODE will switch between PPRZ_MODE_MANUAL and any PPRZ_MODE_AUTO mode selected by RADIO_AUTO_MODE.
|
||||
*
|
||||
@@ -609,7 +609,7 @@ void event_task_ap( void ) {
|
||||
#endif
|
||||
|
||||
#ifdef InsEvent
|
||||
#pragma message "calling InsEvent, remove me.."
|
||||
TODO("calling InsEvent, remove me..")
|
||||
InsEvent(NULL);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
#endif
|
||||
|
||||
#ifndef BAT_CHECKER_DELAY
|
||||
#pragma message "BAT_CHECKER_DELAY is undefined. Falling back to 5 seconds."
|
||||
#define BAT_CHECKER_DELAY 5
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(BAT_CHECKER_DELAY)
|
||||
|
||||
// at this level, the buzzer will be activated periodically
|
||||
#define WARN_BAT_LEVEL1 (LOW_BAT_LEVEL*10)
|
||||
|
||||
@@ -261,7 +261,7 @@ void ahrs_update_accel(void)
|
||||
ahrs_impl.gps_age ++;
|
||||
if (ahrs_impl.gps_age < 50) { //Remove centrifugal acceleration and longitudinal acceleration
|
||||
#if USE_AHRS_GPS_ACCELERATIONS
|
||||
#pragma message "AHRS_FLOAT_DCM uses GPS acceleration."
|
||||
PRINT_CONFIG_MSG("AHRS_FLOAT_DCM uses GPS acceleration.")
|
||||
accel_float.x += ahrs_impl.gps_acceleration; // Longitudinal acceleration
|
||||
#endif
|
||||
accel_float.y += ahrs_impl.gps_speed * Omega[2]; // Centrifugal force on Acc_y = GPS_speed*GyroZ
|
||||
@@ -505,7 +505,7 @@ void Drift_correction(void)
|
||||
Vector_Add(Omega_I,Omega_I,Scaled_Omega_I);//adding integrator to the Omega_I
|
||||
}
|
||||
#if USE_MAGNETOMETER_ONGROUND == 1
|
||||
#pragma message AHRS_FLOAT_DCM uses magnetometer prior to takeoff and GPS during flight
|
||||
PRINT_CONFIG_MSG("AHRS_FLOAT_DCM uses magnetometer prior to takeoff and GPS during flight")
|
||||
else if (launch == FALSE)
|
||||
{
|
||||
float COGX = imu.mag.x; // Non-Tilt-Compensated (for filter stability reasons)
|
||||
|
||||
@@ -39,7 +39,7 @@ void imu_init(void) {
|
||||
VECT3_ASSIGN(imu.mag_neutral, IMU_MAG_X_NEUTRAL, IMU_MAG_Y_NEUTRAL, IMU_MAG_Z_NEUTRAL);
|
||||
#else
|
||||
#if USE_MAGNETOMETER
|
||||
#pragma message "Info: Magnetomter neutrals are set to zero!"
|
||||
INFO("Magnetomter neutrals are set to zero!")
|
||||
#endif
|
||||
INT_VECT3_ZERO(imu.mag_neutral);
|
||||
#endif
|
||||
|
||||
@@ -94,7 +94,7 @@ void imu_impl_init(void)
|
||||
#endif
|
||||
|
||||
#if ASPIRIN_ARCH_INDEP
|
||||
#warning "Arch dependent functions (accel and gyro eoc interrupt) not used for aspirin!"
|
||||
TODO("Arch dependent functions (accel and gyro eoc interrupt) not used for aspirin!")
|
||||
#else
|
||||
imu_aspirin_arch_init();
|
||||
#endif
|
||||
|
||||
@@ -299,7 +299,7 @@ static void mpu_configure(void)
|
||||
|
||||
#if !IMU_ASPIRIN_DISABLE_BARO
|
||||
#ifdef IMU_ASPIRIN_VERSION_2_1
|
||||
#pragma message "Reading the MS5611"
|
||||
PRINT_CONFIG_MSG("Reading the MS5611")
|
||||
/*
|
||||
|
||||
|
||||
|
||||
@@ -68,10 +68,10 @@ PRINT_CONFIG_VAR(ASPIRIN_GYRO_LOWPASS)
|
||||
#ifndef ASPIRIN_GYRO_SMPLRT_DIV
|
||||
# if PERIODIC_FREQUENCY <= 60
|
||||
# define ASPIRIN_GYRO_SMPLRT_DIV 19
|
||||
INFO("Gyro output rate is 50Hz")
|
||||
PRINT_CONFIG_MSG("Gyro output rate is 50Hz")
|
||||
# else
|
||||
# define ASPIRIN_GYRO_SMPLRT_DIV 9
|
||||
INFO("Gyro output rate is 100Hz")
|
||||
PRINT_CONFIG_MSG("Gyro output rate is 100Hz")
|
||||
# endif
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(ASPIRIN_GYRO_SMPLRT_DIV)
|
||||
|
||||
@@ -66,10 +66,10 @@ PRINT_CONFIG_VAR(IMU_PPZUAV_GYRO_LOWPASS)
|
||||
#ifndef IMU_PPZUAV_GYRO_SMPLRT_DIV
|
||||
# if PERIODIC_FREQUENCY <= 60
|
||||
# define IMU_PPZUAV_GYRO_SMPLRT_DIV 19
|
||||
INFO("Gyro output rate is 50Hz")
|
||||
PRINT_CONFIG_MSG("Gyro output rate is 50Hz")
|
||||
# else
|
||||
# define IMU_PPZUAV_GYRO_SMPLRT_DIV 9
|
||||
INFO("Gyro output rate is 100Hz")
|
||||
PRINT_CONFIG_MSG("Gyro output rate is 100Hz")
|
||||
# endif
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(IMU_PPZUAV_GYRO_SMPLRT_DIV)
|
||||
|
||||
@@ -40,7 +40,17 @@
|
||||
#define TODO(x) DO_PRAGMA(message ("TODO - " x))
|
||||
#define INFO(x) DO_PRAGMA(message ("Info: " x))
|
||||
#define INFO_VALUE(x,v) DO_PRAGMA(message ("Info: " x VALUE(v)))
|
||||
|
||||
/* only if PRINT_CONFIG is true */
|
||||
#if PRINT_CONFIG
|
||||
#define PRINT_CONFIG_MSG(x) DO_PRAGMA(message ("Config: " x))
|
||||
#define PRINT_CONFIG_MSG_VALUE(x,v) DO_PRAGMA(message ("Config: " x VALUE(v))
|
||||
#define PRINT_CONFIG_VAR(var) DO_PRAGMA(message ("Config: " #var " = " VALUE(var)))
|
||||
#else
|
||||
#define PRINT_CONFIG_MSG(x)
|
||||
#define PRINT_CONFIG_MSG_VALUE(x,v)
|
||||
#define PRINT_CONFIG_VAR(var)
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FALSE
|
||||
|
||||
Reference in New Issue
Block a user