In the weeds of MarlinBuilder looking at new laser code use of pin PC9

@jeffeb3, got a newbie question on lasers, MarlinBuilder and maybe Plaform.io.

I think I generally understanding how the MarlinBuilder works in generate the nightly V1 Engineering specific machine builds from Marlin bugfix. BTW, nice use of Actions.

Its clever how the MarlinBuilder is doing opt_set and opt_add in order to avoid the confusion of having to edit multiple Marlin files directly (though I need to figure out the difference between an opt_set and a opt_add).

While looking at the laser code changes in MarlinBuilder for the SKR PRO I can see you doing the following in MarlinBuilder/src/configs/boards/skr_pro.

opt_add SPINDLE_LASER_PWM_PIN PC9

My question is, “Don’t you need to also undefine SERVO1_PIN which is defined in pins_BTT_SKR_PRO_common.h so the is not a conflict in using PC9”?

//
// Servos
//
#define SERVO0_PIN PA1
#define SERVO1_PIN PC9

After reviewing most of the servo code I was unsure if the servo code was getting included just because that pin was defined. BTW, I can easily be convinced I’m wrong as I’m just starting with Platform.io and how it all pulls back together before doing the build.

Those functions are in the main marlin code and they are used for the tests for each commit. opt_set has to find the option to replace everything after the option. opt_add will define a new setting. IIRC, opt_set will act like opt_add if it can’t find the setting. This is something I want to change. I want the scripts to fail if they can’t find the setting, unless we have said it is ok to add it. I just need to take an hour and rewrite them that way.

Ryan made those changes. But my guess is that define isn’t even compiled unless the num servos is set to 2 or more. There is also some ability of Marlin to clobber itself (intentionally). You can define two things to some pins and they will just ignore each other until you set the servo value or a laser value.

I can also say pretty confidently that it does compile!