diff --git a/sw/airborne/arch/sim/subsystems/radio_control/spektrum_arch.h b/sw/airborne/arch/sim/subsystems/radio_control/spektrum_arch.h index 95f7b901e8..94239f7db9 100644 --- a/sw/airborne/arch/sim/subsystems/radio_control/spektrum_arch.h +++ b/sw/airborne/arch/sim/subsystems/radio_control/spektrum_arch.h @@ -34,6 +34,10 @@ #define RADIO_CONTROL_NB_CHANNEL 12 #endif +#if RADIO_CONTROL_NB_CHANNEL > 12 +#error "RADIO_CONTROL_NB_CHANNEL mustn't be higher than 12." +#endif + /* channel assignments */ #define RADIO_THROTTLE 0 #define RADIO_ROLL 1 diff --git a/sw/airborne/arch/stm32/subsystems/radio_control/spektrum_arch.h b/sw/airborne/arch/stm32/subsystems/radio_control/spektrum_arch.h index bf6a370580..1228086922 100644 --- a/sw/airborne/arch/stm32/subsystems/radio_control/spektrum_arch.h +++ b/sw/airborne/arch/stm32/subsystems/radio_control/spektrum_arch.h @@ -34,6 +34,10 @@ #define RADIO_CONTROL_NB_CHANNEL 12 #endif +#if RADIO_CONTROL_NB_CHANNEL > 12 +#error "RADIO_CONTROL_NB_CHANNEL mustn't be higher than 12." +#endif + /* default channel assignments */ #ifndef RADIO_THROTTLE #define RADIO_THROTTLE 0 diff --git a/sw/airborne/subsystems/radio_control/ppm.h b/sw/airborne/subsystems/radio_control/ppm.h index a912066544..022abb9d7c 100644 --- a/sw/airborne/subsystems/radio_control/ppm.h +++ b/sw/airborne/subsystems/radio_control/ppm.h @@ -47,6 +47,10 @@ extern void ppm_arch_init(void); #define RADIO_CONTROL_NB_CHANNEL RADIO_CTL_NB #endif +#if RADIO_CONTROL_NB_CHANNEL > RADIO_CTL_NB +#error "RADIO_CONTROL_NB_CHANNEL mustn't be higher than number of channels in radio file." +#endif + /** * ppm pulse type : futaba is falling edge clocked whereas JR is rising edge */ diff --git a/sw/airborne/subsystems/radio_control/sbus_common.h b/sw/airborne/subsystems/radio_control/sbus_common.h index ac1769164a..48b4476662 100644 --- a/sw/airborne/subsystems/radio_control/sbus_common.h +++ b/sw/airborne/subsystems/radio_control/sbus_common.h @@ -68,6 +68,10 @@ #define RADIO_CONTROL_NB_CHANNEL SBUS_NB_CHANNEL #endif +#if RADIO_CONTROL_NB_CHANNEL > SBUS_NB_CHANNEL +#error "RADIO_CONTROL_NB_CHANNEL mustn't be higher than 16." +#endif + /** * SBUS structure */ diff --git a/sw/airborne/subsystems/radio_control/superbitrf_rc.h b/sw/airborne/subsystems/radio_control/superbitrf_rc.h index d20458a0f7..ae91df2f52 100644 --- a/sw/airborne/subsystems/radio_control/superbitrf_rc.h +++ b/sw/airborne/subsystems/radio_control/superbitrf_rc.h @@ -33,6 +33,10 @@ #define RADIO_CONTROL_NB_CHANNEL 14 #endif +#if RADIO_CONTROL_NB_CHANNEL > 14 +#error "RADIO_CONTROL_NB_CHANNEL mustn't be higher than 14." +#endif + /* The channel ordering is always the same for DSM2 and DSMX */ #define RADIO_THROTTLE 0 #define RADIO_ROLL 1