     for (int i=0; i<fullspeedsteps; i++) {
         onestep(pulse);
     }
-    for (int i=0; i<(localAccelSteps - decelDiff); i++) {
+    for (int i=0; i<localAccelSteps; i++) {
         onestep(map(i, 0, localAccelSteps, pulse, maxPulse));
+        if (i>(localAccelSteps - decelLook) && digitalRead(sensorPin)) break;
     }
     findsensor(maxPulse);
     digitalWrite(LED_BUILTIN, LOW);

        // avoid polling millis too often
        for (int i=0; i<10; i++) onestep(pulse);
    }
    for (int i=0; i<(accelSteps - (decelDiff * recentre)); i++) {
        onestep(map(i, 0, accelSteps, pulse, startstoppulse));
    }
    if (recentre) findsensor(startstoppulse);
    digitalWrite(LED_BUILTIN, LOW);

        // TODO log map
        onestep(map(i, 0, glisssteps, startpulse, endpulse));
    }
    for (int i=0; i<accelSteps; i++) {
        onestep(map(i, 0, accelSteps, endpulse, max(maxPulse, endpulse)));
        if (i>(accelSteps - decelLook) && digitalRead(sensorPin)) break;
    }
    findsensor(max(maxPulse, endpulse));
    digitalWrite(LED_BUILTIN, LOW);
