mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 13:23:34 +08:00
pca9685_pwm_out: add dynamic mixing support
This commit is contained in:
@@ -124,8 +124,10 @@ PCA9685Wrapper::PCA9685Wrapper(int schd_rate_limit) :
|
||||
_cycle_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": cycle")),
|
||||
_schd_rate_limit(schd_rate_limit)
|
||||
{
|
||||
_mixing_output.setAllMinValues(PWM_DEFAULT_MIN);
|
||||
_mixing_output.setAllMaxValues(PWM_DEFAULT_MAX);
|
||||
if (!_mixing_output.useDynamicMixing()) {
|
||||
_mixing_output.setAllMinValues(PWM_DEFAULT_MIN);
|
||||
_mixing_output.setAllMaxValues(PWM_DEFAULT_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
PCA9685Wrapper::~PCA9685Wrapper()
|
||||
@@ -173,6 +175,10 @@ void PCA9685Wrapper::updateParams()
|
||||
|
||||
void PCA9685Wrapper::updatePWMParams()
|
||||
{
|
||||
if (_mixing_output.useDynamicMixing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// update pwm params
|
||||
const char *pname_format_pwm_ch_max[2] = {"PWM_MAIN_MAX%d", "PWM_AUX_MAX%d"};
|
||||
const char *pname_format_pwm_ch_min[2] = {"PWM_MAIN_MIN%d", "PWM_AUX_MIN%d"};
|
||||
@@ -369,7 +375,6 @@ bool PCA9685Wrapper::updateOutputs(bool stop_motors, uint16_t *outputs, unsigned
|
||||
void PCA9685Wrapper::Run()
|
||||
{
|
||||
if (should_exit()) {
|
||||
PX4_INFO("PCA9685 stopping.");
|
||||
ScheduleClear();
|
||||
_mixing_output.unregister();
|
||||
unregister_class_devname(PWM_OUTPUT_BASE_DEVICE_PATH, _class_instance);
|
||||
@@ -457,7 +462,6 @@ void PCA9685Wrapper::Run()
|
||||
perf_end(_cycle_perf);
|
||||
}
|
||||
|
||||
// TODO
|
||||
int PCA9685Wrapper::ioctl(cdev::file_t *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
Reference in New Issue
Block a user