     _points[_sys.plannedIndex].targetCount[1] = abs(_points[_sys.plannedIndex].targetPosition[1] - _prevPoint.targetPosition[1]);
     _points[_sys.plannedIndex].delta[0] = (_points[_sys.plannedIndex].targetCount[0]);
     _points[_sys.plannedIndex].delta[1] = (_points[_sys.plannedIndex].targetCount[1]);
+    _points[_sys.plannedIndex].restCount[0] = (_points[_sys.plannedIndex].targetCount[0]);
+    _points[_sys.plannedIndex].restCount[1] = (_points[_sys.plannedIndex].targetCount[1]);
     _points[_sys.plannedIndex].totalCount = _points[_sys.plannedIndex].delta[0] + _points[_sys.plannedIndex].delta[1];
     _points[_sys.plannedIndex].speed = speed;
     if (_sys.plannedIndex > 0)

        }
    }
}
// double tttt = 0;
// long kkk = 0;
ISR(SPI_STC_vect)
{
    char c = SPDR;
    /*test speed
    if (tttt == 0)
    {
        tttt = micros() / 1000.0;
    }
    if (c > 9)
    {
        ttt++;
    }
    if (ttt >= 1024)
    {
        kkk++;
        float n = (micros() / 1000.0 - tttt) / 1000.0;
        Serial.print(ttt / n / 1024.0);
        Serial.print(":");
        Serial.print(kkk);
        Serial.print("\n");
        ttt = 0;
        tttt = micros() / 1000.0;
    }*/
    if (c > 0 && c < 0xff)
    {
        if (!_sys.isSpiProcessing)

void stepX(bool dir)
{
    _sys.currentPosition[0] += dir ? 1 : -1;
    _points[0].restCount[0]--;
    _points[0].totalCount--;
    steppers[0].step(dir);
}
void stepY(bool dir)
{
    _sys.currentPosition[1] += dir ? 1 : -1;
    _points[0].restCount[1]--;
    _points[0].totalCount--;
    steppers[1].step(dir);
}
