NinjaFlight
|
Enumerations | |
enum | mixer_flags { MIXER_FLAG_ARMED = (1 << 3) } |
Functions | |
void | mixer_init (struct mixer *self, const struct config const *config, const struct system_calls_pwm *pwm) |
void | mixer_clear_rules (struct mixer *self) |
saves motor mixer into cleanflight motor mixer format More... | |
void | mixer_input_command (struct mixer *self, mixer_input_t channel, int16_t value) |
inputs a command to one of the input channels of the mixer More... | |
void | mixer_set_throttle_range (struct mixer *self, int16_t mid, int16_t min, int16_t max) |
sets throttle range of the mixer (can be used to set 3d throttle range too) More... | |
void | mixer_update (struct mixer *self) |
calculates outputs from all mixer inputs and mixing rules More... | |
void | mixer_enable_armed (struct mixer *self, bool on) |
arms/disarms the mixer (when disarmed, motor outputs will be set to disarmed pwm values. These are reset to either midrc when in 3d mode or to mincommand when not in 3d mode) More... | |
bool | mixer_motor_limit_reached (struct mixer *self) |
returns true if mixer has determined that motor limit has been reached More... | |
uint8_t | mixer_get_motor_count (struct mixer *self) |
returns the number of motors that are currently being controlled by mixer profile More... | |
uint8_t | mixer_get_servo_count (struct mixer *self) |
returns number of servos that are used by the mixer. More... | |
The primary job of a mixer is to translate inputs from the flight controller into linear or angular movement of the aircraft body. The mixer does this by taking into account frame and thrust configuration and generating actuator values for required control surfaces.
enum mixer_flags |
void mixer_clear_rules | ( | struct mixer * | self | ) |
saves motor mixer into cleanflight motor mixer format
loads a set of motor mixing rules from cleanflight format into current ruleset save servo mixer into cleanflight servo mixer format (sets some fields to defaults) loads servo mixing rules from cleanflight format into internal format clears all mixing rules
void mixer_enable_armed | ( | struct mixer * | self, |
bool | on | ||
) |
arms/disarms the mixer (when disarmed, motor outputs will be set to disarmed pwm values. These are reset to either midrc when in 3d mode or to mincommand when not in 3d mode)
puts mixer into armed state so that outputs are calculated (TODO: this should probably be placed outside of the mixer!)
uint8_t mixer_get_motor_count | ( | struct mixer * | self | ) |
returns the number of motors that are currently being controlled by mixer profile
returns total number of motors that are being actively mixed by the mixer as part of current profile
uint8_t mixer_get_servo_count | ( | struct mixer * | self | ) |
returns number of servos that are used by the mixer.
returns total number of servos that are being actively mxier by the mixer as part of current profile
void mixer_init | ( | struct mixer * | self, |
const struct config const * | config, | ||
const struct system_calls_pwm * | pwm | ||
) |
Initializes an empty mixer objects clearing memory first.
void mixer_input_command | ( | struct mixer * | self, |
mixer_input_t | channel, | ||
int16_t | value | ||
) |
inputs a command to one of the input channels of the mixer
Inputs a command into the mixer. Valid range is [-500 to 500];
channel | the channel to set |
value | the value of the channel. Zero centered and between -500 to 500 |
bool mixer_motor_limit_reached | ( | struct mixer * | self | ) |
returns true if mixer has determined that motor limit has been reached
tests if any of the motors have reached their limit (usually maxthrottle)
void mixer_set_throttle_range | ( | struct mixer * | self, |
int16_t | mid, | ||
int16_t | min, | ||
int16_t | max | ||
) |
sets throttle range of the mixer (can be used to set 3d throttle range too)
Sets throttle range for scaling motor values. All outputs will be centered at mid throttle and will be clipped to min/max range (this works because all inputs are -500 to 500).
mid | the middle throttle value on which outputs will be centered. |
min | minimum possible output value |
max | maximum possible output value |
void mixer_update | ( | struct mixer * | self | ) |
calculates outputs from all mixer inputs and mixing rules
Updates the outputs based on mixing rules from the inputs. Expects inputs to be set using mixer_input_* command.
If mixer is in disarmed state then it will forward group 4 inputs (motor passthrough) to the outputs. This feature can be used to test motors when mixer is not mixing (without changing mixing mode).