Invert duty cycle setpoint when polarity changes