From 9b3462f73f5e0e3cadefd2f64eff55c758dd96d5 Mon Sep 17 00:00:00 2001 From: Josef Larsson Date: Sun, 22 Mar 2015 00:32:22 +0100 Subject: [PATCH 1/8] Refactor SCARA calibration. Save some lines of code and possibly ROM. --- Marlin/Marlin_main.cpp | 76 +++++++++--------------------------------- 1 file changed, 15 insertions(+), 61 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 4ef5d59f11..cb7434ef41 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3967,18 +3967,16 @@ inline void gcode_M303() { } #ifdef SCARA - /** * M360: SCARA calibration: Move to cal-position ThetaA (0 deg calibration) */ - inline bool gcode_M360() { - SERIAL_ECHOLN(" Cal: Theta 0 "); + bool SCARA_move_to_cal(uint8_t delta_x, uint8_t delta_y) { //SoftEndsEnabled = false; // Ignore soft endstops during calibration //SERIAL_ECHOLN(" Soft endstops disabled "); if (! Stopped) { //get_coordinates(); // For X Y Z E F - delta[X_AXIS] = 0; - delta[Y_AXIS] = 120; + delta[X_AXIS] = delta_x; + delta[Y_AXIS] = delta_y; calculate_SCARA_forward_Transform(delta); destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS]; destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; @@ -3989,25 +3987,20 @@ inline void gcode_M303() { return false; } + /** + * M360: SCARA calibration: Move to cal-position ThetaA (0 deg calibration) + */ + inline bool gcode_M360() { + SERIAL_ECHOLN(" Cal: Theta 0 "); + return SCARA_move_to_cal(0, 120); + } + /** * M361: SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree) */ inline bool gcode_M361() { SERIAL_ECHOLN(" Cal: Theta 90 "); - //SoftEndsEnabled = false; // Ignore soft endstops during calibration - //SERIAL_ECHOLN(" Soft endstops disabled "); - if (! Stopped) { - //get_coordinates(); // For X Y Z E F - delta[X_AXIS] = 90; - delta[Y_AXIS] = 130; - calculate_SCARA_forward_Transform(delta); - destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS]; - destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; - prepare_move(); - //ClearToSend(); - return true; - } - return false; + return SCARA_move_to_cal(90, 130); } /** @@ -4015,20 +4008,7 @@ inline void gcode_M303() { */ inline bool gcode_M362() { SERIAL_ECHOLN(" Cal: Psi 0 "); - //SoftEndsEnabled = false; // Ignore soft endstops during calibration - //SERIAL_ECHOLN(" Soft endstops disabled "); - if (! Stopped) { - //get_coordinates(); // For X Y Z E F - delta[X_AXIS] = 60; - delta[Y_AXIS] = 180; - calculate_SCARA_forward_Transform(delta); - destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS]; - destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; - prepare_move(); - //ClearToSend(); - return true; - } - return false; + return SCARA_move_to_cal(60, 180); } /** @@ -4036,20 +4016,7 @@ inline void gcode_M303() { */ inline bool gcode_M363() { SERIAL_ECHOLN(" Cal: Psi 90 "); - //SoftEndsEnabled = false; // Ignore soft endstops during calibration - //SERIAL_ECHOLN(" Soft endstops disabled "); - if (! Stopped) { - //get_coordinates(); // For X Y Z E F - delta[X_AXIS] = 50; - delta[Y_AXIS] = 90; - calculate_SCARA_forward_Transform(delta); - destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS]; - destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; - prepare_move(); - //ClearToSend(); - return true; - } - return false; + return SCARA_move_to_cal(50, 90); } /** @@ -4057,20 +4024,7 @@ inline void gcode_M303() { */ inline bool gcode_M364() { SERIAL_ECHOLN(" Cal: Theta-Psi 90 "); - // SoftEndsEnabled = false; // Ignore soft endstops during calibration - //SERIAL_ECHOLN(" Soft endstops disabled "); - if (! Stopped) { - //get_coordinates(); // For X Y Z E F - delta[X_AXIS] = 45; - delta[Y_AXIS] = 135; - calculate_SCARA_forward_Transform(delta); - destination[X_AXIS] = delta[X_AXIS] / axis_scaling[X_AXIS]; - destination[Y_AXIS] = delta[Y_AXIS] / axis_scaling[Y_AXIS]; - prepare_move(); - //ClearToSend(); - return true; - } - return false; + return SCARA_move_to_cal(45, 135); } /** From 379348487e423bfb67a1aba1c49c5acdb54d5e43 Mon Sep 17 00:00:00 2001 From: Josef Larsson Date: Sun, 22 Mar 2015 12:21:31 +0100 Subject: [PATCH 2/8] Removed malplaced comment. --- Marlin/Marlin_main.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index cb7434ef41..5c1e463121 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3967,9 +3967,6 @@ inline void gcode_M303() { } #ifdef SCARA - /** - * M360: SCARA calibration: Move to cal-position ThetaA (0 deg calibration) - */ bool SCARA_move_to_cal(uint8_t delta_x, uint8_t delta_y) { //SoftEndsEnabled = false; // Ignore soft endstops during calibration //SERIAL_ECHOLN(" Soft endstops disabled "); From 6bdee87be3525d9219301bdb90d7256d92dd9f3b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 23 Mar 2015 00:27:29 -0700 Subject: [PATCH 3/8] Cleanup temperature code - Get rid of unused temp states in the ISR, resulting in more frequent temperature reading with fewer sensors - Shrink code slightly in min/max testing --- Marlin/temperature.cpp | 215 +++++++++++++++++++++++++---------------- 1 file changed, 132 insertions(+), 83 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 26360a5144..50fc0e3813 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1240,16 +1240,26 @@ void disable_heater() { enum TempState { PrepareTemp_0, MeasureTemp_0, - PrepareTemp_BED, - MeasureTemp_BED, - PrepareTemp_1, - MeasureTemp_1, - PrepareTemp_2, - MeasureTemp_2, - PrepareTemp_3, - MeasureTemp_3, - Prepare_FILWIDTH, - Measure_FILWIDTH, + #if HAS_TEMP_BED + PrepareTemp_BED, + MeasureTemp_BED, + #endif + #if HAS_TEMP_1 + PrepareTemp_1, + MeasureTemp_1, + #endif + #if HAS_TEMP_2 + PrepareTemp_2, + MeasureTemp_2, + #endif + #if HAS_TEMP_3 + PrepareTemp_3, + MeasureTemp_3, + #endif + #if HAS_FILAMENT_SENSOR + Prepare_FILWIDTH, + Measure_FILWIDTH, + #endif StartupDelay // Startup, delay initial temp reading a tiny bit so the hardware can settle }; @@ -1473,78 +1483,124 @@ ISR(TIMER0_COMPB_vect) { #if HAS_TEMP_0 raw_temp_value[0] += ADC; #endif - temp_state = PrepareTemp_BED; + temp_state = + #if HAS_TEMP_BED + PrepareTemp_BED + #elif HAS_TEMP_1 + PrepareTemp_1 + #elif HAS_TEMP_2 + PrepareTemp_2 + #elif HAS_TEMP_3 + PrepareTemp_3 + #elif HAS_FILAMENT_SENSOR + Prepare_FILWIDTH + #else + PrepareTemp_0 + #endif + ; break; - case PrepareTemp_BED: - #if HAS_TEMP_BED + + #if HAS_TEMP_BED + case PrepareTemp_BED: START_ADC(TEMP_BED_PIN); - #endif - lcd_buttons_update(); - temp_state = MeasureTemp_BED; - break; - case MeasureTemp_BED: - #if HAS_TEMP_BED + lcd_buttons_update(); + temp_state = MeasureTemp_BED; + break; + case MeasureTemp_BED: raw_temp_bed_value += ADC; - #endif - temp_state = PrepareTemp_1; - break; - case PrepareTemp_1: - #if HAS_TEMP_1 + temp_state = + #if HAS_TEMP_1 + PrepareTemp_1 + #elif HAS_TEMP_2 + PrepareTemp_2 + #elif HAS_TEMP_3 + PrepareTemp_3 + #elif HAS_FILAMENT_SENSOR + Prepare_FILWIDTH + #else + PrepareTemp_0 + #endif + ; + break; + #endif + + #if HAS_TEMP_1 + case PrepareTemp_1: START_ADC(TEMP_1_PIN); - #endif - lcd_buttons_update(); - temp_state = MeasureTemp_1; - break; - case MeasureTemp_1: - #if HAS_TEMP_1 + lcd_buttons_update(); + temp_state = MeasureTemp_1; + break; + case MeasureTemp_1: raw_temp_value[1] += ADC; - #endif - temp_state = PrepareTemp_2; - break; - case PrepareTemp_2: - #if HAS_TEMP_2 + temp_state = + #if HAS_TEMP_2 + PrepareTemp_2 + #elif HAS_TEMP_3 + PrepareTemp_3 + #elif HAS_FILAMENT_SENSOR + Prepare_FILWIDTH + #else + PrepareTemp_0 + #endif + ; + break; + #endif + + #if HAS_TEMP_2 + case PrepareTemp_2: START_ADC(TEMP_2_PIN); - #endif - lcd_buttons_update(); - temp_state = MeasureTemp_2; - break; - case MeasureTemp_2: - #if HAS_TEMP_2 + lcd_buttons_update(); + temp_state = MeasureTemp_2; + break; + case MeasureTemp_2: raw_temp_value[2] += ADC; - #endif - temp_state = PrepareTemp_3; - break; - case PrepareTemp_3: - #if HAS_TEMP_3 + temp_state = + #if HAS_TEMP_3 + PrepareTemp_3 + #elif HAS_FILAMENT_SENSOR + Prepare_FILWIDTH + #else + PrepareTemp_0 + #endif + ; + break; + #endif + + #if HAS_TEMP_3 + case PrepareTemp_3: START_ADC(TEMP_3_PIN); - #endif - lcd_buttons_update(); - temp_state = MeasureTemp_3; - break; - case MeasureTemp_3: - #if HAS_TEMP_3 + lcd_buttons_update(); + temp_state = MeasureTemp_3; + break; + case MeasureTemp_3: raw_temp_value[3] += ADC; - #endif - temp_state = Prepare_FILWIDTH; - break; - case Prepare_FILWIDTH: - #if HAS_FILAMENT_SENSOR + temp_state = + #if HAS_FILAMENT_SENSOR + Prepare_FILWIDTH + #else + PrepareTemp_0 + #endif + ; + break; + #endif + + #if HAS_FILAMENT_SENSOR + case Prepare_FILWIDTH: START_ADC(FILWIDTH_PIN); - #endif - lcd_buttons_update(); - temp_state = Measure_FILWIDTH; - break; - case Measure_FILWIDTH: - #if HAS_FILAMENT_SENSOR + lcd_buttons_update(); + temp_state = Measure_FILWIDTH; + break; + case Measure_FILWIDTH: // raw_filwidth_value += ADC; //remove to use an IIR filter approach if (ADC > 102) { //check that ADC is reading a voltage > 0.5 volts, otherwise don't take in the data. raw_filwidth_value -= (raw_filwidth_value>>7); //multiply raw_filwidth_value by 127/128 raw_filwidth_value += ((unsigned long)ADC<<7); //add new ADC reading } - #endif - temp_state = PrepareTemp_0; - temp_count++; - break; + temp_state = PrepareTemp_0; + temp_count++; + break; + #endif + case StartupDelay: temp_state = PrepareTemp_0; break; @@ -1554,7 +1610,7 @@ ISR(TIMER0_COMPB_vect) { // SERIAL_ERRORLNPGM("Temp measurement error!"); // break; } // switch(temp_state) - + if (temp_count >= OVERSAMPLENR) { // 10 * 16 * 1/(16000000/64/256) = 164ms. if (!temp_meas_ready) { //Only update the raw values if they have been read. Else we could be updating them during reading. #ifndef HEATER_0_USES_MAX6675 @@ -1579,7 +1635,7 @@ ISR(TIMER0_COMPB_vect) { #if HAS_FILAMENT_SENSOR current_raw_filwidth = raw_filwidth_value >> 10; // Divide to get to 0-16384 range since we used 1/128 IIR filter approach #endif - + temp_meas_ready = true; temp_count = 0; for (int i = 0; i < EXTRUDERS; i++) raw_temp_value[i] = 0; @@ -1587,44 +1643,39 @@ ISR(TIMER0_COMPB_vect) { #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP #define GE0 <= - #define LE0 >= #else #define GE0 >= - #define LE0 <= #endif if (current_temperature_raw[0] GE0 maxttemp_raw[0]) max_temp_error(0); - if (current_temperature_raw[0] LE0 minttemp_raw[0]) min_temp_error(0); + if (minttemp_raw[0] GE0 current_temperature_raw[0]) min_temp_error(0); #if EXTRUDERS > 1 #if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP #define GE1 <= - #define LE1 >= #else #define GE1 >= - #define LE1 <= #endif if (current_temperature_raw[1] GE1 maxttemp_raw[1]) max_temp_error(1); - if (current_temperature_raw[1] LE1 minttemp_raw[1]) min_temp_error(1); + if (minttemp_raw[1] GE0 current_temperature_raw[1]) min_temp_error(1); + #if EXTRUDERS > 2 #if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP #define GE2 <= - #define LE2 >= #else #define GE2 >= - #define LE2 <= #endif if (current_temperature_raw[2] GE2 maxttemp_raw[2]) max_temp_error(2); - if (current_temperature_raw[2] LE2 minttemp_raw[2]) min_temp_error(2); + if (minttemp_raw[2] GE0 current_temperature_raw[2]) min_temp_error(2); + #if EXTRUDERS > 3 #if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP #define GE3 <= - #define LE3 >= #else #define GE3 >= - #define LE3 <= #endif if (current_temperature_raw[3] GE3 maxttemp_raw[3]) max_temp_error(3); - if (current_temperature_raw[3] LE3 minttemp_raw[3]) min_temp_error(3); + if (minttemp_raw[3] GE0 current_temperature_raw[3]) min_temp_error(3); + #endif // EXTRUDERS > 3 #endif // EXTRUDERS > 2 #endif // EXTRUDERS > 1 @@ -1632,10 +1683,8 @@ ISR(TIMER0_COMPB_vect) { #if defined(BED_MAXTEMP) && (TEMP_SENSOR_BED != 0) #if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP #define GEBED <= - #define LEBED >= #else #define GEBED >= - #define LEBED <= #endif if (current_temperature_bed_raw GEBED bed_maxttemp_raw) { target_temperature_bed = 0; From e6f6c6e3a1793fb58d25b8dbe14598dfd2abba4d Mon Sep 17 00:00:00 2001 From: wurstnase Date: Mon, 23 Mar 2015 08:32:48 +0100 Subject: [PATCH 4/8] fix bad insertion config again --- Marlin/example_configurations/Felix/Configuration.h | 1 - Marlin/example_configurations/Felix/Configuration_DUAL.h | 1 - 2 files changed, 2 deletions(-) diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 973fb63540..b03e871ed3 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -386,7 +386,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Note: this feature occupies 10'206 byte #ifdef AUTO_BED_LEVELING_GRID -home_offset // set the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define BACK_PROBE_BED_POSITION 180 diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h index 42dcd38278..be59d340fe 100644 --- a/Marlin/example_configurations/Felix/Configuration_DUAL.h +++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h @@ -386,7 +386,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Note: this feature occupies 10'206 byte #ifdef AUTO_BED_LEVELING_GRID -home_offset // set the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define BACK_PROBE_BED_POSITION 180 From 37cde8a19170921774fd95bc4450263966e6c7bb Mon Sep 17 00:00:00 2001 From: nicolas-rambaud Date: Mon, 23 Mar 2015 12:29:12 +0100 Subject: [PATCH 5/8] Report changes from previous PR from old code base including : I've updated the minimum values from the LCD. It has been a while that i want to at least fix this. I have an inductive probe and often i need to set my zOffset to something lower than 0.5. With the current implementation, the default LCD value is set to 0.5 for some reason. On my case i need to be able to set it down to 0.0 as my inductive probe can be lower than 0.5. Before with the LCD we couldn't change this value below 0.5. We had to flash the firmware every time which was painful. Now we are able to change this value down to 0.0 if needed. I've also changed the minimum value for Z min acceleration. In the default configuration it's set to 25 but on the LCD the minimum was 100 which is not coherent. I've changes the minimum to 10. On this axis, depending on the mechanics/motor drivers we might require very low acceleration, so i guess 10 is somehow realistic. --- Marlin/ultralcd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 29b3ca118a..19e3d0c504 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -912,9 +912,9 @@ static void lcd_control_motion_menu() { START_MENU(); MENU_ITEM(back, MSG_CONTROL, lcd_control_menu); #ifdef ENABLE_AUTO_BED_LEVELING - MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, 0.5, 50); + MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, 0.0, 50); #endif - MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 500, 99000); + MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 10, 99000); MENU_ITEM_EDIT(float3, MSG_VXY_JERK, &max_xy_jerk, 1, 990); MENU_ITEM_EDIT(float52, MSG_VZ_JERK, &max_z_jerk, 0.1, 990); MENU_ITEM_EDIT(float3, MSG_VE_JERK, &max_e_jerk, 1, 990); @@ -926,7 +926,7 @@ static void lcd_control_motion_menu() { MENU_ITEM_EDIT(float3, MSG_VTRAV_MIN, &mintravelfeedrate, 0, 999); MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_X, &max_acceleration_units_per_sq_second[X_AXIS], 100, 99000, reset_acceleration_rates); MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Y, &max_acceleration_units_per_sq_second[Y_AXIS], 100, 99000, reset_acceleration_rates); - MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Z, &max_acceleration_units_per_sq_second[Z_AXIS], 100, 99000, reset_acceleration_rates); + MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Z, &max_acceleration_units_per_sq_second[Z_AXIS], 10, 99000, reset_acceleration_rates); MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &max_acceleration_units_per_sq_second[E_AXIS], 100, 99000, reset_acceleration_rates); MENU_ITEM_EDIT(float5, MSG_A_RETRACT, &retract_acceleration, 100, 99000); MENU_ITEM_EDIT(float5, MSG_A_TRAVEL, &travel_acceleration, 100, 99000); From 1fac3886640ac4aa372d7958435f3bef42c51424 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 23 Mar 2015 15:18:22 -0700 Subject: [PATCH 6/8] Revert measurement loop --- Marlin/temperature.cpp | 204 ++++++++++++++++------------------------- 1 file changed, 77 insertions(+), 127 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 50fc0e3813..1582c437a2 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1145,28 +1145,28 @@ void disable_heater() { for (int i=0; i 1 && HAS_TEMP_1 - target_temperature[1] = 0; - soft_pwm[1] = 0; - WRITE_HEATER_1(LOW); + DISABLE_HEATER(1); #endif #if EXTRUDERS > 2 && HAS_TEMP_2 - target_temperature[2] = 0; - soft_pwm[2] = 0; - WRITE_HEATER_2(LOW); + DISABLE_HEATER(2); #endif #if EXTRUDERS > 3 && HAS_TEMP_3 - target_temperature[3] = 0; - soft_pwm[3] = 0; - WRITE_HEATER_3(LOW); + DISABLE_HEATER(3); #endif #if HAS_TEMP_BED @@ -1240,26 +1240,16 @@ void disable_heater() { enum TempState { PrepareTemp_0, MeasureTemp_0, - #if HAS_TEMP_BED - PrepareTemp_BED, - MeasureTemp_BED, - #endif - #if HAS_TEMP_1 - PrepareTemp_1, - MeasureTemp_1, - #endif - #if HAS_TEMP_2 - PrepareTemp_2, - MeasureTemp_2, - #endif - #if HAS_TEMP_3 - PrepareTemp_3, - MeasureTemp_3, - #endif - #if HAS_FILAMENT_SENSOR - Prepare_FILWIDTH, - Measure_FILWIDTH, - #endif + PrepareTemp_BED, + MeasureTemp_BED, + PrepareTemp_1, + MeasureTemp_1, + PrepareTemp_2, + MeasureTemp_2, + PrepareTemp_3, + MeasureTemp_3, + Prepare_FILWIDTH, + Measure_FILWIDTH, StartupDelay // Startup, delay initial temp reading a tiny bit so the hardware can settle }; @@ -1483,123 +1473,83 @@ ISR(TIMER0_COMPB_vect) { #if HAS_TEMP_0 raw_temp_value[0] += ADC; #endif - temp_state = - #if HAS_TEMP_BED - PrepareTemp_BED - #elif HAS_TEMP_1 - PrepareTemp_1 - #elif HAS_TEMP_2 - PrepareTemp_2 - #elif HAS_TEMP_3 - PrepareTemp_3 - #elif HAS_FILAMENT_SENSOR - Prepare_FILWIDTH - #else - PrepareTemp_0 - #endif - ; + temp_state = PrepareTemp_BED; break; - #if HAS_TEMP_BED - case PrepareTemp_BED: + case PrepareTemp_BED: + #if HAS_TEMP_BED START_ADC(TEMP_BED_PIN); - lcd_buttons_update(); - temp_state = MeasureTemp_BED; - break; - case MeasureTemp_BED: + #endif + lcd_buttons_update(); + temp_state = MeasureTemp_BED; + break; + case MeasureTemp_BED: + #if HAS_TEMP_BED raw_temp_bed_value += ADC; - temp_state = - #if HAS_TEMP_1 - PrepareTemp_1 - #elif HAS_TEMP_2 - PrepareTemp_2 - #elif HAS_TEMP_3 - PrepareTemp_3 - #elif HAS_FILAMENT_SENSOR - Prepare_FILWIDTH - #else - PrepareTemp_0 - #endif - ; - break; - #endif + #endif + temp_state = PrepareTemp_1; + break; - #if HAS_TEMP_1 - case PrepareTemp_1: + case PrepareTemp_1: + #if HAS_TEMP_1 START_ADC(TEMP_1_PIN); - lcd_buttons_update(); - temp_state = MeasureTemp_1; - break; - case MeasureTemp_1: + #endif + lcd_buttons_update(); + temp_state = MeasureTemp_1; + break; + case MeasureTemp_1: + #if HAS_TEMP_1 raw_temp_value[1] += ADC; - temp_state = - #if HAS_TEMP_2 - PrepareTemp_2 - #elif HAS_TEMP_3 - PrepareTemp_3 - #elif HAS_FILAMENT_SENSOR - Prepare_FILWIDTH - #else - PrepareTemp_0 - #endif - ; - break; - #endif + #endif + temp_state = PrepareTemp_2; + break; - #if HAS_TEMP_2 - case PrepareTemp_2: + case PrepareTemp_2: + #if HAS_TEMP_2 START_ADC(TEMP_2_PIN); - lcd_buttons_update(); - temp_state = MeasureTemp_2; - break; - case MeasureTemp_2: + #endif + lcd_buttons_update(); + temp_state = MeasureTemp_2; + break; + case MeasureTemp_2: + #if HAS_TEMP_2 raw_temp_value[2] += ADC; - temp_state = - #if HAS_TEMP_3 - PrepareTemp_3 - #elif HAS_FILAMENT_SENSOR - Prepare_FILWIDTH - #else - PrepareTemp_0 - #endif - ; - break; - #endif + #endif + temp_state = PrepareTemp_3; + break; - #if HAS_TEMP_3 - case PrepareTemp_3: + case PrepareTemp_3: + #if HAS_TEMP_3 START_ADC(TEMP_3_PIN); - lcd_buttons_update(); - temp_state = MeasureTemp_3; - break; - case MeasureTemp_3: + #endif + lcd_buttons_update(); + temp_state = MeasureTemp_3; + break; + case MeasureTemp_3: + #if HAS_TEMP_3 raw_temp_value[3] += ADC; - temp_state = - #if HAS_FILAMENT_SENSOR - Prepare_FILWIDTH - #else - PrepareTemp_0 - #endif - ; - break; - #endif + #endif + temp_state = Prepare_FILWIDTH; + break; - #if HAS_FILAMENT_SENSOR - case Prepare_FILWIDTH: + case Prepare_FILWIDTH: + #if HAS_FILAMENT_SENSOR START_ADC(FILWIDTH_PIN); - lcd_buttons_update(); - temp_state = Measure_FILWIDTH; - break; - case Measure_FILWIDTH: + #endif + lcd_buttons_update(); + temp_state = Measure_FILWIDTH; + break; + case Measure_FILWIDTH: + #if HAS_FILAMENT_SENSOR // raw_filwidth_value += ADC; //remove to use an IIR filter approach if (ADC > 102) { //check that ADC is reading a voltage > 0.5 volts, otherwise don't take in the data. raw_filwidth_value -= (raw_filwidth_value>>7); //multiply raw_filwidth_value by 127/128 raw_filwidth_value += ((unsigned long)ADC<<7); //add new ADC reading } - temp_state = PrepareTemp_0; - temp_count++; - break; - #endif + #endif + temp_state = PrepareTemp_0; + temp_count++; + break; case StartupDelay: temp_state = PrepareTemp_0; From b1a7f74ee4cef4e5e40c76318078cb13fc076a8c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 23 Mar 2015 18:25:31 -0700 Subject: [PATCH 7/8] A logo for the Marlin wiki --- Documentation/Logo/marlinwiki.png | Bin 0 -> 6871 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100755 Documentation/Logo/marlinwiki.png diff --git a/Documentation/Logo/marlinwiki.png b/Documentation/Logo/marlinwiki.png new file mode 100755 index 0000000000000000000000000000000000000000..23588b24833d781e433d2ba3212af3c56de7ba8a GIT binary patch literal 6871 zcmaJ_by!tFl)p%KNS8FyDcuk0Zjcb9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@bqz{ zi&8(ZqPdx8k`p(OA7N8+ltxDD`PTi+iHmCI%gr$TD2ltHb&#tSuIR@3A1<1v%7rdV z-PU!ZgLVa+C!{%HMXx5ytDjaslYGNNr69Q_M&&*vZ?}3gbk(3>und?{;Cfl9Qm&-j z`KYkx-8S?aw;7JGElf5IQGGB%TVfO8pwb%_v6tx-`L*la_Ig{UA@86j*lCF=)W8r2 zZJ(`o9%q9u%T5*NDW?J=Joq;ydMsJGOoCY)5lj;+A17g25s?JyJ{fS6!a6}}8m!U3 zlqh@y)8y}C31W(98l>$%nTSm+&9(V^NQqZ&9}_KoAydb5n{fRYLHSU`I2_&fV<=>H z^5SHwlujNN=2sTtLB83*EZ@-^reufn>~fL}Qxl27+_BSGlBfAn+jB{vh7_6m4_ z*2?=gl}b%UQ$dLjvbJK}FIHiz>arC6k~lH4~tJ36`z0kw}G62SUJ|5 z>@3ipwA%o!4U5%nsYf!6_DhxQ!bS! z?sj0;K2JmIpw(ZOp9j!e-RAHz%VuYKx0Rw5ld^9P51KiLkH)jJ;yWd{>To-shaA&K zr@8%TxGbIBJ>L*SaB}3V6Fv=Y5xQ5~Epgn8NA@np7IEveu++S)0$-MvcAGoXq=l}o! literal 0 HcmV?d00001 From fc53e43de6e849be2001c70d604fd2a56948a491 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 23 Mar 2015 20:55:48 -0700 Subject: [PATCH 8/8] Don't test raw temp for MAX6675 - Remove test of raw temp for thermistor 0 when using MAX6675 - Longer `raw_temp_value` array for `TEMP_SENSOR_1_AS_REDUNDANT` --- Marlin/temperature.cpp | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 1582c437a2..cf431cc6f4 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -177,7 +177,7 @@ static volatile bool temp_meas_ready = false; // Init min and max temp with extreme values to prevent false errors during startup static int minttemp_raw[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP, HEATER_3_RAW_LO_TEMP); static int maxttemp_raw[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_RAW_HI_TEMP , HEATER_1_RAW_HI_TEMP , HEATER_2_RAW_HI_TEMP, HEATER_3_RAW_HI_TEMP); -static int minttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS( 0, 0, 0, 0 ); +static int minttemp[EXTRUDERS] = { 0 }; static int maxttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS( 16383, 16383, 16383, 16383 ); //static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP; /* No bed mintemp error implemented?!? */ #ifdef BED_MAXTEMP @@ -197,8 +197,8 @@ static float analog2tempBed(int raw); static void updateTemperaturesFromRawValues(); #ifdef WATCH_TEMP_PERIOD - int watch_start_temp[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0,0); - unsigned long watchmillis[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0,0); + int watch_start_temp[EXTRUDERS] = { 0 }; + unsigned long watchmillis[EXTRUDERS] = { 0 }; #endif //WATCH_TEMP_PERIOD #ifndef SOFT_PWM_SCALE @@ -661,12 +661,6 @@ void manage_heater() { updateTemperaturesFromRawValues(); - #ifdef HEATER_0_USES_MAX6675 - float ct = current_temperature[0]; - if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0); - if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0); - #endif //HEATER_0_USES_MAX6675 - unsigned long ms = millis(); // Loop through all extruders @@ -1257,9 +1251,15 @@ enum TempState { // Timer 0 is shared with millies // ISR(TIMER0_COMPB_vect) { + #ifdef TEMP_SENSOR_1_AS_REDUNDANT + #define TEMP_SENSOR_COUNT 2 + #else + #define TEMP_SENSOR_COUNT EXTRUDERS + #endif + //these variables are only accesible from the ISR, but static, so they don't lose their value static unsigned char temp_count = 0; - static unsigned long raw_temp_value[EXTRUDERS] = { 0 }; + static unsigned long raw_temp_value[TEMP_SENSOR_COUNT] = { 0 }; static unsigned long raw_temp_bed_value = 0; static TempState temp_state = StartupDelay; static unsigned char pwm_count = BIT(SOFT_PWM_SCALE); @@ -1588,16 +1588,22 @@ ISR(TIMER0_COMPB_vect) { temp_meas_ready = true; temp_count = 0; - for (int i = 0; i < EXTRUDERS; i++) raw_temp_value[i] = 0; + for (int i = 0; i < TEMP_SENSOR_COUNT; i++) raw_temp_value[i] = 0; raw_temp_bed_value = 0; - #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP - #define GE0 <= + #ifdef HEATER_0_USES_MAX6675 + float ct = current_temperature[0]; + if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0); + if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0); #else - #define GE0 >= + #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP + #define GE0 <= + #else + #define GE0 >= + #endif + if (current_temperature_raw[0] GE0 maxttemp_raw[0]) max_temp_error(0); + if (minttemp_raw[0] GE0 current_temperature_raw[0]) min_temp_error(0); #endif - if (current_temperature_raw[0] GE0 maxttemp_raw[0]) max_temp_error(0); - if (minttemp_raw[0] GE0 current_temperature_raw[0]) min_temp_error(0); #if EXTRUDERS > 1 #if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP