Ver código fonte

Merge pull request #976 from cocktailyogi/SCARA_by_Yogi

Implemented SCARA-Maths
Erik van der Zalm 10 anos atrás
pai
commit
018b68a5c4

+ 7
- 1
Marlin/Configuration.h Ver arquivo

@@ -12,6 +12,13 @@
12 12
 // example_configurations/delta directory.
13 13
 //
14 14
 
15
+//===========================================================================
16
+//============================= SCARA Printer ===============================
17
+//===========================================================================
18
+// For a Delta printer replace the configuration files with the files in the
19
+// example_configurations/SCARA directory.
20
+//
21
+
15 22
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
16 23
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
17 24
 // build by the user have been successfully uploaded into firmware.
@@ -133,7 +140,6 @@
133 140
 // 1010 is Pt1000 with 1k pullup (non standard)
134 141
 // 147 is Pt100 with 4k7 pullup
135 142
 // 110 is Pt100 with 1k pullup (non standard)
136
-// 70 is 500C thermistor for Pico hot end
137 143
 
138 144
 #define TEMP_SENSOR_0 -1
139 145
 #define TEMP_SENSOR_1 -1

+ 29
- 5
Marlin/ConfigurationStore.cpp Ver arquivo

@@ -37,10 +37,15 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
37 37
 // the default values are used whenever there is a change to the data, to prevent
38 38
 // wrong data being written to the variables.
39 39
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
40
-#ifdef DELTA
41
-#define EEPROM_VERSION "V11"
42
-#else
40
+
43 41
 #define EEPROM_VERSION "V10"
42
+#ifdef DELTA
43
+	#undef EEPROM_VERSION
44
+	#define EEPROM_VERSION "V11"
45
+#endif
46
+#ifdef SCARA
47
+	#undef EEPROM_VERSION
48
+	#define EEPROM_VERSION "V12"
44 49
 #endif
45 50
 
46 51
 #ifdef EEPROM_SETTINGS
@@ -49,7 +54,7 @@ void Config_StoreSettings()
49 54
   char ver[4]= "000";
50 55
   int i=EEPROM_OFFSET;
51 56
   EEPROM_WRITE_VAR(i,ver); // invalidate data first 
52
-  EEPROM_WRITE_VAR(i,axis_steps_per_unit);  
57
+  EEPROM_WRITE_VAR(i,axis_steps_per_unit);
53 58
   EEPROM_WRITE_VAR(i,max_feedrate);  
54 59
   EEPROM_WRITE_VAR(i,max_acceleration_units_per_sq_second);
55 60
   EEPROM_WRITE_VAR(i,acceleration);
@@ -93,6 +98,9 @@ void Config_StoreSettings()
93 98
     int lcd_contrast = 32;
94 99
   #endif
95 100
   EEPROM_WRITE_VAR(i,lcd_contrast);
101
+  #ifdef SCARA
102
+  EEPROM_WRITE_VAR(i,axis_scaling);        // Add scaling for SCARA
103
+  #endif
96 104
   char ver2[4]=EEPROM_VERSION;
97 105
   i=EEPROM_OFFSET;
98 106
   EEPROM_WRITE_VAR(i,ver2); // validate data
@@ -115,6 +123,16 @@ void Config_PrintSettings()
115 123
     SERIAL_ECHOLN("");
116 124
       
117 125
     SERIAL_ECHO_START;
126
+#ifdef SCARA
127
+SERIAL_ECHOLNPGM("Scaling factors:");
128
+    SERIAL_ECHO_START;
129
+    SERIAL_ECHOPAIR("  M365 X",axis_scaling[0]);
130
+    SERIAL_ECHOPAIR(" Y",axis_scaling[1]);
131
+    SERIAL_ECHOPAIR(" Z",axis_scaling[2]);
132
+    SERIAL_ECHOLN("");
133
+      
134
+    SERIAL_ECHO_START;
135
+#endif
118 136
     SERIAL_ECHOLNPGM("Maximum feedrates (mm/s):");
119 137
     SERIAL_ECHO_START;
120 138
     SERIAL_ECHOPAIR("  M203 X",max_feedrate[0]);
@@ -196,7 +214,7 @@ void Config_RetrieveSettings()
196 214
     if (strncmp(ver,stored_ver,3) == 0)
197 215
     {
198 216
         // version number match
199
-        EEPROM_READ_VAR(i,axis_steps_per_unit);  
217
+        EEPROM_READ_VAR(i,axis_steps_per_unit);
200 218
         EEPROM_READ_VAR(i,max_feedrate);  
201 219
         EEPROM_READ_VAR(i,max_acceleration_units_per_sq_second);
202 220
         
@@ -240,6 +258,9 @@ void Config_RetrieveSettings()
240 258
         int lcd_contrast;
241 259
         #endif
242 260
         EEPROM_READ_VAR(i,lcd_contrast);
261
+		#ifdef SCARA
262
+		EEPROM_READ_VAR(i,axis_scaling);
263
+		#endif
243 264
 
244 265
 		// Call updatePID (similar to when we have processed M301)
245 266
 		updatePID();
@@ -266,6 +287,9 @@ void Config_ResetDefault()
266 287
         axis_steps_per_unit[i]=tmp1[i];  
267 288
         max_feedrate[i]=tmp2[i];  
268 289
         max_acceleration_units_per_sq_second[i]=tmp3[i];
290
+		#ifdef SCARA
291
+		axis_scaling[i]=1;
292
+		#endif
269 293
     }
270 294
     
271 295
     // steps per sq second need to be updated to agree with the units per sq second

+ 7
- 0
Marlin/Marlin.h Ver arquivo

@@ -178,6 +178,10 @@ void get_coordinates();
178 178
 void calculate_delta(float cartesian[3]);
179 179
 extern float delta[3];
180 180
 #endif
181
+#ifdef SCARA
182
+void calculate_delta(float cartesian[3]);
183
+void calculate_SCARA_forward_Transform(float f_scara[3]);
184
+#endif
181 185
 void prepare_move();
182 186
 void kill();
183 187
 void Stop();
@@ -215,6 +219,9 @@ extern float delta_diagonal_rod;
215 219
 extern float delta_segments_per_second;
216 220
 void recalc_delta_settings(float radius, float diagonal_rod);
217 221
 #endif
222
+#ifdef SCARA
223
+extern float axis_scaling[3];  // Build size scaling
224
+#endif
218 225
 extern float min_pos[3];
219 226
 extern float max_pos[3];
220 227
 extern bool axis_known_position[3];

+ 352
- 11
Marlin/Marlin_main.cpp Ver arquivo

@@ -172,6 +172,16 @@
172 172
 // M908 - Control digital trimpot directly.
173 173
 // M350 - Set microstepping mode.
174 174
 // M351 - Toggle MS1 MS2 pins directly.
175
+
176
+// ************ SCARA Specific - This can change to suit future G-code regulations
177
+// M360 - SCARA calibration: Move to cal-position ThetaA (0 deg calibration)
178
+// M361 - SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree)
179
+// M362 - SCARA calibration: Move to cal-position PsiA (0 deg calibration)
180
+// M363 - SCARA calibration: Move to cal-position PsiB (90 deg calibration - steps per degree)
181
+// M364 - SCARA calibration: Move to cal-position PSIC (90 deg to Theta calibration position)
182
+// M365 - SCARA calibration: Scaling factor, X, Y, Z axis
183
+//************* SCARA End ***************
184
+
175 185
 // M928 - Start SD logging (M928 filename.g) - ended by M29
176 186
 // M999 - Restart after being stopped by error
177 187
 
@@ -214,6 +224,7 @@ float add_homeing[3]={0,0,0};
214 224
 #ifdef DELTA
215 225
 float endstop_adj[3]={0,0,0};
216 226
 #endif
227
+
217 228
 float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
218 229
 float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
219 230
 bool axis_known_position[3] = {false, false, false};
@@ -294,7 +305,11 @@ int EtoPPressure=0;
294 305
   float delta_diagonal_rod= DELTA_DIAGONAL_ROD;
295 306
   float delta_diagonal_rod_2= sq(delta_diagonal_rod);
296 307
   float delta_segments_per_second= DELTA_SEGMENTS_PER_SECOND;
297
-#endif					
308
+#endif
309
+
310
+#ifdef SCARA                              // Build size scaling
311
+float axis_scaling[3]={1,1,1};  // Build size scaling, default to 1
312
+#endif				
298 313
 
299 314
 bool cancel_heatup = false ;
300 315
 
@@ -303,6 +318,7 @@ bool cancel_heatup = false ;
303 318
 //===========================================================================
304 319
 const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
305 320
 static float destination[NUM_AXIS] = {  0.0, 0.0, 0.0, 0.0};
321
+static float delta[3] = {0.0, 0.0, 0.0};
306 322
 static float offset[3] = {0.0, 0.0, 0.0};
307 323
 static bool home_all_axis = true;
308 324
 static float feedrate = 1500.0, next_feedrate, saved_feedrate;
@@ -876,9 +892,59 @@ static void axis_is_at_home(int axis) {
876 892
     }
877 893
   }
878 894
 #endif
895
+#ifdef SCARA
896
+   float homeposition[3];
897
+   char i;
898
+   
899
+   if (axis < 2)
900
+   {
901
+   
902
+     for (i=0; i<3; i++)
903
+     {
904
+        homeposition[i] = base_home_pos(i); 
905
+     }  
906
+	// SERIAL_ECHOPGM("homeposition[x]= "); SERIAL_ECHO(homeposition[0]);
907
+   //  SERIAL_ECHOPGM("homeposition[y]= "); SERIAL_ECHOLN(homeposition[1]);
908
+   // Works out real Homeposition angles using inverse kinematics, 
909
+   // and calculates homing offset using forward kinematics
910
+     calculate_delta(homeposition);
911
+     
912
+    // SERIAL_ECHOPGM("base Theta= "); SERIAL_ECHO(delta[X_AXIS]);
913
+    // SERIAL_ECHOPGM(" base Psi+Theta="); SERIAL_ECHOLN(delta[Y_AXIS]);
914
+     
915
+     for (i=0; i<2; i++)
916
+     {
917
+        delta[i] -= add_homeing[i];
918
+     } 
919
+     
920
+    // SERIAL_ECHOPGM("addhome X="); SERIAL_ECHO(add_homeing[X_AXIS]);
921
+	// SERIAL_ECHOPGM(" addhome Y="); SERIAL_ECHO(add_homeing[Y_AXIS]);
922
+    // SERIAL_ECHOPGM(" addhome Theta="); SERIAL_ECHO(delta[X_AXIS]);
923
+    // SERIAL_ECHOPGM(" addhome Psi+Theta="); SERIAL_ECHOLN(delta[Y_AXIS]);
924
+      
925
+     calculate_SCARA_forward_Transform(delta);
926
+     
927
+    // SERIAL_ECHOPGM("Delta X="); SERIAL_ECHO(delta[X_AXIS]);
928
+    // SERIAL_ECHOPGM(" Delta Y="); SERIAL_ECHOLN(delta[Y_AXIS]);
929
+     
930
+    current_position[axis] = delta[axis];
931
+    
932
+    // SCARA home positions are based on configuration since the actual limits are determined by the 
933
+    // inverse kinematic transform.
934
+    min_pos[axis] =          base_min_pos(axis); // + (delta[axis] - base_home_pos(axis));
935
+    max_pos[axis] =          base_max_pos(axis); // + (delta[axis] - base_home_pos(axis));
936
+   } 
937
+   else
938
+   {
939
+      current_position[axis] = base_home_pos(axis) + add_homeing[axis];
940
+      min_pos[axis] =          base_min_pos(axis) + add_homeing[axis];
941
+      max_pos[axis] =          base_max_pos(axis) + add_homeing[axis];
942
+   }
943
+#else
879 944
   current_position[axis] = base_home_pos(axis) + add_homeing[axis];
880 945
   min_pos[axis] =          base_min_pos(axis) + add_homeing[axis];
881 946
   max_pos[axis] =          base_max_pos(axis) + add_homeing[axis];
947
+#endif
882 948
 }
883 949
 
884 950
 #ifdef ENABLE_AUTO_BED_LEVELING
