Przeglądaj źródła

Patch LIN_ADVANCE for style and forward-compatibility

Scott Lahteine 8 lat temu
rodzic
commit
6d62a4ffc8
7 zmienionych plików z 141 dodań i 168 usunięć
  1. 9
    9
      Marlin/Configuration_adv.h
  2. 7
    7
      Marlin/Marlin_main.cpp
  3. 7
    1
      Marlin/SanityCheck.h
  4. 18
    13
      Marlin/planner.cpp
  5. 5
    5
      Marlin/planner.h
  6. 71
    105
      Marlin/stepper.cpp
  7. 24
    28
      Marlin/stepper.h

+ 9
- 9
Marlin/Configuration_adv.h Wyświetl plik

@@ -445,6 +445,15 @@
445 445
   #define D_FILAMENT 2.85
446 446
 #endif
447 447
 
448
+// Implementation of a linear pressure control
449
+// Assumption: advance = k * (delta velocity)
450
+// K=0 means advance disabled. A good value for a gregs wade extruder will be around K=75
451
+//#define LIN_ADVANCE
452
+
453
+#if ENABLED(LIN_ADVANCE)
454
+  #define LIN_ADVANCE_K 75
455
+#endif
456
+
448 457
 // @section leveling
449 458
 
450 459
 // Default mesh area is an area with an inset margin on the print area.
@@ -457,15 +466,6 @@
457 466
   #define MESH_MAX_Y (Y_MAX_POS - (MESH_INSET))
458 467
 #endif
459 468
 
460
-//Implementation of a linear pressure control
461
-//Assumption: advance = k * (delta velocity)
462
-//K=0 means advance disabled. A good value for a gregs wade extruder will be around K=75
463
-#define LIN_ADVANCE
464
-
465
-#if ENABLED(LIN_ADVANCE)
466
-  #define LIN_K 75
467
-#endif
468
-
469 469
 // @section extras
470 470
 
471 471
 // Arc interpretation settings:

+ 7
- 7
Marlin/Marlin_main.cpp Wyświetl plik

