Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion src/mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,42 @@ void Mixer::init_mixing()

// Update the motor parameters that will be used
update_parameters();
} else if (mixer_choice != FIXEDWING ||
} else if (mixer_choice != FIXEDWING &&
mixer_choice != INVERTED_VTAIL) {
// Invert the selected "canned" matrix
RF_.comm_manager_.log(CommLinkInterface::LogSeverity::LOG_INFO,
"Inverting selected mixing matrix...");
primary_mixer_ = invert_mixer(array_of_mixers_[mixer_choice]);

// If using a canned mixer but the USE_MOTOR_PARAM is set to 1 (true), raise a warning.
// Motor parameters (thus motor speed/voltage calculations) should not be used with the canned
// mixers, since the output will be vanishingly small. Check online documentation for more
// information.
if (!(RF_.params_.get_param_int(PARAM_USE_MOTOR_PARAMETERS) == 0)) {
RF_.comm_manager_.log(CommLinkInterface::LogSeverity::LOG_WARNING,
("USE_MOTOR_PARAM=1, but PRIMARY_MIXER=" + std::to_string(static_cast<unsigned int>(mixer_choice)) + ", which").c_str());
RF_.comm_manager_.log(CommLinkInterface::LogSeverity::LOG_WARNING,
"may cause issues (check docs). Is this correct?");
}

} else {
// Don't invert the fixedwing mixers
primary_mixer_ = *array_of_mixers_[mixer_choice];

// For the fixedwing canned mixers, the RC_F_AXIS parameter should be set to 0 (X-AXIS).
// Otherwise, the aircraft will arm and appear to be ok, but will zero out any RC throttle
// commands. Raise a warning if this condition is detected
int rc_f_axis = RF_.params_.get_param_int(PARAM_RC_F_AXIS);
if (!(rc_f_axis == 0)) {
RF_.comm_manager_.log(CommLinkInterface::LogSeverity::LOG_WARNING,
("PRIMARY_MIXER=" + std::to_string(static_cast<unsigned int>(mixer_choice))
+ " but RC_F_AXIS="
+ std::to_string(static_cast<unsigned int>(rc_f_axis))
+ ", which"
).c_str());
RF_.comm_manager_.log(CommLinkInterface::LogSeverity::LOG_WARNING,
"will cause issues (check docs). Is this correct?");
}
}

// Load the primary mixer header to the mixer_to_use_ header. Note that both the primary and
Expand Down