Browse Source

Fix for microstepping pin mapping, not using Teensy pin mapping, but Arduino's default pin mapping so Arduino library can be used

Cameron Lai 11 years ago
parent
commit
97ead2eccb
2 changed files with 29 additions and 12 deletions
  1. 10
    8
      Marlin/pins.h
  2. 19
    4
      Marlin/stepper.cpp

+ 10
- 8
Marlin/pins.h View File

@@ -79,14 +79,16 @@
79 79
 #endif
80 80
 
81 81
 // Microstepping pins
82
-#define X_MS1_PIN 13
83
-#define X_MS2_PIN 14
84
-#define Y_MS1_PIN 33
85
-#define Y_MS2_PIN 32
86
-#define Z_MS1_PIN 31
87
-#define Z_MS2_PIN 30
88
-#define E0_MS1_PIN 29
89
-#define E0_MS2_PIN 28
82
+// Note that the pin mapping is not from fastio.h
83
+// See Sd2PinMap.h for the pin configurations
84
+#define X_MS1_PIN 25
85
+#define X_MS2_PIN 26
86
+#define Y_MS1_PIN 9
87
+#define Y_MS2_PIN 8
88
+#define Z_MS1_PIN 7
89
+#define Z_MS2_PIN 6
90
+#define E0_MS1_PIN 5
91
+#define E0_MS2_PIN 4
90 92
 
91 93
 #endif /* 88 */
92 94
 

+ 19
- 4
Marlin/stepper.cpp View File

@@ -1228,13 +1228,22 @@ void digipot_current(uint8_t driver, int current)
1228 1228
 
1229 1229
 void microstep_init()
1230 1230
 {
1231
-  #if defined(X_MS1_PIN) && X_MS1_PIN > -1
1232 1231
   const uint8_t microstep_modes[] = MICROSTEP_MODES;
1233
-  pinMode(X_MS2_PIN,OUTPUT);
1232
+
1233
+  #if defined(E1_MS1_PIN) && E1_MS1_PIN > -1
1234
+  pinMode(E1_MS1_PIN,OUTPUT);
1235
+  pinMode(E1_MS2_PIN,OUTPUT); 
1236
+  #endif
1237
+
1238
+  #if defined(X_MS1_PIN) && X_MS1_PIN > -1
1239
+  pinMode(X_MS1_PIN,OUTPUT);
1240
+  pinMode(X_MS2_PIN,OUTPUT);  
1241
+  pinMode(Y_MS1_PIN,OUTPUT);
1234 1242
   pinMode(Y_MS2_PIN,OUTPUT);
1235
-  pinMode(Z_MS2_PIN,OUTPUT);
1243
+  pinMode(Z_MS1_PIN,OUTPUT);
1244
+  pinMode(Z_MS2_PIN,OUTPUT);  
1245
+  pinMode(E0_MS1_PIN,OUTPUT);
1236 1246
   pinMode(E0_MS2_PIN,OUTPUT);
1237
-  pinMode(E1_MS2_PIN,OUTPUT);
1238 1247
   for(int i=0;i<=4;i++) microstep_mode(i,microstep_modes[i]);
1239 1248
   #endif
1240 1249
 }
@@ -1247,7 +1256,9 @@ void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2)
1247 1256
     case 1: digitalWrite( Y_MS1_PIN,ms1); break;
1248 1257
     case 2: digitalWrite( Z_MS1_PIN,ms1); break;
1249 1258
     case 3: digitalWrite(E0_MS1_PIN,ms1); break;
1259
+    #if defined(E1_MS1_PIN) && E1_MS1_PIN > -1
1250 1260
     case 4: digitalWrite(E1_MS1_PIN,ms1); break;
1261
+    #endif
1251 1262
   }
1252 1263
   if(ms2 > -1) switch(driver)
1253 1264
   {
@@ -1255,7 +1266,9 @@ void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2)
1255 1266
     case 1: digitalWrite( Y_MS2_PIN,ms2); break;
1256 1267
     case 2: digitalWrite( Z_MS2_PIN,ms2); break;
1257 1268
     case 3: digitalWrite(E0_MS2_PIN,ms2); break;
1269
+    #if defined(E1_MS2_PIN) && E1_MS2_PIN > -1
1258 1270
     case 4: digitalWrite(E1_MS2_PIN,ms2); break;
1271
+    #endif
1259 1272
   }
1260 1273
 }
1261 1274
 
@@ -1286,8 +1299,10 @@ void microstep_readings()
1286 1299
       SERIAL_PROTOCOLPGM("E0: ");
1287 1300
       SERIAL_PROTOCOL(   digitalRead(E0_MS1_PIN));
1288 1301
       SERIAL_PROTOCOLLN( digitalRead(E0_MS2_PIN));
1302
+      #if defined(E1_MS1_PIN) && E1_MS1_PIN > -1
1289 1303
       SERIAL_PROTOCOLPGM("E1: ");
1290 1304
       SERIAL_PROTOCOL(   digitalRead(E1_MS1_PIN));
1291 1305
       SERIAL_PROTOCOLLN( digitalRead(E1_MS2_PIN));
1306
+      #endif
1292 1307
 }
1293 1308
 

Loading…
Cancel
Save