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
       Stepper::counter_Z = 0,
87
       Stepper::counter_Z = 0,
88
       Stepper::counter_E = 0;
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
 #if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
92
 #if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
93
 
93
 
534
     #endif
534
     #endif
535
 
535
 
536
     // Calculate new timer value
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
       MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
540
       MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
541
       acc_step_rate += current_block->initial_rate;
541
       acc_step_rate += current_block->initial_rate;
551
       #if ENABLED(LIN_ADVANCE)
551
       #if ENABLED(LIN_ADVANCE)
552
 
552
 
553
         if (current_block->use_advance_lead)
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
         if (current_block->use_advance_lead) {
556
         if (current_block->use_advance_lead) {
557
           #if ENABLED(MIXING_EXTRUDER)
557
           #if ENABLED(MIXING_EXTRUDER)
558
             MIXING_STEPPERS_LOOP(j)
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
           #else
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
           #endif
562
           #endif
563
         }
563
         }
564
 
564
 
588
         eISR_Rate = (timer >> 2) * step_loops / abs(e_steps[TOOL_E_INDEX]);
588
         eISR_Rate = (timer >> 2) * step_loops / abs(e_steps[TOOL_E_INDEX]);
589
       #endif
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
       MultiU24X32toH16(step_rate, deceleration_time, current_block->acceleration_rate);
592
       MultiU24X32toH16(step_rate, deceleration_time, current_block->acceleration_rate);
593
 
593
 
594
       if (step_rate <= acc_step_rate) { // Still decelerating?
594
       if (step_rate <= acc_step_rate) { // Still decelerating?
608
         if (current_block->use_advance_lead) {
608
         if (current_block->use_advance_lead) {
609
           #if ENABLED(MIXING_EXTRUDER)
609
           #if ENABLED(MIXING_EXTRUDER)
610
             MIXING_STEPPERS_LOOP(j)
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
           #else
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
           #endif
614
           #endif
615
         }
615
         }
616
 
616
 

+ 1
- 1
Marlin/stepper.h View File

102
 
102
 
103
     // Counter variables for the Bresenham line tracer
103
     // Counter variables for the Bresenham line tracer
104
     static long counter_X, counter_Y, counter_Z, counter_E;
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
     #if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
107
     #if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
108
       static unsigned char old_OCR0A;
108
       static unsigned char old_OCR0A;

Loading…
Cancel
Save