|
@@ -52,7 +52,8 @@ int Atm_AccelStepper::event( int id ) {
|
|
|
case EVT_EMERGENCY_STOP:
|
|
|
return 0;
|
|
|
case EVT_ON_LIMIT_LOW:
|
|
|
- if (limits_timer.expired(this)){
|
|
|
+ // if (limits_timer.expired(this)){
|
|
|
+ if (millis()-limit_update_offset > LIMIT_UPDATE_RATE){
|
|
|
switch(_limitLow_Mode) {
|
|
|
case 0:
|
|
|
break;
|
|
@@ -87,7 +88,8 @@ int Atm_AccelStepper::event( int id ) {
|
|
|
|
|
|
|
|
|
case EVT_ON_LIMIT_HIGH:
|
|
|
- if (limits_timer.expired(this)){
|
|
|
+ // if (limits_timer.expired(this)){
|
|
|
+ if (millis()-limit_update_offset > LIMIT_UPDATE_RATE){
|
|
|
switch(_limitHigh_Mode) {
|
|
|
case 0:
|
|
|
break;
|
|
@@ -112,7 +114,8 @@ int Atm_AccelStepper::event( int id ) {
|
|
|
changed = limitHigh_State != limitHigh_State_prev ? 1 : 0;
|
|
|
limitHigh_State_prev = limitHigh_State;
|
|
|
if (changed){push( connectors, ON_ONLIMITHIGH, 0, limitHigh_State, 0 );}
|
|
|
- limits_timer.setFromNow(this, LIMIT_UPDATE_RATE);
|
|
|
+ // limits_timer.setFromNow(this, LIMIT_UPDATE_RATE);
|
|
|
+ limit_update_offset = millis();
|
|
|
return changed ;
|
|
|
}
|
|
|
|
|
@@ -175,6 +178,7 @@ void Atm_AccelStepper::action( int id ) {
|
|
|
return;
|
|
|
|
|
|
case LP_RUNNING:
|
|
|
+ //Serial.println(millis()-LIMIT_UPDATE_OFFSET);
|
|
|
// if on limits and limits are hard, stop moving in one direction
|
|
|
if(limitLow_State && _limitLow_Hard && (_currentSpeed<0.)) {
|
|
|
trigger(EVT_EMERGENCY_STOP);
|