Browse Source

Merge remote-tracking branch 'upstream/Marlin_v1' into delta-configuration

Conflicts:
	Marlin/Marlin_main.cpp
Jim Morris 12 years ago
parent
commit
b9d7ccf1cd
9 changed files with 1775 additions and 1551 deletions
  1. 1
    0
      Marlin/Configuration.h
  2. 25
    0
      Marlin/Configuration_adv.h
  3. 5
    1
      Marlin/Marlin.h
  4. 106
    11
      Marlin/Marlin_main.cpp
  5. 1537
    1506
      Marlin/language.h
  6. 24
    11
      Marlin/pins.h
  7. 66
    22
      Marlin/stepper.cpp
  8. 9
    0
      Marlin/ultralcd.cpp
  9. 2
    0
      README.md

+ 1
- 0
Marlin/Configuration.h View File

@@ -28,6 +28,7 @@
28 28
 // 3  = MEGA/RAMPS up to 1.2 = 3
29 29
 // 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed)
30 30
 // 34 = RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed)
31
+// 35 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Fan)
31 32
 // 4  = Duemilanove w/ ATMega328P pin assignment
32 33
 // 5  = Gen6
33 34
 // 51 = Gen6 deluxe

+ 25
- 0
Marlin/Configuration_adv.h View File

@@ -146,6 +146,31 @@
146 146
   #define EXTRUDERS 1
147 147
 #endif
148 148
 
149
+// Enable this for dual x-carriage printers. 
150
+// A dual x-carriage design has the advantage that the inactive extruder can be parked which
151
+// prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
152
+// allowing faster printing speeds.
153
+//#define DUAL_X_CARRIAGE
154
+#ifdef DUAL_X_CARRIAGE
155
+// Configuration for second X-carriage
156
+// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop;
157
+// the second x-carriage always homes to the maximum endstop.
158
+#define X2_MIN_POS 88     // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage
159
+#define X2_MAX_POS 350.45 // set maximum to the distance between toolheads when both heads are homed 
160
+#define X2_HOME_DIR 1     // the second X-carriage always homes to the maximum endstop position
161
+#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position 
162
+    // However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software 
163
+    // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
164
+    // without modifying the firmware (through the "M218 T1 X???" command).
165
+    // Remember: you should set the second extruder x-offset to 0 in your slicer.
166
+
167
+// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
168
+#define X2_ENABLE_PIN 29
169
+#define X2_STEP_PIN 25
170
+#define X2_DIR_PIN 23
171
+
172
+#endif // DUAL_X_CARRIAGE
173
+    
149 174
 //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
150 175
 #define X_HOME_RETRACT_MM 5 
151 176
 #define Y_HOME_RETRACT_MM 5

+ 5
- 1
Marlin/Marlin.h View File

@@ -96,7 +96,11 @@ void process_commands();
96 96
 
97 97
 void manage_inactivity();
98 98
 
99
-#if defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
99
+#if defined(DUAL_X_CARRIAGE) && defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1 \
100
+    && defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
101
+  #define  enable_x() do { WRITE(X_ENABLE_PIN, X_ENABLE_ON); WRITE(X2_ENABLE_PIN, X_ENABLE_ON); } while (0)
102
+  #define disable_x() do { WRITE(X_ENABLE_PIN,!X_ENABLE_ON); WRITE(X2_ENABLE_PIN,!X_ENABLE_ON); } while (0)
103
+#elif defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
100 104
   #define  enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
101 105
   #define disable_x() WRITE(X_ENABLE_PIN,!X_ENABLE_ON)
102 106
 #else

+ 106
- 11
Marlin/Marlin_main.cpp View File

@@ -194,6 +194,10 @@ int EtoPPressure=0;
194 194
   float retract_recover_length=0, retract_recover_feedrate=8*60;
195 195
 #endif
196 196
 
197
+#ifdef ULTIPANEL
198
+	bool powersupply = true;
199
+#endif
200
+
197 201
 //===========================================================================
