Browse Source

Wrap macros to prevent bad expansions

pull/1/head
Scott Lahteine 9 years ago
parent
commit
f9ded2a7c4
  1. 14
      Marlin/Conditionals.h
  2. 4
      Marlin/Configuration.h
  3. 66
      Marlin/Marlin_main.cpp
  4. 2
      Marlin/SdBaseFile.cpp
  5. 4
      Marlin/cardreader.cpp
  6. 2
      Marlin/configuration_store.cpp
  7. 34
      Marlin/dogm_lcd_implementation.h
  8. 6
      Marlin/example_configurations/Felix/Configuration.h
  9. 6
      Marlin/example_configurations/Felix/Configuration_DUAL.h
  10. 6
      Marlin/example_configurations/Hephestos/Configuration.h
  11. 6
      Marlin/example_configurations/Hephestos_2/Configuration.h
  12. 6
      Marlin/example_configurations/K8200/Configuration.h
  13. 6
      Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
  14. 6
      Marlin/example_configurations/RigidBot/Configuration.h
  15. 6
      Marlin/example_configurations/SCARA/Configuration.h
  16. 6
      Marlin/example_configurations/TAZ4/Configuration.h
  17. 6
      Marlin/example_configurations/WITBOX/Configuration.h
  18. 4
      Marlin/example_configurations/adafruit/ST7565/Configuration.h
  19. 4
      Marlin/example_configurations/delta/biv2.5/Configuration.h
  20. 4
      Marlin/example_configurations/delta/generic/Configuration.h
  21. 4
      Marlin/example_configurations/delta/kossel_mini/Configuration.h
  22. 8
      Marlin/example_configurations/delta/kossel_pro/Configuration.h
  23. 8
      Marlin/example_configurations/delta/kossel_xl/Configuration.h
  24. 6
      Marlin/example_configurations/makibox/Configuration.h
  25. 6
      Marlin/example_configurations/tvrrug/Round2/Configuration.h
  26. 4
      Marlin/mesh_bed_leveling.h
  27. 20
      Marlin/planner.cpp
  28. 2
      Marlin/servo.cpp
  29. 26
      Marlin/temperature.cpp
  30. 30
      Marlin/ultralcd.cpp
  31. 2
      Marlin/ultralcd_implementation_hitachi_HD44780.h
  32. 2
      Marlin/ultralcd_st7920_u8glib_rrd.h

14
Marlin/Conditionals.h

@ -264,9 +264,9 @@
/** /**
* Axis lengths * Axis lengths
*/ */
#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS) #define X_MAX_LENGTH (X_MAX_POS - (X_MIN_POS))
#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS) #define Y_MAX_LENGTH (Y_MAX_POS - (Y_MIN_POS))
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS) #define Z_MAX_LENGTH (Z_MAX_POS - (Z_MIN_POS))
/** /**
* SCARA * SCARA
@ -285,8 +285,8 @@
#define Z_HOME_POS MANUAL_Z_HOME_POS #define Z_HOME_POS MANUAL_Z_HOME_POS
#else //!MANUAL_HOME_POSITIONS – Use home switch positions based on homing direction and travel limits #else //!MANUAL_HOME_POSITIONS – Use home switch positions based on homing direction and travel limits
#if ENABLED(BED_CENTER_AT_0_0) #if ENABLED(BED_CENTER_AT_0_0)
#define X_HOME_POS X_MAX_LENGTH * X_HOME_DIR * 0.5 #define X_HOME_POS (X_MAX_LENGTH) * (X_HOME_DIR) * 0.5
#define Y_HOME_POS Y_MAX_LENGTH * Y_HOME_DIR * 0.5 #define Y_HOME_POS (Y_MAX_LENGTH) * (Y_HOME_DIR) * 0.5
#else #else
#define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS) #define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
#define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS) #define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
@ -334,8 +334,8 @@
* Advance calculated values * Advance calculated values
*/ */
#if ENABLED(ADVANCE) #if ENABLED(ADVANCE)
#define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * M_PI) #define EXTRUSION_AREA (0.25 * (D_FILAMENT) * (D_FILAMENT) * M_PI)
#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS] / EXTRUSION_AREA) #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS] / (EXTRUSION_AREA))
#endif #endif
#if ENABLED(ULTIPANEL) && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER) #if ENABLED(ULTIPANEL) && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER)

4
Marlin/Configuration.h

@ -422,9 +422,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

66
Marlin/Marlin_main.cpp