@@ -1142,6 +1208,7 @@ static void homeaxis(int axis) {
1142 1208
   }
1143 1209
 }
1144 1210
 #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
1211
+
1145 1212
 void refresh_cmd_timeout(void)
1146 1213
 {
1147 1214
   previous_millis_cmd = millis();
@@ -1269,6 +1336,7 @@ void process_commands()
1269 1336
         return;
1270 1337
       }
1271 1338
       break;
1339
+#ifndef SCARA //disable arc support
1272 1340
     case 2: // G2  - CW ARC
1273 1341
       if(Stopped == false) {
1274 1342
         get_arc_coordinates();
@@ -1283,6 +1351,7 @@ void process_commands()
1283 1351
         return;
1284 1352
       }
1285 1353
       break;
1354
+#endif
1286 1355
     case 4: // G4 dwell
1287 1356
       LCD_MESSAGEPGM(MSG_DWELL);
1288 1357
       codenum = 0;
@@ -1361,12 +1430,12 @@ void process_commands()
1361 1430
           HOMEAXIS(Z);
1362 1431
 
1363 1432
           calculate_delta(current_position);
1364
-          plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1365
-
1433
+          plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);		  
1434
+		  
1366 1435
 #else // NOT DELTA
1367 1436
 
1368 1437
       home_all_axis = !((code_seen(axis_codes[X_AXIS])) || (code_seen(axis_codes[Y_AXIS])) || (code_seen(axis_codes[Z_AXIS])));
1369
-
1438
+	  
1370 1439
       #if Z_HOME_DIR > 0                      // If homing away from BED do Z first
1371 1440
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
1372 1441
         HOMEAXIS(Z);
@@ -1410,7 +1479,9 @@ void process_commands()
1410 1479
 
1411 1480
         current_position[X_AXIS] = destination[X_AXIS];
1412 1481
         current_position[Y_AXIS] = destination[Y_AXIS];
1482
+		#ifndef SCARA
1413 1483
         current_position[Z_AXIS] = destination[Z_AXIS];
1484
+		#endif
1414 1485
       }
1415 1486
       #endif
1416 1487
 
@@ -1440,13 +1511,21 @@ void process_commands()
1440 1511
       if(code_seen(axis_codes[X_AXIS]))
1441 1512
       {
1442 1513
         if(code_value_long() != 0) {
1443
-          current_position[X_AXIS]=code_value()+add_homeing[0];
1514
+		#ifdef SCARA
1515
+		   current_position[X_AXIS]=code_value();
1516
+		#else
1517
+		   current_position[X_AXIS]=code_value()+add_homeing[0];
1518
+		#endif
1444 1519
         }
1445 1520
       }
1446 1521
 
1447 1522
       if(code_seen(axis_codes[Y_AXIS])) {
1448 1523
         if(code_value_long() != 0) {
1449
-          current_position[Y_AXIS]=code_value()+add_homeing[1];
1524
+         #ifdef SCARA
1525
+		   current_position[Y_AXIS]=code_value();
1526
+		#else
1527
+		   current_position[Y_AXIS]=code_value()+add_homeing[1];
1528
+		#endif
1450 1529
         }
1451 1530
       }
1452 1531
 
@@ -1521,6 +1600,11 @@ void process_commands()
1521 1600
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1522 1601
 #endif // else DELTA
1523 1602
 
1603
+#ifdef SCARA
1604
+	  calculate_delta(current_position);
1605
+      plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1606
+#endif SCARA
1607
+
1524 1608
       #ifdef ENDSTOPS_ONLY_FOR_HOMING
1525 1609
         enable_endstops(false);
1526 1610
       #endif
@@ -1729,8 +1813,17 @@ void process_commands()
1729 1813
              plan_set_e_position(current_position[E_AXIS]);
1730 1814
            }
1731 1815
            else {
1732
-             current_position[i] = code_value()+add_homeing[i];
1733
-             plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1816
+#ifdef SCARA
1817
+		if (i == X_AXIS || i == Y_AXIS) {
1818
+                	current_position[i] = code_value();  
1819
+		}
1820
+		else {
1821
+                current_position[i] = code_value()+add_homeing[i];  
1822
+            	}  
1823
+#else
1824
+		current_position[i] = code_value()+add_homeing[i];
1825
+#endif
1826
+            plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1734 1827
            }
1735 1828
         }
1736 1829
       }
@@ -2597,6 +2690,26 @@ Sigma_Exit:
2597 2690
       SERIAL_PROTOCOL(float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]);
2598 2691
 
2599 2692
       SERIAL_PROTOCOLLN("");
2693
+#ifdef SCARA
2694
+	  SERIAL_PROTOCOLPGM("SCARA Theta:");
2695
+      SERIAL_PROTOCOL(delta[X_AXIS]);
2696
+      SERIAL_PROTOCOLPGM("   Psi+Theta:");
2697
+      SERIAL_PROTOCOL(delta[Y_AXIS]);
2698
+      SERIAL_PROTOCOLLN("");
2699
+      
2700
+      SERIAL_PROTOCOLPGM("SCARA Cal - Theta:");
2701
+      SERIAL_PROTOCOL(delta[X_AXIS]+add_homeing[0]);
2702
+      SERIAL_PROTOCOLPGM("   Psi+Theta (90):");
2703
+      SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+add_homeing[1]);
2704
+      SERIAL_PROTOCOLLN("");
2705
+      
2706
+      SERIAL_PROTOCOLPGM("SCARA step Cal - Theta:");
2707
+      SERIAL_PROTOCOL(delta[X_AXIS]/90*axis_steps_per_unit[X_AXIS]);
2708
+      SERIAL_PROTOCOLPGM("   Psi+Theta:");
2709
+      SERIAL_PROTOCOL((delta[Y_AXIS]-delta[X_AXIS])/90*axis_steps_per_unit[Y_AXIS]);
2710
+      SERIAL_PROTOCOLLN("");
2711
+      SERIAL_PROTOCOLLN("");
2712
+#endif
2600 2713
       break;
2601 2714
     case 120: // M120
2602 2715
       enable_endstops(false) ;
@@ -2718,6 +2831,16 @@ Sigma_Exit:
2718 2831
       {
2719 2832
         if(code_seen(axis_codes[i])) add_homeing[i] = code_value();
2720 2833
       }
2834
+	  #ifdef SCARA
2835
+	   if(code_seen('T'))       // Theta
2836
+      {
2837
+        add_homeing[0] = code_value() ;
2838
+      }
2839
+      if(code_seen('P'))       // Psi
2840
+      {
2841
+        add_homeing[1] = code_value() ;
2842
+      }
2843
+	  #endif
2721 2844
       break;
2722 2845
     #ifdef DELTA
2723 2846
 	case 665: // M665 set delta configurations L<diagonal_rod> R<delta_radius> S<segments_per_sec>
@@ -3096,6 +3219,105 @@ Sigma_Exit:
3096 3219
       PID_autotune(temp, e, c);
3097 3220
     }
3098 3221
     break;
3222
+	#ifdef SCARA
3223
+	case 360:  // M360 SCARA Theta pos1
3224
+      SERIAL_ECHOLN(" Cal: Theta 0 ");
3225
+      //SoftEndsEnabled = false;              // Ignore soft endstops during calibration
3226
+      //SERIAL_ECHOLN(" Soft endstops disabled ");
3227
+      if(Stopped == false) {
3228
+        //get_coordinates(); // For X Y Z E F
3229
+        delta[0] = 0;
3230
+        delta[1] = 120;
3231
+        calculate_SCARA_forward_Transform(delta);
3232
+        destination[0] = delta[0]/axis_scaling[X_AXIS];
3233
+        destination[1] = delta[1]/axis_scaling[Y_AXIS];
3234
+        
3235
+        prepare_move();
3236
+        //ClearToSend();
3237
+        return;
3238
+      }
3239
+    break;
3240
+
3241
+    case 361:  // SCARA Theta pos2
3242
+      SERIAL_ECHOLN(" Cal: Theta 90 ");
3243
+      //SoftEndsEnabled = false;              // Ignore soft endstops during calibration
3244
+      //SERIAL_ECHOLN(" Soft endstops disabled ");
3245
+      if(Stopped == false) {
3246
+        //get_coordinates(); // For X Y Z E F
3247
+        delta[0] = 90;
3248
+        delta[1] = 130;
3249
+        calculate_SCARA_forward_Transform(delta);
3250
+        destination[0] = delta[0]/axis_scaling[X_AXIS];
3251
+        destination[1] = delta[1]/axis_scaling[Y_AXIS];
3252
+        
3253
+        prepare_move();
3254
+        //ClearToSend();
3255
+        return;
3256
+      }
3257
+    break;
3258
+    case 362:  // SCARA Psi pos1
3259
+      SERIAL_ECHOLN(" Cal: Psi 0 ");
3260
+      //SoftEndsEnabled = false;              // Ignore soft endstops during calibration
3261
+      //SERIAL_ECHOLN(" Soft endstops disabled ");
3262
+      if(Stopped == false) {
3263
+        //get_coordinates(); // For X Y Z E F
3264
+        delta[0] = 60;
3265
+        delta[1] = 180;
3266
+        calculate_SCARA_forward_Transform(delta);
3267
+        destination[0] = delta[0]/axis_scaling[X_AXIS];
3268
+        destination[1] = delta[1]/axis_scaling[Y_AXIS];
3269
+        
3270
+        prepare_move();
3271
+        //ClearToSend();
3272
+        return;
3273
+      }
3274
+    break;
3275
+    case 363:  // SCARA Psi pos2
3276
+      SERIAL_ECHOLN(" Cal: Psi 90 ");
3277
+      //SoftEndsEnabled = false;              // Ignore soft endstops during calibration
3278
+      //SERIAL_ECHOLN(" Soft endstops disabled ");
3279
+      if(Stopped == false) {
3280
+        //get_coordinates(); // For X Y Z E F
3281
+        delta[0] = 50;
3282
+        delta[1] = 90;
3283
+        calculate_SCARA_forward_Transform(delta);
3284
+        destination[0] = delta[0]/axis_scaling[X_AXIS];
3285
+        destination[1] = delta[1]/axis_scaling[Y_AXIS];
3286
+        
3287
+        prepare_move();
3288
+        //ClearToSend();
3289
+        return;
3290
+      }
3291
+    break;
3292
+    case 364:  // SCARA Psi pos3 (90 deg to Theta)
3293
+      SERIAL_ECHOLN(" Cal: Theta-Psi 90 ");
3294
+     // SoftEndsEnabled = false;              // Ignore soft endstops during calibration
3295
+      //SERIAL_ECHOLN(" Soft endstops disabled ");
3296
+      if(Stopped == false) {
3297
+        //get_coordinates(); // For X Y Z E F
3298
+        delta[0] = 45;
3299
+        delta[1] = 135;
3300
+        calculate_SCARA_forward_Transform(delta);
3301
+        destination[0] = delta[0]/axis_scaling[X_AXIS];
3302
+        destination[1] = delta[1]/axis_scaling[Y_AXIS]; 
3303
+        
3304
+        prepare_move();
3305
+        //ClearToSend();
3306
+        return;
3307
+      }
3308
+    break;
3309
+    case 365: // M364  Set SCARA scaling for X Y Z
3310
+      for(int8_t i=0; i < 3; i++) 
3311
+      {
3312
+        if(code_seen(axis_codes[i])) 
3313
+        {
3314
+          
3315
+            axis_scaling[i] = code_value();
3316
+          
3317
+        }
3318
+      }
3319
+      break;
3320
+	#endif
3099 3321
     case 400: // M400 finish all moves
