瀏覽代碼

Revert "Reset timer count before first block step"

This reverts commit 5cf6a062e3.
Scott Lahteine 7 年之前
父節點
當前提交
8df5955da4
共有 2 個檔案被更改,包括 9 行新增15 行删除
  1. 6
    15
      Marlin/src/module/stepper.cpp
  2. 3
    0
      Marlin/src/module/stepper.h

+ 6
- 15
Marlin/src/module/stepper.cpp 查看文件

408
   }
408
   }
409
 
409
 
410
   // If there is no current block, attempt to pop one from the buffer
410
   // If there is no current block, attempt to pop one from the buffer
411
-  bool first_step = false;
412
   if (!current_block) {
411
   if (!current_block) {
413
     // Anything in the buffer?
412
     // Anything in the buffer?
414
     if ((current_block = planner.get_current_block())) {
413
     if ((current_block = planner.get_current_block())) {
415
       trapezoid_generator_reset();
414
       trapezoid_generator_reset();
416
-      HAL_timer_set_current_count(STEP_TIMER_NUM, 0);
417
-      first_step = true;
418
 
415
 
419
       // Initialize Bresenham counters to 1/2 the ceiling
416
       // Initialize Bresenham counters to 1/2 the ceiling
420
       counter_X = counter_Y = counter_Z = counter_E = -(current_block->step_event_count >> 1);
417
       counter_X = counter_Y = counter_Z = counter_E = -(current_block->step_event_count >> 1);
669
   // Calculate new timer value
666
   // Calculate new timer value
670
   if (step_events_completed <= (uint32_t)current_block->accelerate_until) {
667
   if (step_events_completed <= (uint32_t)current_block->accelerate_until) {
671
 
668
 
672
-    if (first_step) {
673
-      acc_step_rate = current_block->initial_rate;
674
-      acceleration_time = 0;
675
-    }
676
-    else {
677
-      #ifdef CPU_32_BIT
678
-        MultiU32X24toH32(acc_step_rate, acceleration_time, current_block->acceleration_rate);
679
-      #else
680
-        MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
681
-      #endif
682
-      acc_step_rate += current_block->initial_rate;
683
-    }
669
+    #ifdef CPU_32_BIT
670
+      MultiU32X24toH32(acc_step_rate, acceleration_time, current_block->acceleration_rate);
671
+    #else
672
+      MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
673
+    #endif
674
+    acc_step_rate += current_block->initial_rate;
684
 
675
 
685
     // upper limit
676
     // upper limit
686
     NOMORE(acc_step_rate, current_block->nominal_rate);
677
     NOMORE(acc_step_rate, current_block->nominal_rate);

+ 3
- 0
Marlin/src/module/stepper.h 查看文件

362
       OCR1A_nominal = calc_timer_interval(current_block->nominal_rate);
362
       OCR1A_nominal = calc_timer_interval(current_block->nominal_rate);
363
       // make a note of the number of step loops required at nominal speed
363
       // make a note of the number of step loops required at nominal speed
364
       step_loops_nominal = step_loops;
364
       step_loops_nominal = step_loops;
365
+      acc_step_rate = current_block->initial_rate;
366
+      acceleration_time = calc_timer_interval(acc_step_rate);
367
+      _NEXT_ISR(acceleration_time);
365
 
368
 
366
       #if ENABLED(LIN_ADVANCE)
369
       #if ENABLED(LIN_ADVANCE)
367
         if (current_block->use_advance_lead) {
370
         if (current_block->use_advance_lead) {

Loading…
取消
儲存