mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 11:43:35 +08:00
output drivers: add option to generate a separate output range reversing param
Makes it a bit easier to configure. Reversing by setting MIN > MAX is still supported.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
module_name: PWM Output
|
||||
actuator_output:
|
||||
add_reverse_range_param: true
|
||||
output_groups:
|
||||
- param_prefix: PWM_MAIN
|
||||
channel_label: 'Channel'
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
module_name: '${PWM_MAIN_OR_AUX}'
|
||||
actuator_output:
|
||||
add_reverse_range_param: true
|
||||
output_groups:
|
||||
- generator: pwm
|
||||
param_prefix: '${PWM_MAIN_OR_AUX}'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
module_name: HIL
|
||||
actuator_output:
|
||||
add_reverse_range_param: true
|
||||
show_subgroups_if: 'SYS_HITL>0'
|
||||
output_groups:
|
||||
- param_prefix: HIL_ACT
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
module_name: SIM
|
||||
actuator_output:
|
||||
add_reverse_range_param: true
|
||||
output_groups:
|
||||
- param_prefix: PWM_MAIN
|
||||
channel_label: Channel
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
module_name: PWM MAIN
|
||||
actuator_output:
|
||||
add_reverse_range_param: true
|
||||
output_groups:
|
||||
- generator: pwm
|
||||
param_prefix: PWM_MAIN
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
module_name: UAVCAN
|
||||
actuator_output:
|
||||
add_reverse_range_param: true
|
||||
show_subgroups_if: 'UAVCAN_ENABLE>=3'
|
||||
config_parameters:
|
||||
- param: 'UAVCAN_ENABLE'
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
module_name: UAVCANv1
|
||||
actuator_output:
|
||||
add_reverse_range_param: true
|
||||
output_groups:
|
||||
- param_prefix: UCAN1_ESC
|
||||
channel_label: 'ESC'
|
||||
|
||||
@@ -138,6 +138,9 @@ void MixingOutput::initParamHandles()
|
||||
snprintf(param_name, sizeof(param_name), "%s_%s%d", _param_prefix, "FAIL", i + 1);
|
||||
_param_handles[i].failsafe = param_find(param_name);
|
||||
}
|
||||
|
||||
snprintf(param_name, sizeof(param_name), "%s_%s", _param_prefix, "REV");
|
||||
_param_handle_rev_range = param_find(param_name);
|
||||
}
|
||||
|
||||
void MixingOutput::printStatus() const
|
||||
@@ -230,6 +233,12 @@ void MixingOutput::updateParams()
|
||||
}
|
||||
}
|
||||
|
||||
int32_t rev_range_param;
|
||||
|
||||
if (_param_handle_rev_range != PARAM_INVALID && param_get(_param_handle_rev_range, &rev_range_param) == 0) {
|
||||
_reverse_output_mask |= rev_range_param;
|
||||
}
|
||||
|
||||
if (function_changed) {
|
||||
_need_function_update = true;
|
||||
}
|
||||
|
||||
@@ -346,6 +346,7 @@ private:
|
||||
bool _has_backup_schedule{false};
|
||||
const char *const _param_prefix;
|
||||
ParamHandles _param_handles[MAX_ACTUATORS];
|
||||
param_t _param_handle_rev_range{PARAM_INVALID};
|
||||
hrt_abstime _lowrate_schedule_interval{300_ms};
|
||||
ActuatorTest _actuator_test{_function_assignment};
|
||||
uint32_t _reversible_mask{0}; ///< per-output bits. If set, the output is configured to be reversible (motors only)
|
||||
|
||||
Reference in New Issue
Block a user