Question about setting pwm parameters in rc.mc_defaults

In the “rc.mc_defaults” file that sets the default parameters for multicopters, the PWM_MIN and PWM_MAX values seem to be set twice. First they are set with:

    param set PWM_MIN 1075
    param set PWM_MAX 1950

But then, there is also this:

    set PWM_MIN p:PWM_MIN
    set PWM_MAX p:PWM_MAX

What exactly is this “p” in “p:PWM_MIN” and “p:PWM_MAX”? From where is it getting the values to store in PWM_MIN and PWM_MAX and how can I change them?

p = param. It uses the value of ‘param’ PWM_MIN which was set to 1075
The other PWM_MIN is just a variable.

So can you just write “param set PWM_MIN 1075” and leave it at that? Why do you also need to write “set PWM_MIN p:PWM_MIN”? Are they not setting the same parameter?

The latter sets the value of the variable equal to the value of the parameter

Oh I see, so in order to use the parameter values for other calculations down the road, variables called “PWM_MIN” and “PWM_MAX” are also being defined and given the parameter values. Is that correct? If so, why create separate variables at all if you can always just refer to/call the parameter itself when needed?

If you would only have those 4 lines it would not make sense indeed, but the first two are inside if [ $AUTOCNF == yes ]