|
@@ -10,7 +10,7 @@ Atm_AccelStepper& Atm_AccelStepper::begin(int step_pin, int dir_pin) {
|
|
|
/* ON_ENTER ON_LOOP ON_EXIT EVT_DISABLE EVT_ENABLE EVT_ENABLED_TIMEOUT EVT_STOP EVT_EMERGENCY_STOP EVT_ON_LIMIT_LOW EVT_ON_LIMIT_HIGH EVT_ON_TARGET ELSE */
|
|
|
/* DISABLED */ ENT_DISABLED, -1, -1, -1, ENABLED, -1, -1, -1, -1, -1, -1, -1,
|
|
|
/* ENABLED */ ENT_ENABLED, -1, -1, DISABLE, -1, DISABLED, STOP, STOP, -1, -1, -1, -1,
|
|
|
- /* RUNNING */ -1, LP_RUNNING, -1, DISABLE, -1, -1, STOP, STOP, LIMIT_LOW, LIMIT_HIGH, ENABLED, -1,
|
|
|
+ /* RUNNING */ ENT_RUNNING, LP_RUNNING, -1, DISABLE, -1, -1, STOP, STOP, LIMIT_LOW, LIMIT_HIGH, ENABLED, -1,
|
|
|
/* STOP */ -1, -1, -1, DISABLE, -1, -1, STOP, STOP, -1, -1, -1, -1,
|
|
|
/* HOMING_LOW */ ENT_HOMING_LOW, -1, EXT_HOMING_LOW, DISABLE, -1, -1, STOP, STOP, ENABLED, -1, -1, -1,
|
|
|
/* HOMING_HIGH */ ENT_HOMING_HIGH, -1, EXT_HOMING_HIGH, DISABLE, -1, -1, STOP, STOP, -1, ENABLED, -1, -1,
|
|
@@ -90,11 +90,26 @@ int Atm_AccelStepper::event( int id ) {
|
|
|
void Atm_AccelStepper::action( int id ) {
|
|
|
switch ( id ) {
|
|
|
case ENT_DISABLED:
|
|
|
+ push(connectors, ON_CHANGE, 0, state(), 0);
|
|
|
+ enabled = _enableReversed ? HIGH : LOW;
|
|
|
+ digitalWrite(_enablePin, enabled);
|
|
|
return;
|
|
|
case ENT_ENABLED:
|
|
|
+ push(connectors, ON_CHANGE, 0, state(), 0);
|
|
|
+ enabled = _enableReversed ? LOW : HIGH ;
|
|
|
+ digitalWrite(_enablePin, enabled);
|
|
|
+ sendOSC();
|
|
|
return;
|
|
|
- case LP_RUNNING:
|
|
|
+ case ENT_RUNNING:
|
|
|
+ push(connectors, ON_CHANGE, 0, state(), 0);
|
|
|
+ push(connectors, ON_CHANGE, 0, 2, 0);
|
|
|
return;
|
|
|
+ case LP_RUNNING:
|
|
|
+ tempStep = motor->getPosition();
|
|
|
+ if (tempStep != _currentStep){
|
|
|
+ _currentStep = tempStep;
|
|
|
+ push(connectors, ON_CHANGEPOSITION, 0, _currentStep, 0);
|
|
|
+ }
|
|
|
case ENT_HOMING_LOW:
|
|
|
return;
|
|
|
case EXT_HOMING_LOW:
|