AltHold Integrator WIndup

I have a drone which flies with a rangefinder above ground at low altitude. If there is some obstacle on the ground I wouldn’t want the flight controller to react to this so (too strongly) I thought I’d limit the throttle (PILOT_SPEED_UP_CMD / DN_CMD)
I can’t lower my PID gains because that would damage my steady state performance.
My main issue is that when I lower the maximum throttle allowed I think the integrator starts accumulating and reach the ALT_MAXI.
I was thinking about implementing an anti-windup mechanism which freezes the integrator when the max command has been reached.
Is there a better idea how to cope with this issue?

Never mind. this is already there. my bad.

Could you direct me to the solution you found?

Hey Dexter,

Not sure if that what you mean but at Ac_PosControl.cpp at run_z_controller function there is a position limit which limits the altitude error. It’s not anti-windup but it helped with my problem.