3100 3322
     {
3101 3323
       st_synchronize();
@@ -3658,8 +3880,46 @@ void calculate_delta(float cartesian[3])
3658 3880
 void prepare_move()
3659 3881
 {
3660 3882
   clamp_to_software_endstops(destination);
3661
-
3662 3883
   previous_millis_cmd = millis();
3884
+  
3885
+  #ifdef SCARA //for now same as delta-code
3886
+
3887
+float difference[NUM_AXIS];
3888
+for (int8_t i=0; i < NUM_AXIS; i++) {
3889
+	difference[i] = destination[i] - current_position[i];
3890
+}
3891
+
3892
+float cartesian_mm = sqrt(	sq(difference[X_AXIS]) +
3893
+							sq(difference[Y_AXIS]) +
3894
+							sq(difference[Z_AXIS]));
3895
+if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); }
3896
+if (cartesian_mm < 0.000001) { return; }
3897
+float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
3898
+int steps = max(1, int(scara_segments_per_second * seconds));
3899
+ //SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
3900
+ //SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
3901
+ //SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps);
3902
+for (int s = 1; s <= steps; s++) {
3903
+	float fraction = float(s) / float(steps);
3904
+	for(int8_t i=0; i < NUM_AXIS; i++) {
3905
+		destination[i] = current_position[i] + difference[i] * fraction;
3906
+	}
3907
+
3908
+	
3909
+	calculate_delta(destination);
3910
+         //SERIAL_ECHOPGM("destination[0]="); SERIAL_ECHOLN(destination[0]);
3911
+         //SERIAL_ECHOPGM("destination[1]="); SERIAL_ECHOLN(destination[1]);
3912
+         //SERIAL_ECHOPGM("destination[2]="); SERIAL_ECHOLN(destination[2]);
3913
+         //SERIAL_ECHOPGM("delta[X_AXIS]="); SERIAL_ECHOLN(delta[X_AXIS]);
3914
+         //SERIAL_ECHOPGM("delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]);
3915
+         //SERIAL_ECHOPGM("delta[Z_AXIS]="); SERIAL_ECHOLN(delta[Z_AXIS]);
3916
+         
3917
+	plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],
3918
+	destination[E_AXIS], feedrate*feedmultiply/60/100.0,
3919
+	active_extruder);
3920
+}
3921
+#endif // SCARA
3922
+  
3663 3923
 #ifdef DELTA
3664 3924
   float difference[NUM_AXIS];
3665 3925
   for (int8_t i=0; i < NUM_AXIS; i++) {
@@ -3685,7 +3945,8 @@ void prepare_move()
3685 3945
                      destination[E_AXIS], feedrate*feedmultiply/60/100.0,
3686 3946
                      active_extruder);
3687 3947
   }
3688
-#else
3948
+  
3949
+#endif // DELTA
3689 3950
 
3690 3951
 #ifdef DUAL_X_CARRIAGE
3691 3952
   if (active_extruder_parked)
@@ -3728,6 +3989,7 @@ void prepare_move()
3728 3989
   }
3729 3990
 #endif //DUAL_X_CARRIAGE
3730 3991
 
3992
+#if ! (defined DELTA || defined SCARA)
3731 3993
   // Do not use feedmultiply for E or Z only moves
3732 3994
   if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
3733 3995
       plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
@@ -3735,7 +3997,8 @@ void prepare_move()
3735 3997
   else {
3736 3998
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
3737 3999
   }
3738
-#endif //else DELTA
4000
+#endif // !(DELTA || SCARA)
4001
+
3739 4002
   for(int8_t i=0; i < NUM_AXIS; i++) {
3740 4003
     current_position[i] = destination[i];
3741 4004
   }
@@ -3803,6 +4066,84 @@ void controllerFan()
3803 4066
 }
3804 4067
 #endif
3805 4068
 
4069
+#ifdef SCARA
4070
+void calculate_SCARA_forward_Transform(float f_scara[3])
4071
+{
4072
+  // Perform forward kinematics, and place results in delta[3]
4073
+  // The maths and first version has been done by QHARLEY . Integrated into masterbranch 06/2014 and slightly restructured by Joachim Cerny in June 2014
4074
+  
4075
+  float x_sin, x_cos, y_sin, y_cos;
4076
+  
4077
+    //SERIAL_ECHOPGM("f_delta x="); SERIAL_ECHO(f_scara[X_AXIS]);
4078
+    //SERIAL_ECHOPGM(" y="); SERIAL_ECHO(f_scara[Y_AXIS]);
4079
+  
4080
+    x_sin = sin(f_scara[X_AXIS]/SCARA_RAD2DEG) * Linkage_1;
4081
+    x_cos = cos(f_scara[X_AXIS]/SCARA_RAD2DEG) * Linkage_1;
4082
+    y_sin = sin(f_scara[Y_AXIS]/SCARA_RAD2DEG) * Linkage_2;
4083
+    y_cos = cos(f_scara[Y_AXIS]/SCARA_RAD2DEG) * Linkage_2;
4084
+   
4085
+  //  SERIAL_ECHOPGM(" x_sin="); SERIAL_ECHO(x_sin);
4086
+  //  SERIAL_ECHOPGM(" x_cos="); SERIAL_ECHO(x_cos);
4087
+  //  SERIAL_ECHOPGM(" y_sin="); SERIAL_ECHO(y_sin);
4088
+  //  SERIAL_ECHOPGM(" y_cos="); SERIAL_ECHOLN(y_cos);
4089
+  
4090
+    delta[X_AXIS] = x_cos + y_cos + SCARA_offset_x;  //theta
4091
+    delta[Y_AXIS] = x_sin + y_sin + SCARA_offset_y;  //theta+phi
4092
+	
4093
+    //SERIAL_ECHOPGM(" delta[X_AXIS]="); SERIAL_ECHO(delta[X_AXIS]);
4094
+    //SERIAL_ECHOPGM(" delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]);
4095
+}  
4096
+
4097
+void calculate_delta(float cartesian[3]){
4098
+  //reverse kinematics.
4099
+  // Perform reversed kinematics, and place results in delta[3]
4100
+  // The maths and first version has been done by QHARLEY . Integrated into masterbranch 06/2014 and slightly restructured by Joachim Cerny in June 2014
4101
+  
4102
+  float SCARA_pos[2];
4103
+  static float SCARA_C2, SCARA_S2, SCARA_K1, SCARA_K2, SCARA_theta, SCARA_psi; 
4104
+  
4105
+  SCARA_pos[X_AXIS] = cartesian[X_AXIS] * axis_scaling[X_AXIS] - SCARA_offset_x;  //Translate SCARA to standard X Y
4106
+  SCARA_pos[Y_AXIS] = cartesian[Y_AXIS] * axis_scaling[Y_AXIS] - SCARA_offset_y;  // With scaling factor.
4107
+  
4108
+  #if (Linkage_1 == Linkage_2)
4109
+    SCARA_C2 = ( ( sq(SCARA_pos[X_AXIS]) + sq(SCARA_pos[Y_AXIS]) ) / (2 * (float)L1_2) ) - 1;
4110
+  #else
4111
+    SCARA_C2 =   ( sq(SCARA_pos[X_AXIS]) + sq(SCARA_pos[Y_AXIS]) - (float)L1_2 - (float)L2_2 ) / 45000; 
4112
+  #endif
4113
+  
4114
+  SCARA_S2 = sqrt( 1 - sq(SCARA_C2) );
4115
+  
4116
+  SCARA_K1 = Linkage_1 + Linkage_2 * SCARA_C2;
4117
+  SCARA_K2 = Linkage_2 * SCARA_S2;
4118
+  
4119
+  SCARA_theta = ( atan2(SCARA_pos[X_AXIS],SCARA_pos[Y_AXIS])-atan2(SCARA_K1, SCARA_K2) ) * -1;
4120
+  SCARA_psi   =   atan2(SCARA_S2,SCARA_C2);
4121
+  
4122
+  delta[X_AXIS] = SCARA_theta * SCARA_RAD2DEG;  // Multiply by 180/Pi  -  theta is support arm angle
4123
+  delta[Y_AXIS] = (SCARA_theta + SCARA_psi) * SCARA_RAD2DEG;  //       -  equal to sub arm angle (inverted motor)
4124
+  delta[Z_AXIS] = cartesian[Z_AXIS];
4125
+  
4126
+  /*
4127
+  SERIAL_ECHOPGM("cartesian x="); SERIAL_ECHO(cartesian[X_AXIS]);
4128
+  SERIAL_ECHOPGM(" y="); SERIAL_ECHO(cartesian[Y_AXIS]);
4129
+  SERIAL_ECHOPGM(" z="); SERIAL_ECHOLN(cartesian[Z_AXIS]);
4130
+  
4131
+  SERIAL_ECHOPGM("scara x="); SERIAL_ECHO(SCARA_pos[X_AXIS]);
4132
+  SERIAL_ECHOPGM(" y="); SERIAL_ECHOLN(SCARA_pos[Y_AXIS]);
4133
+  
4134
+  SERIAL_ECHOPGM("delta x="); SERIAL_ECHO(delta[X_AXIS]);
4135
+  SERIAL_ECHOPGM(" y="); SERIAL_ECHO(delta[Y_AXIS]);
4136
+  SERIAL_ECHOPGM(" z="); SERIAL_ECHOLN(delta[Z_AXIS]);
4137
+  
4138
+  SERIAL_ECHOPGM("C2="); SERIAL_ECHO(SCARA_C2);
4139
+  SERIAL_ECHOPGM(" S2="); SERIAL_ECHO(SCARA_S2);
4140
+  SERIAL_ECHOPGM(" Theta="); SERIAL_ECHO(SCARA_theta);
4141
+  SERIAL_ECHOPGM(" Psi="); SERIAL_ECHOLN(SCARA_psi);
4142
+  SERIAL_ECHOLN(" ");*/
4143
+}
4144
+
4145
+#endif
4146
+
3806 4147
 #ifdef TEMP_STAT_LEDS
3807 4148
 static bool blue_led = false;
3808 4149
 static bool red_led = false;

+ 802
- 0
Marlin/example_configurations/SCARA/Configuration.h Ver arquivo

