Libary for Strpper motor controller, eg: Rep-Rap smart stick Catering for both, Phisical 'PIN' endstops, and PORT Expander end stops . ** BOTH IN TEST ** ** Phisical PIN tested (minimal) **** PORT PIN NOT TESTED ****

Files at this revision

API Documentation at this revision

Comitter:
ceri
Date:
Fri Aug 02 13:59:28 2013 +0000
Parent:
1:66e95666c3b5
Child:
3:57d3774612fc
Commit message:
Added little bit to allow pull up on End stops.

Changed in this revision

Stepper.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Stepper.cpp	Mon Jul 29 09:15:11 2013 +0000
+++ b/Stepper.cpp	Fri Aug 02 13:59:28 2013 +0000
@@ -38,8 +38,24 @@
            
     {
     //  bool read_1();
-        if (Endstop_Left   != NC) ESL = true; else ESL = false;
-        if (Endstop_Right  != NC) ESR = true; else ESR = false;
+        if (Endstop_Left   != NC) 
+        {
+            ESL = true; 
+            _Endstop_Left.mode (PullUp);
+        }
+        else 
+        {
+            ESL = false;
+        }
+        if (Endstop_Right  != NC) 
+        {
+            ESR = true; 
+            _Endstop_Right.mode (PullUp);
+        }
+        else 
+        {
+            ESR = false;
+        }
     
     } 
 }  
@@ -56,13 +72,13 @@
 //    else
         // Enable motor .. if not enabled .. short delay befor moveing ..
         
-        if (!_En) 
+        if (_En) 
         {
-            _En = 1;
+            _En = 0;
             wait (0.005);   // 5 mSec.
         }
         
-        _En = 1;
+        _En = 0;
         
         
         {
@@ -78,7 +94,7 @@
 
 bool Stepper::Enable (bool OnOff)
 {
-    _En = OnOff;
+    _En = !OnOff;
 }
 
 // ------------------------------------------------------------------------------------