Browse Source

Added support for Gen3+ (Pins file only)

Added late z enable. (blddk request)
Only calculate look ahead if >2 moves in buffer.
Removed some FORCE_INLINE to save memory.

Signed-off-by: Erik van der Zalm <erik@vdzalm.eu>
Erik van der Zalm 12 years ago
parent
commit
e45e5c68bb
6 changed files with 146 additions and 16 deletions
  1. 3
    1
      Marlin/Configuration.h
  2. 8
    8
      Marlin/Marlin.pde
  3. 124
    1
      Marlin/pins.h
  4. 7
    5
      Marlin/planner.cpp
  5. 3
    0
      Marlin/stepper.cpp
  6. 1
    1
      Marlin/ultralcd.pde

+ 3
- 1
Marlin/Configuration.h View File

@@ -28,7 +28,8 @@
28 28
 // Gen6 = 5,
29 29
 // Sanguinololu 1.2 and above = 62
30 30
 // Ultimaker = 7,
31
-// Teensylu = 8
31
+// Teensylu = 8,
32
+// Gen3+ =9
32 33
 #define MOTHERBOARD 7
33 34
 
34 35
 //===========================================================================
@@ -201,6 +202,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
201 202
 #define DISABLE_Y false
202 203
 #define DISABLE_Z false
203 204
 #define DISABLE_E false // For all extruders
205
+//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
204 206
 
205 207
 // Inverting axis direction
206 208
 //#define INVERT_X_DIR false    // for Mendel set to false, for Orca set to true

+ 8
- 8
Marlin/Marlin.pde View File

@@ -327,7 +327,7 @@ void loop()
327 327
 }
328 328
 
329 329
 