@@ -0,0 +1,802 @@
1
+#ifndef CONFIGURATION_H
2
+#define CONFIGURATION_H
3
+
4
+// This configuration file contains the basic settings.
5
+// Advanced settings can be found in Configuration_adv.h
6
+// BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration
7
+
8
+//===========================================================================
9
+//========================= SCARA Settings ==================================
10
+//===========================================================================
11
+// SCARA-mode for Marlin has been developed by QHARLEY in ZA in 2012/2013. Implemented
12
+// and slightly reworked by JCERNY in 06/2014 with the goal to bring it into Master-Branch
13
+// QHARLEYS Autobedlevelling has not been ported, because Marlin has now Bed-levelling
14
+// You might need Z-Min endstop on SCARA-Printer to use this feature. Actually untested!
15
+// Uncomment to use Morgan scara mode
16
+#define SCARA  
17
+#define scara_segments_per_second 200 //careful, two much will decrease performance...
18
+// Length of inner support arm
19
+#define Linkage_1 150 //mm      Preprocessor cannot handle decimal point...
20
+// Length of outer support arm     Measure arm lengths precisely and enter 
21
+#define Linkage_2 150 //mm    
22
+
23
+// SCARA tower offset (position of Tower relative to bed zero position) 
24
+// This needs to be reasonably accurate as it defines the printbed position in the SCARA space.
25
+#define SCARA_offset_x 100 //mm   
26
+#define SCARA_offset_y -56 //mm
27
+#define SCARA_RAD2DEG 57.2957795  // to convert RAD to degrees
28
+
29
+#define THETA_HOMING_OFFSET 0	//calculatated from Calibration Guide and command M360 / M114 see picture in http://reprap.harleystudio.co.za/?page_id=1073
30
+#define PSI_HOMING_OFFSET 0  // calculatated from Calibration Guide and command M364 / M114 see picture in http://reprap.harleystudio.co.za/?page_id=1073
31
+
32
+//some helper variables to make kinematics faster
33
+#define L1_2 sq(Linkage_1) // do not change
34
+#define L2_2 sq(Linkage_2) // do not change
35
+
36
+//===========================================================================
37
+//========================= SCARA Settings end ==================================
38
+//===========================================================================
39
+
40
+// User-specified version info of this build to display in [Pronterface, etc] terminal window during
41
+// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
42
+// build by the user have been successfully uploaded into firmware.
43
+#define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
44
+#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
45
+
46
+// SERIAL_PORT selects which serial port should be used for communication with the host.
47
+// This allows the connection of wireless adapters (for instance) to non-default port pins.
48
+// Serial port 0 is still used by the Arduino bootloader regardless of this setting.
49
+#define SERIAL_PORT 0
50
+
51
+// This determines the communication speed of the printer
52
+// This determines the communication speed of the printer
53
+#define BAUDRATE 250000
54
+
55
+// This enables the serial port associated to the Bluetooth interface
56
+//#define BTENABLED              // Enable BT interface on AT90USB devices
57
+
58
+
59
+//// The following define selects which electronics board you have. Please choose the one that matches your setup
60
+// 10 = Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics"
61
+// 11 = Gen7 v1.1, v1.2 = 11
62
+// 12 = Gen7 v1.3
63
+// 13 = Gen7 v1.4
64
+// 131 = OpenHardware.co.za custom Gen7 electronics
65
+// 2  = Cheaptronic v1.0
66
+// 20 = Sethi 3D_1
67
+// 3  = MEGA/RAMPS up to 1.2 = 3
68
+// 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed)
69
+// 34 = RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed)
70
+// 35 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Fan)
71
+// 4  = Duemilanove w/ ATMega328P pin assignment
72
+// 5  = Gen6
73
+// 51 = Gen6 deluxe
74
+// 6  = Sanguinololu < 1.2
75
+// 62 = Sanguinololu 1.2 and above
76
+// 63 = Melzi
77
+// 64 = STB V1.1
78
+// 65 = Azteeg X1
79
+// 66 = Melzi with ATmega1284 (MaKr3d version)
80
+// 67 = Azteeg X3
81
+// 68 = Azteeg X3 Pro
82
+// 7  = Ultimaker
83
+// 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
84
+// 72 = Ultimainboard 2.x (Uses TEMP_SENSOR 20)
85
+// 77 = 3Drag Controller
86
+// 8  = Teensylu
87
+// 80 = Rumba
88
+// 81 = Printrboard (AT90USB1286)
89
+// 82 = Brainwave (AT90USB646)
90
+// 83 = SAV Mk-I (AT90USB1286)
91
+// 84 = Teensy++2.0 (AT90USB1286) // CLI compile: DEFINES=AT90USBxx_TEENSYPP_ASSIGNMENTS HARDWARE_MOTHERBOARD=84  make
92
+// 9  = Gen3+
93
+// 70 = Megatronics
94
+// 701= Megatronics v2.0
95
+// 702= Minitronics v1.0
96
+// 90 = Alpha OMCA board
97
+// 91 = Final OMCA board
98
+// 301= Rambo
99
+// 21 = Elefu Ra Board (v3)
100
+// 88 = 5DPrint D8 Driver Board
101
+
102
+#ifndef MOTHERBOARD
103
+#define MOTHERBOARD 33
104
+#endif
105
+
106
+// Define this to set a custom name for your generic Mendel,
107
+// #define CUSTOM_MENDEL_NAME "This Mendel"
108
+
109
+// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines)
110
+// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4)
111
+// #define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
112
+
113
+// This defines the number of extruders
114
+#define EXTRUDERS 1
115
+
116
+//// The following define selects which power supply you have. Please choose the one that matches your setup
117
+// 1 = ATX
118
+// 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC)
119
+
120
+#define POWER_SUPPLY 1
121
+
122
+// Define this to have the electronics keep the power supply off on startup. If you don't know what this is leave it.
123
+// #define PS_DEFAULT_OFF
124
+
125
+//===========================================================================
126
+//=============================Thermal Settings  ============================
127
+//===========================================================================
128
+//
129
+//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table
130
+//
131
+//// Temperature sensor settings:
132
+// -2 is thermocouple with MAX6675 (only for sensor 0)
133
+// -1 is thermocouple with AD595
134
+// 0 is not used
135
+// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
136
+// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
137
+// 3 is Mendel-parts thermistor (4.7k pullup)
138
+// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
139
+// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup)
140
+// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup)
141
+// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup)
142
+// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup)
143
+// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
144
+// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
145
+// 10 is 100k RS thermistor 198-961 (4.7k pullup)
146
+// 11 is 100k beta 3950 1% thermistor (4.7k pullup)
147
+// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
148
+// 20 is the PT100 circuit found in the Ultimainboard V2.x
149
+// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
150
+//
151
+//    1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k
152
+//                          (but gives greater accuracy and more stable PID)
153
+// 51 is 100k thermistor - EPCOS (1k pullup)
154
+// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
155
+// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup)
156
+//
157
+// 1047 is Pt1000 with 4k7 pullup
158
+// 1010 is Pt1000 with 1k pullup (non standard)
159
+// 147 is Pt100 with 4k7 pullup
160
+// 110 is Pt100 with 1k pullup (non standard)
161
+
162
+#define TEMP_SENSOR_0 1
163
+#define TEMP_SENSOR_1 0
164
+#define TEMP_SENSOR_2 0
165
+#define TEMP_SENSOR_BED 1
166
+
167
+// This makes temp sensor 1 a redundant sensor for sensor 0. If the temperatures difference between these sensors is to high the print will be aborted.
168
+//#define TEMP_SENSOR_1_AS_REDUNDANT
169
+#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10
170
+
171
+// Actual temperature must be close to target for this long before M109 returns success
172
+#define TEMP_RESIDENCY_TIME 3  // (seconds)
173
+#define TEMP_HYSTERESIS 2       // (degC) range of +/- temperatures considered "close" to the target one
174
+#define TEMP_WINDOW     1       // (degC) Window around target to start the residency timer x degC early.
175
+
176
+// The minimal temperature defines the temperature below which the heater will not be enabled It is used
177
+// to check that the wiring to the thermistor is not broken.
178
+// Otherwise this would lead to the heater being powered on all the time.
179
+#define HEATER_0_MINTEMP 5
180
+#define HEATER_1_MINTEMP 5
181
+#define HEATER_2_MINTEMP 5
182
+#define BED_MINTEMP 5
183
+
184
+// When temperature exceeds max temp, your heater will be switched off.
185
+// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
186
+// You should use MINTEMP for thermistor short/failure protection.
187
+#define HEATER_0_MAXTEMP 275
188
+#define HEATER_1_MAXTEMP 275
189
+#define HEATER_2_MAXTEMP 275
190
+#define BED_MAXTEMP 150
191
+
192
+// If your bed has low resistance e.g. .6 ohm and throws the fuse you can duty cycle it to reduce the
193
+// average current. The value should be an integer and the heat bed will be turned on for 1 interval of
194
+// HEATER_BED_DUTY_CYCLE_DIVIDER intervals.
195
+//#define HEATER_BED_DUTY_CYCLE_DIVIDER 4
196
+
197
+// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
198
+#define EXTRUDER_WATTS (2*2/5.9) //  P=I^2/R
199
+#define BED_WATTS (5.45*5.45/2.2)      // P=I^2/R
200
+
201
+// PID settings:
202
+// Comment the following line to disable PID and enable bang-bang.
203
+#define PIDTEMP
204
+#define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
205
+#define PID_MAX 255 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
206
+#ifdef PIDTEMP
207
+  //#define PID_DEBUG // Sends debug data to the serial port.
208
+  //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
209
+  #define PID_FUNCTIONAL_RANGE 20 // If the temperature difference between the target temperature and the actual temperature
210
+                                  // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
211
+  #define PID_INTEGRAL_DRIVE_MAX 255  //limit for the integral term
212
+  #define K1 0.95 //smoothing factor within the PID
213
+  #define PID_dT ((OVERSAMPLENR * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
214
+
215
+// If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
216
+// Ultimaker
217
+  //  #define  DEFAULT_Kp 22.2
218
+  //  #define  DEFAULT_Ki 1.08
219
+   // #define  DEFAULT_Kd 114
220
+  
221
+ // Jhead MK5: From Autotune  
222
+  //  #define  DEFAULT_Kp 20.92
223
+   // #define  DEFAULT_Ki 1.51
224
+  //  #define  DEFAULT_Kd 72.34
225
+    
226
+ //Merlin Hotend: From Autotune  
227
+    #define  DEFAULT_Kp 24.5
228
+    #define  DEFAULT_Ki 1.72
229
+    #define  DEFAULT_Kd 87.73
230
+
231
+// MakerGear
232
+//    #define  DEFAULT_Kp 7.0
233
+//    #define  DEFAULT_Ki 0.1
234
+//    #define  DEFAULT_Kd 12
235
+
236
+// Mendel Parts V9 on 12V
237
+  //  #define  DEFAULT_Kp 63.0
238
+   // #define  DEFAULT_Ki 2.25
239
+   // #define  DEFAULT_Kd 440
240
+#endif // PIDTEMP
241
+
242
+// Bed Temperature Control
243
+// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
244
+//
245
+// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder.
246
+// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
247
+// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating.
248
+// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater.
249
+// If your configuration is significantly different than this and you don't understand the issues involved, you probably
250
+// shouldn't use bed PID until someone else verifies your hardware works.
251
+// If this is enabled, find your own PID constants below.
252
+#define PIDTEMPBED
253
+//
254
+#define BED_LIMIT_SWITCHING
255
+
256
+// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option.
257
+// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis)
258
+// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did,
259
+// so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
260
+#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
261
+
262
+#ifdef PIDTEMPBED
263
+//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
264
+//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
265
+  //  #define  DEFAULT_bedKp 10.00
266
+  //  #define  DEFAULT_bedKi .023
267
+  //  #define  DEFAULT_bedKd 305.4
268
+
269
+//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
270
+//from pidautotune
271
+//    #define  DEFAULT_bedKp 97.1
272
+//    #define  DEFAULT_bedKi 1.41
273
+//    #define  DEFAULT_bedKd 1675.16
274
+
275
+//12v Heatbed Mk3 12V in parallel
276
+//from pidautotune
277
+    #define  DEFAULT_bedKp 630.14
278
+    #define  DEFAULT_bedKi 121.71
279
+    #define  DEFAULT_bedKd 815.64
280
+    
281
+// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
282
+#endif // PIDTEMPBED
283
+
284
+
285
+
286
+//this prevents dangerous Extruder moves, i.e. if the temperature is under the limit
287
+//can be software-disabled for whatever purposes by
288
+//#define PREVENT_DANGEROUS_EXTRUDE
289
+//if PREVENT_DANGEROUS_EXTRUDE is on, you can still disable (uncomment) very long bits of extrusion separately.
290
+#define PREVENT_LENGTHY_EXTRUDE
291
+
292
+#define EXTRUDE_MINTEMP 150
293
+#define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.
294
+
295
+/*================== Thermal Runaway Protection ==============================
296
+This is a feature to protect your printer from burn up in flames if it has
297
+a thermistor coming off place (this happened to a friend of mine recently and
298
+motivated me writing this feature).
299
+
300
+The issue: If a thermistor come off, it will read a lower temperature than actual.
301
+The system will turn the heater on forever, burning up the filament and anything
302
+else around.
303
+
304
+After the temperature reaches the target for the first time, this feature will 
305
+start measuring for how long the current temperature stays below the target 
306
+minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS).
307
+
308
+If it stays longer than _PERIOD, it means the thermistor temperature
309
+cannot catch up with the target, so something *may be* wrong. Then, to be on the
310
+safe side, the system will he halt.
311
+
312
+Bear in mind the count down will just start AFTER the first time the 
313
+thermistor temperature is over the target, so you will have no problem if
314
+your extruder heater takes 2 minutes to hit the target on heating.
315
+
316
+*/
317
+// If you want to enable this feature for all your extruder heaters,
318
+// uncomment the 2 defines below:
319
+
320
+// Parameters for all extruder heaters
321
+//#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 //in seconds
322
+//#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
323
+
324
+// If you want to enable this feature for your bed heater,
325
+// uncomment the 2 defines below:
326
+
327
+// Parameters for the bed heater
328
+//#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 //in seconds
329
+//#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
330
+//===========================================================================
331
+
332
+//===========================================================================
333
+//=============================Mechanical Settings===========================
334
+//===========================================================================
335
+
336
+// Uncomment the following line to enable CoreXY kinematics
337
+// #define COREXY
338
+
339
+// coarse Endstop Settings
340
+//#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
341
+
342
+#ifndef ENDSTOPPULLUPS
343
+  // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
344
+  // #define ENDSTOPPULLUP_XMAX
345
+  // #define ENDSTOPPULLUP_YMAX
346
+   #define ENDSTOPPULLUP_ZMAX  // open pin, inverted
347
+   #define ENDSTOPPULLUP_XMIN  // open pin, inverted
348
+   #define ENDSTOPPULLUP_YMIN  // open pin, inverted
349
+  // #define ENDSTOPPULLUP_ZMIN
350
+#endif
351
+
352
+#ifdef ENDSTOPPULLUPS
353
+  #define ENDSTOPPULLUP_XMAX
354
+  #define ENDSTOPPULLUP_YMAX
355
+  #define ENDSTOPPULLUP_ZMAX
356
+  #define ENDSTOPPULLUP_XMIN
357
+  #define ENDSTOPPULLUP_YMIN
358
+  #define ENDSTOPPULLUP_ZMIN
359
+#endif
360
+
361
+// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
362
+const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
363
+const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
364
+const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
365
+const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
366
+const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
367
+const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
368
+//#define DISABLE_MAX_ENDSTOPS
369
+//#define DISABLE_MIN_ENDSTOPS
370
+
371
+// Disable max endstops for compatibility with endstop checking routine
372
+#if defined(COREXY) && !defined(DISABLE_MAX_ENDSTOPS)
373
+  #define DISABLE_MAX_ENDSTOPS
374
+#endif
375
+
376
+// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
377
+#define X_ENABLE_ON 0
378
+#define Y_ENABLE_ON 0
379
+#define Z_ENABLE_ON 0
380
+#define E_ENABLE_ON 0 // For all extruders
381
+
382
+// Disables axis when it's not being used.
383
+#define DISABLE_X false
384
+#define DISABLE_Y false
385
+#define DISABLE_Z false
386
+#define DISABLE_E false // For all extruders
387
+#define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled
388
+
389
+#define INVERT_X_DIR false    // for Mendel set to false, for Orca set to true
390
+#define INVERT_Y_DIR false    // for Mendel set to true, for Orca set to false
391
+#define INVERT_Z_DIR true     // for Mendel set to false, for Orca set to true
392
+#define INVERT_E0_DIR false   // for direct drive extruder v9 set to true, for geared extruder set to false
393
+#define INVERT_E1_DIR false    // for direct drive extruder v9 set to true, for geared extruder set to false
394
+#define INVERT_E2_DIR false   // for direct drive extruder v9 set to true, for geared extruder set to false
395
+
396
+// ENDSTOP SETTINGS:
397
+// Sets direction of endstop	s when homing; 1=MAX, -1=MIN
398
+#define X_HOME_DIR 1
399
+#define Y_HOME_DIR 1
400
+#define Z_HOME_DIR -1
401
+
402
+#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS.
403
+#define max_software_endstops true  // If true, axis won't move to coordinates greater than the defined lengths below.
404
+
405
+// Travel limits after homing
406
+#define X_MAX_POS 200
407
+#define X_MIN_POS 0
408
+#define Y_MAX_POS 200
409
+#define Y_MIN_POS 0
410
+#define Z_MAX_POS 225
411
+#define Z_MIN_POS MANUAL_Z_HOME_POS
412
+
413
+#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
414
+#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
415
+#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
416
+//============================= Bed Auto Leveling ===========================
417
+
418
+//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line)
419
+
420
+#ifdef ENABLE_AUTO_BED_LEVELING
421
+
422
+// There are 2 different ways to pick the X and Y locations to probe:
423
+
424
+//  - "grid" mode
425
+//    Probe every point in a rectangular grid
426
+//    You must specify the rectangle, and the density of sample points
427
+//    This mode is preferred because there are more measurements.
428
+//    It used to be called ACCURATE_BED_LEVELING but "grid" is more descriptive
429
+
430
+//  - "3-point" mode
431
+//    Probe 3 arbitrary points on the bed (that aren't colinear)
432
+//    You must specify the X & Y coordinates of all 3 points
433
+
434
+  #define AUTO_BED_LEVELING_GRID
435
+  // with AUTO_BED_LEVELING_GRID, the bed is sampled in a
436
+  // AUTO_BED_LEVELING_GRID_POINTSxAUTO_BED_LEVELING_GRID_POINTS grid
437
+  // and least squares solution is calculated
438
+  // Note: this feature occupies 10'206 byte
439
+  #ifdef AUTO_BED_LEVELING_GRID
440
+
441
+    // set the rectangle in which to probe
442
+    #define LEFT_PROBE_BED_POSITION 15
443
+    #define RIGHT_PROBE_BED_POSITION 170
444
+    #define BACK_PROBE_BED_POSITION 180
445
+    #define FRONT_PROBE_BED_POSITION 20
446
+
447
+     // set the number of grid points per dimension
448
+     // I wouldn't see a reason to go above 3 (=9 probing points on the bed)
449
+    #define AUTO_BED_LEVELING_GRID_POINTS 2
450
+
451
+
452
+  #else  // not AUTO_BED_LEVELING_GRID
453
+    // with no grid, just probe 3 arbitrary points.  A simple cross-product
454
+    // is used to esimate the plane of the print bed
455
+
456
+      #define ABL_PROBE_PT_1_X 15
457
+      #define ABL_PROBE_PT_1_Y 180
458
+      #define ABL_PROBE_PT_2_X 15
459
+      #define ABL_PROBE_PT_2_Y 20
460
+      #define ABL_PROBE_PT_3_X 170
461
+      #define ABL_PROBE_PT_3_Y 20
462
+
463
+  #endif // AUTO_BED_LEVELING_GRID
464
+
465
+
466
+  // these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
467
+  #define X_PROBE_OFFSET_FROM_EXTRUDER -25
468
+  #define Y_PROBE_OFFSET_FROM_EXTRUDER -29
469
+  #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35
470
+
471
+  //#define Z_RAISE_BEFORE_HOMING 4       // (in mm) Raise Z before homing (G28) for Probe Clearance.
472
+                                        // Be sure you have this distance over your Z_MAX_POS in case
473
+
474
+  #define XY_TRAVEL_SPEED 8000         // X and Y axis travel speed between probes, in mm/min
475
+
476
+  #define Z_RAISE_BEFORE_PROBING 15    //How much the extruder will be raised before traveling to the first probing point.
477
+  #define Z_RAISE_BETWEEN_PROBINGS 5  //How much the extruder will be raised when traveling from between next probing points
478
+
479
+
480
+  //If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
481
+  //The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
482
+  // You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
483
+
484
+//  #define PROBE_SERVO_DEACTIVATION_DELAY 300
485
+
486
+
487
+//If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
488
+//it is highly recommended you let this Z_SAFE_HOMING enabled!!!
489
+
490
+ // #define Z_SAFE_HOMING   // This feature is meant to avoid Z homing with probe outside the bed area.
491
+                          // When defined, it will:
492
+                          // - Allow Z homing only after X and Y homing AND stepper drivers still enabled
493
+                          // - If stepper drivers timeout, it will need X and Y homing again before Z homing
494
+                          // - Position the probe in a defined XY point before Z Homing when homing all axis (G28)
495
+                          // - Block Z homing only when the probe is outside bed area.
496
+
497
+  #ifdef Z_SAFE_HOMING
498
+
499
+    #define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2)    // X point for Z homing when homing all axis (G28)
500
+    #define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2)    // Y point for Z homing when homing all axis (G28)
501
+
502
+  #endif
503
+
504
+#endif // ENABLE_AUTO_BED_LEVELING
505
+
506
+
507
+// The position of the homing switches
508
+#define MANUAL_HOME_POSITIONS  // If defined, MANUAL_*_HOME_POS below will be used
509
+//#define BED_CENTER_AT_0_0  // If defined, the center of the bed is at (X=0, Y=0)
510
+
511
+//Manual homing switch locations:
512
+// For deltabots this means top and center of the Cartesian print volume.
513
+// For SCARA: Offset between HomingPosition and Bed X=0 / Y=0
514
+#define MANUAL_X_HOME_POS -22.
515
+#define MANUAL_Y_HOME_POS -52.
516
+#define MANUAL_Z_HOME_POS 0.1  // Distance between nozzle and print surface after homing.
517
+
518
+
519
+//// MOVEMENT SETTINGS
520
+#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
521
+#define HOMING_FEEDRATE {40*60, 40*60, 10*60, 0}  // set the homing speeds (mm/min)
522
+
523
+// default settings
524
+
525
+#define DEFAULT_AXIS_STEPS_PER_UNIT   {103.69,106.65,200/1.25,1000}  // default steps per unit for SCARA
526
+#define DEFAULT_MAX_FEEDRATE          {300, 300, 30, 25}    // (mm/sec)
527
+#define DEFAULT_MAX_ACCELERATION      {300,300,20,1000}    // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot.
528
+
529
+#define DEFAULT_ACCELERATION          400    // X, Y, Z and E max acceleration in mm/s^2 for printing moves
530
+#define DEFAULT_RETRACT_ACCELERATION  2000  // X, Y, Z and E max acceleration in mm/s^2 for retracts
531
+
532
+// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
533
+// The offset has to be X=0, Y=0 for extruder 0 hotend (default extruder).
534
+// For the other hotends it is their distance from the extruder 0 hotend.
535
+// #define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
536
+// #define EXTRUDER_OFFSET_Y {0.0, 5.00}  // (in mm) for each extruder, offset of the hotend on the Y axis
537
+
538
+// The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously)
539
+#define DEFAULT_XYJERK                5    // (mm/sec)
540
+#define DEFAULT_ZJERK                 0.4    // (mm/sec)
541
+#define DEFAULT_EJERK                 3    // (mm/sec)
542
+
543
+//===========================================================================
544
+//=============================Additional Features===========================
545
+//===========================================================================
546
+
547
+// Custom M code points
548
+//#define CUSTOM_M_CODES
549
+#ifdef CUSTOM_M_CODES
550
+  #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
551
+  #define Z_PROBE_OFFSET_RANGE_MIN -15
552
+  #define Z_PROBE_OFFSET_RANGE_MAX -5
553
+#endif
554
+
555
+
556
+// EEPROM
557
+// The microcontroller can store settings in the EEPROM, e.g. max velocity...
558
+// M500 - stores parameters in EEPROM
559
+// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
560
+// M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
561
+//define this to enable EEPROM support
562
+//#define EEPROM_SETTINGS
563
+//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
564
+// please keep turned on if you can.
565
+#define EEPROM_CHITCHAT
566
+
567
+// Preheat Constants
568
+#define PLA_PREHEAT_HOTEND_TEMP 180
569
+#define PLA_PREHEAT_HPB_TEMP 70
570
+#define PLA_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
571
+
572
+#define ABS_PREHEAT_HOTEND_TEMP 240
573
+#define ABS_PREHEAT_HPB_TEMP 100
574
+#define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
575
+
576
+//LCD and SD support
577
+//#define ULTRA_LCD  //general LCD support, also 16x2
578
+//#define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
579
+//#define SDSUPPORT // Enable SD Card Support in Hardware Console
580
+//#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
581
+//#define SD_CHECK_AND_RETRY // Use CRC checks and retries on the SD communication
582
+//#define ENCODER_PULSES_PER_STEP 1 // Increase if you have a high resolution encoder
583
+//#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
584
+//#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
585
+//#define ULTIPANEL  //the UltiPanel as on Thingiverse
586
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
587
+//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
588
+
589
+// The MaKr3d Makr-Panel with graphic controller and SD support
590
+// http://reprap.org/wiki/MaKr3d_MaKrPanel
591
+//#define MAKRPANEL
592
+
593
+// The RepRapDiscount Smart Controller (white PCB)
594
+// http://reprap.org/wiki/RepRapDiscount_Smart_Controller
595
+//#define REPRAP_DISCOUNT_SMART_CONTROLLER
596
+
597
+// The GADGETS3D G3D LCD/SD Controller (blue PCB)
598
+// http://reprap.org/wiki/RAMPS_1.3/1.4_GADGETS3D_Shield_with_Panel
599
+//#define G3D_PANEL
600
+
601
+// The RepRapDiscount FULL GRAPHIC Smart Controller (quadratic white PCB)
602
+// http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller
603
+//
604
+// ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
605
+//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
606
+
607
+// The RepRapWorld REPRAPWORLD_KEYPAD v1.1
608
+// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626
609
+//#define REPRAPWORLD_KEYPAD
610
+//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 // how much should be moved when a key is pressed, eg 10.0 means 10mm per click
611
+
612
+// The Elefu RA Board Control Panel
613
+// http://www.elefu.com/index.php?route=product/product&product_id=53
614
+// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARUDINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
615
+//#define RA_CONTROL_PANEL
616
+
617
+//automatic expansion
618
+#if defined (MAKRPANEL)
619
+ #define DOGLCD
620
+ #define SDSUPPORT
621
+ #define ULTIPANEL
622
+ #define NEWPANEL
623
+ #define DEFAULT_LCD_CONTRAST 17
624
+#endif
625
+
626
+#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
627
+ #define DOGLCD
628
+ #define U8GLIB_ST7920
629
+ #define REPRAP_DISCOUNT_SMART_CONTROLLER
630
+#endif
631
+
632
+#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
633
+ #define ULTIPANEL
634
+ #define NEWPANEL
635
+#endif
636
+
637
+#if defined(REPRAPWORLD_KEYPAD)
638
+  #define NEWPANEL
639
+  #define ULTIPANEL
640
+#endif
641
+#if defined(RA_CONTROL_PANEL)
642
+ #define ULTIPANEL
643
+ #define NEWPANEL
644
+ #define LCD_I2C_TYPE_PCA8574
645
+ #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
646
+#endif
647
+
648
+//I2C PANELS
649
+
650
+//#define LCD_I2C_SAINSMART_YWROBOT
651
+#ifdef LCD_I2C_SAINSMART_YWROBOT
652
+  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
653
+  // Make sure it is placed in the Arduino libraries directory.
654
+  #define LCD_I2C_TYPE_PCF8575
655
+  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
656
+  #define NEWPANEL
657
+  #define ULTIPANEL
658
+#endif
659
+
660
+// PANELOLU2 LCD with status LEDs, separate encoder and click inputs
661
+//#define LCD_I2C_PANELOLU2
662
+#ifdef LCD_I2C_PANELOLU2
663
+  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
664
+  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
665
+  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
666
+  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
667
+  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
668
+  #define LCD_I2C_TYPE_MCP23017
669
+  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
670
+  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
671
+  #define NEWPANEL
672
+  #define ULTIPANEL
673
+
674
+  #ifndef ENCODER_PULSES_PER_STEP
675
+	#define ENCODER_PULSES_PER_STEP 4
676
+  #endif
677
+
678
+  #ifndef ENCODER_STEPS_PER_MENU_ITEM
679
+	#define ENCODER_STEPS_PER_MENU_ITEM 1
680
+  #endif
681
+
682
+
683
+  #ifdef LCD_USE_I2C_BUZZER
684
+	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
685
+	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
686
+  #endif
687
+
688
+#endif
689
+
690
+// Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
691
+//#define LCD_I2C_VIKI
692
+#ifdef LCD_I2C_VIKI
693
+  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
694
+  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
695
+  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
696
+  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
697
+  #define LCD_I2C_TYPE_MCP23017
698
+  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
699
+  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
700
+  #define NEWPANEL
701
+  #define ULTIPANEL
702
+#endif
703
+
704
+// Shift register panels
705
+// ---------------------
706
+// 2 wire Non-latching LCD SR from:
707
+// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
708
+//#define SR_LCD
709
+#ifdef SR_LCD
710
+   #define SR_LCD_2W_NL    // Non latching 2 wire shift register
711
+   //#define NEWPANEL
712
+#endif
713
+
714
+
715
+#ifdef ULTIPANEL
716
+//  #define NEWPANEL  //enable this if you have a click-encoder panel
717
+  #define SDSUPPORT
718
+  #define ULTRA_LCD
719
+  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
720
+    #define LCD_WIDTH 20
721
+    #define LCD_HEIGHT 5
722
+  #else
723
+    #define LCD_WIDTH 20
724
+    #define LCD_HEIGHT 4
725
+  #endif
726
+#else //no panel but just LCD
727
+  #ifdef ULTRA_LCD
728
+  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
729
+    #define LCD_WIDTH 20
730
+    #define LCD_HEIGHT 5
731
+  #else
732
+    #define LCD_WIDTH 16
733
+    #define LCD_HEIGHT 2
734
+  #endif
735
+  #endif
736
+#endif
737
+
738
+// default LCD contrast for dogm-like LCD displays
739
+#ifdef DOGLCD
740
+# ifndef DEFAULT_LCD_CONTRAST
741
+#  define DEFAULT_LCD_CONTRAST 32
742
+# endif
743
+#endif
744
+
745
+// Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
746
+//#define FAST_PWM_FAN
747
+
748
+// Temperature status LEDs that display the hotend and bet temperature.
749
+// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
750
+// Otherwise the RED led is on. There is 1C hysteresis.
751
+//#define TEMP_STAT_LEDS
752
+
753
+// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
754
+// which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
755
+// is too low, you should also increment SOFT_PWM_SCALE.
756
+//#define FAN_SOFT_PWM
757
+
758
+// Incrementing this by 1 will double the software PWM frequency,
759
+// affecting heaters, and the fan if FAN_SOFT_PWM is enabled.
760
+// However, control resolution will be halved for each increment;
761
+// at zero value, there are 128 effective control positions.
762
+#define SOFT_PWM_SCALE 0
763
+
764
+// M240  Triggers a camera by emulating a Canon RC-1 Remote
765
+// Data from: http://www.doc-diy.net/photo/rc-1_hacked/
766
+// #define PHOTOGRAPH_PIN     23
767
+
768
+// SF send wrong arc g-codes when using Arc Point as fillet procedure
769
+//#define SF_ARC_FIX
770
+
771
+// Support for the BariCUDA Paste Extruder.
772
+//#define BARICUDA
773
+
774
+//define BlinkM/CyzRgb Support
775
+//#define BLINKM
776
+
777
+/*********************************************************************\
778
+* R/C SERVO support
779
+* Sponsored by TrinityLabs, Reworked by codexmas
780
+**********************************************************************/
781
+
782
+// Number of servos
783
+//
784
+// If you select a configuration below, this will receive a default value and does not need to be set manually
785
+// set it manually if you have more servos than extruders and wish to manually control some
786
+// leaving it undefined or defining as 0 will disable the servo subsystem
787
+// If unsure, leave commented / disabled
788
+//
789
+//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
790
+
791
+// Servo Endstops
792
+//
793
+// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
794
+// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500.
795
+//
796
+//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
797
+//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
798
+
799
+#include "Configuration_adv.h"
800
+#include "thermistortables.h"
801
+
802
+#endif //__CONFIGURATION_H

