forked from Archive/PX4-Autopilot
pca9685_pwm_out: add dynamic mixing support
This commit is contained in:
parent
955179e992
commit
35ce6d1b73
|
@ -37,6 +37,8 @@ px4_add_module(
|
|||
SRCS
|
||||
main.cpp
|
||||
PCA9685.cpp
|
||||
MODULE_CONFIG
|
||||
module.yaml
|
||||
DEPENDS
|
||||
mixer
|
||||
mixer_module
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
module_name: PCA9685 Output
|
||||
actuator_output:
|
||||
output_groups:
|
||||
- param_prefix: PCA9685
|
||||
channel_label: 'PCA9685'
|
||||
standard_params:
|
||||
disarmed: { min: 800, max: 2200, default: 900 }
|
||||
min: { min: 800, max: 1400, default: 1000 }
|
||||
max: { min: 1600, max: 2200, default: 2000 }
|
||||
failsafe: { min: 800, max: 2200 }
|
||||
num_channels: 16
|
||||
|
Loading…
Reference in New Issue