@ -285,7 +285,7 @@ const int sensitive_pins[] = SENSITIVE_PINS; ///< Sensitive pin list for M42
// Inactivity shutdown // Inactivity shutdown
millis_t previous_cmd_ms = 0; millis_t previous_cmd_ms = 0;
static millis_t max_inactive_time = 0; static millis_t max_inactive_time = 0;
static millis_t stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME * 1000L; static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000L;
millis_t print_job_start_ms = 0; ///< Print job start time millis_t print_job_start_ms = 0; ///< Print job start time
millis_t print_job_stop_ms = 0; ///< Print job stop time millis_t print_job_stop_ms = 0; ///< Print job stop time
static uint8_t target_extruder; static uint8_t target_extruder;
@ -1638,13 +1638,13 @@ static void setup_for_endstop_move() {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (marlin_debug_flags & DEBUG_LEVELING) { if (marlin_debug_flags & DEBUG_LEVELING) {
SERIAL_ECHOPAIR("> do_blocking_move_to_xy ", x - X_PROBE_OFFSET_FROM_EXTRUDER); SERIAL_ECHOPAIR("> do_blocking_move_to_xy ", x - (X_PROBE_OFFSET_FROM_EXTRUDER));
SERIAL_ECHOPAIR(", ", y - Y_PROBE_OFFSET_FROM_EXTRUDER); SERIAL_ECHOPAIR(", ", y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
SERIAL_EOL; SERIAL_EOL;
} }
#endif #endif
do_blocking_move_to_xy(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER); // this also updates current_position do_blocking_move_to_xy(x - (X_PROBE_OFFSET_FROM_EXTRUDER), y - (Y_PROBE_OFFSET_FROM_EXTRUDER)); // this also updates current_position
#if DISABLED(Z_PROBE_SLED) && DISABLED(Z_PROBE_ALLEN_KEY) #if DISABLED(Z_PROBE_SLED) && DISABLED(Z_PROBE_ALLEN_KEY)
if (probe_action & ProbeDeploy) { if (probe_action & ProbeDeploy) {
@ -2281,7 +2281,7 @@ inline void gcode_G28() {
sync_plan_position(); sync_plan_position();
// Move all carriages up together until the first endstop is hit. // Move all carriages up together until the first endstop is hit.
for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = 3 * Z_MAX_LENGTH; for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = 3 * (Z_MAX_LENGTH);
feedrate = 1.732 * homing_feedrate[X_AXIS]; feedrate = 1.732 * homing_feedrate[X_AXIS];
line_to_destination(); line_to_destination();
st_synchronize(); st_synchronize();
@ -2330,7 +2330,7 @@ inline void gcode_G28() {
feedrate = max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s) feedrate = max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s)
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (marlin_debug_flags & DEBUG_LEVELING) { if (marlin_debug_flags & DEBUG_LEVELING) {
SERIAL_ECHOPAIR("Raise Z (before homing) to ", (float)MIN_Z_HEIGHT_FOR_HOMING); SERIAL_ECHOPAIR("Raise Z (before homing) to ", (float)(MIN_Z_HEIGHT_FOR_HOMING));
SERIAL_EOL; SERIAL_EOL;
print_xyz("> (home_all_axis || homeZ) > current_position", current_position); print_xyz("> (home_all_axis || homeZ) > current_position", current_position);
print_xyz("> (home_all_axis || homeZ) > destination", destination); print_xyz("> (home_all_axis || homeZ) > destination", destination);
@ -2467,8 +2467,8 @@ inline void gcode_G28() {
// //
// Set the Z probe (or just the nozzle) destination to the safe homing point // Set the Z probe (or just the nozzle) destination to the safe homing point
// //
destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_PROBE_OFFSET_FROM_EXTRUDER); destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - (X_PROBE_OFFSET_FROM_EXTRUDER));
destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER); destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - (Y_PROBE_OFFSET_FROM_EXTRUDER));
destination[Z_AXIS] = current_position[Z_AXIS]; //z is already at the right height destination[Z_AXIS] = current_position[Z_AXIS]; //z is already at the right height
feedrate = XY_TRAVEL_SPEED; feedrate = XY_TRAVEL_SPEED;
@ -2500,10 +2500,10 @@ inline void gcode_G28() {
// Make sure the Z probe is within the physical limits // Make sure the Z probe is within the physical limits
// NOTE: This doesn't necessarily ensure the Z probe is also within the bed! // NOTE: This doesn't necessarily ensure the Z probe is also within the bed!
float cpx = current_position[X_AXIS], cpy = current_position[Y_AXIS]; float cpx = current_position[X_AXIS], cpy = current_position[Y_AXIS];
if ( cpx >= X_MIN_POS - X_PROBE_OFFSET_FROM_EXTRUDER if ( cpx >= X_MIN_POS - (X_PROBE_OFFSET_FROM_EXTRUDER)
&& cpx <= X_MAX_POS - X_PROBE_OFFSET_FROM_EXTRUDER && cpx <= X_MAX_POS - (X_PROBE_OFFSET_FROM_EXTRUDER)
&& cpy >= Y_MIN_POS - Y_PROBE_OFFSET_FROM_EXTRUDER && cpy >= Y_MIN_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)
&& cpy <= Y_MAX_POS - Y_PROBE_OFFSET_FROM_EXTRUDER) { && cpy <= Y_MAX_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)) {
// Home the Z axis // Home the Z axis
HOMEAXIS(Z); HOMEAXIS(Z);
@ -2669,8 +2669,8 @@ inline void gcode_G28() {
} }
else { else {
// For others, save the Z of the previous point, then raise Z again. // For others, save the Z of the previous point, then raise Z again.
ix = (probe_point - 1) % MESH_NUM_X_POINTS; ix = (probe_point - 1) % (MESH_NUM_X_POINTS);
iy = (probe_point - 1) / MESH_NUM_X_POINTS; iy = (probe_point - 1) / (MESH_NUM_X_POINTS);
if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // zig-zag if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // zig-zag
mbl.set_z(ix, iy, current_position[Z_AXIS]); mbl.set_z(ix, iy, current_position[Z_AXIS]);
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
@ -2678,9 +2678,9 @@ inline void gcode_G28() {
st_synchronize(); st_synchronize();
} }
// Is there another point to sample? Move there. // Is there another point to sample? Move there.
if (probe_point < MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS) { if (probe_point < (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
ix = probe_point % MESH_NUM_X_POINTS; ix = probe_point % (MESH_NUM_X_POINTS);
iy = probe_point / MESH_NUM_X_POINTS; iy = probe_point / (MESH_NUM_X_POINTS);
if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // zig-zag if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // zig-zag
current_position[X_AXIS] = mbl.get_x(ix); current_position[X_AXIS] = mbl.get_x(ix);
current_position[Y_AXIS] = mbl.get_y(iy); current_position[Y_AXIS] = mbl.get_y(iy);
@ -2832,18 +2832,18 @@ inline void gcode_G28() {
back_probe_bed_position = code_seen('B') ? code_value_short() : BACK_PROBE_BED_POSITION; back_probe_bed_position = code_seen('B') ? code_value_short() : BACK_PROBE_BED_POSITION;
bool left_out_l = left_probe_bed_position < MIN_PROBE_X, bool left_out_l = left_probe_bed_position < MIN_PROBE_X,
left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - MIN_PROBE_EDGE, left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - (MIN_PROBE_EDGE),
right_out_r = right_probe_bed_position > MAX_PROBE_X, right_out_r = right_probe_bed_position > MAX_PROBE_X,
right_out = right_out_r || right_probe_bed_position < left_probe_bed_position + MIN_PROBE_EDGE, right_out = right_out_r || right_probe_bed_position < left_probe_bed_position + MIN_PROBE_EDGE,
front_out_f = front_probe_bed_position < MIN_PROBE_Y, front_out_f = front_probe_bed_position < MIN_PROBE_Y,
front_out = front_out_f || front_probe_bed_position > back_probe_bed_position - MIN_PROBE_EDGE, front_out = front_out_f || front_probe_bed_position > back_probe_bed_position - (MIN_PROBE_EDGE),
back_out_b = back_probe_bed_position > MAX_PROBE_Y, back_out_b = back_probe_bed_position > MAX_PROBE_Y,
back_out = back_out_b || back_probe_bed_position < front_probe_bed_position + MIN_PROBE_EDGE; back_out = back_out_b || back_probe_bed_position < front_probe_bed_position + MIN_PROBE_EDGE;
if (left_out || right_out || front_out || back_out) { if (left_out || right_out || front_out || back_out) {
if (left_out) { if (left_out) {
out_of_range_error(PSTR("(L)eft")); out_of_range_error(PSTR("(L)eft"));
left_probe_bed_position = left_out_l ? MIN_PROBE_X : right_probe_bed_position - MIN_PROBE_EDGE; left_probe_bed_position = left_out_l ? MIN_PROBE_X : right_probe_bed_position - (MIN_PROBE_EDGE);
} }
if (right_out) { if (right_out) {
out_of_range_error(PSTR("(R)ight")); out_of_range_error(PSTR("(R)ight"));
@ -2851,7 +2851,7 @@ inline void gcode_G28() {
} }
if (front_out) { if (front_out) {
out_of_range_error(PSTR("(F)ront")); out_of_range_error(PSTR("(F)ront"));
front_probe_bed_position = front_out_f ? MIN_PROBE_Y : back_probe_bed_position - MIN_PROBE_EDGE; front_probe_bed_position = front_out_f ? MIN_PROBE_Y : back_probe_bed_position - (MIN_PROBE_EDGE);
} }
if (back_out) { if (back_out) {
out_of_range_error(PSTR("(B)ack")); out_of_range_error(PSTR("(B)ack"));
@ -3597,7 +3597,7 @@ inline void gcode_M42() {
bool deploy_probe_for_each_reading = code_seen('E'); bool deploy_probe_for_each_reading = code_seen('E');
if (code_seen('X')) { if (code_seen('X')) {
X_probe_location = code_value() - X_PROBE_OFFSET_FROM_EXTRUDER; X_probe_location = code_value() - (X_PROBE_OFFSET_FROM_EXTRUDER);
if (X_probe_location < X_MIN_POS || X_probe_location > X_MAX_POS) { if (X_probe_location < X_MIN_POS || X_probe_location > X_MAX_POS) {
out_of_range_error(PSTR("X")); out_of_range_error(PSTR("X"));
return; return;
@ -3677,7 +3677,7 @@ inline void gcode_M42() {
if (n_legs) { if (n_legs) {
millis_t ms = millis(); millis_t ms = millis();
double radius = ms % (X_MAX_LENGTH / 4), // limit how far out to go double radius = ms % ((X_MAX_LENGTH) / 4), // limit how far out to go
theta = RADIANS(ms % 360L); theta = RADIANS(ms % 360L);
float dir = (ms & 0x0001) ? 1 : -1; // clockwise or counter clockwise float dir = (ms & 0x0001) ? 1 : -1; // clockwise or counter clockwise
@ -3832,7 +3832,7 @@ inline void gcode_M104() {
#if HAS_TEMP_BED #if HAS_TEMP_BED
SERIAL_PROTOCOLPGM(" B@:"); SERIAL_PROTOCOLPGM(" B@:");
#ifdef BED_WATTS #ifdef BED_WATTS
SERIAL_PROTOCOL((BED_WATTS * getHeaterPower(-1)) / 127); SERIAL_PROTOCOL(((BED_WATTS) * getHeaterPower(-1)) / 127);
SERIAL_PROTOCOLCHAR('W'); SERIAL_PROTOCOLCHAR('W');
#else #else
SERIAL_PROTOCOL(getHeaterPower(-1)); SERIAL_PROTOCOL(getHeaterPower(-1));
@ -3840,7 +3840,7 @@ inline void gcode_M104() {
#endif #endif
SERIAL_PROTOCOLPGM(" @:"); SERIAL_PROTOCOLPGM(" @:");
#ifdef EXTRUDER_WATTS #ifdef EXTRUDER_WATTS
SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(target_extruder)) / 127); SERIAL_PROTOCOL(((EXTRUDER_WATTS) * getHeaterPower(target_extruder)) / 127);
SERIAL_PROTOCOLCHAR('W'); SERIAL_PROTOCOLCHAR('W');
#else #else
SERIAL_PROTOCOL(getHeaterPower(target_extruder)); SERIAL_PROTOCOL(getHeaterPower(target_extruder));
@ -3851,7 +3851,7 @@ inline void gcode_M104() {
SERIAL_PROTOCOL(e); SERIAL_PROTOCOL(e);
SERIAL_PROTOCOLCHAR(':'); SERIAL_PROTOCOLCHAR(':');
#ifdef EXTRUDER_WATTS #ifdef EXTRUDER_WATTS
SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(e)) / 127); SERIAL_PROTOCOL(((EXTRUDER_WATTS) * getHeaterPower(e)) / 127);
SERIAL_PROTOCOLCHAR('W'); SERIAL_PROTOCOLCHAR('W');
#else #else
SERIAL_PROTOCOL(getHeaterPower(e)); SERIAL_PROTOCOL(getHeaterPower(e));
@ -3943,7 +3943,7 @@ inline void gcode_M109() {
#ifdef TEMP_RESIDENCY_TIME #ifdef TEMP_RESIDENCY_TIME
long residency_start_ms = -1; long residency_start_ms = -1;
// Loop until the temperature has stabilized // Loop until the temperature has stabilized
#define TEMP_CONDITIONS (residency_start_ms < 0 || now < residency_start_ms + TEMP_RESIDENCY_TIME * 1000UL) #define TEMP_CONDITIONS (residency_start_ms < 0 || now < residency_start_ms + (TEMP_RESIDENCY_TIME) * 1000UL)
#else #else
// Loop until the temperature is very close target // Loop until the temperature is very close target
#define TEMP_CONDITIONS (fabs(degHotend(target_extruder) - degTargetHotend(target_extruder)) < 0.75f) #define TEMP_CONDITIONS (fabs(degHotend(target_extruder) - degTargetHotend(target_extruder)) < 0.75f)
@ -3961,7 +3961,7 @@ inline void gcode_M109() {
#ifdef TEMP_RESIDENCY_TIME #ifdef TEMP_RESIDENCY_TIME
SERIAL_PROTOCOLPGM(" W:"); SERIAL_PROTOCOLPGM(" W:");
if (residency_start_ms >= 0) { if (residency_start_ms >= 0) {
long rem = ((TEMP_RESIDENCY_TIME * 1000UL) - (now - residency_start_ms)) / 1000UL; long rem = (((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL;
SERIAL_PROTOCOLLN(rem); SERIAL_PROTOCOLLN(rem);
} }
else { else {
@ -5533,7 +5533,7 @@ inline void gcode_M907() {
// this one uses actual amps in floating point // this one uses actual amps in floating point
for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) digipot_i2c_set_current(i, code_value()); for (int i = 0; i < NUM_AXIS; i++) if (code_seen(axis_codes[i])) digipot_i2c_set_current(i, code_value());
// for each additional extruder (named B,C,D,E..., channels 4,5,6,7...) // for each additional extruder (named B,C,D,E..., channels 4,5,6,7...)
for (int i = NUM_AXIS; i < DIGIPOT_I2C_NUM_CHANNELS; i++) if (code_seen('B' + i - NUM_AXIS)) digipot_i2c_set_current(i, code_value()); for (int i = NUM_AXIS; i < DIGIPOT_I2C_NUM_CHANNELS; i++) if (code_seen('B' + i - (NUM_AXIS))) digipot_i2c_set_current(i, code_value());
#endif #endif
} }
@ -6821,7 +6821,7 @@ void plan_arc(
) { ) {
lastMotor = ms; //... set time to NOW so the fan will turn on lastMotor = ms; //... set time to NOW so the fan will turn on
} }
uint8_t speed = (lastMotor == 0 || ms >= lastMotor + (CONTROLLERFAN_SECS * 1000UL)) ? 0 : CONTROLLERFAN_SPEED; uint8_t speed = (lastMotor == 0 || ms >= lastMotor + ((CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED;
// allows digital or PWM fan output to be used (see M42 handling) // allows digital or PWM fan output to be used (see M42 handling)
digitalWrite(CONTROLLERFAN_PIN, speed); digitalWrite(CONTROLLERFAN_PIN, speed);
analogWrite(CONTROLLERFAN_PIN, speed); analogWrite(CONTROLLERFAN_PIN, speed);
@ -7054,7 +7054,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
#endif #endif
#if ENABLED(EXTRUDER_RUNOUT_PREVENT) #if ENABLED(EXTRUDER_RUNOUT_PREVENT)
if (ms > previous_cmd_ms + EXTRUDER_RUNOUT_SECONDS * 1000) if (ms > previous_cmd_ms + (EXTRUDER_RUNOUT_SECONDS) * 1000)
if (degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP) { if (degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP) {
bool oldstatus; bool oldstatus;
switch (active_extruder) { switch (active_extruder) {
@ -7083,8 +7083,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
} }
float oldepos = current_position[E_AXIS], oldedes = destination[E_AXIS]; float oldepos = current_position[E_AXIS], oldedes = destination[E_AXIS];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS],
destination[E_AXIS] + EXTRUDER_RUNOUT_EXTRUDE * EXTRUDER_RUNOUT_ESTEPS / axis_steps_per_unit[E_AXIS], destination[E_AXIS] + (EXTRUDER_RUNOUT_EXTRUDE) * (EXTRUDER_RUNOUT_ESTEPS) / axis_steps_per_unit[E_AXIS],
EXTRUDER_RUNOUT_SPEED / 60. * EXTRUDER_RUNOUT_ESTEPS / axis_steps_per_unit[E_AXIS], active_extruder); (EXTRUDER_RUNOUT_SPEED) / 60. * (EXTRUDER_RUNOUT_ESTEPS) / axis_steps_per_unit[E_AXIS], active_extruder);
current_position[E_AXIS] = oldepos; current_position[E_AXIS] = oldepos;
destination[E_AXIS] = oldedes; destination[E_AXIS] = oldedes;
plan_set_e_position(oldepos); plan_set_e_position(oldepos);

2
Marlin/SdBaseFile.cpp

@ -1134,7 +1134,7 @@ int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) {
// Sanity-check the VFAT entry. The first cluster is always set to zero. And the sequence number should be higher than 0 // Sanity-check the VFAT entry. The first cluster is always set to zero. And the sequence number should be higher than 0
if (VFAT->firstClusterLow == 0 && (VFAT->sequenceNumber & 0x1F) > 0 && (VFAT->sequenceNumber & 0x1F) <= MAX_VFAT_ENTRIES) { if (VFAT->firstClusterLow == 0 && (VFAT->sequenceNumber & 0x1F) > 0 && (VFAT->sequenceNumber & 0x1F) <= MAX_VFAT_ENTRIES) {
// TODO: Store the filename checksum to verify if a none-long filename aware system modified the file table. // TODO: Store the filename checksum to verify if a none-long filename aware system modified the file table.
n = ((VFAT->sequenceNumber & 0x1F) - 1) * FILENAME_LENGTH; n = ((VFAT->sequenceNumber & 0x1F) - 1) * (FILENAME_LENGTH);
for (uint8_t i = 0; i < FILENAME_LENGTH; i++) for (uint8_t i = 0; i < FILENAME_LENGTH; i++)
longFilename[n + i] = (i < 5) ? VFAT->name1[i] : (i < 11) ? VFAT->name2[i - 5] : VFAT->name3[i - 11]; longFilename[n + i] = (i < 5) ? VFAT->name1[i] : (i < 11) ? VFAT->name2[i - 5] : VFAT->name3[i - 11];
// If this VFAT entry is the last one, add a NUL terminator at the end of the string // If this VFAT entry is the last one, add a NUL terminator at the end of the string

4
Marlin/cardreader.cpp

@ -264,7 +264,7 @@ void CardReader::getAbsFilename(char *t) {
workDirParents[i].getFilename(t); //SDBaseFile.getfilename! workDirParents[i].getFilename(t); //SDBaseFile.getfilename!
while (*t && cnt < MAXPATHNAMELENGTH) { t++; cnt++; } //crawl counter forward. while (*t && cnt < MAXPATHNAMELENGTH) { t++; cnt++; } //crawl counter forward.
} }
if (cnt < MAXPATHNAMELENGTH - FILENAME_LENGTH) if (cnt < MAXPATHNAMELENGTH - (FILENAME_LENGTH))
file.getFilename(t); file.getFilename(t);
else else
t[0] = 0; t[0] = 0;
@ -500,7 +500,7 @@ void CardReader::checkautostart(bool force) {
while (root.readDir(p, NULL) > 0) { while (root.readDir(p, NULL) > 0) {
for (int8_t i = 0; i < (int8_t)strlen((char*)p.name); i++) p.name[i] = tolower(p.name[i]); for (int8_t i = 0; i < (int8_t)strlen((char*)p.name); i++) p.name[i] = tolower(p.name[i]);
if (p.name[9] != '~' && strncmp((char*)p.name, autoname, 5) == 0) { if (p.name[9] != '~' && strncmp((char*)p.name, autoname, 5) == 0) {
char cmd[4 + (FILENAME_LENGTH + 1) * MAX_DIR_DEPTH + 2]; char cmd[4 + (FILENAME_LENGTH + 1) * (MAX_DIR_DEPTH) + 2];
sprintf_P(cmd, PSTR("M23 %s"), autoname); sprintf_P(cmd, PSTR("M23 %s"), autoname);
enqueuecommand(cmd); enqueuecommand(cmd);
enqueuecommands_P(PSTR("M24")); enqueuecommands_P(PSTR("M24"));

2
Marlin/configuration_store.cpp

@ -163,7 +163,7 @@ void Config_StoreSettings() {
uint8_t mesh_num_y = 3; uint8_t mesh_num_y = 3;
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
// Compile time test that sizeof(mbl.z_values) is as expected // Compile time test that sizeof(mbl.z_values) is as expected
typedef char c_assert[(sizeof(mbl.z_values) == MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS * sizeof(dummy)) ? 1 : -1]; typedef char c_assert[(sizeof(mbl.z_values) == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS) * sizeof(dummy)) ? 1 : -1];
mesh_num_x = MESH_NUM_X_POINTS; mesh_num_x = MESH_NUM_X_POINTS;
mesh_num_y = MESH_NUM_Y_POINTS; mesh_num_y = MESH_NUM_Y_POINTS;
EEPROM_WRITE_VAR(i, mbl.active); EEPROM_WRITE_VAR(i, mbl.active);

34
Marlin/dogm_lcd_implementation.h

@ -225,14 +225,14 @@ static void lcd_implementation_init() {
#endif #endif
#if ENABLED(SHOW_BOOTSCREEN) #if ENABLED(SHOW_BOOTSCREEN)
int offx = (u8g.getWidth() - START_BMPWIDTH) / 2; int offx = (u8g.getWidth() - (START_BMPWIDTH)) / 2;
#if ENABLED(START_BMPHIGH) #if ENABLED(START_BMPHIGH)
int offy = 0; int offy = 0;
#else #else
int offy = DOG_CHAR_HEIGHT; int offy = DOG_CHAR_HEIGHT;
#endif #endif
int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * DOG_CHAR_WIDTH) / 2; int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2;
u8g.firstPage(); u8g.firstPage();
do { do {
@ -240,11 +240,11 @@ static void lcd_implementation_init() {
u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
lcd_setFont(FONT_MENU); lcd_setFont(FONT_MENU);
#ifndef STRING_SPLASH_LINE2 #ifndef STRING_SPLASH_LINE2
u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1); u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT), STRING_SPLASH_LINE1);
#else #else
int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1) * DOG_CHAR_WIDTH) / 2; int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1) * (DOG_CHAR_WIDTH)) / 2;
u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT * 3 / 2, STRING_SPLASH_LINE1); u8g.drawStr(txt1X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1);
u8g.drawStr(txt2X, u8g.getHeight() - DOG_CHAR_HEIGHT * 1 / 2, STRING_SPLASH_LINE2); u8g.drawStr(txt2X, u8g.getHeight() - (DOG_CHAR_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2);
#endif #endif
} }
} while (u8g.nextPage()); } while (u8g.nextPage());
@ -288,20 +288,20 @@ static void lcd_implementation_status_screen() {
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
// SD Card Symbol // SD Card Symbol
u8g.drawBox(42, 42 - TALL_FONT_CORRECTION, 8, 7); u8g.drawBox(42, 42 - (TALL_FONT_CORRECTION), 8, 7);
u8g.drawBox(50, 44 - TALL_FONT_CORRECTION, 2, 5); u8g.drawBox(50, 44 - (TALL_FONT_CORRECTION), 2, 5);
u8g.drawFrame(42, 49 - TALL_FONT_CORRECTION, 10, 4); u8g.drawFrame(42, 49 - (TALL_FONT_CORRECTION), 10, 4);
u8g.drawPixel(50, 43 - TALL_FONT_CORRECTION); u8g.drawPixel(50, 43 - (TALL_FONT_CORRECTION));
// Progress bar frame // Progress bar frame
u8g.drawFrame(54, 49, 73, 4 - TALL_FONT_CORRECTION); u8g.drawFrame(54, 49, 73, 4 - (TALL_FONT_CORRECTION));
// SD Card Progress bar and clock // SD Card Progress bar and clock
lcd_setFont(FONT_STATUSMENU); lcd_setFont(FONT_STATUSMENU);
if (IS_SD_PRINTING) { if (IS_SD_PRINTING) {
// Progress bar solid part // Progress bar solid part
u8g.drawBox(55, 50, (unsigned int)(71.f * card.percentDone() / 100.f), 2 - TALL_FONT_CORRECTION); u8g.drawBox(55, 50, (unsigned int)(71.f * card.percentDone() / 100.f), 2 - (TALL_FONT_CORRECTION));
} }
u8g.setPrintPos(80,48); u8g.setPrintPos(80,48);
@ -443,13 +443,13 @@ static void lcd_implementation_status_screen() {
static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) { static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) {
if (isSelected) { if (isSelected) {
u8g.setColorIndex(1); // black on white u8g.setColorIndex(1); // black on white
u8g.drawBox(0, row * DOG_CHAR_HEIGHT + 3 - TALL_FONT_CORRECTION, LCD_PIXEL_WIDTH, DOG_CHAR_HEIGHT); u8g.drawBox(0, row * (DOG_CHAR_HEIGHT) + 3 - (TALL_FONT_CORRECTION), LCD_PIXEL_WIDTH, DOG_CHAR_HEIGHT);
u8g.setColorIndex(0); // following text must be white on black u8g.setColorIndex(0); // following text must be white on black
} }
else { else {
u8g.setColorIndex(1); // unmarked text is black on white u8g.setColorIndex(1); // unmarked text is black on white
} }
u8g.setPrintPos(START_ROW * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); u8g.setPrintPos((START_ROW) * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT));
} }
static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, const char* pstr, char pre_char, char post_char) { static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, const char* pstr, char pre_char, char post_char) {
@ -463,7 +463,7 @@ static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, co
pstr++; pstr++;
} }
while (n--) lcd_print(' '); while (n--) lcd_print(' ');
u8g.setPrintPos(LCD_PIXEL_WIDTH - DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); u8g.setPrintPos(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT));
lcd_print(post_char); lcd_print(post_char);
lcd_print(' '); lcd_print(' ');
} }
@ -481,7 +481,7 @@ static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const c
} }
lcd_print(':'); lcd_print(':');
while (n--) lcd_print(' '); while (n--) lcd_print(' ');
u8g.setPrintPos(LCD_PIXEL_WIDTH - DOG_CHAR_WIDTH * vallen, (row + 1) * DOG_CHAR_HEIGHT); u8g.setPrintPos(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH) * vallen, (row + 1) * (DOG_CHAR_HEIGHT));
if (pgm) lcd_printPGM(data); else lcd_print((char*)data); if (pgm) lcd_printPGM(data); else lcd_print((char*)data);
} }
@ -528,7 +528,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
if (lcd_strlen_P(pstr) > LCD_WIDTH - 2 - vallen) rows = 2; if (lcd_strlen_P(pstr) > LCD_WIDTH - 2 - vallen) rows = 2;
const float kHalfChar = DOG_CHAR_HEIGHT_EDIT / 2; const float kHalfChar = (DOG_CHAR_HEIGHT_EDIT) / 2;
float rowHeight = u8g.getHeight() / (rows + 1); // 1/(rows+1) = 1/2 or 1/3 float rowHeight = u8g.getHeight() / (rows + 1); // 1/(rows+1) = 1/2 or 1/3
u8g.setPrintPos(0, rowHeight + kHalfChar); u8g.setPrintPos(0, rowHeight + kHalfChar);

6
Marlin/example_configurations/Felix/Configuration.h

@ -404,10 +404,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

6
Marlin/example_configurations/Felix/Configuration_DUAL.h

@ -401,10 +401,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

6
Marlin/example_configurations/Hephestos/Configuration.h

@ -414,10 +414,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

6
Marlin/example_configurations/Hephestos_2/Configuration.h

@ -417,10 +417,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

6
Marlin/example_configurations/K8200/Configuration.h

@ -437,10 +437,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

6
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h

@ -422,10 +422,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

6
Marlin/example_configurations/RigidBot/Configuration.h

@ -416,10 +416,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

6
Marlin/example_configurations/SCARA/Configuration.h

@ -430,10 +430,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

6
Marlin/example_configurations/TAZ4/Configuration.h

@ -442,10 +442,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

6
Marlin/example_configurations/WITBOX/Configuration.h

@ -414,10 +414,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

4
Marlin/example_configurations/adafruit/ST7565/Configuration.h

@ -422,9 +422,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

4
Marlin/example_configurations/delta/biv2.5/Configuration.h

@ -457,9 +457,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

4
Marlin/example_configurations/delta/generic/Configuration.h

@ -457,9 +457,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

4
Marlin/example_configurations/delta/kossel_mini/Configuration.h

@ -457,9 +457,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

8
Marlin/example_configurations/delta/kossel_pro/Configuration.h

@ -444,10 +444,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.
@ -713,7 +713,7 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#define XYZ_MICROSTEPS 32 #define XYZ_MICROSTEPS 32
#define XYZ_BELT_PITCH 2 #define XYZ_BELT_PITCH 2
#define XYZ_PULLEY_TEETH 20 #define XYZ_PULLEY_TEETH 20
#define XYZ_STEPS (XYZ_FULL_STEPS_PER_ROTATION * XYZ_MICROSTEPS / double(XYZ_BELT_PITCH) / double(XYZ_PULLEY_TEETH)) #define XYZ_STEPS ((XYZ_FULL_STEPS_PER_ROTATION) * (XYZ_MICROSTEPS) / double(XYZ_BELT_PITCH) / double(XYZ_PULLEY_TEETH))
// default settings // default settings
// delta speeds must be the same on xyz // delta speeds must be the same on xyz

8
Marlin/example_configurations/delta/kossel_xl/Configuration.h

@ -450,10 +450,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.
@ -634,7 +634,7 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#define XYZ_MICROSTEPS 16 #define XYZ_MICROSTEPS 16
#define XYZ_BELT_PITCH 2 #define XYZ_BELT_PITCH 2
#define XYZ_PULLEY_TEETH 16 #define XYZ_PULLEY_TEETH 16
#define XYZ_STEPS (XYZ_FULL_STEPS_PER_ROTATION * XYZ_MICROSTEPS / double(XYZ_BELT_PITCH) / double(XYZ_PULLEY_TEETH)) #define XYZ_STEPS ((XYZ_FULL_STEPS_PER_ROTATION) * (XYZ_MICROSTEPS) / double(XYZ_BELT_PITCH) / double(XYZ_PULLEY_TEETH))
#define DEFAULT_AXIS_STEPS_PER_UNIT {XYZ_STEPS, XYZ_STEPS, XYZ_STEPS, 158} // default steps per unit for PowerWasp #define DEFAULT_AXIS_STEPS_PER_UNIT {XYZ_STEPS, XYZ_STEPS, XYZ_STEPS, 158} // default steps per unit for PowerWasp
#define DEFAULT_MAX_FEEDRATE {200, 200, 200, 200} // (mm/sec) #define DEFAULT_MAX_FEEDRATE {200, 200, 200, 200} // (mm/sec)

6
Marlin/example_configurations/makibox/Configuration.h

@ -425,10 +425,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

6
Marlin/example_configurations/tvrrug/Round2/Configuration.h

@ -412,10 +412,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_MIN_X 10 #define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X))
#define MESH_MIN_Y 10 #define MESH_MIN_Y 10
#define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y))
#define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited.
#define MESH_NUM_Y_POINTS 3 #define MESH_NUM_Y_POINTS 3
#define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0.

4
Marlin/mesh_bed_leveling.h

@ -2,8 +2,8 @@
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
#define MESH_X_DIST ((MESH_MAX_X - MESH_MIN_X)/(MESH_NUM_X_POINTS - 1)) #define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X))/(MESH_NUM_X_POINTS - 1))
#define MESH_Y_DIST ((MESH_MAX_Y - MESH_MIN_Y)/(MESH_NUM_Y_POINTS - 1)) #define MESH_Y_DIST ((MESH_MAX_Y - (MESH_MIN_Y))/(MESH_NUM_Y_POINTS - 1))
class mesh_bed_leveling { class mesh_bed_leveling {
public: public:

20
Marlin/planner.cpp

@ -447,7 +447,7 @@ void check_axes_activity() {
} }
#endif //FAN_KICKSTART_TIME #endif //FAN_KICKSTART_TIME
#if defined(FAN_MIN_PWM) #if defined(FAN_MIN_PWM)
#define CALC_FAN_SPEED (tail_fan_speed ? ( FAN_MIN_PWM + (tail_fan_speed * (255 - FAN_MIN_PWM)) / 255 ) : 0) #define CALC_FAN_SPEED (tail_fan_speed ? ( FAN_MIN_PWM + (tail_fan_speed * (255 - (FAN_MIN_PWM))) / 255 ) : 0)
#else #else
#define CALC_FAN_SPEED tail_fan_speed #define CALC_FAN_SPEED tail_fan_speed
#endif // FAN_MIN_PWM #endif // FAN_MIN_PWM
@ -524,7 +524,7 @@ float junction_deviation = 0.1;
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
} }
#if ENABLED(PREVENT_LENGTHY_EXTRUDE) #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
if (labs(de) > axis_steps_per_unit[E_AXIS] * EXTRUDE_MAXLENGTH) { if (labs(de) > axis_steps_per_unit[E_AXIS] * (EXTRUDE_MAXLENGTH)) {
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
de = 0; // no difference de = 0; // no difference
SERIAL_ECHO_START; SERIAL_ECHO_START;
@ -634,10 +634,10 @@ float junction_deviation = 0.1;
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
if (extruder_duplication_enabled) { if (extruder_duplication_enabled) {
enable_e1(); enable_e1();
g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE * 2; g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2;
} }
#endif #endif
g_uc_extruder_last_move[0] = BLOCK_BUFFER_SIZE * 2; g_uc_extruder_last_move[0] = (BLOCK_BUFFER_SIZE) * 2;
#if EXTRUDERS > 1 #if EXTRUDERS > 1
if (g_uc_extruder_last_move[1] == 0) disable_e1(); if (g_uc_extruder_last_move[1] == 0) disable_e1();
#if EXTRUDERS > 2 #if EXTRUDERS > 2
@ -651,7 +651,7 @@ float junction_deviation = 0.1;
#if EXTRUDERS > 1 #if EXTRUDERS > 1
case 1: case 1:
enable_e1(); enable_e1();
g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE * 2; g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2;
if (g_uc_extruder_last_move[0] == 0) disable_e0(); if (g_uc_extruder_last_move[0] == 0) disable_e0();
#if EXTRUDERS > 2 #if EXTRUDERS > 2
if (g_uc_extruder_last_move[2] == 0) disable_e2(); if (g_uc_extruder_last_move[2] == 0) disable_e2();
@ -663,7 +663,7 @@ float junction_deviation = 0.1;
#if EXTRUDERS > 2 #if EXTRUDERS > 2
case 2: case 2:
enable_e2(); enable_e2();
g_uc_extruder_last_move[2] = BLOCK_BUFFER_SIZE * 2; g_uc_extruder_last_move[2] = (BLOCK_BUFFER_SIZE) * 2;
if (g_uc_extruder_last_move[0] == 0) disable_e0(); if (g_uc_extruder_last_move[0] == 0) disable_e0();
if (g_uc_extruder_last_move[1] == 0) disable_e1(); if (g_uc_extruder_last_move[1] == 0) disable_e1();
#if EXTRUDERS > 3 #if EXTRUDERS > 3
@ -673,7 +673,7 @@ float junction_deviation = 0.1;
#if EXTRUDERS > 3 #if EXTRUDERS > 3
case 3: case 3:
enable_e3(); enable_e3();
g_uc_extruder_last_move[3] = BLOCK_BUFFER_SIZE * 2; g_uc_extruder_last_move[3] = (BLOCK_BUFFER_SIZE) * 2;
if (g_uc_extruder_last_move[0] == 0) disable_e0(); if (g_uc_extruder_last_move[0] == 0) disable_e0();
if (g_uc_extruder_last_move[1] == 0) disable_e1(); if (g_uc_extruder_last_move[1] == 0) disable_e1();
if (g_uc_extruder_last_move[2] == 0) disable_e2(); if (g_uc_extruder_last_move[2] == 0) disable_e2();
@ -749,9 +749,9 @@ float junction_deviation = 0.1;
// Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill // Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill
#if ENABLED(OLD_SLOWDOWN) || ENABLED(SLOWDOWN) #if ENABLED(OLD_SLOWDOWN) || ENABLED(SLOWDOWN)
bool mq = moves_queued > 1 && moves_queued < BLOCK_BUFFER_SIZE / 2; bool mq = moves_queued > 1 && moves_queued < (BLOCK_BUFFER_SIZE) / 2;
#if ENABLED(OLD_SLOWDOWN) #if ENABLED(OLD_SLOWDOWN)
if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE; if (mq) feed_rate *= 2.0 * moves_queued / (BLOCK_BUFFER_SIZE);
#endif #endif
#if ENABLED(SLOWDOWN) #if ENABLED(SLOWDOWN)
// segment time im micro seconds // segment time im micro seconds
@ -974,7 +974,7 @@ float junction_deviation = 0.1;
} }
else { else {
long acc_dist = estimate_acceleration_distance(0, block->nominal_rate, block->acceleration_st); long acc_dist = estimate_acceleration_distance(0, block->nominal_rate, block->acceleration_st);
float advance = (STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K) * (cse * cse * EXTRUSION_AREA * EXTRUSION_AREA) * 256; float advance = ((STEPS_PER_CUBIC_MM_E) * (EXTRUDER_ADVANCE_K)) * (cse * cse * (EXTRUSION_AREA) * (EXTRUSION_AREA)) * 256;
block->advance = advance; block->advance = advance;
block->advance_rate = acc_dist ? advance / (float)acc_dist : 0; block->advance_rate = acc_dist ? advance / (float)acc_dist : 0;
} }

2
Marlin/servo.cpp

@ -281,7 +281,7 @@ void Servo::writeMicroseconds(int value) {
byte channel = this->servoIndex; byte channel = this->servoIndex;
if (channel < MAX_SERVOS) { // ensure channel is valid if (channel < MAX_SERVOS) { // ensure channel is valid
// ensure pulse width is valid // ensure pulse width is valid
value = constrain(value, SERVO_MIN(), SERVO_MAX()) - TRIM_DURATION; value = constrain(value, SERVO_MIN(), SERVO_MAX()) - (TRIM_DURATION);
value = usToTicks(value); // convert to ticks after compensating for interrupt overhead - 12 Aug 2009 value = usToTicks(value); // convert to ticks after compensating for interrupt overhead - 12 Aug 2009
CRITICAL_SECTION_START; CRITICAL_SECTION_START;

26
Marlin/temperature.cpp

@ -139,8 +139,8 @@ static unsigned char soft_pwm[EXTRUDERS];
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
#if ENABLED(PID_PARAMS_PER_EXTRUDER) #if ENABLED(PID_PARAMS_PER_EXTRUDER)
float Kp[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kp); float Kp[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kp);
float Ki[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Ki* PID_dT); float Ki[EXTRUDERS] = ARRAY_BY_EXTRUDERS1((DEFAULT_Ki) * (PID_dT));
float Kd[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kd / PID_dT); float Kd[EXTRUDERS] = ARRAY_BY_EXTRUDERS1((DEFAULT_Kd) / (PID_dT));
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_ADD_EXTRUSION_RATE)
float Kc[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kc); float Kc[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kc);
#endif // PID_ADD_EXTRUSION_RATE #endif // PID_ADD_EXTRUSION_RATE
@ -230,9 +230,9 @@ void PID_autotune(float temp, int extruder, int ncycles) {
disable_all_heaters(); // switch off all heaters. disable_all_heaters(); // switch off all heaters.
if (extruder < 0) if (extruder < 0)
soft_pwm_bed = bias = d = MAX_BED_POWER / 2; soft_pwm_bed = bias = d = (MAX_BED_POWER) / 2;
else else
soft_pwm[extruder] = bias = d = PID_MAX / 2; soft_pwm[extruder] = bias = d = (PID_MAX) / 2;
// PID Tuning loop // PID Tuning loop
for (;;) { for (;;) {
@ -355,14 +355,14 @@ void PID_autotune(float temp, int extruder, int ncycles) {
void updatePID() { void updatePID() {
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
for (int e = 0; e < EXTRUDERS; e++) { for (int e = 0; e < EXTRUDERS; e++) {
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / PID_PARAM(Ki,e); temp_iState_max[e] = (PID_INTEGRAL_DRIVE_MAX) / PID_PARAM(Ki,e);
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_ADD_EXTRUSION_RATE)
last_position[e] = 0; last_position[e] = 0;
#endif #endif
} }
#endif #endif
#if ENABLED(PIDTEMPBED) #if ENABLED(PIDTEMPBED)
temp_iState_max_bed = PID_BED_INTEGRAL_DRIVE_MAX / bedKi; temp_iState_max_bed = (PID_BED_INTEGRAL_DRIVE_MAX) / bedKi;
#endif #endif
} }
@ -481,7 +481,7 @@ float get_pid_output(int e) {
pid_output = BANG_MAX; pid_output = BANG_MAX;
pid_reset[e] = true; pid_reset[e] = true;
} }
else if (pid_error[e] < -PID_FUNCTIONAL_RANGE || target_temperature[e] == 0) { else if (pid_error[e] < -(PID_FUNCTIONAL_RANGE) || target_temperature[e] == 0) {
pid_output = 0; pid_output = 0;
pid_reset[e] = true; pid_reset[e] = true;
} }
@ -698,7 +698,7 @@ void manage_heater() {
if (current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP) { if (current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP) {
if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS) if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS)
soft_pwm_bed = 0; soft_pwm_bed = 0;
else if (current_temperature_bed <= target_temperature_bed - BED_HYSTERESIS) else if (current_temperature_bed <= target_temperature_bed - (BED_HYSTERESIS))
soft_pwm_bed = MAX_BED_POWER >> 1; soft_pwm_bed = MAX_BED_POWER >> 1;
} }
else { else {
@ -759,7 +759,7 @@ static float analog2temp(int raw, uint8_t e) {
return celsius; return celsius;
} }
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN)) + TEMP_SENSOR_AD595_OFFSET;
} }
// Derived from RepRap FiveD extruder::getTemperature() // Derived from RepRap FiveD extruder::getTemperature()
@ -786,7 +786,7 @@ static float analog2tempBed(int raw) {
#elif defined(BED_USES_AD595) #elif defined(BED_USES_AD595)
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN)) + TEMP_SENSOR_AD595_OFFSET;
#else #else
@ -860,14 +860,14 @@ void tp_init() {
maxttemp[e] = maxttemp[0]; maxttemp[e] = maxttemp[0];
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
temp_iState_min[e] = 0.0; temp_iState_min[e] = 0.0;
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / PID_PARAM(Ki, e); temp_iState_max[e] = (PID_INTEGRAL_DRIVE_MAX) / PID_PARAM(Ki, e);
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_ADD_EXTRUSION_RATE)
last_position[e] = 0; last_position[e] = 0;
#endif #endif
#endif //PIDTEMP #endif //PIDTEMP
#if ENABLED(PIDTEMPBED) #if ENABLED(PIDTEMPBED)
temp_iState_min_bed = 0.0; temp_iState_min_bed = 0.0;
temp_iState_max_bed = PID_BED_INTEGRAL_DRIVE_MAX / bedKi; temp_iState_max_bed = (PID_BED_INTEGRAL_DRIVE_MAX) / bedKi;
#endif //PIDTEMPBED #endif //PIDTEMPBED
} }
@ -1042,7 +1042,7 @@ void tp_init() {
void start_watching_heater(int e) { void start_watching_heater(int e) {
if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) { if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) {
watch_target_temp[e] = degHotend(e) + WATCH_TEMP_INCREASE; watch_target_temp[e] = degHotend(e) + WATCH_TEMP_INCREASE;
watch_heater_next_ms[e] = millis() + WATCH_TEMP_PERIOD * 1000UL; watch_heater_next_ms[e] = millis() + (WATCH_TEMP_PERIOD) * 1000UL;
} }
else else
watch_heater_next_ms[e] = 0; watch_heater_next_ms[e] = 0;

30
Marlin/ultralcd.cpp

@ -28,7 +28,7 @@ int absPreheatFanSpeed;
typedef void (*menuFunc_t)(); typedef void (*menuFunc_t)();
uint8_t lcd_status_message_level; uint8_t lcd_status_message_level;
char lcd_status_message[3 * LCD_WIDTH + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1 char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
#if ENABLED(DOGLCD) #if ENABLED(DOGLCD)
#include "dogm_lcd_implementation.h" #include "dogm_lcd_implementation.h"
@ -209,8 +209,8 @@ static void lcd_status_screen();
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
#endif //!ENCODER_RATE_MULTIPLIER #endif //!ENCODER_RATE_MULTIPLIER
#define END_MENU() \ #define END_MENU() \
if (encoderLine >= _menuItemNr) { encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; }\ if (encoderLine >= _menuItemNr) { encoderPosition = _menuItemNr * (ENCODER_STEPS_PER_MENU_ITEM) - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; }\
if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \ if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - (LCD_HEIGHT) + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
} } while(0) } } while(0)
/** Used variables to keep track of the menu */ /** Used variables to keep track of the menu */
@ -352,7 +352,7 @@ static void lcd_status_screen() {
} }
if (feedrate_multiplier == 100) { if (feedrate_multiplier == 100) {
if (int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE) { if (int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE) {
feedrate_multiplier += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE; feedrate_multiplier += int(encoderPosition) - (ENCODER_FEEDRATE_DEADZONE);
encoderPosition = 0; encoderPosition = 0;
} }
else if (int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE) { else if (int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE) {
@ -841,7 +841,7 @@ static void _lcd_move(const char* name, AxisEnum axis, int min, int max) {
} }
} }
#if ENABLED(DELTA) #if ENABLED(DELTA)
static float delta_clip_radius_2 = DELTA_PRINTABLE_RADIUS * DELTA_PRINTABLE_RADIUS; static float delta_clip_radius_2 = (DELTA_PRINTABLE_RADIUS) * (DELTA_PRINTABLE_RADIUS);
static int delta_clip( float a ) { return sqrt(delta_clip_radius_2 - a*a); } static int delta_clip( float a ) { return sqrt(delta_clip_radius_2 - a*a); }
static void lcd_move_x() { int clip = delta_clip(current_position[Y_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(X_MIN_POS, -clip), min(X_MAX_POS, clip)); } static void lcd_move_x() { int clip = delta_clip(current_position[Y_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(X_MIN_POS, -clip), min(X_MAX_POS, clip)); }
static void lcd_move_y() { int clip = delta_clip(current_position[X_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(X_MIN_POS, -clip), min(X_MAX_POS, clip)); } static void lcd_move_y() { int clip = delta_clip(current_position[X_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(X_MIN_POS, -clip), min(X_MAX_POS, clip)); }
@ -1824,14 +1824,14 @@ bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); }
void lcd_setstatus(const char* message, bool persist) { void lcd_setstatus(const char* message, bool persist) {
if (lcd_status_message_level > 0) return; if (lcd_status_message_level > 0) return;
strncpy(lcd_status_message, message, 3 * LCD_WIDTH); strncpy(lcd_status_message, message, 3 * (LCD_WIDTH));
set_utf_strlen(lcd_status_message, LCD_WIDTH); set_utf_strlen(lcd_status_message, LCD_WIDTH);
lcd_finishstatus(persist); lcd_finishstatus(persist);
} }
void lcd_setstatuspgm(const char* message, uint8_t level) { void lcd_setstatuspgm(const char* message, uint8_t level) {
if (level >= lcd_status_message_level) { if (level >= lcd_status_message_level) {
strncpy_P(lcd_status_message, message, 3 * LCD_WIDTH); strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
set_utf_strlen(lcd_status_message, LCD_WIDTH); set_utf_strlen(lcd_status_message, LCD_WIDTH);
lcd_status_message_level = level; lcd_status_message_level = level;
lcd_finishstatus(level > 0); lcd_finishstatus(level > 0);
@ -1887,7 +1887,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#if ENABLED(RIGIDBOT_PANEL) #if ENABLED(RIGIDBOT_PANEL)
if (now > next_button_update_ms) { if (now > next_button_update_ms) {
if (READ(BTN_UP) == 0) { if (READ(BTN_UP) == 0) {
encoderDiff = -1 * ENCODER_STEPS_PER_MENU_ITEM; encoderDiff = -1 * (ENCODER_STEPS_PER_MENU_ITEM);
next_button_update_ms = now + 300; next_button_update_ms = now + 300;
} }
else if (READ(BTN_DWN) == 0) { else if (READ(BTN_DWN) == 0) {
@ -1895,7 +1895,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
next_button_update_ms = now + 300; next_button_update_ms = now + 300;
} }
else if (READ(BTN_LFT) == 0) { else if (READ(BTN_LFT) == 0) {
encoderDiff = -1 * ENCODER_PULSES_PER_STEP; encoderDiff = -1 * (ENCODER_PULSES_PER_STEP);
next_button_update_ms = now + 300; next_button_update_ms = now + 300;
} }
else if (READ(BTN_RT) == 0) { else if (READ(BTN_RT) == 0) {
@ -2245,7 +2245,7 @@ char* ftostr52(const float& x) {
static void _lcd_level_bed() { static void _lcd_level_bed() {
if (encoderPosition != 0) { if (encoderPosition != 0) {
refresh_cmd_timeout(); refresh_cmd_timeout();
current_position[Z_AXIS] += float((int)encoderPosition) * MBL_Z_STEP; current_position[Z_AXIS] += float((int)encoderPosition) * (MBL_Z_STEP);
if (min_software_endstops) NOLESS(current_position[Z_AXIS], Z_MIN_POS); if (min_software_endstops) NOLESS(current_position[Z_AXIS], Z_MIN_POS);
if (max_software_endstops) NOMORE(current_position[Z_AXIS], Z_MAX_POS); if (max_software_endstops) NOMORE(current_position[Z_AXIS], Z_MAX_POS);
encoderPosition = 0; encoderPosition = 0;
@ -2257,12 +2257,12 @@ char* ftostr52(const float& x) {
if (LCD_CLICKED) { if (LCD_CLICKED) {
if (!debounce_click) { if (!debounce_click) {
debounce_click = true; debounce_click = true;
int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS, int ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS),
iy = _lcd_level_bed_position / MESH_NUM_X_POINTS; iy = _lcd_level_bed_position / (MESH_NUM_X_POINTS);
if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
mbl.set_z(ix, iy, current_position[Z_AXIS]); mbl.set_z(ix, iy, current_position[Z_AXIS]);
_lcd_level_bed_position++; _lcd_level_bed_position++;
if (_lcd_level_bed_position == MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS) { if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
line_to_current(Z_AXIS); line_to_current(Z_AXIS);
mbl.active = 1; mbl.active = 1;
@ -2272,8 +2272,8 @@ char* ftostr52(const float& x) {
else { else {
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
line_to_current(Z_AXIS); line_to_current(Z_AXIS);
ix = _lcd_level_bed_position % MESH_NUM_X_POINTS; ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS);
iy = _lcd_level_bed_position / MESH_NUM_X_POINTS; iy = _lcd_level_bed_position / (MESH_NUM_X_POINTS);
if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
current_position[X_AXIS] = mbl.get_x(ix); current_position[X_AXIS] = mbl.get_x(ix);
current_position[Y_AXIS] = mbl.get_y(iy); current_position[Y_AXIS] = mbl.get_y(iy);

2
Marlin/ultralcd_implementation_hitachi_HD44780.h

@ -731,7 +731,7 @@ static void lcd_implementation_status_screen() {
// Draw the progress bar if the message has shown long enough // Draw the progress bar if the message has shown long enough
// or if there is no message set. // or if there is no message set.
if (millis() >= progress_bar_ms + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) { if (millis() >= progress_bar_ms + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100, int tix = (int)(card.percentDone() * (LCD_WIDTH) * 3) / 100,
cel = tix / 3, rem = tix % 3, i = LCD_WIDTH; cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
char msg[LCD_WIDTH + 1], b = ' '; char msg[LCD_WIDTH + 1], b = ' ';
msg[i] = '\0'; msg[i] = '\0';

2
Marlin/ultralcd_st7920_u8glib_rrd.h

@ -63,7 +63,7 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
ST7920_WRITE_BYTE(0x80 | y); //set y ST7920_WRITE_BYTE(0x80 | y); //set y
ST7920_WRITE_BYTE(0x80); //set x = 0 ST7920_WRITE_BYTE(0x80); //set x = 0
ST7920_SET_DAT(); ST7920_SET_DAT();
for (i = 0; i < 2 * LCD_PIXEL_WIDTH / 8; i++) //2x width clears both segments for (i = 0; i < 2 * (LCD_PIXEL_WIDTH) / 8; i++) //2x width clears both segments
ST7920_WRITE_BYTE(0); ST7920_WRITE_BYTE(0);
ST7920_SET_CMD(); ST7920_SET_CMD();
} }

Loading…
Cancel
Save