-
Notifications
You must be signed in to change notification settings - Fork 7
RxConfig
Receiver configuration: select the receiver type and map AUX channels to arm and
flight modes. Every function here is called once from plutoRxConfig().
The minRange / maxRange arguments define the RC-value window (1000 - 2000) in
which that switch position is considered active.
Receiver type, passed to Receiver_Mode().
typedef enum {
Rx_ESP, // ESP-based receiver (onboard Wi-Fi)
Rx_PPM, // PPM receiver
Rx_CAM, // Camera-based receiver
Rx_ELRS // ExpressLRS (CRSF) receiver on USART1
} rx_mode_e;The set of configurable flight modes.
typedef enum {
Mode_ARM, // Arm mode
Mode_ANGLE, // Angle mode
Mode_BARO, // Barometer / altitude mode
Mode_MAG, // Magnetometer / heading mode
Mode_HEADFREE // Head-free mode
} flight_mode;AUX channel, passed to the config functions. Note the channel numbers start at 5.
typedef enum {
Rx_AUX1 = 4, // AUX1 (channel 5)
Rx_AUX2, // AUX2 (channel 6)
Rx_AUX3, // AUX3 (channel 7)
Rx_AUX4, // AUX4 (channel 8)
Rx_AUX5 // AUX5 (channel 9)
} rx_channel_e;-
uint8_t DevModeAUX- AUX channel assigned to Developer Mode. -
uint16_t DevModeMinRange- Developer Mode activation window, low bound. -
uint16_t DevModeMaxRange- Developer Mode activation window, high bound.
Selects the receiver type. Call it first in plutoRxConfig().
void plutoRxConfig ( void ) {
Receiver_Mode ( Rx_ESP ); // or Rx_ELRS, Rx_PPM, Rx_CAM
}Maps the arm switch to an AUX channel and activation window.
void plutoRxConfig ( void ) {
Receiver_Config_Arm ( Rx_AUX1, 1700, 2000 ); // armed when AUX1 is high
}Each of these maps a flight mode to an AUX channel and activation window. Call
them in plutoRxConfig().
void Receiver_Config_Mode_Angle(rx_channel_e rxChannel, uint16_t minRange, uint16_t maxRange)void Receiver_Config_Mode_Baro(rx_channel_e rxChannel, uint16_t minRange, uint16_t maxRange)void Receiver_Config_Mode_Mag(rx_channel_e rxChannel, uint16_t minRange, uint16_t maxRange)void Receiver_Config_Mode_HeadFree(rx_channel_e rxChannel, uint16_t minRange, uint16_t maxRange)void Receiver_Config_Mode_Dev(rx_channel_e rxChannel, uint16_t minRange, uint16_t maxRange)
void plutoRxConfig ( void ) {
Receiver_Config_Mode_Angle ( Rx_AUX2, 1000, 1300 ); // Angle when AUX2 low
Receiver_Config_Mode_Baro ( Rx_AUX2, 1700, 2000 ); // Alt-hold when AUX2 high
Receiver_Config_Mode_Mag ( Rx_AUX3, 1700, 2000 ); // Mag when AUX3 high
Receiver_Config_Mode_HeadFree ( Rx_AUX4, 1700, 2000 ); // Head-free when AUX4 high
Receiver_Config_Mode_Dev ( Rx_AUX5, 1700, 2000 ); // Developer Mode on AUX5 high
}
Receiver_Config_Mode_Devsets the AUX channel that toggles Developer Mode, which is what runsonLoopStart/plutoLoop/onLoopFinish.
Initializes the STM32 PB3 to ESP IO14 connection. Call it in plutoRxConfig()
when using the onboard ESP receiver.
void plutoRxConfig ( void ) {
Receiver_Mode ( Rx_ESP );
STM_PB3_ESP_IO14_Init();
}A complete receiver setup: select the receiver, map the arm switch, and assign flight modes to AUX channels.
#include "PlutoPilot.h"
void plutoRxConfig ( void ) {
// Receiver type.
Receiver_Mode ( Rx_ESP );
// Arm switch on AUX1 (high = armed).
Receiver_Config_Arm ( Rx_AUX1, 1700, 2000 );
// Flight modes.
Receiver_Config_Mode_Angle ( Rx_AUX2, 1000, 1300 ); // low position
Receiver_Config_Mode_Baro ( Rx_AUX2, 1700, 2000 ); // high position
Receiver_Config_Mode_Mag ( Rx_AUX3, 1700, 2000 );
Receiver_Config_Mode_HeadFree ( Rx_AUX4, 1700, 2000 );
Receiver_Config_Mode_Dev ( Rx_AUX5, 1700, 2000 ); // Developer Mode
// Onboard ESP link.
STM_PB3_ESP_IO14_Init();
}MagisV2 © 2026 Drona Aviation | Licensed under GPL-3.0 | Report Issues