+ 507
- 0
Marlin/example_configurations/SCARA/Configuration_adv.h Ver arquivo

@@ -0,0 +1,507 @@
1
+#ifndef CONFIGURATION_ADV_H
2
+#define CONFIGURATION_ADV_H
3
+
4
+//===========================================================================
5
+//=============================Thermal Settings  ============================
6
+//===========================================================================
7
+
8
+#ifdef BED_LIMIT_SWITCHING
9
+  #define BED_HYSTERESIS 2 //only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
10
+#endif
11
+#define BED_CHECK_INTERVAL 3000 //ms between checks in bang-bang control
12
+
13
+//// Heating sanity check:
14
+// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
15
+// If the temperature has not increased at the end of that period, the target temperature is set to zero.
16
+// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
17
+//  differ by at least 2x WATCH_TEMP_INCREASE
18
+//#define WATCH_TEMP_PERIOD 40000 //40 seconds
19
+//#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
20
+
21
+#ifdef PIDTEMP
22
+  // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
23
+  // if Kc is chosen well, the additional required power due to increased melting should be compensated.
24
+  #define PID_ADD_EXTRUSION_RATE
25
+  #ifdef PID_ADD_EXTRUSION_RATE
26
+    #define  DEFAULT_Kc (1) //heating power=Kc*(e_speed)
27
+  #endif
28
+#endif
29
+
30
+
31
+//automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode.
32
+//The maximum buffered steps/sec of the extruder motor are called "se".
33
+//You enter the autotemp mode by a M109 S<mintemp> B<maxtemp> F<factor>
34
+// the target temperature is set to mintemp+factor*se[steps/sec] and limited by mintemp and maxtemp
35
+// you exit the value by any M109 without F*
36
+// Also, if the temperature is set to a value <mintemp, it is not changed by autotemp.
37
+// on an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
38
+#define AUTOTEMP
39
+#ifdef AUTOTEMP
40
+  #define AUTOTEMP_OLDWEIGHT 0.98
41
+#endif
42
+
43
+//Show Temperature ADC value
44
+//The M105 command return, besides traditional information, the ADC value read from temperature sensors.
45
+//#define SHOW_TEMP_ADC_VALUES
46
+
47
+//  extruder run-out prevention.
48
+//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
49
+//#define EXTRUDER_RUNOUT_PREVENT
50
+#define EXTRUDER_RUNOUT_MINTEMP 180
51
+#define EXTRUDER_RUNOUT_SECONDS 30.
52
+#define EXTRUDER_RUNOUT_ESTEPS 14. //mm filament
53
+#define EXTRUDER_RUNOUT_SPEED 180.  //extrusion speed
54
+#define EXTRUDER_RUNOUT_EXTRUDE 100
55
+
56
+//These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements.
57
+//The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET"
58
+#define TEMP_SENSOR_AD595_OFFSET 0.0
59
+#define TEMP_SENSOR_AD595_GAIN   1.0
60
+
61
+//This is for controlling a fan to cool down the stepper drivers
62
+//it will turn on when any driver is enabled
63
+//and turn off after the set amount of seconds from last driver being disabled again
64
+#define CONTROLLERFAN_PIN -1 //Pin used for the fan to cool controller (-1 to disable)
65
+#define CONTROLLERFAN_SECS 60 //How many seconds, after all motors were disabled, the fan should run
66
+#define CONTROLLERFAN_SPEED 255  // == full speed
67
+
68
+// When first starting the main fan, run it at full speed for the
69
+// given number of milliseconds.  This gets the fan spinning reliably
70
+// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
71
+//#define FAN_KICKSTART_TIME 100
72
+
73
+// Extruder cooling fans
74
+// Configure fan pin outputs to automatically turn on/off when the associated
75
+// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE.
76
+// Multiple extruders can be assigned to the same pin in which case
77
+// the fan will turn on when any selected extruder is above the threshold.
78
+#define EXTRUDER_0_AUTO_FAN_PIN   -1
79
+#define EXTRUDER_1_AUTO_FAN_PIN   -1
80
+#define EXTRUDER_2_AUTO_FAN_PIN   -1
81
+#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
82
+#define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
83
+
84
+
85
+//===========================================================================
86
+//=============================Mechanical Settings===========================
87
+//===========================================================================
88
+
89
+#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
90
+
91
+
92
+//// AUTOSET LOCATIONS OF LIMIT SWITCHES
93
+//// Added by ZetaPhoenix 09-15-2012
94
+#ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
95
+  #define X_HOME_POS MANUAL_X_HOME_POS
96
+  #define Y_HOME_POS MANUAL_Y_HOME_POS
97
+  #define Z_HOME_POS MANUAL_Z_HOME_POS
98
+#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
99
+  //X axis
100
+  #if X_HOME_DIR == -1
101
+    #ifdef BED_CENTER_AT_0_0
102
+      #define X_HOME_POS X_MAX_LENGTH * -0.5
103
+    #else
104
+      #define X_HOME_POS X_MIN_POS
105
+    #endif //BED_CENTER_AT_0_0
106
+  #else
107
+    #ifdef BED_CENTER_AT_0_0
108
+      #define X_HOME_POS X_MAX_LENGTH * 0.5
109
+    #else
110
+      #define X_HOME_POS X_MAX_POS
111
+    #endif //BED_CENTER_AT_0_0
112
+  #endif //X_HOME_DIR == -1
113
+
114
+  //Y axis
115
+  #if Y_HOME_DIR == -1
116
+    #ifdef BED_CENTER_AT_0_0
117
+      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
118
+    #else
119
+      #define Y_HOME_POS Y_MIN_POS
120
+    #endif //BED_CENTER_AT_0_0
121
+  #else
122
+    #ifdef BED_CENTER_AT_0_0
123
+      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
124
+    #else
125
+      #define Y_HOME_POS Y_MAX_POS
126
+    #endif //BED_CENTER_AT_0_0
127
+  #endif //Y_HOME_DIR == -1
128
+
129
+  // Z axis
130
+  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
131
+    #define Z_HOME_POS Z_MIN_POS
132
+  #else
133
+    #define Z_HOME_POS Z_MAX_POS
134
+  #endif //Z_HOME_DIR == -1
135
+#endif //End auto min/max positions
136
+//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
137
+
138
+
139
+//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
140
+
141
+// A single Z stepper driver is usually used to drive 2 stepper motors.
142
+// Uncomment this define to utilize a separate stepper driver for each Z axis motor.
143
+// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used
144
+// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards.
145
+// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
146
+//#define Z_DUAL_STEPPER_DRIVERS
147
+
148
+#ifdef Z_DUAL_STEPPER_DRIVERS
149
+  #undef EXTRUDERS
150
+  #define EXTRUDERS 1
151
+#endif
152
+
153
+// Same again but for Y Axis.
154
+//#define Y_DUAL_STEPPER_DRIVERS
155
+
156
+// Define if the two Y drives need to rotate in opposite directions
157
+#define INVERT_Y2_VS_Y_DIR true
158
+
159
+#ifdef Y_DUAL_STEPPER_DRIVERS
160
+  #undef EXTRUDERS
161
+  #define EXTRUDERS 1
162
+#endif
163
+
164
+#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
165
+  #error "You cannot have dual drivers for both Y and Z"
166
+#endif
167
+
168
+// Enable this for dual x-carriage printers.
169
+// A dual x-carriage design has the advantage that the inactive extruder can be parked which
170
+// prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
171
+// allowing faster printing speeds.
172
+//#define DUAL_X_CARRIAGE
173
+#ifdef DUAL_X_CARRIAGE
174
+// Configuration for second X-carriage
175
+// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop;
176
+// the second x-carriage always homes to the maximum endstop.
177
+#define X2_MIN_POS 80     // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage
178
+#define X2_MAX_POS 353    // set maximum to the distance between toolheads when both heads are homed
179
+#define X2_HOME_DIR 1     // the second X-carriage always homes to the maximum endstop position
180
+#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
181
+    // However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
182
+    // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
183
+    // without modifying the firmware (through the "M218 T1 X???" command).
184
+    // Remember: you should set the second extruder x-offset to 0 in your slicer.
185
+
186
+// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
187
+#define X2_ENABLE_PIN 29
188
+#define X2_STEP_PIN 25
189
+#define X2_DIR_PIN 23
190
+
191
+// There are a few selectable movement modes for dual x-carriages using M605 S<mode>
192
+//    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
193
+//                           as long as it supports dual x-carriages. (M605 S0)
194
+//    Mode 1: Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so
195
+//                           that additional slicer support is not required. (M605 S1)
196
+//    Mode 2: Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all
197
+//                           actions of the first x-carriage. This allows the printer to print 2 arbitrary items at
198
+//                           once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
199
+
200
+// This is the default power-up mode which can be later using M605.
201
+#define DEFAULT_DUAL_X_CARRIAGE_MODE 0
202
+
203
+// As the x-carriages are independent we can now account for any relative Z offset
204
+#define EXTRUDER1_Z_OFFSET 0.0           // z offset relative to extruder 0
205
+
206
+// Default settings in "Auto-park Mode"
207
+#define TOOLCHANGE_PARK_ZLIFT   0.2      // the distance to raise Z axis when parking an extruder
208
+#define TOOLCHANGE_UNPARK_ZLIFT 1        // the distance to raise Z axis when unparking an extruder
209
+
210
+// Default x offset in duplication mode (typically set to half print bed width)
211
+#define DEFAULT_DUPLICATION_X_OFFSET 100
212
+
213
+#endif //DUAL_X_CARRIAGE
214
+
215
+//homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
216
+#define X_HOME_RETRACT_MM 3
217
+#define Y_HOME_RETRACT_MM 3
218
+#define Z_HOME_RETRACT_MM 3
219
+//#define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
220
+#ifdef SCARA
221
+	#define QUICK_HOME //SCARA needs Quickhome
222
+#endif
223
+
224
+#define AXIS_RELATIVE_MODES {false, false, false, false}
225
+
226
+#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
227
+
228
+//By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
229
+#define INVERT_X_STEP_PIN false
230
+#define INVERT_Y_STEP_PIN false
231
+#define INVERT_Z_STEP_PIN false
232
+#define INVERT_E_STEP_PIN false
233
+
234
+//default stepper release if idle
235
+#define DEFAULT_STEPPER_DEACTIVE_TIME 240
236
+
237
+#define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
238
+#define DEFAULT_MINTRAVELFEEDRATE     0.0
239
+
240
+// Feedrates for manual moves along X, Y, Z, E from panel
241
+#ifdef ULTIPANEL
242
+#define MANUAL_FEEDRATE {50*60, 50*60, 10*60, 60}  // set the speeds for manual moves (mm/min)
243
+#endif
244
+
245
+//Comment to disable setting feedrate multiplier via encoder
246
+#ifdef ULTIPANEL
247
+    #define ULTIPANEL_FEEDMULTIPLY
248
+#endif
249
+
250
+// minimum time in microseconds that a movement needs to take if the buffer is emptied.
251
+#define DEFAULT_MINSEGMENTTIME        20000
252
+
253
+// If defined the movements slow down when the look ahead buffer is only half full
254
+//#define SLOWDOWN
255
+#ifdef SCARA
256
+ #undef SLOWDOWN
257
+#endif
258
+// Frequency limit
259
+// See nophead's blog for more info
260
+// Not working O
261
+//#define XY_FREQUENCY_LIMIT  15
262
+
263
+// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end
264
+// of the buffer and all stops. This should not be much greater than zero and should only be changed
265
+// if unwanted behavior is observed on a user's machine when running at very slow speeds.
266
+#define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
267
+
268
+// MS1 MS2 Stepper Driver Microstepping mode table
269
+#define MICROSTEP1 LOW,LOW
270
+#define MICROSTEP2 HIGH,LOW
271
+#define MICROSTEP4 LOW,HIGH
272
+#define MICROSTEP8 HIGH,HIGH
273
+#define MICROSTEP16 HIGH,HIGH
274
+
275
+// Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
276
+#define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
277
+
278
+// Motor Current setting (Only functional when motor driver current ref pins are connected to a digital trimpot on supported boards)
279
+#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
280
+
281
+// uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
282
+//#define DIGIPOT_I2C
283
+// Number of channels available for I2C digipot, For Azteeg X3 Pro we have 8
284
+#define DIGIPOT_I2C_NUM_CHANNELS 8
285
+// actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
286
+#define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}
287
+
288
+//===========================================================================
289
+//=============================Additional Features===========================
290
+//===========================================================================
291
+
292
+//#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
293
+#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
294
+
295
+#define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
296
+#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
297
+
298
+#define SDCARD_RATHERRECENTFIRST  //reverse file order of sd card menu display. Its sorted practically after the file system block order.
299
+// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that.
300
+// using:
301
+//#define MENU_ADDAUTOSTART
302
+
303
+// The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
304
+//#define USE_WATCHDOG
305
+
306
+#ifdef USE_WATCHDOG
307
+// If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on.
308
+// The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset.
309
+//  However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
310
+//#define WATCHDOG_RESET_MANUAL
311
+#endif
312
+
313
+// Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
314
+//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
315
+
316
+// Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process
317
+// it can e.g. be used to change z-positions in the print startup phase in real-time
318
+// does not respect endstops!
319
+//#define BABYSTEPPING
320
+#ifdef BABYSTEPPING
321
+  #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
322
+  #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
323
+  #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
324
+
325
+  #ifdef COREXY
326
+    #error BABYSTEPPING not implemented for COREXY yet.
327
+  #endif
328
+
329
+  #ifdef DELTA
330
+    #ifdef BABYSTEP_XY
331
+      #error BABYSTEPPING only implemented for Z axis on deltabots.
332
+    #endif
333
+  #endif
334
+  
335
+  #ifdef SCARA
336
+    #error BABYSTEPPING not implemented for SCARA yet.
337
+  #endif
338
+  
339
+#endif
340
+
341
+// extruder advance constant (s2/mm3)
342
+//
343
+// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
344
+//
345
+// Hooke's law says:		force = k * distance
346
+// Bernoulli's principle says:	v ^ 2 / 2 + g . h + pressure / density = constant
347
+// so: v ^ 2 is proportional to number of steps we advance the extruder
348
+#define ADVANCE
349
+
350
+#ifdef ADVANCE
351
+  #define EXTRUDER_ADVANCE_K .0
352
+
353
+  #define D_FILAMENT 1.75
354
+  #define STEPS_MM_E 1000
355
+  #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
356
+  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA)
357
+
358
+#endif // ADVANCE
359
+
360
+// Arc interpretation settings:
361
+#define MM_PER_ARC_SEGMENT 1
362
+#define N_ARC_CORRECTION 25
363
+
364
+const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
365
+
366
+// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted
367
+// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT
368
+// in the pins.h file.  When using a push button pulling the pin to ground this will need inverted.  This setting should
369
+// be commented out otherwise
370
+#define SDCARDDETECTINVERTED
371
+
372
+#ifdef ULTIPANEL
373
+ #undef SDCARDDETECTINVERTED
374
+#endif
375
+
376
+// Power Signal Control Definitions
377
+// By default use ATX definition
378
+#ifndef POWER_SUPPLY
379
+  #define POWER_SUPPLY 1
380
+#endif
381
+// 1 = ATX
382
+#if (POWER_SUPPLY == 1)
383
+  #define PS_ON_AWAKE  LOW
384
+  #define PS_ON_ASLEEP HIGH
385
+#endif
386
+// 2 = X-Box 360 203W
387
+#if (POWER_SUPPLY == 2)
388
+  #define PS_ON_AWAKE  HIGH
389
+  #define PS_ON_ASLEEP LOW
390
+#endif
391
+
392
+// Control heater 0 and heater 1 in parallel.
393
+//#define HEATERS_PARALLEL
394
+
395
+//===========================================================================
396
+//=============================Buffers           ============================
397
+//===========================================================================
398
+
399
+// The number of linear motions that can be in the plan at any give time.
400
+// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering.
401
+#if defined SDSUPPORT
402
+  #define BLOCK_BUFFER_SIZE 16   // SD,LCD,Buttons take more memory, block buffer needs to be smaller
403
+#else
404
+  #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
405
+#endif
406
+
407
+
408
+//The ASCII buffer for receiving from the serial:
409
+#define MAX_CMD_SIZE 96
410
+#define BUFSIZE 4
411
+
412
+
413
+// Firmware based and LCD controlled retract
414
+// M207 and M208 can be used to define parameters for the retraction.
415
+// The retraction can be called by the slicer using G10 and G11
416
+// until then, intended retractions can be detected by moves that only extrude and the direction.
417
+// the moves are than replaced by the firmware controlled ones.
418
+
419
+// #define FWRETRACT  //ONLY PARTIALLY TESTED
420
+#ifdef FWRETRACT
421
+  #define MIN_RETRACT 0.1                //minimum extruded mm to accept a automatic gcode retraction attempt
422
+  #define RETRACT_LENGTH 3               //default retract length (positive mm)
423
+  #define RETRACT_FEEDRATE 35            //default feedrate for retracting (mm/s)
424
+  #define RETRACT_ZLIFT 0                //default retract Z-lift
425
+  #define RETRACT_RECOVER_LENGTH 0       //default additional recover length (mm, added to retract length when recovering)
426
+  #define RETRACT_RECOVER_FEEDRATE 8     //default feedrate for recovering from retraction (mm/s)
427
+#endif
428
+
429
+//adds support for experimental filament exchange support M600; requires display
430
+#ifdef ULTIPANEL
431
+  #define FILAMENTCHANGEENABLE
432
+  #ifdef FILAMENTCHANGEENABLE
433
+    #define FILAMENTCHANGE_XPOS 3
434
+    #define FILAMENTCHANGE_YPOS 3
435
+    #define FILAMENTCHANGE_ZADD 10
436
+    #define FILAMENTCHANGE_FIRSTRETRACT -2
437
+    #define FILAMENTCHANGE_FINALRETRACT -100
438
+  #endif
439
+#endif
440
+
441
+#ifdef FILAMENTCHANGEENABLE
442
+  #ifdef EXTRUDER_RUNOUT_PREVENT
443
+    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
444
+  #endif
445
+#endif
446
+
447
+//===========================================================================
448
+//=============================  Define Defines  ============================
449
+//===========================================================================
450
+#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
451
+  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
452
+#endif
453
+
454
+#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
455
+  #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
456
+#endif
457
+
458
+#if TEMP_SENSOR_0 > 0
459
+  #define THERMISTORHEATER_0 TEMP_SENSOR_0
460
+  #define HEATER_0_USES_THERMISTOR
461
+#endif
462
+#if TEMP_SENSOR_1 > 0
463
+  #define THERMISTORHEATER_1 TEMP_SENSOR_1
464
+  #define HEATER_1_USES_THERMISTOR
465
+#endif
466
+#if TEMP_SENSOR_2 > 0
467
+  #define THERMISTORHEATER_2 TEMP_SENSOR_2
468
+  #define HEATER_2_USES_THERMISTOR
469
+#endif
470
+#if TEMP_SENSOR_BED > 0
471
+  #define THERMISTORBED TEMP_SENSOR_BED
472
+  #define BED_USES_THERMISTOR
473
+#endif
474
+#if TEMP_SENSOR_0 == -1
475
+  #define HEATER_0_USES_AD595
476
+#endif
477
+#if TEMP_SENSOR_1 == -1
478
+  #define HEATER_1_USES_AD595
479
+#endif
480
+#if TEMP_SENSOR_2 == -1
481
+  #define HEATER_2_USES_AD595
482
+#endif
483
+#if TEMP_SENSOR_BED == -1
484
+  #define BED_USES_AD595
485
+#endif
486
+#if TEMP_SENSOR_0 == -2
487
+  #define HEATER_0_USES_MAX6675
488
+#endif
489
+#if TEMP_SENSOR_0 == 0
490
+  #undef HEATER_0_MINTEMP
491
+  #undef HEATER_0_MAXTEMP
492
+#endif
493
+#if TEMP_SENSOR_1 == 0
494
+  #undef HEATER_1_MINTEMP
495
+  #undef HEATER_1_MAXTEMP
496
+#endif
497
+#if TEMP_SENSOR_2 == 0
498
+  #undef HEATER_2_MINTEMP
499
+  #undef HEATER_2_MAXTEMP
500
+#endif
501
+#if TEMP_SENSOR_BED == 0
502
+  #undef BED_MINTEMP
503
+  #undef BED_MAXTEMP
504
+#endif
505
+
506
+
507
+#endif //__CONFIGURATION_ADV_H

