From 78747b1328e46b55344da14afb735994f5c16809 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Apr 2016 23:11:35 -0700 Subject: [PATCH 1/7] min_pos/max_pos => sw_endstop_min/sw_endstop_max --- Marlin/Marlin.h | 4 ++-- Marlin/Marlin_main.cpp | 44 ++++++++++++++++++++++++++---------------- Marlin/ultralcd.cpp | 10 +++++----- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index aa3d54de77..dc73e8e746 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -275,8 +275,8 @@ extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in m extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner extern float current_position[NUM_AXIS]; extern float home_offset[3]; // axis[n].home_offset -extern float min_pos[3]; // axis[n].min_pos -extern float max_pos[3]; // axis[n].max_pos +extern float sw_endstop_min[3]; // axis[n].sw_endstop_min +extern float sw_endstop_max[3]; // axis[n].sw_endstop_max extern bool axis_known_position[3]; // axis[n].is_known extern bool axis_homed[3]; // axis[n].is_homed diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 7b232e56bd..3bb393c7cc 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -286,8 +286,10 @@ float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0); float position_shift[3] = { 0 }; float home_offset[3] = { 0 }; -float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS }; -float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS }; + +// Software Endstops. Default to configured limits. +float sw_endstop_min[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS }; +float sw_endstop_max[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS }; #if FAN_COUNT > 0 int fanSpeeds[FAN_COUNT] = { 0 }; @@ -1212,24 +1214,32 @@ static void update_software_endstops(AxisEnum axis) { if (axis == X_AXIS) { float dual_max_x = max(extruder_offset[X_AXIS][1], X2_MAX_POS); if (active_extruder != 0) { - min_pos[X_AXIS] = X2_MIN_POS + offs; - max_pos[X_AXIS] = dual_max_x + offs; + sw_endstop_min[X_AXIS] = X2_MIN_POS + offs; + sw_endstop_max[X_AXIS] = dual_max_x + offs; return; } else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) { - min_pos[X_AXIS] = base_min_pos(X_AXIS) + offs; - max_pos[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_extruder_x_offset) + offs; + sw_endstop_min[X_AXIS] = base_min_pos(X_AXIS) + offs; + sw_endstop_max[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_extruder_x_offset) + offs; return; } } else #endif { - min_pos[axis] = base_min_pos(axis) + offs; - max_pos[axis] = base_max_pos(axis) + offs; + sw_endstop_min[axis] = base_min_pos(axis) + offs; + sw_endstop_max[axis] = base_max_pos(axis) + offs; } } +/** + * Change the home offset for an axis, update the current + * position and the software endstops to retain the same + * relative distance to the new home. + * + * Since this changes the current_position, code should + * call sync_plan_position soon after this. + */ static void set_home_offset(AxisEnum axis, float v) { current_position[axis] += v - home_offset[axis]; home_offset[axis] = v; @@ -1294,8 +1304,8 @@ static void set_axis_is_at_home(AxisEnum axis) { * SCARA home positions are based on configuration since the actual * limits are determined by the inverse kinematic transform. */ - min_pos[axis] = base_min_pos(axis); // + (delta[axis] - base_home_pos(axis)); - max_pos[axis] = base_max_pos(axis); // + (delta[axis] - base_home_pos(axis)); + sw_endstop_min[axis] = base_min_pos(axis); // + (delta[axis] - base_home_pos(axis)); + sw_endstop_max[axis] = base_max_pos(axis); // + (delta[axis] - base_home_pos(axis)); } else #endif @@ -5842,7 +5852,7 @@ inline void gcode_M428() { bool err = false; for (int8_t i = X_AXIS; i <= Z_AXIS; i++) { if (axis_homed[i]) { - float base = (current_position[i] > (min_pos[i] + max_pos[i]) / 2) ? base_home_pos(i) : 0, + float base = (current_position[i] > (sw_endstop_min[i] + sw_endstop_max[i]) / 2) ? base_home_pos(i) : 0, diff = current_position[i] - base; if (diff > -20 && diff < 20) { set_home_offset((AxisEnum)i, home_offset[i] - diff); @@ -7032,8 +7042,8 @@ void ok_to_send() { void clamp_to_software_endstops(float target[3]) { if (min_software_endstops) { - NOLESS(target[X_AXIS], min_pos[X_AXIS]); - NOLESS(target[Y_AXIS], min_pos[Y_AXIS]); + NOLESS(target[X_AXIS], sw_endstop_min[X_AXIS]); + NOLESS(target[Y_AXIS], sw_endstop_min[Y_AXIS]); float negative_z_offset = 0; #if ENABLED(AUTO_BED_LEVELING_FEATURE) @@ -7048,13 +7058,13 @@ void clamp_to_software_endstops(float target[3]) { negative_z_offset += home_offset[Z_AXIS]; } #endif - NOLESS(target[Z_AXIS], min_pos[Z_AXIS] + negative_z_offset); + NOLESS(target[Z_AXIS], sw_endstop_min[Z_AXIS] + negative_z_offset); } if (max_software_endstops) { - NOMORE(target[X_AXIS], max_pos[X_AXIS]); - NOMORE(target[Y_AXIS], max_pos[Y_AXIS]); - NOMORE(target[Z_AXIS], max_pos[Z_AXIS]); + NOMORE(target[X_AXIS], sw_endstop_max[X_AXIS]); + NOMORE(target[Y_AXIS], sw_endstop_max[Y_AXIS]); + NOMORE(target[Z_AXIS], sw_endstop_max[Z_AXIS]); } } diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index a8296c0db6..4521587b08 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1167,13 +1167,13 @@ static void _lcd_move(const char* name, AxisEnum axis, float min, float max) { #if ENABLED(DELTA) 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 void lcd_move_x() { int clip = delta_clip(current_position[Y_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(min_pos[X_AXIS], -clip), min(max_pos[X_AXIS], clip)); } - static void lcd_move_y() { int clip = delta_clip(current_position[X_AXIS]); _lcd_move(PSTR(MSG_MOVE_Y), Y_AXIS, max(min_pos[Y_AXIS], -clip), min(max_pos[Y_AXIS], clip)); } + static void lcd_move_x() { int clip = delta_clip(current_position[Y_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(sw_endstop_min[X_AXIS], -clip), min(sw_endstop_max[X_AXIS], clip)); } + static void lcd_move_y() { int clip = delta_clip(current_position[X_AXIS]); _lcd_move(PSTR(MSG_MOVE_Y), Y_AXIS, max(sw_endstop_min[Y_AXIS], -clip), min(sw_endstop_max[Y_AXIS], clip)); } #else - static void lcd_move_x() { _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, min_pos[X_AXIS], max_pos[X_AXIS]); } - static void lcd_move_y() { _lcd_move(PSTR(MSG_MOVE_Y), Y_AXIS, min_pos[Y_AXIS], max_pos[Y_AXIS]); } + static void lcd_move_x() { _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, sw_endstop_min[X_AXIS], sw_endstop_max[X_AXIS]); } + static void lcd_move_y() { _lcd_move(PSTR(MSG_MOVE_Y), Y_AXIS, sw_endstop_min[Y_AXIS], sw_endstop_max[Y_AXIS]); } #endif -static void lcd_move_z() { _lcd_move(PSTR(MSG_MOVE_Z), Z_AXIS, min_pos[Z_AXIS], max_pos[Z_AXIS]); } +static void lcd_move_z() { _lcd_move(PSTR(MSG_MOVE_Z), Z_AXIS, sw_endstop_min[Z_AXIS], sw_endstop_max[Z_AXIS]); } static void lcd_move_e( #if EXTRUDERS > 1 uint8_t e From a4062a47acfc96906b0dc822b1ba31a0baea8f9c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Apr 2016 23:12:15 -0700 Subject: [PATCH 2/7] Rename baricuda variables --- Marlin/Marlin.h | 4 ++-- Marlin/Marlin_main.cpp | 12 ++++++------ Marlin/planner.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index dc73e8e746..353cf50a44 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -340,8 +340,8 @@ extern bool axis_homed[3]; // axis[n].is_homed #endif #if ENABLED(BARICUDA) - extern int ValvePressure; - extern int EtoPPressure; + extern int baricuda_valve_pressure; + extern int baricuda_e_to_p_pressure; #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 3bb393c7cc..ba352eee3c 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -346,8 +346,8 @@ static uint8_t target_extruder; #endif #if ENABLED(BARICUDA) - int ValvePressure = 0; - int EtoPPressure = 0; + int baricuda_valve_pressure = 0; + int baricuda_e_to_p_pressure = 0; #endif #if ENABLED(FWRETRACT) @@ -4622,22 +4622,22 @@ inline void gcode_M112() { kill(PSTR(MSG_KILLED)); } /** * M126: Heater 1 valve open */ - inline void gcode_M126() { ValvePressure = code_seen('S') ? constrain(code_value(), 0, 255) : 255; } + inline void gcode_M126() { baricuda_valve_pressure = code_seen('S') ? constrain(code_value(), 0, 255) : 255; } /** * M127: Heater 1 valve close */ - inline void gcode_M127() { ValvePressure = 0; } + inline void gcode_M127() { baricuda_valve_pressure = 0; } #endif #if HAS_HEATER_2 /** * M128: Heater 2 valve open */ - inline void gcode_M128() { EtoPPressure = code_seen('S') ? constrain(code_value(), 0, 255) : 255; } + inline void gcode_M128() { baricuda_e_to_p_pressure = code_seen('S') ? constrain(code_value(), 0, 255) : 255; } /** * M129: Heater 2 valve close */ - inline void gcode_M129() { EtoPPressure = 0; } + inline void gcode_M129() { baricuda_e_to_p_pressure = 0; } #endif #endif //BARICUDA diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index ae2b66d00c..ed3cd3047f 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -428,8 +428,8 @@ void check_axes_activity() { #endif #if ENABLED(BARICUDA) - unsigned char tail_valve_pressure = ValvePressure, - tail_e_to_p_pressure = EtoPPressure; + unsigned char tail_valve_pressure = baricuda_valve_pressure, + tail_e_to_p_pressure = baricuda_e_to_p_pressure; #endif block_t* block; @@ -650,8 +650,8 @@ float junction_deviation = 0.1; #endif #if ENABLED(BARICUDA) - block->valve_pressure = ValvePressure; - block->e_to_p_pressure = EtoPPressure; + block->valve_pressure = baricuda_valve_pressure; + block->e_to_p_pressure = baricuda_e_to_p_pressure; #endif // Compute direction bits for this block From 27b2e2e786926099eb1d49db9f72b044b23760ab Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Apr 2016 23:13:07 -0700 Subject: [PATCH 3/7] Document some variables --- Marlin/Marlin_main.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index ba352eee3c..1f4863d1f3 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -284,7 +284,11 @@ bool volumetric_enabled = false; float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA); float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0); +// The distance that XYZ has been offset by G92. Reset by G28. float position_shift[3] = { 0 }; + +// This offset is added to the configured home position. +// Set by M206, M428, or menu item. Saved to EEPROM. float home_offset[3] = { 0 }; // Software Endstops. Default to configured limits. @@ -295,23 +299,36 @@ float sw_endstop_max[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS }; int fanSpeeds[FAN_COUNT] = { 0 }; #endif +// The active extruder (tool). Set with T command. uint8_t active_extruder = 0; + +// Relative Mode. Enable with G91, disable with G90. +static bool relative_mode = false; + bool cancel_heatup = false; const char errormagic[] PROGMEM = "Error:"; const char echomagic[] PROGMEM = "echo:"; const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'}; -static bool relative_mode = false; //Determines Absolute or Relative Coordinates static int serial_count = 0; -static char* seen_pointer; ///< A pointer to find chars in the command string (X, Y, Z, E, etc.) -const char* queued_commands_P = NULL; /* pointer to the current line in the active sequence of commands, or NULL when none */ + +// GCode parameter pointer used by code_seen(), code_value(), etc. +static char* seen_pointer; + +// Next Immediate GCode Command pointer. NULL if none. +const char* queued_commands_P = NULL; + const int sensitive_pins[] = SENSITIVE_PINS; ///< Sensitive pin list for M42 + // Inactivity shutdown millis_t previous_cmd_ms = 0; static millis_t max_inactive_time = 0; static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL; + +// Print Job Timer Stopwatch print_job_timer = Stopwatch(); + static uint8_t target_extruder; #if ENABLED(AUTO_BED_LEVELING_FEATURE) From cafa8b8ce33cf75fc0ec8cfc2693945a9b9072e5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Apr 2016 23:16:49 -0700 Subject: [PATCH 4/7] Rename filament runout items --- Marlin/Marlin.h | 2 +- Marlin/Marlin_main.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 353cf50a44..45bf622471 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -226,7 +226,7 @@ void kill(const char*); void Stop(); #if ENABLED(FILAMENT_RUNOUT_SENSOR) - void filrunout(); + void handle_filament_runout(); #endif /** diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 1f4863d1f3..63cee03230 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -446,7 +446,7 @@ static uint8_t target_extruder; #endif #if ENABLED(FILAMENT_RUNOUT_SENSOR) - static bool filrunoutEnqueued = false; + static bool filament_ran_out = false; #endif static bool send_ok[BUFSIZE]; @@ -6105,7 +6105,7 @@ inline void gcode_M503() { #endif #if ENABLED(FILAMENT_RUNOUT_SENSOR) - filrunoutEnqueued = false; + filament_ran_out = false; #endif } @@ -7741,7 +7741,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { #if HAS_FILRUNOUT if (IS_SD_PRINTING && !(READ(FILRUNOUT_PIN) ^ FIL_RUNOUT_INVERTING)) - filrunout(); + handle_filament_runout(); #endif if (commands_in_queue < BUFSIZE) get_available_commands(); @@ -7924,9 +7924,9 @@ void kill(const char* lcd_msg) { #if ENABLED(FILAMENT_RUNOUT_SENSOR) - void filrunout() { - if (!filrunoutEnqueued) { - filrunoutEnqueued = true; + void handle_filament_runout() { + if (!filament_ran_out) { + filament_ran_out = true; enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT)); st_synchronize(); } From 39ee9c526baa112b0f0c08ce99009ad26887d308 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 18 Apr 2016 00:01:28 -0700 Subject: [PATCH 5/7] setTargetedHotend => get_target_extruder_from_command --- Marlin/Marlin_main.cpp | 59 +++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 63cee03230..5fbb21f0ed 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -496,8 +496,6 @@ void process_next_command(); void plan_arc(float target[NUM_AXIS], float* offset, uint8_t clockwise); -bool setTargetedHotend(int code); - void serial_echopair_P(const char* s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); } @@ -1161,6 +1159,30 @@ bool code_seen(char code) { return (seen_pointer != NULL); // Return TRUE if the code-letter was found } +/** + * Set target_extruder from the T parameter or the active_extruder + * + * Returns TRUE if the target is invalid + */ +bool get_target_extruder_from_command(int code) { + if (code_seen('T')) { + short t = code_value_short(); + if (t >= EXTRUDERS) { + SERIAL_ECHO_START; + SERIAL_CHAR('M'); + SERIAL_ECHO(code); + SERIAL_ECHOPAIR(" " MSG_INVALID_EXTRUDER " ", t); + SERIAL_EOL; + return true; + } + target_extruder = t; + } + else + target_extruder = active_extruder; + + return false; +} + #define DEFINE_PGM_READ_ANY(type, reader) \ static inline type pgm_read_any(const type *p) \ { return pgm_read_##reader##_near(p); } @@ -4233,7 +4255,7 @@ inline void gcode_M77() { * M104: Set hot end temperature */ inline void gcode_M104() { - if (setTargetedHotend(104)) return; + if (get_target_extruder_from_command(104)) return; if (DEBUGGING(DRYRUN)) return; if (code_seen('S')) { @@ -4341,7 +4363,7 @@ inline void gcode_M104() { * M105: Read hot end and bed temperature */ inline void gcode_M105() { - if (setTargetedHotend(105)) return; + if (get_target_extruder_from_command(105)) return; #if HAS_TEMP_HOTEND || HAS_TEMP_BED SERIAL_PROTOCOLPGM(MSG_OK); @@ -4385,7 +4407,7 @@ inline void gcode_M105() { */ inline void gcode_M109() { - if (setTargetedHotend(109)) return; + if (get_target_extruder_from_command(109)) return; if (DEBUGGING(DRYRUN)) return; bool no_wait_for_cooling = code_seen('S'); @@ -5052,7 +5074,7 @@ inline void gcode_M121() { enable_endstops_globally(false); } */ inline void gcode_M200() { - if (setTargetedHotend(200)) return; + if (get_target_extruder_from_command(200)) return; if (code_seen('D')) { float diameter = code_value(); @@ -5304,7 +5326,7 @@ inline void gcode_M206() { * Z - Available with DUAL_X_CARRIAGE */ inline void gcode_M218() { - if (setTargetedHotend(218)) return; + if (get_target_extruder_from_command(218)) return; if (code_seen('X')) extruder_offset[X_AXIS][target_extruder] = code_value(); if (code_seen('Y')) extruder_offset[Y_AXIS][target_extruder] = code_value(); @@ -5343,7 +5365,7 @@ inline void gcode_M220() { inline void gcode_M221() { if (code_seen('S')) { int sval = code_value(); - if (setTargetedHotend(221)) return; + if (get_target_extruder_from_command(221)) return; extruder_multiplier[target_extruder] = sval; } } @@ -8006,27 +8028,6 @@ void Stop() { } } -/** - * Set target_extruder from the T parameter or the active_extruder - * - * Returns TRUE if the target is invalid - */ -bool setTargetedHotend(int code) { - target_extruder = active_extruder; - if (code_seen('T')) { - target_extruder = code_value_short(); - if (target_extruder >= EXTRUDERS) { - SERIAL_ECHO_START; - SERIAL_CHAR('M'); - SERIAL_ECHO(code); - SERIAL_ECHOPGM(" " MSG_INVALID_EXTRUDER " "); - SERIAL_ECHOLN((int)target_extruder); - return true; - } - } - return false; -} - float calculate_volumetric_multiplier(float diameter) { if (!volumetric_enabled || diameter == 0) return 1.0; float d2 = diameter * 0.5; From ac69fad96d0eeafc65016328c5fdf2ee08e2cd0a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 18 Apr 2016 00:05:22 -0700 Subject: [PATCH 6/7] lowercase "stop" function --- Marlin/Marlin.h | 1 - Marlin/Marlin_main.cpp | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 45bf622471..7c4096205c 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -223,7 +223,6 @@ void ok_to_send(); void reset_bed_level(); void prepare_move(); void kill(const char*); -void Stop(); #if ENABLED(FILAMENT_RUNOUT_SENSOR) void handle_filament_runout(); diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 5fbb21f0ed..1162262bd4 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -491,6 +491,8 @@ static bool send_ok[BUFSIZE]; * *************************************************************************** */ +void stop(); + void get_available_commands(); void process_next_command(); @@ -1761,7 +1763,7 @@ static void setup_for_endstop_move() { SERIAL_ERRORLNPGM("Z-Probe failed to engage!"); LCD_ALERTMESSAGEPGM("Err: ZPROBE"); } - Stop(); + stop(); } #endif // Z_PROBE_ALLEN_KEY @@ -1865,7 +1867,7 @@ static void setup_for_endstop_move() { SERIAL_ERRORLNPGM("Z-Probe failed to retract!"); LCD_ALERTMESSAGEPGM("Err: ZPROBE"); } - Stop(); + stop(); } #endif // Z_PROBE_ALLEN_KEY @@ -8017,7 +8019,7 @@ void kill(const char* lcd_msg) { } #endif // FAST_PWM_FAN -void Stop() { +void stop() { disable_all_heaters(); if (IsRunning()) { Running = false; From 8a2587f017a6feb6fd68f344f5677939cdd89fa5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 19 Apr 2016 19:57:32 -0700 Subject: [PATCH 7/7] Read size for MAX6675 from sizeof(max6675_temp) --- Marlin/temperature.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index bfbadc6cbe..a48b8db7ec 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1219,13 +1219,11 @@ void disable_all_heaters() { #define MAX6675_HEAT_INTERVAL 250u #if ENABLED(MAX6675_IS_MAX31855) - unsigned long max6675_temp = 2000; - #define MAX6675_READ_BYTES 4 + uint32_t max6675_temp = 2000; #define MAX6675_ERROR_MASK 7 #define MAX6675_DISCARD_BITS 18 #else - unsigned int max6675_temp = 2000; - #define MAX6675_READ_BYTES 2 + uint16_t max6675_temp = 2000; #define MAX6675_ERROR_MASK 4 #define MAX6675_DISCARD_BITS 3 #endif @@ -1257,7 +1255,7 @@ void disable_all_heaters() { // Read a big-endian temperature value max6675_temp = 0; - for (uint8_t i = MAX6675_READ_BYTES; i--;) { + for (uint8_t i = sizeof(max6675_temp); i--;) { SPDR = 0; for (;!TEST(SPSR, SPIF);); max6675_temp |= SPDR;