Update stepper library: High-speed stepping mod and timer rollover fix
Update stepper library: High-speed stepping mod and timer rollover fix

When using the stepper library with a 1.8 degrees per step motor, and at high angular speeds, the current Stepper library leads to really loud and jittery rotation. This is due to the fact that the timing is calculated in milliseconds, and the delay length between steps is only 2.5 milliseconds when trying to spin at 120 rpm. Since only integer math is performed, you end up actually bouncing between different step delays, and thus speeds, from step to step instead of giving the motor a constant input.  Which causes the motor to freak out.

Changing the library to calculate the step delays in micros() solves that problem for any speed you can reasonably demand from your stepper motor. The down side is that the micros() counter rolls over every hour or so, and any move you perform after that point will hang your code. Easy fix for that is to add an || micros() - this->last_step_time < 0 to the while loop if statement in Stepper.cpp.

jabezGit/Arduino,radut/Arduino,PaoloP74/Arduino,eduardocasarin/Arduino,KlaasDeNys/Arduino,NaSymbol/Arduino,HCastano/Arduino,arunkuttiyara/Arduino,kidswong999/Arduino,spapadim/Arduino,pdNor/Arduino,koltegirish/Arduino,KlaasDeNys/Arduino,weera00/Arduino,HCastano/Arduino,zenmanenergy/Arduino,wilhelmryan/Arduino,stevemayhew/Arduino,paulo-raca/ESP8266-Arduino,adafruit/ESP8266-Arduino,NaSymbol/Arduino,shannonshsu/Arduino,tskurauskas/Arduino,tannewt/Arduino,noahchense/Arduino-1,jamesrob4/Arduino,tomkrus007/Arduino,lulufei/Arduino,steamboating/Arduino,ThoughtWorksIoTGurgaon/Arduino,niggor/Arduino_cc,leftbrainstrain/Arduino-ESP8266,ccoenen/Arduino,nandojve/Arduino,ccoenen/Arduino,niggor/Arduino_cc,shannonshsu/Arduino,paulmand3l/Arduino,andyvand/Arduino-1,adamkh/Arduino,raimohanska/Arduino,drpjk/Arduino,EmuxEvans/Arduino,PeterVH/Arduino,Chris--A/Arduino,drpjk/Arduino,snargledorf/Arduino,majenkotech/Arduino,ogahara/Arduino,ogahara/Arduino,garci66/Arduino,myrtleTree33/Arduino,radut/Arduino,acosinwork/Arduino,paulo-raca/ESP8266-Arduino,jabezGit/Arduino,ikbelkirasan/Arduino,shiitakeo/Arduino,wayoda/Arduino,koltegirish/Arduino,zaiexx/Arduino,HCastano/Arduino,wilhelmryan/Arduino,Alfredynho/AgroSis,Cloudino/Cloudino-Arduino-IDE,raimohanska/Arduino,OpenDevice/Arduino,nandojve/Arduino,NicoHood/Arduino,tskurauskas/Arduino,jabezGit/Arduino,ThoughtWorksIoTGurgaon/Arduino,radut/Arduino,jaimemaretoli/Arduino,jabezGit/Arduino,talhaburak/Arduino,ForestNymph/Arduino_sources,mattvenn/Arduino,ari-analytics/Arduino,acosinwork/Arduino,mattvenn/Arduino,acosinwork/Arduino,eggfly/arduino,eggfly/arduino,ntruchsess/Arduino-1,eggfly/arduino,KlaasDeNys/Arduino,bsmr-arduino/Arduino,EmuxEvans/Arduino,tomkrus007/Arduino,koltegirish/Arduino,steamboating/Arduino,zaiexx/Arduino,paulo-raca/ESP8266-Arduino,wayoda/Arduino,nkolban/Arduino,jaimemaretoli/Arduino,Chris--A/Arduino,zederson/Arduino,laylthe/Arduino,bsmr-arduino/Arduino,leftbrainstrain/Arduino-ESP8266,jomolinare/Arduino,ssvs111/Arduino,nandojve/Arduino,byran/Arduino,tommyli2014/Arduino,tbowmo/Arduino,tommyli2014/Arduino,noahchense/Arduino-1,ari-analytics/Arduino,paulmand3l/Arduino,shiitakeo/Arduino,gberl001/Arduino,shiitakeo/Arduino,bsmr-arduino/Arduino,zenmanenergy/Arduino,adafruit/ESP8266-Arduino,aichi/Arduino-2,mangelajo/Arduino,nandojve/Arduino,aichi/Arduino-2,jamesrob4/Arduino,shannonshsu/Arduino,leftbrainstrain/Arduino-ESP8266,karlitxo/Arduino,stickbreaker/Arduino,danielchalef/Arduino,drpjk/Arduino,xxxajk/Arduino-1,mattvenn/Arduino,bigjosh/Arduino,fungxu/Arduino,spapadim/Arduino,sanyaade-iot/Arduino-1,HCastano/Arduino,ogferreiro/Arduino,me-no-dev/Arduino-1,wilhelmryan/Arduino,ogahara/Arduino,koltegirish/Arduino,nandojve/Arduino,vbextreme/Arduino,weera00/Arduino,raimohanska/Arduino,jabezGit/Arduino,arunkuttiyara/Arduino,ikbelkirasan/Arduino,jomolinare/Arduino,radut/Arduino,Cloudino/Arduino,HCastano/Arduino,steamboating/Arduino,myrtleTree33/Arduino,Chris--A/Arduino,ssvs111/Arduino,eeijcea/Arduino-1,snargledorf/Arduino,ogferreiro/Arduino,nkolban/Arduino,eddyst/Arduino-SourceCode,fungxu/Arduino,lulufei/Arduino,ssvs111/Arduino,mangelajo/Arduino,majenkotech/Arduino,ThoughtWorksIoTGurgaon/Arduino,gestrem/Arduino,byran/Arduino,shannonshsu/Arduino,ikbelkirasan/Arduino,PaoloP74/Arduino,gonium/Arduino,tannewt/Arduino,jmgonzalez00449/Arduino,wilhelmryan/Arduino,NaSymbol/Arduino,ssvs111/Arduino,superboonie/Arduino,ogahara/Arduino,adafruit/ESP8266-Arduino,ccoenen/Arduino,jomolinare/Arduino,Alfredynho/AgroSis,ricklon/Arduino,eduardocasarin/Arduino,stevemayhew/Arduino,zederson/Arduino,ektor5/Arduino,cscenter/Arduino,zederson/Arduino,weera00/Arduino,myrtleTree33/Arduino,Cloudino/Arduino,danielchalef/Arduino,jaimemaretoli/Arduino,aichi/Arduino-2,sanyaade-iot/Arduino-1,jmgonzalez00449/Arduino,laylthe/Arduino,xxxajk/Arduino-1,lukeWal/Arduino,nkolban/Arduino,ssvs111/Arduino,ThoughtWorksIoTGurgaon/Arduino,Chris--A/Arduino,NeuralSpaz/Arduino,NaSymbol/Arduino,tannewt/Arduino,noahchense/Arduino-1,Gourav2906/Arduino,gonium/Arduino,stevemayhew/Arduino,talhaburak/Arduino,Protoneer/Arduino,NeuralSpaz/Arduino,superboonie/Arduino,stickbreaker/Arduino,ektor5/Arduino,weera00/Arduino,noahchense/Arduino-1,wdoganowski/Arduino,zaiexx/Arduino,acosinwork/Arduino,cscenter/Arduino,Alfredynho/AgroSis,sanyaade-iot/Arduino-1,bigjosh/Arduino,aichi/Arduino-2,bsmr-arduino/Arduino,drpjk/Arduino,laylthe/Arduino,spapadim/Arduino,cscenter/Arduino,garci66/Arduino,nkolban/Arduino,chaveiro/Arduino,adamkh/Arduino,fungxu/Arduino,nkolban/Arduino,tbowmo/Arduino,lukeWal/Arduino,zaiexx/Arduino,gonium/Arduino,NicoHood/Arduino,Gourav2906/Arduino,byran/Arduino,leftbrainstrain/Arduino-ESP8266,wdoganowski/Arduino,wilhelmryan/Arduino,drpjk/Arduino,wdoganowski/Arduino,onovy/Arduino,EmuxEvans/Arduino,Cloudino/Arduino,leftbrainstrain/Arduino-ESP8266,laylthe/Arduino,gberl001/Arduino,acosinwork/Arduino,eggfly/arduino,talhaburak/Arduino,andyvand/Arduino-1,eeijcea/Arduino-1,paulmand3l/Arduino,NeuralSpaz/Arduino,onovy/Arduino,gberl001/Arduino,eddyst/Arduino-SourceCode,pdNor/Arduino,acosinwork/Arduino,ashwin713/Arduino,mateuszdw/Arduino,ThoughtWorksIoTGurgaon/Arduino,leftbrainstrain/Arduino-ESP8266,jabezGit/Arduino,shannonshsu/Arduino,pdNor/Arduino,ForestNymph/Arduino_sources,eduardocasarin/Arduino,mattvenn/Arduino,ThoughtWorksIoTGurgaon/Arduino,koltegirish/Arduino,weera00/Arduino,raimohanska/Arduino,niggor/Arduino_cc,paulmand3l/Arduino,tomkrus007/Arduino,wayoda/Arduino,zenmanenergy/Arduino,me-no-dev/Arduino-1,ogahara/Arduino,vbextreme/Arduino,tbowmo/Arduino,snargledorf/Arduino,ashwin713/Arduino,stickbreaker/Arduino,vbextreme/Arduino,garci66/Arduino,wayoda/Arduino,mangelajo/Arduino,OpenDevice/Arduino,eggfly/arduino,tbowmo/Arduino,lukeWal/Arduino,lukeWal/Arduino,Alfredynho/AgroSis,pdNor/Arduino,kidswong999/Arduino,xxxajk/Arduino-1,gestrem/Arduino,NeuralSpaz/Arduino,NicoHood/Arduino,ogferreiro/Arduino,eddyst/Arduino-SourceCode,ashwin713/Arduino,adamkh/Arduino,shiitakeo/Arduino,sanyaade-iot/Arduino-1,tskurauskas/Arduino,PeterVH/Arduino,adamkh/Arduino,talhaburak/Arduino,ari-analytics/Arduino,vbextreme/Arduino,stevemayhew/Arduino,wayoda/Arduino,eeijcea/Arduino-1,ccoenen/Arduino,garci66/Arduino,shiitakeo/Arduino,gberl001/Arduino,mateuszdw/Arduino,ricklon/Arduino,zaiexx/Arduino,stickbreaker/Arduino,garci66/Arduino,superboonie/Arduino,PeterVH/Arduino,Protoneer/Arduino,bsmr-arduino/Arduino,Cloudino/Cloudino-Arduino-IDE,ashwin713/Arduino,ccoenen/Arduino,gberl001/Arduino,steamboating/Arduino,eggfly/arduino,PeterVH/Arduino,jamesrob4/Arduino,NeuralSpaz/Arduino,tskurauskas/Arduino,chaveiro/Arduino,Cloudino/Arduino,ssvs111/Arduino,Chris--A/Arduino,arunkuttiyara/Arduino,snargledorf/Arduino,mateuszdw/Arduino,nandojve/Arduino,Cloudino/Arduino,Cloudino/Arduino,EmuxEvans/Arduino,wayoda/Arduino,gberl001/Arduino,wilhelmryan/Arduino,weera00/Arduino,aichi/Arduino-2,NicoHood/Arduino,niggor/Arduino_cc,ogferreiro/Arduino,eggfly/arduino,byran/Arduino,ThoughtWorksIoTGurgaon/Arduino,henningpohl/Arduino,ashwin713/Arduino,Cloudino/Arduino,ntruchsess/Arduino-1,gestrem/Arduino,zederson/Arduino,HCastano/Arduino,cscenter/Arduino,tomkrus007/Arduino,stickbreaker/Arduino,majenkotech/Arduino,ogahara/Arduino,HCastano/Arduino,mattvenn/Arduino,bsmr-arduino/Arduino,xxxajk/Arduino-1,superboonie/Arduino,zederson/Arduino,jomolinare/Arduino,onovy/Arduino,wayoda/Arduino,tommyli2014/Arduino,acosinwork/Arduino,henningpohl/Arduino,eeijcea/Arduino-1,mangelajo/Arduino,superboonie/Arduino,kidswong999/Arduino,eddyst/Arduino-SourceCode,HCastano/Arduino,NaSymbol/Arduino,jmgonzalez00449/Arduino,Cloudino/Cloudino-Arduino-IDE,spapadim/Arduino,eggfly/arduino,Cloudino/Cloudino-Arduino-IDE,ari-analytics/Arduino,ogferreiro/Arduino,kidswong999/Arduino,chaveiro/Arduino,radut/Arduino,talhaburak/Arduino,radut/Arduino,stickbreaker/Arduino,onovy/Arduino,zenmanenergy/Arduino,ricklon/Arduino,Protoneer/Arduino,ForestNymph/Arduino_sources,lukeWal/Arduino,EmuxEvans/Arduino,lukeWal/Arduino,xxxajk/Arduino-1,zederson/Arduino,stickbreaker/Arduino,karlitxo/Arduino,jabezGit/Arduino,ogferreiro/Arduino,chaveiro/Arduino,niggor/Arduino_cc,Chris--A/Arduino,stevemayhew/Arduino,raimohanska/Arduino,PeterVH/Arduino,andyvand/Arduino-1,henningpohl/Arduino,nkolban/Arduino,Gourav2906/Arduino,lulufei/Arduino,ntruchsess/Arduino-1,ashwin713/Arduino,karlitxo/Arduino,lukeWal/Arduino,kidswong999/Arduino,weera00/Arduino,arunkuttiyara/Arduino,ikbelkirasan/Arduino,andyvand/Arduino-1,tskurauskas/Arduino,aichi/Arduino-2,xxxajk/Arduino-1,ntruchsess/Arduino-1,adamkh/Arduino,shannonshsu/Arduino,wdoganowski/Arduino,xxxajk/Arduino-1,Alfredynho/AgroSis,tbowmo/Arduino,me-no-dev/Arduino-1,aichi/Arduino-2,ashwin713/Arduino,jmgonzalez00449/Arduino,jaimemaretoli/Arduino,cscenter/Arduino,byran/Arduino,tannewt/Arduino,koltegirish/Arduino,PaoloP74/Arduino,KlaasDeNys/Arduino,adafruit/ESP8266-Arduino,majenkotech/Arduino,drpjk/Arduino,adamkh/Arduino,snargledorf/Arduino,NeuralSpaz/Arduino,PeterVH/Arduino,eduardocasarin/Arduino,vbextreme/Arduino,laylthe/Arduino,koltegirish/Arduino,smily77/Arduino,bigjosh/Arduino,jamesrob4/Arduino,talhaburak/Arduino,Alfredynho/AgroSis,eddyst/Arduino-SourceCode,nkolban/Arduino,danielchalef/Arduino,wayoda/Arduino,shiitakeo/Arduino,OpenDevice/Arduino,ari-analytics/Arduino,ikbelkirasan/Arduino,Alfredynho/AgroSis,bigjosh/Arduino,laylthe/Arduino,lulufei/Arduino,fungxu/Arduino,PaoloP74/Arduino,KlaasDeNys/Arduino,radut/Arduino,noahchense/Arduino-1,lulufei/Arduino,majenkotech/Arduino,tomkrus007/Arduino,NaSymbol/Arduino,smily77/Arduino,onovy/Arduino,tommyli2014/Arduino,arunkuttiyara/Arduino,niggor/Arduino_cc,mangelajo/Arduino,myrtleTree33/Arduino,jamesrob4/Arduino,majenkotech/Arduino,danielchalef/Arduino,raimohanska/Arduino,eeijcea/Arduino-1,NicoHood/Arduino,sanyaade-iot/Arduino-1,ntruchsess/Arduino-1,garci66/Arduino,gberl001/Arduino,wilhelmryan/Arduino,adamkh/Arduino,Chris--A/Arduino,henningpohl/Arduino,vbextreme/Arduino,tomkrus007/Arduino,spapadim/Arduino,Protoneer/Arduino,ari-analytics/Arduino,smily77/Arduino,andyvand/Arduino-1,bigjosh/Arduino,ari-analytics/Arduino,noahchense/Arduino-1,paulmand3l/Arduino,paulmand3l/Arduino,gonium/Arduino,ccoenen/Arduino,arunkuttiyara/Arduino,mateuszdw/Arduino,tskurauskas/Arduino,Chris--A/Arduino,Gourav2906/Arduino,pdNor/Arduino,chaveiro/Arduino,steamboating/Arduino,garci66/Arduino,zaiexx/Arduino,chaveiro/Arduino,snargledorf/Arduino,ikbelkirasan/Arduino,tbowmo/Arduino,jmgonzalez00449/Arduino,ektor5/Arduino,OpenDevice/Arduino,eeijcea/Arduino-1,NeuralSpaz/Arduino,henningpohl/Arduino,smily77/Arduino,smily77/Arduino,fungxu/Arduino,cscenter/Arduino,eduardocasarin/Arduino,PaoloP74/Arduino,lukeWal/Arduino,jmgonzalez00449/Arduino,karlitxo/Arduino,jaimemaretoli/Arduino,ektor5/Arduino,spapadim/Arduino,byran/Arduino,eddyst/Arduino-SourceCode,wdoganowski/Arduino,ricklon/Arduino,laylthe/Arduino,wdoganowski/Arduino,adafruit/ESP8266-Arduino,leftbrainstrain/Arduino-ESP8266,smily77/Arduino,nandojve/Arduino,NaSymbol/Arduino,EmuxEvans/Arduino,myrtleTree33/Arduino,vbextreme/Arduino,Gourav2906/Arduino,talhaburak/Arduino,spapadim/Arduino,PaoloP74/Arduino,me-no-dev/Arduino-1,jaimemaretoli/Arduino,arunkuttiyara/Arduino,onovy/Arduino,tbowmo/Arduino,ThoughtWorksIoTGurgaon/Arduino,mateuszdw/Arduino,eduardocasarin/Arduino,myrtleTree33/Arduino,fungxu/Arduino,ntruchsess/Arduino-1,ogahara/Arduino,me-no-dev/Arduino-1,adafruit/ESP8266-Arduino,andyvand/Arduino-1,PaoloP74/Arduino,Protoneer/Arduino,tommyli2014/Arduino,ikbelkirasan/Arduino,pdNor/Arduino,tskurauskas/Arduino,tannewt/Arduino,EmuxEvans/Arduino,ntruchsess/Arduino-1,jaimemaretoli/Arduino,jmgonzalez00449/Arduino,Gourav2906/Arduino,Protoneer/Arduino,andyvand/Arduino-1,sanyaade-iot/Arduino-1,shiitakeo/Arduino,sanyaade-iot/Arduino-1,paulmand3l/Arduino,tomkrus007/Arduino,acosinwork/Arduino,ccoenen/Arduino,eddyst/Arduino-SourceCode,kidswong999/Arduino,gestrem/Arduino,pdNor/Arduino,mangelajo/Arduino,mangelajo/Arduino,OpenDevice/Arduino,superboonie/Arduino,me-no-dev/Arduino-1,ForestNymph/Arduino_sources,ricklon/Arduino,PaoloP74/Arduino,ForestNymph/Arduino_sources,cscenter/Arduino,jabezGit/Arduino,chaveiro/Arduino,PeterVH/Arduino,NaSymbol/Arduino,Cloudino/Cloudino-Arduino-IDE,karlitxo/Arduino,bigjosh/Arduino,NicoHood/Arduino,paulo-raca/ESP8266-Arduino,eeijcea/Arduino-1,ari-analytics/Arduino,lulufei/Arduino,jaimemaretoli/Arduino,mattvenn/Arduino,zenmanenergy/Arduino,mateuszdw/Arduino,NicoHood/Arduino,superboonie/Arduino,garci66/Arduino,bsmr-arduino/Arduino,tskurauskas/Arduino,me-no-dev/Arduino-1,tannewt/Arduino,PeterVH/Arduino,niggor/Arduino_cc,Cloudino/Cloudino-Arduino-IDE,zaiexx/Arduino,superboonie/Arduino,niggor/Arduino_cc,snargledorf/Arduino,Gourav2906/Arduino,ccoenen/Arduino,ogferreiro/Arduino,Protoneer/Arduino,KlaasDeNys/Arduino,adamkh/Arduino,tommyli2014/Arduino,paulo-raca/ESP8266-Arduino,gestrem/Arduino,zenmanenergy/Arduino,drpjk/Arduino,me-no-dev/Arduino-1,ForestNymph/Arduino_sources,zederson/Arduino,ashwin713/Arduino,mateuszdw/Arduino,niggor/Arduino_cc,ntruchsess/Arduino-1,Cloudino/Cloudino-Arduino-IDE,ikbelkirasan/Arduino,zaiexx/Arduino,stevemayhew/Arduino,bsmr-arduino/Arduino,noahchense/Arduino-1,ektor5/Arduino,NicoHood/Arduino,steamboating/Arduino,karlitxo/Arduino,cscenter/Arduino,shannonshsu/Arduino,gonium/Arduino,jamesrob4/Arduino,mattvenn/Arduino,adafruit/ESP8266-Arduino,xxxajk/Arduino-1,OpenDevice/Arduino,kidswong999/Arduino,henningpohl/Arduino,majenkotech/Arduino,jomolinare/Arduino,ssvs111/Arduino,henningpohl/Arduino,danielchalef/Arduino,ForestNymph/Arduino_sources,kidswong999/Arduino,gestrem/Arduino,gestrem/Arduino,jamesrob4/Arduino,tbowmo/Arduino,paulo-raca/ESP8266-Arduino,myrtleTree33/Arduino,KlaasDeNys/Arduino,steamboating/Arduino,onovy/Arduino,talhaburak/Arduino,byran/Arduino,ricklon/Arduino,jomolinare/Arduino,danielchalef/Arduino,eduardocasarin/Arduino,tomkrus007/Arduino,KlaasDeNys/Arduino,danielchalef/Arduino,wdoganowski/Arduino,stevemayhew/Arduino,OpenDevice/Arduino,smily77/Arduino,pdNor/Arduino,Gourav2906/Arduino,fungxu/Arduino,byran/Arduino,karlitxo/Arduino,paulo-raca/ESP8266-Arduino,chaveiro/Arduino,henningpohl/Arduino,tannewt/Arduino,ricklon/Arduino,zenmanenergy/Arduino,bigjosh/Arduino,gonium/Arduino,stevemayhew/Arduino,tommyli2014/Arduino,lulufei/Arduino,ektor5/Arduino,vbextreme/Arduino,raimohanska/Arduino,bigjosh/Arduino,gonium/Arduino,eddyst/Arduino-SourceCode,shannonshsu/Arduino,nandojve/Arduino,jomolinare/Arduino,jmgonzalez00449/Arduino