M42 command does not work first time, but it works the second time

Hello everyone,

I have used my MPCNC with my SKR Pro board for a while now without problems running marlin
Today I decided to update the firmware to
I am using some custom menu items which run M42 commands to switch relays on and off. It always worked fine, untill today.
When I boot up my MPCNC and run the M42 command for the first time, it does nothing.
I have to run M42 P112 S255, then M42 P112 S0 (still nothing happens) and after that I can finally use the commands like they are supposed to.

Does anyone know what might cause this weird behaviour? It has always worked fine.

Thank in advance.

PS I will also ask on the Marlin GitHub