+ 0
- 75
Marlin/thermistortables.h Ver arquivo

@@ -1021,81 +1021,6 @@ const short temptable_1047[][2] PROGMEM = {
1021 1021
   PtLine(300,1000,4700)
1022 1022
 };
1023 1023
 #endif
1024
-#if (THERMISTORHEATER_0 == 70) || (THERMISTORHEATER_1 == 70) || (THERMISTORHEATER_2 == 70) || (THERMISTORBED == 70) // 500C thermistor for Pico hot end
1025
-const short temptable_70[][2] PROGMEM = {
1026
-  {  110.774119598719*OVERSAMPLENR ,  350 },
1027
-  {  118.214386957249*OVERSAMPLENR ,  345 },
1028
-  {  126.211418543166*OVERSAMPLENR ,  340 },
1029
-  {  134.789559066223*OVERSAMPLENR ,  335 },
1030
-  {  144.004513869701*OVERSAMPLENR ,  330 },
1031
-  {  153.884483790827*OVERSAMPLENR ,  325 },
1032
-  {  164.484880793637*OVERSAMPLENR ,  320 },
1033
-  {  175.848885102724*OVERSAMPLENR ,  315 },
1034
-  {  188.006799079015*OVERSAMPLENR ,  310 },
1035
-  {  201.008072969044*OVERSAMPLENR ,  305 },
1036
-  {  214.83716032276*OVERSAMPLENR ,  300 },
1037
-  {  229.784739779664*OVERSAMPLENR ,  295 },
1038
-  {  245.499466045473*OVERSAMPLENR ,  290 },
1039
-  {  262.2766342096*OVERSAMPLENR ,  285 },
1040
-  {  280.073883176433*OVERSAMPLENR ,  280 },
1041
-  {  298.952693467726*OVERSAMPLENR ,  275 },
1042
-  {  318.808251051674*OVERSAMPLENR ,  270 },
1043
-  {  337.490932563222*OVERSAMPLENR ,  265 },
1044
-  {  361.683649122745*OVERSAMPLENR ,  260 },
1045
-  {  384.717024083981*OVERSAMPLENR ,  255 },
1046
-  {  408.659301759076*OVERSAMPLENR ,  250 },
1047
-  {  433.471659455884*OVERSAMPLENR ,  245 },
1048
-  {  459.199039926034*OVERSAMPLENR ,  240 },
1049
-  {  485.566500982316*OVERSAMPLENR ,  235 },
1050
-  {  512.538918631075*OVERSAMPLENR ,  230 },
1051
-  {  539.980999544838*OVERSAMPLENR ,  225 },
1052
-  {  567.783095549935*OVERSAMPLENR ,  220 },
1053
-  {  595.698041673552*OVERSAMPLENR ,  215 },
1054
-  {  623.633922319597*OVERSAMPLENR ,  210 },
1055
-  {  651.356162750829*OVERSAMPLENR ,  205 },
1056
-  {  678.700901620956*OVERSAMPLENR ,  200 },
1057
-  {  705.528145361264*OVERSAMPLENR ,  195 },
1058
-  {  731.61267976339*OVERSAMPLENR ,  190 },
1059
-  {  756.786212184365*OVERSAMPLENR ,  185 },
1060
-  {  780.950223357761*OVERSAMPLENR ,  180 },
1061
-  {  804.012961595082*OVERSAMPLENR ,  175 },
1062
-  {  825.904975939166*OVERSAMPLENR ,  170 },
1063
-  {  846.403941639008*OVERSAMPLENR ,  165 },
1064
-  {  865.52326974895*OVERSAMPLENR ,  160 },
1065
-  {  883.246145367727*OVERSAMPLENR ,  155 },
1066
-  {  899.5821946515*OVERSAMPLENR ,  150 },
1067
-  {  914.544289228582*OVERSAMPLENR ,  145 },
1068
-  {  928.145628221761*OVERSAMPLENR ,  140 },
1069
-  {  940.422208546562*OVERSAMPLENR ,  135 },
1070
-  {  951.456922916497*OVERSAMPLENR ,  130 },
1071
-  {  961.303500633788*OVERSAMPLENR ,  125 },
1072
-  {  970.044756889055*OVERSAMPLENR ,  120 },
1073
-  {  977.761456230051*OVERSAMPLENR ,  115 },
1074
-  {  984.540978083453*OVERSAMPLENR ,  110 },
1075
-  {  990.440780765757*OVERSAMPLENR ,  105 },
1076
-  {  995.589621465301*OVERSAMPLENR ,  100 },
1077
-  {  1000.02514280144*OVERSAMPLENR ,  95 },
1078
-  {  1003.84429789876*OVERSAMPLENR ,  90 },
1079
-  {  1007.10199009318*OVERSAMPLENR ,  85 },
1080
-  {  1009.87151698323*OVERSAMPLENR ,  80 },
1081
-  {  1012.21633594237*OVERSAMPLENR ,  75 },
1082
-  {  1014.18959892949*OVERSAMPLENR ,  70 },
1083
-  {  1015.84079162998*OVERSAMPLENR ,  65 },
1084
-  {  1017.21555915335*OVERSAMPLENR ,  60 },
1085
-  {  1018.35284662863*OVERSAMPLENR ,  55 },
1086
-  {  1019.28926921888*OVERSAMPLENR ,  50 },
1087
-  {  1020.05398015669*OVERSAMPLENR ,  45 },
1088
-  {  1020.67737496272*OVERSAMPLENR ,  40 },
1089
-  {  1021.1802909627*OVERSAMPLENR ,  35 },
1090
-  {  1021.58459281248*OVERSAMPLENR ,  30 },
1091
-  {  1021.90701441192*OVERSAMPLENR ,  25 },
1092
-  {  1022.16215103698*OVERSAMPLENR ,  20 },
1093
-  {  1022.36275529549*OVERSAMPLENR ,  15 },
1094
-  {  1022.51930392497*OVERSAMPLENR ,  10 },
1095
-  {  1022.64051573734*OVERSAMPLENR ,  5 },
1096
-  {  1022.73355805611*OVERSAMPLENR ,  0 }
1097
-};
1098
-#endif
1099 1024
 