330
-FORCE_INLINE void get_command() 
330
+void get_command() 
331 331
 { 
332 332
   while( MSerial.available() > 0  && buflen < BUFSIZE) {
333 333
     serial_char = MSerial.read();
@@ -474,20 +474,20 @@ FORCE_INLINE void get_command()
474 474
 }
475 475
 
476 476
 
477
-FORCE_INLINE float code_value() 
477
+float code_value() 
478 478
 { 
479 479
   return (strtod(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL)); 
480 480
 }
481
-FORCE_INLINE long code_value_long() 
481
+long code_value_long() 
482 482
 { 
483 483
   return (strtol(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL, 10)); 
484 484
 }
485
-FORCE_INLINE bool code_seen(char code_string[]) //Return True if the string was found
485
+bool code_seen(char code_string[]) //Return True if the string was found
486 486
 { 
487 487
   return (strstr(cmdbuffer[bufindr], code_string) != NULL); 
488 488
 }  
489 489
 
490
-FORCE_INLINE bool code_seen(char code)
490
+bool code_seen(char code)
491 491
 {
492 492
   strchr_pointer = strchr(cmdbuffer[bufindr], code);
493 493
   return (strchr_pointer != NULL);  //Return True if a character was found
@@ -519,7 +519,7 @@ FORCE_INLINE bool code_seen(char code)
519 519
     endstops_hit_on_purpose();\
520 520
   }
521 521
 
522
-FORCE_INLINE void process_commands()
522
+void process_commands()
523 523
 {
524 524
   unsigned long codenum; //throw away variable
525 525
   char *starpos = NULL;
@@ -1235,7 +1235,7 @@ void ClearToSend()
1235 1235
   SERIAL_PROTOCOLLNPGM("ok"); 
1236 1236
 }
1237 1237
 
1238
-FORCE_INLINE void get_coordinates()
1238
+void get_coordinates()
1239 1239
 {
1240 1240
   for(int8_t i=0; i < NUM_AXIS; i++) {
1241 1241
     if(code_seen(axis_codes[i])) destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
@@ -1247,7 +1247,7 @@ FORCE_INLINE void get_coordinates()
1247 1247
   }
1248 1248
 }
1249 1249
 
1250
-FORCE_INLINE void get_arc_coordinates()
1250
+void get_arc_coordinates()
1251 1251
 {
1252 1252
    get_coordinates();
1253 1253
    if(code_seen('I')) offset[0] = code_value();

+ 124
- 1
Marlin/pins.h View File

@@ -470,7 +470,7 @@
470 470
 #define X_STEP_PIN         15
471 471
 #define X_DIR_PIN          21
472 472
 #define X_MIN_PIN          18
473
-#define X_MAX_PIN           -2
473
+#define X_MAX_PIN           -1
474 474
 
475 475
 #define Y_STEP_PIN         22
476 476
 #define Y_DIR_PIN          23
@@ -653,6 +653,73 @@
653 653
 
654 654
 #endif
655 655
 
656
+#if MOTHERBOARD == 71
657
+#define KNOWN_BOARD
658
+/*****************************************************************
659
+* Ultimaker pin assignment (Old electronics)
660
+******************************************************************/
661
+
662
+#ifndef __AVR_ATmega1280__
663
+ #ifndef __AVR_ATmega2560__
664
+ #error Oops!  Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
665
+ #endif
666
+#endif
667
+
668
+#define X_STEP_PIN 25
669
+#define X_DIR_PIN 23
670
+#define X_MIN_PIN 15
671
+#define X_MAX_PIN 14
672
+#define X_ENABLE_PIN 27
673
+
674
+#define Y_STEP_PIN 31
675
+#define Y_DIR_PIN 33
676
+#define Y_MIN_PIN 17
677
+#define Y_MAX_PIN 16
678
+#define Y_ENABLE_PIN 29
679
+
680
+#define Z_STEP_PIN 37 
681
+#define Z_DIR_PIN 39
682
+#define Z_MIN_PIN 19
683
+#define Z_MAX_PIN 18
684
+#define Z_ENABLE_PIN 35
685
+
686
+#define HEATER_BED_PIN -1 
687
+#define TEMP_BED_PIN -1  
688
+
689
+#define HEATER_0_PIN  2
690
+#define TEMP_0_PIN 8   
691
+
692
+#define HEATER_1_PIN 1
693
+#define TEMP_1_PIN 1
694
+
695
+#define HEATER_2_PIN -1
696
+#define TEMP_2_PIN -1
697
+
698
+#define E0_STEP_PIN         43
699
+#define E0_DIR_PIN          45
700
+#define E0_ENABLE_PIN       41
701
+
702
+#define E1_STEP_PIN         -1
703
+#define E1_DIR_PIN          -1
704
+#define E1_ENABLE_PIN       -1
705
+
706
+#define SDPOWER            -1
707
+#define SDSS               -1
708
+#define LED_PIN            -1
709
+#define FAN_PIN            -1
710
+#define PS_ON_PIN          -1
711
+#define KILL_PIN           -1
712
+#define SUICIDE_PIN        -1  //PIN that has to be turned on right after start, to keep power flowing.
713
+
714
+#define LCD_PINS_RS 24 
715
+#define LCD_PINS_ENABLE 22
716
+#define LCD_PINS_D4 36
717
+#define LCD_PINS_D5 34 
718
+#define LCD_PINS_D6 32
719
+#define LCD_PINS_D7 30
720
+
721
+#endif
722
+
656 723
 /****************************************************************************************
657 724
 * Teensylu 0.7 pin assingments (ATMEGA90USB)
658 725
 * Requires the Teensyduino software with Teensy2.0++ selected in arduino IDE!
@@ -712,6 +779,62 @@
712 779
 #endif
713 780
 #endif
714 781
 
782
+/****************************************************************************************
783
+* Gen3+ pin assignment
784
+*
785
+****************************************************************************************/
786
+#if MOTHERBOARD == 9
787
+#define MOTHERBOARD 6
788
+#define KNOWN_BOARD 1
789
+#ifndef __AVR_ATmega644P__
790
+#error Oops!  Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
791
+#endif
792
+
793
+#define X_STEP_PIN         15
794
+#define X_DIR_PIN          18
795
+#define X_MIN_PIN          20
796
+#define X_MAX_PIN           -1
797
+
798
+#define Y_STEP_PIN         23
799
+#define Y_DIR_PIN          22
800
+#define Y_MIN_PIN          25
801
+#define Y_MAX_PIN          -1
802
+
803
+#define Z_STEP_PIN         27
804
+#define Z_DIR_PIN          28
805
+#define Z_MIN_PIN          30
806
+#define Z_MAX_PIN          -1
807
+
808
+#define E_STEP_PIN         17
809
+#define E_DIR_PIN          21
810
+
811
+#define LED_PIN            -1
812
+
813
+#define FAN_PIN            -1 
814
+
815
+#define PS_ON_PIN         14
816
+#define KILL_PIN           -1
817
+
818
+#define HEATER_0_PIN       12 // (extruder)
819
+
820
+#define HEATER_1_PIN       16 // (bed)
821
+#define X_ENABLE_PIN       19
822
+#define Y_ENABLE_PIN       24
823
+#define Z_ENABLE_PIN       29
824
+#define E_ENABLE_PIN       13
825
+
826
+#define TEMP_0_PIN          0   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 33 extruder)
827
+#define TEMP_1_PIN          5   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 34 bed)
828
+#define TEMP_2_PIN         -1
829
+#define SDPOWER            -1
830
+#define SDSS               4
831
+#define HEATER_2_PIN       -1
832
+
833
+#endif
834
+
835
+
836
+
837
+
715 838
 #ifndef KNOWN_BOARD
716 839
 #error Unknown MOTHERBOARD value in configuration.h
717 840
 #endif

+ 7
- 5
Marlin/planner.cpp View File

@@ -430,7 +430,9 @@ void check_axes_activity() {
430 430
   }
431 431
   if((DISABLE_X) && (x_active == 0)) disable_x();
432 432
   if((DISABLE_Y) && (y_active == 0)) disable_y();
433
-  if((DISABLE_Z) && (z_active == 0)) disable_z();
433
+  #ifndef Z_LATE_ENABLE
434
+    if((DISABLE_Z) && (z_active == 0)) disable_z();
435
+  #endif
434 436
   if((DISABLE_E) && (e_active == 0)) { disable_e0();disable_e1();disable_e2(); }
435 437
 }
436 438
 
@@ -505,7 +507,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
505 507
   //enable active axes
506 508
   if(block->steps_x != 0) enable_x();
507 509
   if(block->steps_y != 0) enable_y();
508
-  if(block->steps_z != 0) enable_z();
510
+//  if(block->steps_z != 0) enable_z();
509 511
 
510 512
   // Enable all
511 513
   if(block->steps_e != 0) { enable_e0();enable_e1();enable_e2(); }
@@ -535,10 +537,10 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
535 537
     	if(feed_rate<minimumfeedrate) feed_rate=minimumfeedrate;
536 538
   } 
