Fresh Eyes Needed - Stuttering Motor Issues

Good news
i know your problem: the ramping up and down PWM is lowering voltage too much .
It is explained in a 2012 post on the forum

If you really are trying to run a 24V motor at a fraction of a volt then this is expected behaviour. If the stall current is .75A at 24V then it should be taking about 11mA at 0.375V - the torque at that low current isn't enough to overcome static and dynamic friction so its only just running.

Using PWM from a higher voltage may improve matters but there is a fundamental issue here that you can't run a brushed DC motor at a tiny fraction of its design speed without friction being dominant.

from here

Bad news

Code must mostly be rewritten- which would also fix issues pointed out by @paulS

There are 3 variables involved in the conditions here, and you handle 2 of the 8 possible combinations. That leaves 6 un-handled. Not a good idea.

The names of most of your variables leaves a lot to be desired. Maybe they meant something to the original coder, but they mean nothing to me.

I can help with the rewrite, however, check PM