Browse Source

Use bit-size typedefs for some stepper vars

Scott Lahteine 8 years ago
parent
commit
08f717e5f7
2 changed files with 10 additions and 10 deletions
  1. 9
    9
      Marlin/stepper.cpp
  2. 1
    1
      Marlin/stepper.h

+ 9
- 9
Marlin/stepper.cpp View File

@@ -87,7 +87,7 @@ long  Stepper::counter_X = 0,
87 87
       Stepper::counter_Z = 0,
88 88
       Stepper::counter_E = 0;
89 89
 
90
-volatile unsigned long Stepper::step_events_completed = 0; // The number of step events executed in the current block
90
+volatile uint32_t Stepper::step_events_completed = 0; // The number of step events executed in the current block
91 91
 
92 92
 #if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
93 93
 
@@ -534,8 +534,8 @@ void Stepper::isr() {
534 534
     #endif
535 535
 
536 536
     // Calculate new timer value
537
-    unsigned short timer, step_rate;
538
-    if (step_events_completed <= (unsigned long)current_block->accelerate_until) {
537
+    uint16_t timer, step_rate;
538
+    if (step_events_completed <= (uint32_t)current_block->accelerate_until) {
539 539
 
540 540
       MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
541 541
       acc_step_rate += current_block->initial_rate;
@@ -551,14 +551,14 @@ void Stepper::isr() {
551 551
       #if ENABLED(LIN_ADVANCE)
552 552
 
553 553
         if (current_block->use_advance_lead)
554
-          current_estep_rate[TOOL_E_INDEX] = ((unsigned long)acc_step_rate * current_block->e_speed_multiplier8) >> 8;
554
+          current_estep_rate[TOOL_E_INDEX] = ((uint32_t)acc_step_rate * current_block->e_speed_multiplier8) >> 8;
555 555
 
556 556
         if (current_block->use_advance_lead) {
557 557
           #if ENABLED(MIXING_EXTRUDER)
558 558
             MIXING_STEPPERS_LOOP(j)
559
-              current_estep_rate[j] = ((unsigned long)acc_step_rate * current_block->e_speed_multiplier8 * current_block->step_event_count / current_block->mix_event_count[j]) >> 8;
559
+              current_estep_rate[j] = ((uint32_t)acc_step_rate * current_block->e_speed_multiplier8 * current_block->step_event_count / current_block->mix_event_count[j]) >> 8;
560 560
           #else
561
-            current_estep_rate[TOOL_E_INDEX] = ((unsigned long)acc_step_rate * current_block->e_speed_multiplier8) >> 8;
561
+            current_estep_rate[TOOL_E_INDEX] = ((uint32_t)acc_step_rate * current_block->e_speed_multiplier8) >> 8;
562 562
           #endif
563 563
         }
564 564
 
@@ -588,7 +588,7 @@ void Stepper::isr() {
588 588
         eISR_Rate = (timer >> 2) * step_loops / abs(e_steps[TOOL_E_INDEX]);
589 589
       #endif
590 590
     }
591
-    else if (step_events_completed > (unsigned long)current_block->decelerate_after) {
591
+    else if (step_events_completed > (uint32_t)current_block->decelerate_after) {
592 592
       MultiU24X32toH16(step_rate, deceleration_time, current_block->acceleration_rate);
593 593
 
594 594
       if (step_rate <= acc_step_rate) { // Still decelerating?
@@ -608,9 +608,9 @@ void Stepper::isr() {
608 608
         if (current_block->use_advance_lead) {
609 609
           #if ENABLED(MIXING_EXTRUDER)
610 610
             MIXING_STEPPERS_LOOP(j)
611
-              current_estep_rate[j] = ((unsigned long)step_rate * current_block->e_speed_multiplier8 * current_block->step_event_count / current_block->mix_event_count[j]) >> 8;
611
+              current_estep_rate[j] = ((uint32_t)step_rate * current_block->e_speed_multiplier8 * current_block->step_event_count / current_block->mix_event_count[j]) >> 8;
612 612
           #else
613
-            current_estep_rate[TOOL_E_INDEX] = ((unsigned long)step_rate * current_block->e_speed_multiplier8) >> 8;
613
+            current_estep_rate[TOOL_E_INDEX] = ((uint32_t)step_rate * current_block->e_speed_multiplier8) >> 8;
614 614
           #endif
615 615
         }
616 616
 

+ 1
- 1
Marlin/stepper.h View File

@@ -102,7 +102,7 @@ class Stepper {
102 102
 
103 103
     // Counter variables for the Bresenham line tracer
104 104
     static long counter_X, counter_Y, counter_Z, counter_E;
105
-    static volatile unsigned long step_events_completed; // The number of step events executed in the current block
105
+    static volatile uint32_t step_events_completed; // The number of step events executed in the current block
106 106
 
107 107
     #if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
108 108
       static unsigned char old_OCR0A;

Loading…
Cancel
Save