537 539
 
538
-#ifdef SLOWDOWN
540
+
539 541
   // slow down when de buffer starts to empty, rather than wait at the corner for a buffer refill
540 542
   int moves_queued=(block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
541
-  
543
+#ifdef SLOWDOWN
542 544
   if(moves_queued < (BLOCK_BUFFER_SIZE * 0.5) && moves_queued > 1) feed_rate = feed_rate*moves_queued / (BLOCK_BUFFER_SIZE * 0.5); 
543 545
 #endif
544 546
 
@@ -686,7 +688,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
686 688
     vmax_junction = max_z_jerk/2;
687 689
   vmax_junction = min(vmax_junction, block->nominal_speed);
688 690
 
689
-  if ((block_buffer_head != block_buffer_tail) && (previous_nominal_speed > 0.0)) {
691
+  if ((moves_queued > 1) && (previous_nominal_speed > 0.0)) {
690 692
     float jerk = sqrt(pow((current_speed[X_AXIS]-previous_speed[X_AXIS]), 2)+pow((current_speed[Y_AXIS]-previous_speed[Y_AXIS]), 2));
691 693
     if((previous_speed[X_AXIS] != 0.0) || (previous_speed[Y_AXIS] != 0.0)) {
692 694
       vmax_junction = block->nominal_speed;

+ 3
- 0
Marlin/stepper.cpp View File

@@ -274,6 +274,9 @@ FORCE_INLINE void trapezoid_generator_reset() {
274 274
   acceleration_time = calc_timer(acc_step_rate);
275 275
   OCR1A = acceleration_time;
276 276
   OCR1A_nominal = calc_timer(current_block->nominal_rate);
277
+  #ifdef Z_LATE_ENABLE
278
+    if(current_block->steps_z > 0) enable_z();
279
+  #endif
277 280
   
278 281
 //    SERIAL_ECHO_START;
279 282
 //    SERIAL_ECHOPGM("advance :");

+ 1
- 1
Marlin/ultralcd.pde View File

@@ -59,7 +59,7 @@ void lcdProgMemprint(const char *str)
59 59
 //=============================functions         ============================
60 60
 //===========================================================================
61 61
 
62
-FORCE_INLINE int intround(const float &x){return int(0.5+x);}
62
+int intround(const float &x){return int(0.5+x);}
63 63
 
64 64
 void lcd_status(const char* message)
65 65
 {

Loading…
Cancel
Save