@@ -6469,13 +6469,13 @@ inline void gcode_M503() {
6469 6469
 #endif // DUAL_X_CARRIAGE
6470 6470
 
6471 6471
 #if ENABLED(LIN_ADVANCE)
6472
-/**
6473
- * M905: Set advance factor
6474
- */
6475
-inline void gcode_M905() {
6476
-  stepper.synchronize();
6477
-  stepper.advance_M905();
6478
-}
6472
+  /**
6473
+   * M905: Set advance factor
6474
+   */
6475
+  inline void gcode_M905() {
6476
+    stepper.synchronize();
6477
+    stepper.advance_M905();
6478
+  }
6479 6479
 #endif
6480 6480
 
6481 6481
 /**

+ 7
- 1
Marlin/SanityCheck.h Wyświetl plik

@@ -352,13 +352,19 @@
352 352
 #endif // AUTO_BED_LEVELING_FEATURE
353 353
 
354 354
 /**
355
+ * Advance Extrusion
356
+ */
357
+#if ENABLED(ADVANCE) && ENABLED(LIN_ADVANCE)
358
+  #error You can enable ADVANCE or LIN_ADVANCE, but not both.
359
+#endif
360
+
361
+/**
355 362
  * Filament Width Sensor
356 363
  */
357 364
 #if ENABLED(FILAMENT_WIDTH_SENSOR) && !HAS_FILAMENT_WIDTH_SENSOR
358 365
   #error "FILAMENT_WIDTH_SENSOR requires a FILWIDTH_PIN to be defined."
359 366
 #endif
360 367
 
361
-
362 368
 /**
363 369
  * ULTIPANEL encoder
364 370
  */

+ 18
- 13
Marlin/planner.cpp Wyświetl plik

@@ -1045,24 +1045,28 @@ void Planner::check_axes_activity() {
1045 1045
   // the maximum junction speed and may always be ignored for any speed reduction checks.
1046 1046
   block->nominal_length_flag = (block->nominal_speed <= v_allowable);
1047 1047
   block->recalculate_flag = true; // Always calculate trapezoid for new block
1048
-  
1049
-  #ifdef LIN_ADVANCE
1050
-    //bse = allsteps: A problem occures if there is a very tiny move before a retract.
1051
-    //In this case, the retract and the move will be executed together. This leads to an enormus amount advance steps due to a hughe e_acceleration.
1052
-    //The math is correct, but you don't want a retract move done with advance! This situation has to be filtered out.
1053
-    if ((!bse || (!bsx && !bsy && !bsz)) || (stepper.get_advance_k() == 0) || (bse == allsteps)) {
1048
+
1049
+  // Update previous path unit_vector and nominal speed
1050
+  for (int i = 0; i < NUM_AXIS; i++) previous_speed[i] = current_speed[i];
1051
+  previous_nominal_speed = block->nominal_speed;
1052
+
1053
+  #if ENABLED(LIN_ADVANCE)
1054
+
1055
+    // bse == allsteps: A problem occurs when there's a very tiny move before a retract.
1056
+    // In this case, the retract and the move will be executed together.
1057
+    // This leads to an enormous number of advance steps due to a huge e_acceleration.
1058
+    // The math is correct, but you don't want a retract move done with advance!
1059
+    // So this situation is filtered out here.
1060
+    if (!bse || (!bsx && !bsy && !bsz) || stepper.get_advance_k() == 0 || bse == allsteps) {
1054 1061
       block->use_advance_lead = false;
1055
-    } else {
1062
+    }
1063
+    else {
1056 1064
       block->use_advance_lead = true;
1057 1065
       block->e_speed_multiplier8 = (block->steps[E_AXIS] << 8) / block->step_event_count;
1058 1066
     }
1059
-  #endif
1060 1067
 
1061
-  // Update previous path unit_vector and nominal speed
1062
-  for (int i = 0; i < NUM_AXIS; i++) previous_speed[i] = current_speed[i];
1063
-  previous_nominal_speed = block->nominal_speed;
1068
+  #elif ENABLED(ADVANCE)
1064 1069
 
1065
-  #if ENABLED(ADVANCE)
1066 1070
     // Calculate advance rate
1067 1071
     if (!bse || (!bsx && !bsy && !bsz)) {
1068 1072
       block->advance_rate = 0;
@@ -1081,7 +1085,8 @@ void Planner::check_axes_activity() {
1081 1085
      SERIAL_ECHOPGM("advance rate :");
1082 1086
      SERIAL_ECHOLN(block->advance_rate/256.0);
1083 1087
      */
1084
-  #endif // ADVANCE
1088
+
1089
+  #endif // ADVANCE or LIN_ADVANCE
1085 1090
 
1086 1091
   calculate_trapezoid_for_block(block, block->entry_speed / block->nominal_speed, safe_speed / block->nominal_speed);
1087 1092
 

+ 5
- 5
Marlin/planner.h Wyświetl plik

@@ -64,16 +64,16 @@ typedef struct {
64 64
 
65 65
   unsigned char direction_bits;             // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
66 66
 
67
-  #if ENABLED(ADVANCE)
67
+  // Advance extrusion
68
+  #if ENABLED(LIN_ADVANCE)
69
+    bool use_advance_lead;
70
+    int e_speed_multiplier8; // Factorised by 2^8 to avoid float
71
+  #elif ENABLED(ADVANCE)
68 72
     long advance_rate;
69 73
     volatile long initial_advance;
70 74
     volatile long final_advance;
71 75
     float advance;
72 76
   #endif
73
-  #ifdef LIN_ADVANCE
74
-    bool use_advance_lead;
75
-    int e_speed_multiplier8; //factorised by 2^8 to avoid float
76
-  #endif
77 77
 
78 78
   // Fields used by the motion planner to manage acceleration
79 79
   float nominal_speed,                               // The nominal speed for this block in mm/sec

+ 71
- 105
Marlin/stepper.cpp Wyświetl plik

@@ -89,13 +89,24 @@ long  Stepper::counter_X = 0,
89 89
 
90 90
 volatile unsigned long Stepper::step_events_completed = 0; // The number of step events executed in the current block
91 91
 
92
-#if ENABLED(ADVANCE)
92
+#if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
93
+
93 94
   unsigned char Stepper::old_OCR0A;
94
-  long  Stepper::final_advance = 0,
95
-        Stepper::old_advance = 0,
96
-        Stepper::e_steps[EXTRUDERS],
97
-        Stepper::advance_rate,
98
-        Stepper::advance;
95
+  volatile unsigned char Stepper::eISR_Rate = 200; // Keep the ISR at a low rate until needed
96
+
97
+  #if ENABLED(LIN_ADVANCE)
98
+    volatile int Stepper::e_steps[EXTRUDERS];
99
+    int Stepper::extruder_advance_k = LIN_ADVANCE_K,
100
+        Stepper::final_estep_rate,
101
+        Stepper::current_estep_rate[EXTRUDERS],
102
+        Stepper::current_adv_steps[EXTRUDERS];
103
+  #else
104
+    long  Stepper::e_steps[EXTRUDERS],
105
+          Stepper::final_advance = 0,
106
+          Stepper::old_advance = 0,
107
+          Stepper::advance_rate,
108
+          Stepper::advance;
109
+  #endif
99 110
 #endif
100 111
 
101 112
 long Stepper::acceleration_time, Stepper::deceleration_time;
@@ -344,30 +355,32 @@ void Stepper::isr() {
344 355
         customizedSerial.checkRx(); // Check for serial chars.
345 356
       #endif
346 357
 
347
-      #if ENABLED(ADVANCE)
348
-        counter_E += current_block->steps[E_AXIS];
349
-        if (counter_E > 0) {
350
-          counter_E -= current_block->step_event_count;
351
-          e_steps[current_block->active_extruder] += motor_direction(E_AXIS) ? -1 : 1;
352
-        }
353
-      #endif //ADVANCE
354
-      
355 358
       #if ENABLED(LIN_ADVANCE)
359
+
356 360
         counter_E += current_block->steps[E_AXIS];
357 361
         if (counter_E > 0) {
358 362
           counter_E -= current_block->step_event_count;
359
-          count_position[_AXIS(E)] += count_direction[_AXIS(E)];
363
+          count_position[E_AXIS] += count_direction[E_AXIS];
360 364
           e_steps[current_block->active_extruder] += motor_direction(E_AXIS) ? -1 : 1;
361 365
         }
362
-        
363
-        if (current_block->use_advance_lead){
366
+
367
+        if (current_block->use_advance_lead) {
364 368
           int delta_adv_steps; //Maybe a char would be enough?
365 369
           delta_adv_steps = (((long)extruder_advance_k * current_estep_rate[current_block->active_extruder]) >> 9) - current_adv_steps[current_block->active_extruder];
366 370
           e_steps[current_block->active_extruder] += delta_adv_steps;
367 371
           current_adv_steps[current_block->active_extruder] += delta_adv_steps;
368 372
         }
369
-      #endif //LIN_ADVANCE
370 373
 
374
+      #elif ENABLED(ADVANCE)
375
+
376
+        counter_E += current_block->steps[E_AXIS];
377
+        if (counter_E > 0) {
378
+          counter_E -= current_block->step_event_count;
379
+          e_steps[current_block->active_extruder] += motor_direction(E_AXIS) ? -1 : 1;
380
+        }
381
+
382
+      #endif // ADVANCE or LIN_ADVANCE
383
+      
371 384
       #define _COUNTER(AXIS) counter_## AXIS
372 385
       #define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP
373 386
       #define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN
@@ -379,7 +392,7 @@ void Stepper::isr() {
379 392
       STEP_ADD(X);
380 393
       STEP_ADD(Y);
381 394
       STEP_ADD(Z);
382
-      #if (DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE))
395
+      #if DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE)
383 396
         STEP_ADD(E);
384 397
       #endif
385 398
 
@@ -393,7 +406,7 @@ void Stepper::isr() {
393 406
       STEP_IF_COUNTER(X);
394 407
       STEP_IF_COUNTER(Y);
395 408
       STEP_IF_COUNTER(Z);
396
-      #if (DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE))
409
+      #if DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE)
397 410
         STEP_IF_COUNTER(E);
398 411
       #endif
399 412
 
@@ -416,12 +429,11 @@ void Stepper::isr() {
416 429
       acceleration_time += timer;
417 430
       
418 431
       #if ENABLED(LIN_ADVANCE)
419
-        if (current_block->use_advance_lead){
432
+
433
+        if (current_block->use_advance_lead)
420 434
           current_estep_rate[current_block->active_extruder] = ((unsigned long)acc_step_rate * current_block->e_speed_multiplier8) >> 8;
421
-        }
422
-      #endif
423 435
 
424
-      #if ENABLED(ADVANCE)
436
+      #elif ENABLED(ADVANCE)
425 437
 
426 438
         advance += advance_rate * step_loops;
427 439
         //NOLESS(advance, current_block->advance);
@@ -430,7 +442,8 @@ void Stepper::isr() {
430 442
         e_steps[current_block->active_extruder] += ((advance >> 8) - old_advance);
431 443
         old_advance = advance >> 8;
432 444
 
433
-      #endif //ADVANCE
445
+      #endif // ADVANCE or LIN_ADVANCE
446
+
434 447
     }
435 448
     else if (step_events_completed > (unsigned long)current_block->decelerate_after) {
436 449
       MultiU24X32toH16(step_rate, deceleration_time, current_block->acceleration_rate);
@@ -448,12 +461,12 @@ void Stepper::isr() {
448 461
       deceleration_time += timer;
449 462
       
450 463
       #if ENABLED(LIN_ADVANCE)
451
-        if (current_block->use_advance_lead){
464
+
465
+        if (current_block->use_advance_lead)
452 466
           current_estep_rate[current_block->active_extruder] = ((unsigned long)step_rate * current_block->e_speed_multiplier8) >> 8;
453
-        }
454
-      #endif
455 467
 
456
-      #if ENABLED(ADVANCE)
468
+      #elif ENABLED(ADVANCE)
469
+
457 470
         advance -= advance_rate * step_loops;
458 471
         NOLESS(advance, final_advance);
459 472
 
@@ -461,15 +474,15 @@ void Stepper::isr() {
461 474
         uint32_t advance_whole = advance >> 8;
462 475
         e_steps[current_block->active_extruder] += advance_whole - old_advance;
463 476
         old_advance = advance_whole;
464
-      #endif //ADVANCE
477
+
478
+      #endif // ADVANCE or LIN_ADVANCE
465 479
     }
466 480
     else {
467
-      #ifdef LIN_ADVANCE
468
-        if (current_block->use_advance_lead){
481
+      #if ENABLED(LIN_ADVANCE)
482
+        if (current_block->use_advance_lead)
469 483
           current_estep_rate[current_block->active_extruder] = final_estep_rate;
470
-        }
471 484
       #endif
472
-      
485
+
473 486
       OCR1A = OCR1A_nominal;
474 487
       // ensure we're running at the correct step rate, even if we just came off an acceleration
475 488
       step_loops = step_loops_nominal;
@@ -485,12 +498,14 @@ void Stepper::isr() {
485 498
   }
486 499
 }
487 500
 
488
-#if ENABLED(ADVANCE)
501
+#if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
502
+
489 503
   // Timer interrupt for E. e_steps is set in the main routine;
490 504
   // Timer 0 is shared with millies
491 505
   ISR(TIMER0_COMPA_vect) { Stepper::advance_isr(); }
492 506
 
493 507
   void Stepper::advance_isr() {
508
+
494 509
     old_OCR0A += 52; // ~10kHz interrupt (250000 / 26 = 9615kHz)
495 510
     OCR0A = old_OCR0A;
496 511
 
@@ -521,58 +536,10 @@ void Stepper::isr() {
521 536
         #endif
522 537
       #endif
523 538
     }
524
-  }
525 539
 
526
-#endif // ADVANCE
527
-
528
-#if ENABLED(LIN_ADVANCE)
529
-unsigned char old_OCR0A;
530
-// Timer interrupt for E. e_steps is set in the main routine;
531
-// Timer 0 is shared with millies
532
-ISR(TIMER0_COMPA_vect) { stepper.advance_isr(); }
533
-
534
-void Stepper::advance_isr() {
535
-  old_OCR0A += 52; // ~10kHz interrupt (250000 / 26 = 9615kHz) war 52
536
-  OCR0A = old_OCR0A;
537
-
538
-#define STEP_E_ONCE(INDEX) \
539
-  if (e_steps[INDEX] != 0) { \
540
-    E## INDEX ##_STEP_WRITE(INVERT_E_STEP_PIN); \
541
-    if (e_steps[INDEX] < 0) { \
542
-      E## INDEX ##_DIR_WRITE(INVERT_E## INDEX ##_DIR); \
543
-      e_steps[INDEX]++; \
544
-    } \
545
-    else if (e_steps[INDEX] > 0) { \
546
-      E## INDEX ##_DIR_WRITE(!INVERT_E## INDEX ##_DIR); \
547
-      e_steps[INDEX]--; \
548
-    } \
549
-    E## INDEX ##_STEP_WRITE(!INVERT_E_STEP_PIN); \
550 540
   }
551 541
 
552
-  // Step all E steppers that have steps, up to 4 steps per interrupt
553
-  for (unsigned char i = 0; i < 4; i++) {
554
-    #if EXTRUDERS > 3
555
-      switch(current_block->active_extruder){case 3:STEP_E_ONCE(3);break;case 2:STEP_E_ONCE(2);break;case 1:STEP_E_ONCE(1);break;default:STEP_E_ONCE(0);}
556
-    #elif EXTRUDERS > 2
557
-      switch(current_block->active_extruder){case 2:STEP_E_ONCE(2);break;case 1:STEP_E_ONCE(1);break;default:STEP_E_ONCE(0);}
558
-    #elif EXTRUDERS > 1
559
-      #if DISABLED(DUAL_X_CARRIAGE)
560
-        if(current_block->active_extruder == 1){STEP_E_ONCE(1)}else{STEP_E_ONCE(0);}
561
-      #else
562
-        extern bool extruder_duplication_enabled;
563
-        if(extruder_duplication_enabled){
564
-          STEP_E_ONCE(0);
565
-          STEP_E_ONCE(1);
566
-        }else {
567
-          if(current_block->active_extruder == 1){STEP_E_ONCE(1)}else{STEP_E_ONCE(0);}
568
-        }
569
-      #endif
570
-    #else
571
-      STEP_E_ONCE(0);
572
-    #endif
573
-  }
574
-}
575
-#endif // LIN_ADVANCE
542
+#endif // ADVANCE or LIN_ADVANCE
576 543
 
577 544
 void Stepper::init() {
578 545
 
@@ -738,27 +705,29 @@ void Stepper::init() {
738 705
   OCR1A = 0x4000;
739 706
   TCNT1 = 0;
740 707
   ENABLE_STEPPER_DRIVER_INTERRUPT();
741
-  
742
-  #if ENABLED(LIN_ADVANCE)
743
-    for (int i = 0; i < EXTRUDERS; i++){
744
-      e_steps[i] = 0;
745
-      current_adv_steps[i] = 0;
746
-    }
747
-    #if defined(TCCR0A) && defined(WGM01)
748
-      CBI(TCCR0A, WGM01);
749
-      CBI(TCCR0A, WGM00);
708
+
709
+  #if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
710
+
711
+    #if ENABLED(LIN_ADVANCE)
712
+
713
+      for (int i = 0; i < EXTRUDERS; i++) {
714
+        e_steps[i] = 0;
715
+        current_adv_steps[i] = 0;
716
+      }
717
+
718
+    #elif ENABLED(ADVANCE)
719
+
720
+      for (uint8_t i = 0; i < EXTRUDERS; i++) e_steps[i] = 0;
721
+
750 722
     #endif
751
-    SBI(TIMSK0, OCIE0A);
752
-  #endif //LIN_ADVANCE
753 723
 
754
-  #if ENABLED(ADVANCE)
755 724
     #if defined(TCCR0A) && defined(WGM01)
756 725
       CBI(TCCR0A, WGM01);
757 726
       CBI(TCCR0A, WGM00);
758 727
     #endif
759
-    for (uint8_t i = 0; i < EXTRUDERS; i++) e_steps[i] = 0;
760 728
     SBI(TIMSK0, OCIE0A);
761
-  #endif //ADVANCE
729
+
730
+  #endif // ADVANCE or LIN_ADVANCE
762 731
 
763 732
   endstops.enable(true); // Start with endstops active. After homing they can be disabled
764 733
   sei();
@@ -1137,15 +1106,12 @@ void Stepper::microstep_readings() {
1137 1106
 }
1138 1107
 
1139 1108
 #if ENABLED(LIN_ADVANCE)
1109
+
1140 1110
   void Stepper::advance_M905() {
1141 1111
     if (code_seen('K')) extruder_advance_k = code_value();
1142 1112
     SERIAL_ECHO_START;
1143
-    SERIAL_ECHOPGM("Advance factor:");
1144
-    SERIAL_CHAR(' ');
1145
-    SERIAL_ECHOLN(extruder_advance_k);
1113
+    SERIAL_ECHOPAIR("Advance factor: ", extruder_advance_k);
1114
+    SERIAL_EOL;
1146 1115
   }
1147 1116
 
1148
-  int Stepper::get_advance_k(){
1149
-    return extruder_advance_k;
1150
-  }
1151
-#endif
1117
+#endif // LIN_ADVANCE

+ 24
- 28
Marlin/stepper.h Wyświetl plik

@@ -90,14 +90,6 @@ class Stepper {
90 90
       static bool performing_homing;
91 91
     #endif
92 92
 
93
-    #if ENABLED(ADVANCE)
94
-      static long e_steps[EXTRUDERS];
95
-    #endif
96
-    
97
-    #if ENABLED(LIN_ADVANCE)
98
-      int extruder_advance_k = LIN_K;
99
-    #endif
100
-
101 93
   private:
102 94
 
103 95
     static unsigned char last_direction_bits;        // The next stepping-bits to be output
@@ -111,18 +103,23 @@ class Stepper {
111 103
     static long counter_X, counter_Y, counter_Z, counter_E;
112 104
     static volatile unsigned long step_events_completed; // The number of step events executed in the current block
113 105
 
114
-    #if ENABLED(ADVANCE)
106
+    #if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
115 107
       static unsigned char old_OCR0A;
116
-      static long advance_rate, advance, old_advance, final_advance;
117
-    #endif
118
-    
119
-    #if ENABLED(LIN_ADVANCE)
120
-      unsigned char old_OCR0A;
121
-      volatile int e_steps[EXTRUDERS];
122
-      int final_estep_rate;
123
-      int current_estep_rate[EXTRUDERS]; //Actual extruder speed [steps/s]
124
-      int current_adv_steps[EXTRUDERS]; //The amount of current added esteps due to advance. Think of it as the current amount of pressure applied to the spring (=filament).
125
-    #endif
108
+      static volatile unsigned char eISR_Rate;
109
+      #if ENABLED(LIN_ADVANCE)
110
+        static volatile int e_steps[EXTRUDERS];
111
+        static int extruder_advance_k;
112
+        static int final_estep_rate;
113
+        static int current_estep_rate[EXTRUDERS]; // Actual extruder speed [steps/s]
114
+        static int current_adv_steps[EXTRUDERS];  // The amount of current added esteps due to advance.
115
+                                                  // i.e., the current amount of pressure applied
116
+                                                  // to the spring (=filament).
117
+      #else
118
+        static long e_steps[EXTRUDERS];
119
+        static long advance_rate, advance, final_advance;
120
+        static long old_advance;
121
+      #endif
122
+    #endif // ADVANCE or LIN_ADVANCE
126 123
 
127 124
     static long acceleration_time, deceleration_time;
128 125
     //unsigned long accelerate_until, decelerate_after, acceleration_rate, initial_rate, final_rate, nominal_rate;
@@ -168,15 +165,9 @@ class Stepper {
168 165
 
169 166
     static void isr();
170 167
 
171
-    #if ENABLED(ADVANCE)
168
+    #if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
172 169
       static void advance_isr();
173 170
     #endif
174
-    
175
-    #if ENABLED(LIN_ADVANCE)
176
-      void advance_isr();
177
-      void advance_M905();
178
-      int get_advance_k();
179
-    #endif
180 171
 
181 172
     //
182 173
     // Block until all buffered steps are executed
@@ -264,6 +255,11 @@ class Stepper {
264 255
       return endstops_trigsteps[axis] / planner.axis_steps_per_mm[axis];
265 256
     }
266 257
 
258
+    #if ENABLED(LIN_ADVANCE)
259
+      void advance_M905();
260
+      FORCE_INLINE int get_advance_k() { return extruder_advance_k; }
261
+    #endif
262
+
267 263
   private:
268 264
 
269 265
     static FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
@@ -335,7 +331,7 @@ class Stepper {
335 331
       OCR1A = acceleration_time;
336 332
       
337 333
       #if ENABLED(LIN_ADVANCE)
338
-        if (current_block->use_advance_lead){
334
+        if (current_block->use_advance_lead) {
339 335
           current_estep_rate[current_block->active_extruder] = ((unsigned long)acc_step_rate * current_block->e_speed_multiplier8) >> 8;
340 336
           final_estep_rate = (current_block->nominal_rate * current_block->e_speed_multiplier8) >> 8;
341 337
         }
@@ -357,4 +353,4 @@ class Stepper {
357 353
 
358 354
 };
359 355
 
360
-#endif // STEPPER_H
356
+#endif // STEPPER_H

Ładowanie…
Anuluj
Zapisz