@ -178,7 +178,6 @@ def get_actuator_output_params(yaml_config, output_functions,
all_params = { }
all_params = { }
group_idx = 0
group_idx = 0
add_reverse_range_param = yaml_config [ ' actuator_output ' ] . get ( ' add_reverse_range_param ' , False )
all_param_prefixes = { }
all_param_prefixes = { }
def add_local_param ( param_name , param_def ) :
def add_local_param ( param_name , param_def ) :
@ -299,13 +298,9 @@ Note that non-motor outputs might already be active in prearm state if COM_PREAR
'''
'''
minimum_description = \
minimum_description = \
''' Minimum output value (when not disarmed).
''' Minimum output value (when not disarmed).
The output range can be reversed by setting Min > Max .
'''
'''
maximum_description = \
maximum_description = \
''' Maxmimum output value (when not disarmed).
''' Maxmimum output value (when not disarmed).
The output range can be reversed by setting Min > Max .
'''
'''
failsafe_description = \
failsafe_description = \
''' This is the output value that is set when in failsafe mode.
''' This is the output value that is set when in failsafe mode.
@ -346,29 +341,29 @@ When set to -1 (default), the value depends on the function (see {:}).
}
}
add_local_param ( param_prefix + ' _ ' + param_suffix + ' $ {i} ' , param )
add_local_param ( param_prefix + ' _ ' + param_suffix + ' $ {i} ' , param )
if add_reverse_range_param :
# add reverse range param
for param_prefix in all_param_prefixes :
for param_prefix in all_param_prefixes :
groups = all_param_prefixes [ param_prefix ]
groups = all_param_prefixes [ param_prefix ]
# collect the bits
# collect the bits
channel_bits = { }
channel_bits = { }
for instance_start , instance_start_label , num_instances , label in groups :
for instance_start , instance_start_label , num_instances , label in groups :
for instance in range ( instance_start , instance_start + num_instances ) :
for instance in range ( instance_start , instance_start + num_instances ) :
instance_label = instance - instance_start + instance_start_label
instance_label = instance - instance_start + instance_start_label
channel_bits [ instance - 1 ] = label + ' ' + str ( instance_label )
channel_bits [ instance - 1 ] = label + ' ' + str ( instance_label )
param = {
param = {
' description ' : {
' description ' : {
' short ' : ' Reverse Output Range for ' + module_name ,
' short ' : ' Reverse Output Range for ' + module_name ,
' long ' :
' long ' :
''' Allows to reverse the output range for each channel.
''' Allows to reverse the output range for each channel.
Note : this is only useful for servos .
Note : this is only useful for servos .
''' .format(channel_label),
''' .format(channel_label),
} ,
} ,
' type ' : ' bitmask ' ,
' type ' : ' bitmask ' ,
' default ' : 0 ,
' default ' : 0 ,
' bit ' : channel_bits
' bit ' : channel_bits
}
}
add_local_param ( param_prefix + ' _REV ' , param )
add_local_param ( param_prefix + ' _REV ' , param )
if verbose : print ( ' adding actuator params: {:} ' . format ( all_params ) )
if verbose : print ( ' adding actuator params: {:} ' . format ( all_params ) )
return all_params
return all_params