From 82a3ed2f9a76225ffadecd43c98cca1dc477673a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 14 Jul 2015 19:49:43 -0700 Subject: [PATCH 1/4] Cleanup and dev notes in Marlin.h --- Marlin/Marlin.h | 54 +++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 50ea9ecf0..bc237f049 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -206,18 +206,6 @@ void disable_all_steppers(); void FlushSerialRequestResend(); void ok_to_send(); -#ifdef DELTA - void calculate_delta(float cartesian[3]); - #ifdef ENABLE_AUTO_BED_LEVELING - extern int delta_grid_spacing[2]; - void adjust_delta(float cartesian[3]); - #endif - extern float delta[3]; -#endif -#ifdef SCARA - void calculate_delta(float cartesian[3]); - void calculate_SCARA_forward_Transform(float f_scara[3]); -#endif void reset_bed_level(); void prepare_move(); void kill(const char *); @@ -269,26 +257,34 @@ extern int extruder_multiplier[EXTRUDERS]; // sets extrude multiply factor (in p extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder. 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]; +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 bool axis_known_position[3]; // axis[n].is_known -#ifdef DELTA - extern float endstop_adj[3]; - extern float delta_radius; - extern float delta_diagonal_rod; - extern float delta_segments_per_second; - void recalc_delta_settings(float radius, float diagonal_rod); -#elif defined(Z_DUAL_ENDSTOPS) +#if defined(DELTA) || defined(SCARA) + extern float delta[3]; + void calculate_delta(float cartesian[3]); + #ifdef DELTA + extern float endstop_adj[3]; // axis[n].endstop_adj + extern float delta_radius; + extern float delta_diagonal_rod; + extern float delta_segments_per_second; + void recalc_delta_settings(float radius, float diagonal_rod); + #ifdef ENABLE_AUTO_BED_LEVELING + extern int delta_grid_spacing[2]; + void adjust_delta(float cartesian[3]); + #endif + #elif defined(SCARA) + extern float axis_scaling[3]; // Build size scaling + void calculate_SCARA_forward_Transform(float f_scara[3]); + #endif +#endif + +#ifdef Z_DUAL_ENDSTOPS extern float z_endstop_adj; #endif -#ifdef SCARA - extern float axis_scaling[3]; // Build size scaling -#endif - -extern float min_pos[3]; -extern float max_pos[3]; -extern bool axis_known_position[3]; - #ifdef ENABLE_AUTO_BED_LEVELING extern float zprobe_zoffset; #endif @@ -320,7 +316,7 @@ extern int fanSpeed; #ifdef FWRETRACT extern bool autoretract_enabled; - extern bool retracted[EXTRUDERS]; + extern bool retracted[EXTRUDERS]; // extruder[n].retracted extern float retract_length, retract_length_swap, retract_feedrate, retract_zlift; extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate; #endif From 3bde4f48557f0ff8508c8789753f040bc90d7434 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 14 Jul 2015 19:50:27 -0700 Subject: [PATCH 2/4] Require temp sensor for bed thermal protection --- Marlin/temperature.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index a662e99af..07b3c9a65 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -80,7 +80,7 @@ unsigned char soft_pwm_bed; static TRState thermal_runaway_state_machine[4] = { TRReset, TRReset, TRReset, TRReset }; static millis_t thermal_runaway_timer[4]; // = {0,0,0,0}; #endif - #ifdef THERMAL_PROTECTION_BED + #if defined(THERMAL_PROTECTION_BED) && TEMP_SENSOR_BED != 0 static TRState thermal_runaway_bed_state_machine = TRReset; static millis_t thermal_runaway_bed_timer; #endif From 77e80ef367bb678a2e58bc448f50e14ff855aee8 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 14 Jul 2015 19:51:26 -0700 Subject: [PATCH 3/4] Require extruders for thermal code --- Marlin/temperature.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 07b3c9a65..25d891d23 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1550,7 +1550,7 @@ ISR(TIMER0_COMPB_vect) { if (minttemp_raw[0] GE0 current_temperature_raw[0]) min_temp_error(0); #endif - #if HAS_TEMP_1 + #if HAS_TEMP_1 && EXTRUDERS > 1 #if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP #define GE1 <= #else @@ -1560,7 +1560,7 @@ ISR(TIMER0_COMPB_vect) { if (minttemp_raw[1] GE1 current_temperature_raw[1]) min_temp_error(1); #endif // TEMP_SENSOR_1 - #if HAS_TEMP_2 + #if HAS_TEMP_2 && EXTRUDERS > 2 #if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP #define GE2 <= #else @@ -1570,7 +1570,7 @@ ISR(TIMER0_COMPB_vect) { if (minttemp_raw[2] GE2 current_temperature_raw[2]) min_temp_error(2); #endif // TEMP_SENSOR_2 - #if HAS_TEMP_3 + #if HAS_TEMP_3 && EXTRUDERS > 3 #if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP #define GE3 <= #else From baa9199973365c77d80da4722951c6b8cf7ccd54 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 14 Jul 2015 22:55:56 -0700 Subject: [PATCH 4/4] Define extern delta only for delta --- Marlin/Marlin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index bc237f049..4846d12b7 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -263,9 +263,9 @@ extern float max_pos[3]; // axis[n].max_pos extern bool axis_known_position[3]; // axis[n].is_known #if defined(DELTA) || defined(SCARA) - extern float delta[3]; void calculate_delta(float cartesian[3]); #ifdef DELTA + extern float delta[3]; extern float endstop_adj[3]; // axis[n].endstop_adj extern float delta_radius; extern float delta_diagonal_rod;