Skip to content

Commit

Permalink
Focuser enable support fixes
Browse files Browse the repository at this point in the history
Allows for A21/A22 to be defined but not used for enPin
  • Loading branch information
hjd1964 committed Oct 29, 2018
1 parent b3f13cb commit 98ebc78
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/lib/Focuser.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,20 @@ class focuser {
void enableDriver() {
// for Aux5/Aux6 (DAC) support for stepper driver EN control on MaxPCB
#if defined(A21) && defined(A22)
if (enPin==A21) { if (enableState==HIGH) analogWrite(A21,1024); else analogWrite(A21,0); return; }
if (enPin==A22) { if (enableState==HIGH) analogWrite(A22,1024); else analogWrite(A22,0); return; }
#endif
if (enPin==A21) { if (enableState==HIGH) analogWrite(A21,255); else analogWrite(A21,0); return; } else
if (enPin==A22) { if (enableState==HIGH) analogWrite(A22,255); else analogWrite(A22,0); return; } else digitalWrite(enPin,enableState);
#else
digitalWrite(enPin,enableState);
#endif
}

void disableDriver() {
#if defined(A21) && defined(A22)
if (enPin==A21) { if (disableState==HIGH) analogWrite(A21,1024); else analogWrite(A21,0); return; }
if (enPin==A22) { if (disableState==HIGH) analogWrite(A22,1024); else analogWrite(A22,0); return; }
#endif
if (enPin==A21) { if (disableState==HIGH) analogWrite(A21,255); else analogWrite(A21,0); return; } else
if (enPin==A22) { if (disableState==HIGH) analogWrite(A22,255); else analogWrite(A22,0); return; } else digitalWrite(enPin,disableState);
#else
digitalWrite(enPin,disableState);
#endif
}

// parameters
Expand Down

0 comments on commit 98ebc78

Please sign in to comment.