Lock the gimbal roll to the aircraft

Greetings,

Is there a way to lock/unlock the servo gimbal pitch/roll (tied to an RC channel/switch on the remote) ?

I want to be able to choose between camera being stabilized to the horizon and camera following the aircraft attitude (like it’s fixed without gimbal).
Is there a way to configure ?

Thanks

If you want your camera in a fixed position relative to the airframe you could use gimbal stowing.

no, that just turns gimbal to a “stow” angle, and keeps it aligned to it independent of the aircraft attitude. At least in my case of 2 axis “basecam” knock-off from Aliexpress that I control via servo lines.

I think you can make a script to send correct signal when a switch is in a correct position though camera likely will feel a bit floaty.