ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

Sub: automatically deal with misconfigured lights/actuators

Open Williangalvani opened this issue 3 months ago • 1 comments

The migration of lights and actuators means that when updating, the functionalities will break.

This patch handles both cases:

  • For lights, if we have a joystick button assigned for Lights, no SERVO_FUNCTION assigned to k_lights1/2, AND we have channels set to RCIN9/RCIN10 (previously where lights were hardcoded), we change these to the corresponding k_lights1/2 value.

  • Similarly, for the "legacy" servo_inc/dec/... joystick buttons, we check if the legacy channels (9,10,11) are free(disabled), and if the new corresponding actuator is not already configured to a SERVO_FUNCTION. In that case, we set that SERVO_FUNCTION to the correct k_actuator output.

Note: I'd love to not use AP_Param::set_and_save_by_name, but I couldn't find an alternative.

Williangalvani avatar Sep 17 '25 12:09 Williangalvani

Need to ... check if the new parameter is configured in storage before setting it.

@IamPete1 I may be misunderstanding, but both functions already check the existing servo channel assignments for both existing use (of the old value), and lack of use of the new value on other channels, as part of determining whether to change the old channel's value to the new default.

Currently I think if you were to manually set a output back to "none" then on the next boot the conversion would be done again.

As an example, if someone manually sets servo channel 9 to Disabled (0) (k_none), and doesn't clear their actuator_1_* joystick button functions and also doesn't set some other channel to Actuator 1, then yes, the conversion would be done again on the next restart.

That could be slightly confusing for new users that unexpectedly run into it, but that seems like a reasonable tradeoff given they have input parameters configured that cannot be used for their output configuration - i.e. if they want to configure those inputs then they should either configure a corresponding output in the same boot cycle, set a non-none value for the output that would otherwise be used as the default, or accept the default output option.

ES-Alexander avatar Sep 19 '25 15:09 ES-Alexander