Browse Source

Merge pull request #5908 from thinkyhead/rc_fix_slowdown

General minor cleanup
pull/1/head
Scott Lahteine 8 years ago
committed by GitHub
parent
commit
9924199802
  1. 22
      Marlin/Marlin_main.cpp
  2. 6
      Marlin/planner.cpp
  3. 4
      Marlin/planner.h
  4. 9
      Marlin/temperature.cpp

22
Marlin/Marlin_main.cpp

@ -661,18 +661,12 @@ static bool send_ok[BUFSIZE];
#define KEEPALIVE_STATE(n) ;
#endif // HOST_KEEPALIVE_FEATURE
#define DEFINE_PGM_READ_ANY(type, reader) \
static inline type pgm_read_any(const type *p) \
{ return pgm_read_##reader##_near(p); }
DEFINE_PGM_READ_ANY(float, float)
DEFINE_PGM_READ_ANY(signed char, byte)
static inline float pgm_read_any(const float *p) { return pgm_read_float_near(p); }
static inline signed char pgm_read_any(const signed char *p) { return pgm_read_byte_near(p); }
#define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \
static const PROGMEM type array##_P[XYZ] = \
{ X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \
static inline type array(int axis) \
{ return pgm_read_any(&array##_P[axis]); }
static const PROGMEM type array##_P[XYZ] = { X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \
static inline type array(AxisEnum axis) { return pgm_read_any(&array##_P[axis]); }
XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS)
XYZ_CONSTS_FROM_CONFIG(float, base_max_pos, MAX_POS)
@ -848,12 +842,8 @@ static bool drain_injected_commands_P() {
cmd[sizeof(cmd) - 1] = '\0';
while ((c = cmd[i]) && c != '\n') i++; // find the end of this gcode command
cmd[i] = '\0';
if (shove_and_echo_command(cmd)) { // success?
if (c) // newline char?
injected_commands_P += i + 1; // advance to the next command
else
injected_commands_P = NULL; // nul char? no more commands
}
if (shove_and_echo_command(cmd)) // success?
injected_commands_P = c ? injected_commands_P + i + 1 : NULL; // next command or done
}
return (injected_commands_P != NULL); // return whether any more remain
}

6
Marlin/planner.cpp

@ -942,7 +942,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
* Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
*/
#if IS_CORE
float delta_mm[7];
float delta_mm[Z_HEAD + 1];
#if CORE_IS_XY
delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS];
delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS];
@ -963,7 +963,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
delta_mm[C_AXIS] = CORESIGN(db - dc) * steps_to_mm[C_AXIS];
#endif
#else
float delta_mm[4];
float delta_mm[XYZE];
delta_mm[X_AXIS] = da * steps_to_mm[X_AXIS];
delta_mm[Y_AXIS] = db * steps_to_mm[Y_AXIS];
delta_mm[Z_AXIS] = dc * steps_to_mm[Z_AXIS];
@ -995,10 +995,10 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
// Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill
#if ENABLED(SLOWDOWN) || ENABLED(ULTRA_LCD) || defined(XY_FREQUENCY_LIMIT)
// Segment time im micro seconds
unsigned long segment_time = lround(1000000.0 / inverse_mm_s);
#endif
#if ENABLED(SLOWDOWN)
// Segment time im micro seconds
if (moves_queued > 1 && moves_queued < (BLOCK_BUFFER_SIZE) / 2) {
if (segment_time < min_segment_time) {
// buffer is draining, add extra time. The amount of time added increases if the buffer is still emptied more.

4
Marlin/planner.h

@ -414,9 +414,7 @@ class Planner {
#endif
#if ENABLED(AUTOTEMP)
static float autotemp_max;
static float autotemp_min;
static float autotemp_factor;
static float autotemp_min, autotemp_max, autotemp_factor;
static bool autotemp_enabled;
static void getHighESpeed();
static void autotemp_M104_M109();

9
Marlin/temperature.cpp

@ -982,9 +982,6 @@ void Temperature::init() {
#if ENABLED(FAST_PWM_FAN)
setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
#endif
#if ENABLED(FAN_SOFT_PWM)
soft_pwm_fan[0] = fanSpeedSoftPwm[0] >> 1;
#endif
#endif
#if HAS_FAN1
@ -992,9 +989,6 @@ void Temperature::init() {
#if ENABLED(FAST_PWM_FAN)
setPwmFrequency(FAN1_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
#endif
#if ENABLED(FAN_SOFT_PWM)
soft_pwm_fan[1] = fanSpeedSoftPwm[1] >> 1;
#endif
#endif
#if HAS_FAN2
@ -1002,9 +996,6 @@ void Temperature::init() {
#if ENABLED(FAST_PWM_FAN)
setPwmFrequency(FAN2_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
#endif
#if ENABLED(FAN_SOFT_PWM)
soft_pwm_fan[2] = fanSpeedSoftPwm[2] >> 1;
#endif
#endif
#if ENABLED(HEATER_0_USES_MAX6675)

Loading…
Cancel
Save