glideOn = false;
targetPV = -0.05;

for i=1:1:length(slope)
    if (~glideOn)
        if ((slope(i) <= targetPV) && (slope(i) > (1.3 * targetPV)))
            glideOn = true;
            RunPVPID = false;
        end
    else
        if ((slope(i) > (0.9 * targetPV)) || (slope(i) < (1.5 * targetPV)))
            glideOn = false;
            RunPVPID = true;
        end
    end
    fprintf(1, 'i = %d   slope = %8.5f  glideOn = %d \n', i, slope(i), glideOn);
end
            