- 
                Notifications
    You must be signed in to change notification settings 
- Fork 72
Closed
Labels
analysisThis issue requires additional analysisThis issue requires additional analysisenhancementNew feature or requestNew feature or request
Description
the "AccelStepper" library can be improved. This one accumulates in time a software error. It can be interesting to mathematically integrate this one. Where the "AccelStepper" lib makes
    unsigned long time = micros();   
    if (time - _lastStepTime >= _stepInterval)
    {
	if (_direction == DIRECTION_CW)
	{
	    _currentPos += 1;
	}
	else
	{
	    _currentPos -= 1;
	}
	step(_currentPos);
	_lastStepTime = time; 
	return true;
    }
I had coded a version with this fix, my lib is much less complete than AccelStepper but takes into account the software error. As a comparison in my lib I did like this . "this->m_ei" is integrate error
unsigned long r_elsp= micros() - this->m_elaps;
        if( (_mv_type == MOVE_TYPE::HALF_STEP ? this->m_inter_delay/2.0 : this->m_inter_delay)  <=r_elsp-this->m_ie)
        {
          this->next_step(_mv_type);
          this->m_elaps = micros();
          this->m_ie += this->m_inter_delay-r_elsp;
          step++;
        }
Metadata
Metadata
Assignees
Labels
analysisThis issue requires additional analysisThis issue requires additional analysisenhancementNew feature or requestNew feature or request