198 202
 //=============================private variables=============================
199 203
 //===========================================================================
@@ -677,7 +681,44 @@ XYZ_CONSTS_FROM_CONFIG(float, max_length,      MAX_LENGTH);
677 681
 XYZ_CONSTS_FROM_CONFIG(float, home_retract_mm, HOME_RETRACT_MM);
678 682
 XYZ_CONSTS_FROM_CONFIG(signed char, home_dir,  HOME_DIR);
679 683
 
684
+#ifdef DUAL_X_CARRIAGE
685
+  #if EXTRUDERS == 1 || defined(COREXY) \
686
+      || !defined(X2_ENABLE_PIN) || !defined(X2_STEP_PIN) || !defined(X2_DIR_PIN) \
687
+      || !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS) \
688
+      || !defined(X_MAX_PIN) || X_MAX_PIN < 0
689
+    #error "Missing or invalid definitions for DUAL_X_CARRIAGE mode."
690
+  #endif
691
+  #if X_HOME_DIR != -1 || X2_HOME_DIR != 1
692
+    #error "Please use canonical x-carriage assignment" // the x-carriages are defined by their homing directions
693
+  #endif  
694
+    
695
+static float x_home_pos(int extruder) {
696
+  if (extruder == 0)
697
+    return base_home_pos(X_AXIS) + add_homeing[X_AXIS];
698
+  else
699
+    // In dual carriage mode the extruder offset provides an override of the
700
+    // second X-carriage offset when homed - otherwise X2_HOME_POS is used.
701
+    // This allow soft recalibration of the second extruder offset position without firmware reflash 
702
+    // (through the M218 command).
703
+    return (extruder_offset[X_AXIS][1] > 0) ? extruder_offset[X_AXIS][1] : X2_HOME_POS;
704
+}
705
+
706
+static int x_home_dir(int extruder) {
707
+  return (extruder == 0) ? X_HOME_DIR : X2_HOME_DIR;
708
+}
709
+
710
+static float inactive_x_carriage_pos = X2_MAX_POS;
711
+#endif     
712
+
680 713
 static void axis_is_at_home(int axis) {
714
+#ifdef DUAL_X_CARRIAGE
715
+  if (axis == X_AXIS && active_extruder != 0) {
716
+    current_position[X_AXIS] = x_home_pos(active_extruder);
717
+    min_pos[X_AXIS] =          X2_MIN_POS;
718
+    max_pos[X_AXIS] =          max(extruder_offset[X_AXIS][1], X2_MAX_POS);
719
+    return;
720
+  }
721
+#endif  
681 722
   current_position[axis] = base_home_pos(axis) + add_homeing[axis];
682 723
   min_pos[axis] =          base_min_pos(axis) + add_homeing[axis];
683 724
   max_pos[axis] =          base_max_pos(axis) + add_homeing[axis];
@@ -686,10 +727,16 @@ static void axis_is_at_home(int axis) {
686 727
 static void homeaxis(int axis) {
687 728
 #define HOMEAXIS_DO(LETTER) \
688 729
   ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))
730
+
689 731
   if (axis==X_AXIS ? HOMEAXIS_DO(X) :
690 732
       axis==Y_AXIS ? HOMEAXIS_DO(Y) :
691 733
       axis==Z_AXIS ? HOMEAXIS_DO(Z) :
692 734
       0) {
735
+    int axis_home_dir = home_dir(axis);
736
+#ifdef DUAL_X_CARRIAGE
737
+    if (axis == X_AXIS)
738
+      axis_home_dir = x_home_dir(active_extruder);
739
+#endif
693 740
 
694 741
     // Engage Servo endstop if enabled
695 742
     #ifdef SERVO_ENDSTOPS
@@ -700,18 +747,18 @@ static void homeaxis(int axis) {
700 747
       
701 748
     current_position[axis] = 0;
702 749
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
703
-    destination[axis] = 1.5 * max_length(axis) * home_dir(axis);
750
+    destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
704 751
     feedrate = homing_feedrate[axis];
705 752
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
706 753
     st_synchronize();
707 754
 
708 755
     current_position[axis] = 0;
709 756
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
710
-    destination[axis] = -home_retract_mm(axis) * home_dir(axis);
757
+    destination[axis] = -home_retract_mm(axis) * axis_home_dir;
711 758
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
712 759
     st_synchronize();
713 760
 
714
-    destination[axis] = 2*home_retract_mm(axis) * home_dir(axis);
761
+    destination[axis] = 2*home_retract_mm(axis) * axis_home_dir;
715 762
 #ifdef DELTA
716 763
     feedrate = homing_feedrate[axis]/10;
717 764
 #else
@@ -855,7 +902,7 @@ void process_commands()
855 902
 
856 903
 #else // NOT DELTA
857 904
 
858
-          home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
905
+      home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
859 906
 
860 907
       #if Z_HOME_DIR > 0                      // If homing away from BED do Z first
861 908
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
@@ -868,8 +915,14 @@ void process_commands()
868 915
       {
869 916
         current_position[X_AXIS] = 0;current_position[Y_AXIS] = 0;
870 917
 
918
+       #ifndef DUAL_X_CARRIAGE
919
+        int x_axis_home_dir = home_dir(X_AXIS);
920
+       #else
921
+        int x_axis_home_dir = x_home_dir(active_extruder);
922
+       #endif
923
+        
871 924
         plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
872
-        destination[X_AXIS] = 1.5 * X_MAX_LENGTH * X_HOME_DIR;destination[Y_AXIS] = 1.5 * Y_MAX_LENGTH * Y_HOME_DIR;
925
+        destination[X_AXIS] = 1.5 * max_length(X_AXIS) * x_axis_home_dir;destination[Y_AXIS] = 1.5 * max_length(Y_AXIS) * home_dir(Y_AXIS);
873 926
         feedrate = homing_feedrate[X_AXIS];
874 927
         if(homing_feedrate[Y_AXIS]<feedrate)
875 928
           feedrate =homing_feedrate[Y_AXIS];
@@ -894,6 +947,13 @@ void process_commands()
894 947
 
895 948
       if((home_all_axis) || (code_seen(axis_codes[X_AXIS])))
896 949
       {
950
+      #ifdef DUAL_X_CARRIAGE
951
+        int tmp_extruder = active_extruder;
952
+        active_extruder = !active_extruder;
953
+        HOMEAXIS(X);
954
+        inactive_x_carriage_pos = current_position[X_AXIS];
955
+        active_extruder = tmp_extruder;
956
+      #endif         
897 957
         HOMEAXIS(X);
898 958
       }
899 959
 
@@ -926,7 +986,7 @@ void process_commands()
926 986
         }
927 987
       }
928 988
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
929
-#endif // DELTA
989
+#endif // else DELTA
930 990
           
931 991
       #ifdef ENDSTOPS_ONLY_FOR_HOMING
932 992
         enable_endstops(false);
@@ -1338,14 +1398,26 @@ void process_commands()
1338 1398
     #endif
1339 1399
 
1340 1400
     #if defined(PS_ON_PIN) && PS_ON_PIN > -1
1341
-      case 80: // M80 - ATX Power On
1401
+      case 80: // M80 - Turn on Power Supply
1342 1402
         SET_OUTPUT(PS_ON_PIN); //GND
1343 1403
         WRITE(PS_ON_PIN, PS_ON_AWAKE);
1404
+        #ifdef ULTIPANEL
1405
+          powersupply = true;
1406
+          LCD_MESSAGEPGM(WELCOME_MSG);
1407
+          lcd_update();
1408
+        #endif
1344 1409
         break;
1345 1410
       #endif
1346
-
1347
-      case 81: // M81 - ATX Power Off
1348
-
1411
+      
1412
+      case 81: // M81 - Turn off Power Supply
1413
+        disable_heater();
1414
+        st_synchronize();
1415
+        disable_e0();
1416
+        disable_e1();
1417
+        disable_e2();
1418
+        finishAndDisableSteppers();
1419
+        fanSpeed = 0;
1420
+        delay(1000); // Wait a little before to switch off
1349 1421
       #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
1350 1422
         st_synchronize();
1351 1423
         suicide();
@@ -1353,7 +1425,12 @@ void process_commands()
1353 1425
         SET_OUTPUT(PS_ON_PIN);
1354 1426
         WRITE(PS_ON_PIN, PS_ON_ASLEEP);
1355 1427
       #endif
1356
-        break;
1428
+      #ifdef ULTIPANEL
1429
+        powersupply = false;
1430
+        LCD_MESSAGEPGM(MACHINE_NAME" "MSG_OFF".");
1431
+        lcd_update();
1432
+      #endif
1433
+	  break;
1357 1434
 
1358 1435
     case 82:
1359 1436
       axis_relative_modes[3] = false;
@@ -2005,6 +2082,20 @@ void process_commands()
2005 2082
       if(tmp_extruder != active_extruder) {
2006 2083
         // Save current position to return to after applying extruder offset
2007 2084
         memcpy(destination, current_position, sizeof(destination));
2085
+      #ifdef DUAL_X_CARRIAGE
2086
+        // only apply Y extruder offset in dual x carriage mode (x offset is already used in determining home pos)
2087
+        current_position[Y_AXIS] = current_position[Y_AXIS] -
2088
+                     extruder_offset[Y_AXIS][active_extruder] +
2089
+                     extruder_offset[Y_AXIS][tmp_extruder];
2090
+
2091
+        float tmp_x_pos = current_position[X_AXIS];
2092
+
2093
+        // Set the new active extruder and position
2094
+        active_extruder = tmp_extruder;
2095
+        axis_is_at_home(X_AXIS); //this function updates X min/max values.
2096
+        current_position[X_AXIS] = inactive_x_carriage_pos;
2097
+        inactive_x_carriage_pos = tmp_x_pos;      
2098
+      #else    
2008 2099
         // Offset extruder (only by XY)
2009 2100
         int i;
2010 2101
         for(i = 0; i < 2; i++) {
@@ -2014,6 +2105,7 @@ void process_commands()
2014 2105
         }
2015 2106
         // Set the new active extruder and position
2016 2107
         active_extruder = tmp_extruder;
2108
+      #endif //else DUAL_X_CARRIAGE
2017 2109
         plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
2018 2110
         // Move to the old position if 'F' was in the parameters
2019 2111
         if(make_move && Stopped == false) {
@@ -2258,6 +2350,9 @@ void controllerFan()
2258 2350
        || !READ(E2_ENABLE_PIN)
2259 2351
     #endif
2260 2352
     #if EXTRUDER > 1
2353
+      #if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
2354
+       || !READ(X2_ENABLE_PIN)
2355
+      #endif
2261 2356
        || !READ(E1_ENABLE_PIN)
2262 2357
     #endif
2263 2358
        || !READ(E0_ENABLE_PIN)) //If any of the drivers are enabled...

+ 1537
- 1506
Marlin/language.h
File diff suppressed because it is too large
View File


+ 24
- 11
Marlin/pins.h View File

@@ -298,7 +298,7 @@
298 298
 * Arduino Mega pin assignment
299 299
 *
300 300
 ****************************************************************************************/
301
-#if MOTHERBOARD == 3 || MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 77
301
+#if MOTHERBOARD == 3 || MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77
302 302
 #define KNOWN_BOARD 1
303 303
 
304 304
 //////////////////FIX THIS//////////////
@@ -314,7 +314,7 @@
314 314
 // #define RAMPS_V_1_0
315 315
 
316 316
 
317
-#if MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 77
317
+#if MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77
318 318
 
319 319
   #define LARGE_FLASH true
320 320
   
@@ -392,7 +392,7 @@
392 392
     #define LED_PIN            13
393 393
   #endif
394 394
 
395
-  #if MOTHERBOARD == 33
395
+  #if MOTHERBOARD == 33 || MOTHERBOARD == 35
396 396
     #define FAN_PIN            9 // (Sprinter config)
397 397
   #else
398 398
     #define FAN_PIN            4 // IO pin. Buffer needed
@@ -401,6 +401,10 @@
401 401
   #if MOTHERBOARD == 77
402 402
     #define FAN_PIN            8 
403 403
   #endif
404
+  
405
+  #if MOTHERBOARD == 35
406
+    #define CONTROLLERFAN_PIN  10 //Pin used for the fan to cool controller
407
+  #endif
404 408
 
405 409
   #define PS_ON_PIN          12
406 410
 
@@ -410,12 +414,18 @@
410 414
     #define KILL_PIN           -1
411 415
   #endif
412 416
 
413
-  #define HEATER_0_PIN       10   // EXTRUDER 1
417
+  #if MOTHERBOARD == 35
418
+    #define HEATER_0_PIN       8
419
+  #else
420
+    #define HEATER_0_PIN       10   // EXTRUDER 1
421
+  #endif
422
+
414 423
   #if MOTHERBOARD == 33 
415 424
     #define HEATER_1_PIN       -1
416 425
   #else
417 426
     #define HEATER_1_PIN       9    // EXTRUDER 2 (FAN On Sprinter)
418 427
   #endif
428
+
419 429
   #define HEATER_2_PIN       -1 
420 430
 
421 431
   #if MOTHERBOARD == 77
@@ -427,10 +437,15 @@
427 437
   #define TEMP_0_PIN         13   // ANALOG NUMBERING
428 438
   #define TEMP_1_PIN         15   // ANALOG NUMBERING
429 439
   #define TEMP_2_PIN         -1   // ANALOG NUMBERING
430
-  #if MOTHERBOARD == 77
431
-    #define HEATER_BED_PIN     9    // BED
440
+
441
+  #if MOTHERBOARD == 35
442
+    #define HEATER_BED_PIN     -1    // NO BED
432 443
   #else
433
-    #define HEATER_BED_PIN     8    // BED
444
+    #if MOTHERBOARD == 77
445
+      #define HEATER_BED_PIN     9    // BED
446
+    #else
447
+      #define HEATER_BED_PIN     8    // BED
448
+    #endif
434 449
   #endif
435 450
   #define TEMP_BED_PIN       14   // ANALOG NUMBERING
436 451
 
@@ -578,7 +593,7 @@
578 593
 #define TEMP_2_PIN          -1   
579 594
 #define TEMP_BED_PIN        1    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
580 595
 
581
-#endif // MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 77
596
+#endif // MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77
582 597
 
583 598
 // SPI for Max6675 Thermocouple 
584 599
 
@@ -592,9 +607,7 @@
592 607
   #define MAX6675_SS       49
593 608
 #endif
594 609
 
595
-#endif //MOTHERBOARD == 3 || MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 77
596
-
597
-
610
+#endif //MOTHERBOARD == 3 || MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77
598 611
 
599 612
 /****************************************************************************************
600 613
 * Duemilanove w/ ATMega328P pin assignment

+ 66
- 22
Marlin/stepper.cpp View File

@@ -348,11 +348,21 @@ ISR(TIMER1_COMPA_vect)
348 348
 
349 349
     // Set the direction bits (X_AXIS=A_AXIS and Y_AXIS=B_AXIS for COREXY)
350 350
     if((out_bits & (1<<X_AXIS))!=0){
351
-      WRITE(X_DIR_PIN, INVERT_X_DIR);
351
+      #ifdef DUAL_X_CARRIAGE
352
+      if (active_extruder != 0)
353
+        WRITE(X2_DIR_PIN,INVERT_X_DIR);
354
+      else
355
+      #endif        
356
+        WRITE(X_DIR_PIN, INVERT_X_DIR);
352 357
       count_direction[X_AXIS]=-1;
353 358
     }
354 359
     else{
355
-      WRITE(X_DIR_PIN, !INVERT_X_DIR);
360
+      #ifdef DUAL_X_CARRIAGE
361
+      if (active_extruder != 0)
362
+        WRITE(X2_DIR_PIN,!INVERT_X_DIR);
363
+      else
364
+      #endif        
365
+        WRITE(X_DIR_PIN, !INVERT_X_DIR);
356 366
       count_direction[X_AXIS]=1;
357 367
     }
358 368
     if((out_bits & (1<<Y_AXIS))!=0){
@@ -372,29 +382,41 @@ ISR(TIMER1_COMPA_vect)
372 382
     #endif
373 383
       CHECK_ENDSTOPS
374 384
       {
375
-        #if defined(X_MIN_PIN) && X_MIN_PIN > -1
376
-          bool x_min_endstop=(READ(X_MIN_PIN) != X_ENDSTOPS_INVERTING);
377
-          if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0)) {
378
-            endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
379
-            endstop_x_hit=true;
380
-            step_events_completed = current_block->step_event_count;
381
-          }
382
-          old_x_min_endstop = x_min_endstop;
383
-        #endif
385
+        #ifdef DUAL_X_CARRIAGE
386
+        // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
387
+        if ((active_extruder == 0 && X_HOME_DIR == -1) || (active_extruder != 0 && X2_HOME_DIR == -1))
388
+        #endif          
389
+        {
390
+          #if defined(X_MIN_PIN) && X_MIN_PIN > -1
391
+            bool x_min_endstop=(READ(X_MIN_PIN) != X_ENDSTOPS_INVERTING);
392
+            if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0)) {
393
+              endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
394
+              endstop_x_hit=true;
395
+              step_events_completed = current_block->step_event_count;
396
+            }
397
+            old_x_min_endstop = x_min_endstop;
398
+          #endif
399
+        }
384 400
       }
385 401
     }
386 402
     else { // +direction
387 403
       CHECK_ENDSTOPS 
388 404
       {
389
-        #if defined(X_MAX_PIN) && X_MAX_PIN > -1
390
-          bool x_max_endstop=(READ(X_MAX_PIN) != X_ENDSTOPS_INVERTING);
391
-          if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0)){
392
-            endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
393
-            endstop_x_hit=true;
394
-            step_events_completed = current_block->step_event_count;
395
-          }
396
-          old_x_max_endstop = x_max_endstop;
397
-        #endif
405
+        #ifdef DUAL_X_CARRIAGE
406
+        // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
407
+        if ((active_extruder == 0 && X_HOME_DIR == 1) || (active_extruder != 0 && X2_HOME_DIR == 1))
408
+        #endif          
409
+        {
410
+          #if defined(X_MAX_PIN) && X_MAX_PIN > -1
411
+            bool x_max_endstop=(READ(X_MAX_PIN) != X_ENDSTOPS_INVERTING);
412
+            if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0)){
413
+              endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
414
+              endstop_x_hit=true;
415
+              step_events_completed = current_block->step_event_count;
416
+            }
417
+            old_x_max_endstop = x_max_endstop;
418
+          #endif
419
+        }  
398 420
       }
399 421
     }
400 422
 
@@ -507,10 +529,20 @@ ISR(TIMER1_COMPA_vect)
507 529
 
508 530
         counter_x += current_block->steps_x;
509 531
         if (counter_x > 0) {
510
-          WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
532
+          #ifdef DUAL_X_CARRIAGE
533
+          if (active_extruder != 0)
534
+            WRITE(X2_STEP_PIN,!INVERT_X_STEP_PIN);
535
+          else
536
+          #endif        
537
+            WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
511 538
           counter_x -= current_block->step_event_count;
512 539
           count_position[X_AXIS]+=count_direction[X_AXIS];   
513
-          WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
540
+          #ifdef DUAL_X_CARRIAGE
541
+          if (active_extruder != 0)
542
+            WRITE(X2_STEP_PIN,INVERT_X_STEP_PIN);
543
+          else
544
+          #endif        
545
+            WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
514 546
         }
515 547
   
516 548
         counter_y += current_block->steps_y;
@@ -685,6 +717,9 @@ void st_init()
685 717
   #if defined(X_DIR_PIN) && X_DIR_PIN > -1
686 718
     SET_OUTPUT(X_DIR_PIN);
687 719
   #endif
720
+  #if defined(X2_DIR_PIN) && X2_DIR_PIN > -1
721
+    SET_OUTPUT(X2_DIR_PIN);
722
+  #endif
688 723
   #if defined(Y_DIR_PIN) && Y_DIR_PIN > -1 
689 724
     SET_OUTPUT(Y_DIR_PIN);
690 725
   #endif
@@ -711,6 +746,10 @@ void st_init()
711 746
     SET_OUTPUT(X_ENABLE_PIN);
712 747
     if(!X_ENABLE_ON) WRITE(X_ENABLE_PIN,HIGH);
713 748
   #endif
749
+  #if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
750
+    SET_OUTPUT(X2_ENABLE_PIN);
751
+    if(!X_ENABLE_ON) WRITE(X2_ENABLE_PIN,HIGH);
752
+  #endif
714 753
   #if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
715 754
     SET_OUTPUT(Y_ENABLE_PIN);
716 755
     if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH);
@@ -788,6 +827,11 @@ void st_init()
788 827
     WRITE(X_STEP_PIN,INVERT_X_STEP_PIN);
789 828
     disable_x();
790 829
   #endif  
830
+  #if defined(X2_STEP_PIN) && (X2_STEP_PIN > -1) 
831
+    SET_OUTPUT(X2_STEP_PIN);
832
+    WRITE(X2_STEP_PIN,INVERT_X_STEP_PIN);
833
+    disable_x();
834
+  #endif  
791 835
   #if defined(Y_STEP_PIN) && (Y_STEP_PIN > -1) 
792 836
     SET_OUTPUT(Y_STEP_PIN);
793 837
     WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN);

+ 9
- 0
Marlin/ultralcd.cpp View File

@@ -40,6 +40,7 @@ void copy_and_scalePID_d();
40 40
 /* Different menus */
41 41
 static void lcd_status_screen();
42 42
 #ifdef ULTIPANEL
43
+extern bool powersupply;
43 44
 static void lcd_main_menu();
44 45
 static void lcd_tune_menu();
45 46
 static void lcd_prepare_menu();
@@ -348,6 +349,14 @@ static void lcd_prepare_menu()
348 349
     MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla);
349 350
     MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
350 351
     MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
352
+#if PS_ON_PIN > -1
353
+    if (powersupply)
354
+    {
355
+        MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
356
+    }else{
357
+        MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80"));
358
+    }
359
+#endif
351 360
     MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
352 361
     END_MENU();
353 362
 }

+ 2
- 0
README.md View File

@@ -41,6 +41,8 @@ Features:
41 41
 *   Heater power reporting. Useful for PID monitoring.
42 42
 *   PID tuning
43 43
 *   CoreXY kinematics (www.corexy.com/theory.html)
44
+*   Delta kinematics
45
+*   Dual X-carriage support for multiple extruder systems
44 46
 *   Configurable serial port to support connection of wireless adaptors.
45 47
 *   Automatic operation of extruder/cold-end cooling fans based on nozzle temperature
46 48
 *   RC Servo Support, specify angle or duration for continuous rotation servos.

Loading…
Cancel
Save