1100 1025
 #define _TT_NAME(_N) temptable_ ## _N
1101 1026
 #define TT_NAME(_N) _TT_NAME(_N)

+ 9
- 4
Marlin/ultralcd.cpp Ver arquivo

@@ -19,6 +19,7 @@ int absPreheatHotendTemp;
19 19
 int absPreheatHPBTemp;
20 20
 int absPreheatFanSpeed;
21 21
 
22
+
22 23
 #ifdef ULTIPANEL
23 24
 static float manual_feedrate[] = MANUAL_FEEDRATE;
24 25
 #endif // ULTIPANEL
@@ -255,8 +256,8 @@ static void lcd_sdcard_stop()
255 256
         enquecommand_P(PSTR(SD_FINISHED_RELEASECOMMAND));
256 257
     }
257 258
     autotempShutdown();
258
-    
259
-    cancel_heatup = true;
259
+
260
+	cancel_heatup = true;
260 261
 }
261 262
 
262 263
 /* Menu implementation */
@@ -869,6 +870,10 @@ static void lcd_control_motion_menu()
869 870
 #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
870 871
     MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &abort_on_endstop_hit);
871 872
 #endif
873
+#ifdef SCARA
874
+    MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS],0.5,2);
875
+    MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS],0.5,2);
876
+#endif
872 877
     END_MENU();
