Allow adjusting PWM output range for lights, fan or heater channels

Hi @BStiles, welcome to the forum :slight_smile:

ArduSub’s joystick button function handling for Lights1 is here:

Somewhat confusingly, the output values are determined by the lights1 input channel range (rather than the SERVOn_ values for the assigned lights1 output channel, which are apparently ignored). That’s probably a bug, but for now you can set the values corresponding the the RC Input channel for the control you’re working with.

For Lights1 that’s RC9 (note the RC_Channels::rc_channel(8); in the implementation is zero-indexed). I’ve confirmed that setting RC9_MIN=1 (0 skipped the lowest step, 1 is still ~0% duty-cycle) and RC9_MAX=5000 (100% duty-cycle for a 200Hz output) or RC9_MAX=20000 (100% duty-cycle for a 50Hz output) allows whichever output channel is assigned to Lights1 (e.g. MAIN 8/servo 8 for your described use-case) to take on values in that range by checking SERVO_OUTPUT_RAW. I imagine that works fine for the actual outputs, but I’ll leave that for you to check with your LED or oscilloscope.

Number of steps can be controlled as usual by the Brightness Steps control from the Lights page, or the JS_LIGHTS_STEPS parameter if for some reason you want more than 10 steps.