Browse Source

Also convert acceleration_rate to uint32_t

acceleration_rate is also unsigned
Yuri D'Elia 4 years ago
parent
commit
30a806608f
2 changed files with 2 additions and 2 deletions
  1. 1 1
      Firmware/planner.cpp
  2. 1 1
      Firmware/planner.h

+ 1 - 1
Firmware/planner.cpp

@@ -1132,7 +1132,7 @@ Having the real displacement of the head, we can calculate the total movement le
     block->acceleration_st = (block->acceleration_st + (bresenham_oversample >> 1)) / bresenham_oversample;
 #endif
 
-  block->acceleration_rate = (long)((float)block->acceleration_st * (16777216.0 / (F_CPU / 8.0)));
+  block->acceleration_rate = ((float)block->acceleration_st * (16777216.0 / (F_CPU / 8.0)));
 
 #ifdef LIN_ADVANCE
   if (block->use_advance_lead) {

+ 1 - 1
Firmware/planner.h

@@ -73,7 +73,7 @@ typedef struct {
   // steps_x.y,z, step_event_count, acceleration_rate, direction_bits and active_extruder are set by plan_buffer_line().
   dda_isteps_t steps_x, steps_y, steps_z, steps_e;  // Step count along each axis
   dda_usteps_t step_event_count;            // The number of step events required to complete this block
-  long acceleration_rate;                   // The acceleration rate used for acceleration calculation
+  uint32_t acceleration_rate;               // The acceleration rate used for acceleration calculation
   unsigned char direction_bits;             // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
   unsigned char active_extruder;            // Selects the active extruder
   // accelerate_until and decelerate_after are set by calculate_trapezoid_for_block() and they need to be synchronized with the stepper interrupt controller.