873 878
 }
874 879
 
@@ -904,13 +909,13 @@ static void lcd_control_retract_menu()
904 909
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
905 910
     MENU_ITEM_EDIT(bool, MSG_AUTORETRACT, &autoretract_enabled);
906 911
     MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT, &retract_length, 0, 100);
907
-    #if EXTRUDERS > 1
912
+	#if EXTRUDERS > 1
908 913
       MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_SWAP, &retract_length_swap, 0, 100);
909 914
     #endif
910 915
     MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACTF, &retract_feedrate, 1, 999);
911 916
     MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_ZLIFT, &retract_zlift, 0, 999);
912 917
     MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER, &retract_recover_length, 0, 100);
913
-    #if EXTRUDERS > 1
918
+	#if EXTRUDERS > 1
914 919
       MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER_SWAP, &retract_recover_length_swap, 0, 100);
915 920
     #endif
916 921
     MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &retract_recover_feedrate, 1, 999);

+ 1
- 0
README.md Ver arquivo

@@ -47,6 +47,7 @@ Features:
47 47
 *   PID tuning
48 48
 *   CoreXY kinematics (www.corexy.com/theory.html)
49 49
 *   Delta kinematics
50
+*   SCARA kinematics
50 51
 *   Dual X-carriage support for multiple extruder systems
51 52
 *   Configurable serial port to support connection of wireless adaptors.
52 53
 *   Automatic operation of extruder/cold-end cooling fans based on nozzle temperature

Carregando…
Cancelar
Salvar