From d28f5b9e826d469062bb75c042afa5056e3e2e70 Mon Sep 17 00:00:00 2001 From: MarcelMo Date: Sun, 15 Feb 2015 15:58:29 +0100 Subject: [PATCH 1/4] Support for simple customisable AutoZProbing area MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When probing PCB´s I had the problem that i needed auto-leveling for specific areas (it´s never the same size). Not much code, but very useful. Now I use simply G29 L5 R55 F5 B35 P3 to probe a 4x6cm PCB before milling. I used int for values... might be wrong... I hope this time I got the right development tree. (tried first with https://github.com/MarlinFirmware/Marlin/pull/1130/commits) --- Marlin/Marlin_main.cpp | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 3917b0a1e1..1063761e76 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1720,6 +1720,7 @@ void process_commands() #ifdef ENABLE_AUTO_BED_LEVELING case 29: // G29 Detailed Z-Probe, probes the bed at 3 or more points. + // Override probing area by providing [F]ront [B]ack [L]eft [R]ight Grid[P]oints values { #if Z_MIN_PIN == -1 #error "You must have a Z_MIN endstop in order to enable Auto Bed Leveling feature!!! Z_MIN_PIN must point to a valid hardware pin." @@ -1733,6 +1734,16 @@ void process_commands() SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN); break; // abort G29, since we don't know where we are } + int left_probe_bed_position=LEFT_PROBE_BED_POSITION; + int right_probe_bed_position=RIGHT_PROBE_BED_POSITION; + int back_probe_bed_position=BACK_PROBE_BED_POSITION; + int front_probe_bed_position=FRONT_PROBE_BED_POSITION; + int auto_bed_leveling_grid_points=AUTO_BED_LEVELING_GRID_POINTS; + if (code_seen('L')) left_probe_bed_position=(int)code_value(); + if (code_seen('R')) right_probe_bed_position=(int)code_value(); + if (code_seen('B')) back_probe_bed_position=(int)code_value(); + if (code_seen('F')) front_probe_bed_position=(int)code_value(); + if (code_seen('P')) auto_bed_leveling_grid_points=(int)code_value(); #ifdef Z_PROBE_SLED dock_sled(false); @@ -1754,8 +1765,8 @@ void process_commands() #ifdef AUTO_BED_LEVELING_GRID // probe at the points of a lattice grid - int xGridSpacing = (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION) / (AUTO_BED_LEVELING_GRID_POINTS-1); - int yGridSpacing = (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION) / (AUTO_BED_LEVELING_GRID_POINTS-1); + int xGridSpacing = (right_probe_bed_position - left_probe_bed_position) / (auto_bed_leveling_grid_points-1); + int yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points-1); // solve the plane equation ax + by + d = z @@ -1765,32 +1776,35 @@ void process_commands() // so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z // "A" matrix of the linear system of equations - double eqnAMatrix[AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS*3]; + double eqnAMatrix[auto_bed_leveling_grid_points*auto_bed_leveling_grid_points*3]; + // "B" vector of Z points - double eqnBVector[AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS]; + double eqnBVector[auto_bed_leveling_grid_points*auto_bed_leveling_grid_points]; + int probePointCounter = 0; bool zig = true; - for (int yProbe=FRONT_PROBE_BED_POSITION; yProbe <= BACK_PROBE_BED_POSITION; yProbe += yGridSpacing) + for (int yProbe=front_probe_bed_position; yProbe <= back_probe_bed_position; yProbe += yGridSpacing) + { int xProbe, xInc; if (zig) { - xProbe = LEFT_PROBE_BED_POSITION; - //xEnd = RIGHT_PROBE_BED_POSITION; + xProbe = left_probe_bed_position; + //xEnd = right_probe_bed_position; xInc = xGridSpacing; zig = false; } else // zag { - xProbe = RIGHT_PROBE_BED_POSITION; - //xEnd = LEFT_PROBE_BED_POSITION; + xProbe = right_probe_bed_position; + //xEnd = left_probe_bed_position; xInc = -xGridSpacing; zig = true; } - for (int xCount=0; xCount < AUTO_BED_LEVELING_GRID_POINTS; xCount++) + for (int xCount=0; xCount < auto_bed_leveling_grid_points; xCount++) { float z_before; if (probePointCounter == 0) @@ -1822,9 +1836,9 @@ void process_commands() eqnBVector[probePointCounter] = measured_z; - eqnAMatrix[probePointCounter + 0*AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS] = xProbe; - eqnAMatrix[probePointCounter + 1*AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS] = yProbe; - eqnAMatrix[probePointCounter + 2*AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS] = 1; + eqnAMatrix[probePointCounter + 0*auto_bed_leveling_grid_points*auto_bed_leveling_grid_points] = xProbe; + eqnAMatrix[probePointCounter + 1*auto_bed_leveling_grid_points*auto_bed_leveling_grid_points] = yProbe; + eqnAMatrix[probePointCounter + 2*auto_bed_leveling_grid_points*auto_bed_leveling_grid_points] = 1; probePointCounter++; xProbe += xInc; } @@ -1832,7 +1846,7 @@ void process_commands() clean_up_after_endstop_move(); // solve lsq problem - double *plane_equation_coefficients = qr_solve(AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS, 3, eqnAMatrix, eqnBVector); + double *plane_equation_coefficients = qr_solve(auto_bed_leveling_grid_points*auto_bed_leveling_grid_points, 3, eqnAMatrix, eqnBVector); SERIAL_PROTOCOLPGM("Eqn coefficients: a: "); SERIAL_PROTOCOL(plane_equation_coefficients[0]); From 2e166f533770f49f07fca3672714c82871a17917 Mon Sep 17 00:00:00 2001 From: Maverikou Date: Tue, 29 Jul 2014 20:56:55 +0300 Subject: [PATCH 2/4] Added support for PanelOne from T3P3. --- Marlin/Configuration.h | 8 ++++++++ Marlin/pins_RAMPS_13.h | 22 ++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 41e1ed7ed9..b4e0c20c55 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -581,6 +581,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click +// PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) +// http://reprap.org/wiki/PanelOne +//#define PANEL_ONE + // The MaKr3d Makr-Panel with graphic controller and SD support // http://reprap.org/wiki/MaKr3d_MaKrPanel //#define MAKRPANEL @@ -639,6 +643,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define ENCODER_STEPS_PER_MENU_ITEM 1 #endif +#if defined (PANEL_ONE) + #define SDSUPPORT + #define ULTIMAKERCONTROLLER +#endif #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define DOGLCD diff --git a/Marlin/pins_RAMPS_13.h b/Marlin/pins_RAMPS_13.h index 840804a9d1..b2e6d05787 100644 --- a/Marlin/pins_RAMPS_13.h +++ b/Marlin/pins_RAMPS_13.h @@ -122,12 +122,22 @@ #ifdef ULTRA_LCD #ifdef NEWPANEL - #define LCD_PINS_RS 16 - #define LCD_PINS_ENABLE 17 - #define LCD_PINS_D4 23 - #define LCD_PINS_D5 25 - #define LCD_PINS_D6 27 - #define LCD_PINS_D7 29 + #ifdef PANEL_ONE + #define LCD_PINS_RS 40 + #define LCD_PINS_ENABLE 42 + #define LCD_PINS_D4 65 + #define LCD_PINS_D5 66 + #define LCD_PINS_D6 44 + #define LCD_PINS_D7 64 + #else + #define LCD_PINS_RS 16 + #define LCD_PINS_ENABLE 17 + #define LCD_PINS_D4 23 + #define LCD_PINS_D5 25 + #define LCD_PINS_D6 27 + #define LCD_PINS_D7 29 + #endif + #ifdef REPRAP_DISCOUNT_SMART_CONTROLLER #define BEEPER 37 From a9e15aa50379e0729c3f82fcf61334db91ef4c11 Mon Sep 17 00:00:00 2001 From: maverikou Date: Sun, 22 Feb 2015 20:15:05 +0200 Subject: [PATCH 3/4] Updated example configurations --- Marlin/example_configurations/Hephestos/Configuration.h | 8 ++++++++ Marlin/example_configurations/K8200/Configuration.h | 8 ++++++++ Marlin/example_configurations/SCARA/Configuration.h | 8 ++++++++ Marlin/example_configurations/WITBOX/Configuration.h | 8 ++++++++ Marlin/example_configurations/delta/Configuration.h | 8 ++++++++ Marlin/example_configurations/makibox/Configuration.h | 8 ++++++++ .../example_configurations/tvrrug/Round2/Configuration.h | 8 ++++++++ 7 files changed, 56 insertions(+) diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 93a0f1809c..c1bb413aad 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -587,6 +587,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click +// PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) +// http://reprap.org/wiki/PanelOne +//#define PANEL_ONE + // The MaKr3d Makr-Panel with graphic controller and SD support // http://reprap.org/wiki/MaKr3d_MaKrPanel //#define MAKRPANEL @@ -645,6 +649,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define ENCODER_STEPS_PER_MENU_ITEM 1 #endif +#if defined (PANEL_ONE) + #define SDSUPPORT + #define ULTIMAKERCONTROLLER +#endif #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define DOGLCD diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index e17ee9e330..b56e053014 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -597,6 +597,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click +// PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) +// http://reprap.org/wiki/PanelOne +//#define PANEL_ONE + // The MaKr3d Makr-Panel with graphic controller and SD support // http://reprap.org/wiki/MaKr3d_MaKrPanel //#define MAKRPANEL @@ -655,6 +659,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define ENCODER_STEPS_PER_MENU_ITEM 1 #endif +#if defined (PANEL_ONE) + #define SDSUPPORT + #define ULTIMAKERCONTROLLER +#endif #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define DOGLCD diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 43a94f705b..45584c1621 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -590,6 +590,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click +// PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) +// http://reprap.org/wiki/PanelOne +//#define PANEL_ONE + // The MaKr3d Makr-Panel with graphic controller and SD support // http://reprap.org/wiki/MaKr3d_MaKrPanel //#define MAKRPANEL @@ -648,6 +652,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define ENCODER_STEPS_PER_MENU_ITEM 1 #endif +#if defined (PANEL_ONE) + #define SDSUPPORT + #define ULTIMAKERCONTROLLER +#endif #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define DOGLCD diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index 02aa94b2d9..e240abfedd 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -591,6 +591,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click +// PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) +// http://reprap.org/wiki/PanelOne +//#define PANEL_ONE + // The MaKr3d Makr-Panel with graphic controller and SD support // http://reprap.org/wiki/MaKr3d_MaKrPanel //#define MAKRPANEL @@ -649,6 +653,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define ENCODER_STEPS_PER_MENU_ITEM 1 #endif +#if defined (PANEL_ONE) + #define SDSUPPORT + #define ULTIMAKERCONTROLLER +#endif #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define DOGLCD diff --git a/Marlin/example_configurations/delta/Configuration.h b/Marlin/example_configurations/delta/Configuration.h index ba5f6590a3..e880f8a2d8 100644 --- a/Marlin/example_configurations/delta/Configuration.h +++ b/Marlin/example_configurations/delta/Configuration.h @@ -495,6 +495,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click +// PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) +// http://reprap.org/wiki/PanelOne +//#define PANEL_ONE + // The MaKr3d Makr-Panel with graphic controller and SD support // http://reprap.org/wiki/MaKr3d_MaKrPanel //#define MAKRPANEL @@ -560,6 +564,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define ENCODER_STEPS_PER_MENU_ITEM 1 #endif +#if defined (PANEL_ONE) + #define SDSUPPORT + #define ULTIMAKERCONTROLLER +#endif #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define DOGLCD diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index e054918b9d..d17f3867ec 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -565,6 +565,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click +// PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) +// http://reprap.org/wiki/PanelOne +//#define PANEL_ONE + // The MaKr3d Makr-Panel with graphic controller and SD support // http://reprap.org/wiki/MaKr3d_MaKrPanel //#define MAKRPANEL @@ -623,6 +627,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define ENCODER_STEPS_PER_MENU_ITEM 1 #endif +#if defined (PANEL_ONE) + #define SDSUPPORT + #define ULTIMAKERCONTROLLER +#endif #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define DOGLCD diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index fccc267f22..2a18c1e8ca 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -578,6 +578,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click +// PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) +// http://reprap.org/wiki/PanelOne +//#define PANEL_ONE + // The MaKr3d Makr-Panel with graphic controller and SD support // http://reprap.org/wiki/MaKr3d_MaKrPanel //#define MAKRPANEL @@ -636,6 +640,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define ENCODER_STEPS_PER_MENU_ITEM 1 #endif +#if defined (PANEL_ONE) + #define SDSUPPORT + #define ULTIMAKERCONTROLLER +#endif #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define DOGLCD From c6d2ebe452d6dd53a0ec03bc88a4f16eda8037c0 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Tue, 24 Feb 2015 11:02:16 +0100 Subject: [PATCH 4/4] Extend the idea of dummy temperature sensors. Added a second sensor and made them configurable. --- Marlin/Configuration.h | 5 ++++- Marlin/thermistortables.h | 21 +++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index afcd9134cb..f5e0f15fa7 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -118,7 +118,10 @@ Here are some standard links for getting your machine calibrated: // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup // 110 is Pt100 with 1k pullup (non standard) -// 999 is a Dummy Table. It will ALWAYS read 25C.. Use it for Testing or Development purposes. NEVER for production machine. +// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. +// Use it for Testing or Development purposes. NEVER for production machine. +// #define DUMMY_THERMISTOR_998_VALUE 25 +// #define DUMMY_THERMISTOR_999_VALUE 100 #define TEMP_SENSOR_0 -1 #define TEMP_SENSOR_1 -1 diff --git a/Marlin/thermistortables.h b/Marlin/thermistortables.h index aa1019b0ab..61092f005e 100644 --- a/Marlin/thermistortables.h +++ b/Marlin/thermistortables.h @@ -1096,13 +1096,26 @@ const short temptable_1047[][2] PROGMEM = { #endif #if (THERMISTORHEATER_0 == 999) || (THERMISTORHEATER_1 == 999) || (THERMISTORHEATER_2 == 999) || (THERMISTORHEATER_3 == 999) || (THERMISTORBED == 999) //User defined table -// Dummy Thermistor table.. It will ALWAYS read 25C. -const short temptable_999[][2] PROGMEM = { - {1*OVERSAMPLENR, 25}, - {1023*OVERSAMPLENR, 25} + // Dummy Thermistor table.. It will ALWAYS read a fixed value. + #ifndef DUMMY_THERMISTOR_999_VALUE + #define DUMMY_THERMISTOR_999_VALUE 25 + #endif + const short temptable_999[][2] PROGMEM = { + {1*OVERSAMPLENR, DUMMY_THERMISTOR_999_VALUE}, + {1023*OVERSAMPLENR, DUMMY_THERMISTOR_999_VALUE} }; #endif +#if (THERMISTORHEATER_0 == 998) || (THERMISTORHEATER_1 == 998) || (THERMISTORHEATER_2 == 998) || (THERMISTORHEATER_3 == 998) || (THERMISTORBED == 998) //User defined table + // Dummy Thermistor table.. It will ALWAYS read a fixed value. + #ifndef DUMMY_THERMISTOR_998_VALUE + #define DUMMY_THERMISTOR_998_VALUE 25 + #endif + const short temptable_998[][2] PROGMEM = { + {1*OVERSAMPLENR, DUMMY_THERMISTOR_998_VALUE}, + {1023*OVERSAMPLENR, DUMMY_THERMISTOR_998_VALUE} +}; +#endif #define _TT_NAME(_N) temptable_ ## _N