From 5aa80e6c0521156cdbb6f765ba0ca47e8cb7dfe1 Mon Sep 17 00:00:00 2001 From: Erik de Bruijn Date: Tue, 8 May 2012 17:32:50 +0200 Subject: [PATCH 01/11] Made language.h more flexible. Automatically do the right defines based on MOTHERBOARD == 7 ? "Ultimaker" : "Mendel" --- Marlin/language.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Marlin/language.h b/Marlin/language.h index 4747ce626e..f6180bc408 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -10,11 +10,20 @@ #define LANGUAGE_CHOICE 1 // Pick your language from the list above +#define PROTOCOL_VERSION "1.0" + +#ifdef MOTHERBOARD == 7 + #define MACHINE_NAME "Ultimaker" + #define FIRMWARE_URL "http://firmware.ultimaker.com" +#else + #define MACHINE_NAME "Mendel" + #define FIRMWARE_URL "http://www.mendel-parts.com" +#endif + #if LANGUAGE_CHOICE == 1 // LCD Menu Messages - - #define WELCOME_MSG "Printer Ready." + #define WELCOME_MSG MACHINE_NAME " Ready." #define MSG_SD_INSERTED "Card inserted" #define MSG_SD_REMOVED "Card removed" #define MSG_MAIN " Main \003" @@ -63,8 +72,8 @@ #define MSG_MAIN_WIDE " Main \003" #define MSG_TEMPERATURE_WIDE " Temperature \x7E" #define MSG_MOTION_WIDE " Motion \x7E" - #define MSG_STORE_EPROM " Store EPROM" - #define MSG_LOAD_EPROM " Load EPROM" + #define MSG_STORE_EPROM " Store memory" + #define MSG_LOAD_EPROM " Load memory" #define MSG_RESTORE_FAILSAFE " Restore Failsafe" #define MSG_REFRESH "\004Refresh" #define MSG_WATCH " Watch \003" @@ -76,7 +85,7 @@ #define MSG_CARD_MENU " Card Menu \x7E" #define MSG_NO_CARD " No Card" #define MSG_SERIAL_ERROR_MENU_STRUCTURE "Something is wrong in the MenuStructure." - #define MSG_DWELL "DWELL..." + #define MSG_DWELL "Sleep..." #define MSG_NO_MOVE "No move." #define MSG_PART_RELEASE "Partial Release" #define MSG_KILLED "KILLED. " @@ -94,7 +103,7 @@ #define MSG_BROWNOUT_RESET " Brown out Reset" #define MSG_WATCHDOG_RESET " Watchdog Reset" #define MSG_SOFTWARE_RESET " Software Reset" - #define MSG_MARLIN "Marlin: " + #define MSG_MARLIN "Marlin " #define MSG_AUTHOR " | Author: " #define MSG_CONFIGURATION_VER " Last Updated: " #define MSG_FREE_MEMORY " Free Memory: " @@ -116,7 +125,7 @@ #define MSG_HEATING_COMPLETE "Heating done." #define MSG_BED_HEATING "Bed Heating." #define MSG_BED_DONE "Bed done." - #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:http://www.mendel-parts.com PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1\n" + #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:1\n" #define MSG_COUNT_X " Count X:" #define MSG_ERR_KILLED "Printer halted. kill() called !!" #define MSG_ERR_STOPPED "Printer stopped deu to errors. Fix the error and use M999 to restart!. (Temperature is reset. Set it before restarting)" @@ -157,7 +166,7 @@ // LCD Menu Messages - #define WELCOME_MSG "UltiMARLIN Ready." + #define WELCOME_MSG MACHINE_NAME " Ready." #define MSG_SD_INSERTED "Card inserted" #define MSG_SD_REMOVED "Card removed" @@ -263,7 +272,7 @@ #define MSG_HEATING_COMPLETE "Heating done." #define MSG_BED_HEATING "Bed Heating." #define MSG_BED_DONE "Bed done." - #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:http://www.mendel-parts.com PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1\n" + #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:\n" #define MSG_COUNT_X " Count X:" #define MSG_ERR_KILLED "Printer halted. kill() called !!" #define MSG_ERR_STOPPED "Printer stopped due to errors. Fix the error and use M999 to restart!" From d88205d89da20ea8b84a3f57d461be08510948a7 Mon Sep 17 00:00:00 2001 From: Erik de Bruijn Date: Tue, 8 May 2012 17:18:31 +0200 Subject: [PATCH 02/11] Suggestion to improve (TODO), no actual code changed --- Marlin/ultralcd.pde | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Marlin/ultralcd.pde b/Marlin/ultralcd.pde index c6cd15bb04..f9eb19b19d 100644 --- a/Marlin/ultralcd.pde +++ b/Marlin/ultralcd.pde @@ -1,3 +1,5 @@ +#include "language.h" +#include "temperature.h" #include "ultralcd.h" #ifdef ULTRA_LCD #include "Marlin.h" @@ -708,6 +710,7 @@ void MainMenu::showAxisMove() } break; case ItemAM_E: + // ErikDB: TODO: this length should be changed for volumetric. MENUITEM( lcdprintPGM(MSG_EXTRUDE) , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E5");beepshort(); ) ; break; default: From e3fe1f0d007e7306ac3b20bd99b3a7debbf91fcd Mon Sep 17 00:00:00 2001 From: Erik de Bruijn Date: Tue, 8 May 2012 17:27:45 +0200 Subject: [PATCH 03/11] =?UTF-8?q?Made=20a=20more=20granular=20configuratio?= =?UTF-8?q?n=20possible=20PREVENT=5FLENGTHY=5FEXTRUDE=EF=9C=88.=20You=20ca?= =?UTF-8?q?n=20now=20decide=20to=20allow/disallow=20large=20length=20of=20?= =?UTF-8?q?extrusions=20to=20be=20executed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Turning off the protection might be beneficial to those who want to do fast and long reversals. --- Marlin/Configuration.h | 3 +++ Marlin/planner.cpp | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index f15876770e..880d48a7d2 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -108,6 +108,9 @@ //this prevents dangerous Extruder moves, i.e. if the temperature is under the limit //can be software-disabled for whatever purposes by #define PREVENT_DANGEROUS_EXTRUDE +//if PREVENT_DANGEROUS_EXTRUDE is on, you can still disable (uncomment) very long bits of extrusion separately. +#define PREVENT_LENGTHY_EXTRUDE + #define EXTRUDE_MINTEMP 170 #define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances. diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index cfb503deb8..b620589533 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -495,12 +495,14 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa SERIAL_ECHO_START; SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); } + #ifdef PREVENT_LENGTHY_EXTRUDE if(labs(target[E_AXIS]-position[E_AXIS])>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 SERIAL_ECHO_START; SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); } + #endif #endif // Prepare to set up new block From 279d00da9f363c3868609e89f1eee4d592732355 Mon Sep 17 00:00:00 2001 From: Daid Date: Wed, 9 May 2012 10:50:44 +0200 Subject: [PATCH 04/11] Fixed #if for Ultimaker. --- Marlin/language.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/language.h b/Marlin/language.h index f6180bc408..6fdf14995c 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -12,7 +12,7 @@ #define PROTOCOL_VERSION "1.0" -#ifdef MOTHERBOARD == 7 +#if MOTHERBOARD == 7 || MOTHERBOARD == 71 #define MACHINE_NAME "Ultimaker" #define FIRMWARE_URL "http://firmware.ultimaker.com" #else @@ -89,7 +89,7 @@ #define MSG_NO_MOVE "No move." #define MSG_PART_RELEASE "Partial Release" #define MSG_KILLED "KILLED. " - #define MSG_STOPPED "STOPPED. " + #define MSG_STOPPED "STOPPED. " #define MSG_PREHEAT_PLA " Preheat PLA" #define MSG_PREHEAT_ABS " Preheat ABS" #define MSG_STEPPER_RELEASED "Released." @@ -182,7 +182,7 @@ #define MSG_PREHEAT_PLA " Preheat PLA" #define MSG_PREHEAT_ABS " Preheat ABS" #define MSG_MOVE_AXIS " Move Axis \x7E" - #define MSG_MOVE_AXIS " Achsen verfahren \x7E" + #define MSG_MOVE_AXIS " Achsen verfahren \x7E" #define MSG_SPEED " Geschw:" #define MSG_NOZZLE " \002Duese:" #define MSG_NOZZLE1 " \002Duese2:" From 516ec90242c935110bcf00e8d285302ebe86cd31 Mon Sep 17 00:00:00 2001 From: Daid Date: Sat, 19 May 2012 17:54:07 +0200 Subject: [PATCH 05/11] Add M401 - Wait for user on LCD button press --- Marlin/Marlin.pde | 30 +++++++++++++++++++++++++++++- Marlin/language.h | 1 + Marlin/ultralcd.h | 1 + 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index c9cff67de0..6d8a7b4dc8 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -107,6 +107,7 @@ // M302 - Allow cold extrudes // M303 - PID relay autotune S sets the target temperature. (default target temperature = 150C) // M400 - Finish all moves +// M401 - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled) // M500 - stores paramters in EEPROM // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily). // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. @@ -596,6 +597,7 @@ void process_commands() while(millis() < codenum ){ manage_heater(); manage_inactivity(1); + LCD_STATUS; } break; case 28: //G28 Home all Axis one at a time @@ -1259,11 +1261,37 @@ void process_commands() PID_autotune(temp); } break; - case 400: // finish all moves + case 400: // M400 finish all moves { st_synchronize(); } break; +#ifdef ULTRA_LCD + case 401: // M401 - Wait for user button press on LCD + { + LCD_MESSAGEPGM(MSG_USERWAIT); + codenum = 0; + if(code_seen('P')) codenum = code_value(); // milliseconds to wait + if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait + + st_synchronize(); + previous_millis_cmd = millis(); + if (codenum > 0) + { + codenum += millis(); // keep track of when we started waiting + while(millis() < codenum && buttons == 0){ + manage_heater(); + manage_inactivity(1); + } + }else{ + while(buttons == 0) { + manage_heater(); + manage_inactivity(1); + } + } + } + break; +#endif case 500: // Store settings in EEPROM { EEPROM_StoreSettings(); diff --git a/Marlin/language.h b/Marlin/language.h index 6fdf14995c..5dfb06c2e3 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -86,6 +86,7 @@ #define MSG_NO_CARD " No Card" #define MSG_SERIAL_ERROR_MENU_STRUCTURE "Something is wrong in the MenuStructure." #define MSG_DWELL "Sleep..." + #define MSG_USERWAIT "Wait for user..." #define MSG_NO_MOVE "No move." #define MSG_PART_RELEASE "Partial Release" #define MSG_KILLED "KILLED. " diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index b01368bc14..c3bc94b730 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -13,6 +13,7 @@ #define LCD_UPDATE_INTERVAL 100 #define STATUSTIMEOUT 15000 extern LiquidCrystal lcd; + extern volatile char buttons=0; //the last checked buttons in a bit array. #ifdef NEWPANEL #define EN_C (1< Date: Sat, 19 May 2012 17:57:52 +0200 Subject: [PATCH 06/11] Do not initialize in the header file. --- Marlin/ultralcd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index c3bc94b730..72df26d1e0 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -13,7 +13,7 @@ #define LCD_UPDATE_INTERVAL 100 #define STATUSTIMEOUT 15000 extern LiquidCrystal lcd; - extern volatile char buttons=0; //the last checked buttons in a bit array. + extern volatile char buttons; //the last checked buttons in a bit array. #ifdef NEWPANEL #define EN_C (1< Date: Sat, 19 May 2012 18:48:43 +0200 Subject: [PATCH 07/11] Update after testing --- Marlin/Marlin.pde | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index 6d8a7b4dc8..a1843a0ad3 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -1279,12 +1279,12 @@ void process_commands() if (codenum > 0) { codenum += millis(); // keep track of when we started waiting - while(millis() < codenum && buttons == 0){ + while(millis() < codenum && !CLICKED){ manage_heater(); manage_inactivity(1); } }else{ - while(buttons == 0) { + while(!CLICKED) { manage_heater(); manage_inactivity(1); } From 16413bb8f2f3b55ea24e8f8ff7f3a7c5576fb6a2 Mon Sep 17 00:00:00 2001 From: Daid Date: Sat, 19 May 2012 18:53:56 +0200 Subject: [PATCH 08/11] Last M401 update, refresh the LCD during an M401 wait. --- Marlin/Marlin.pde | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index a1843a0ad3..185c9f7817 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -1282,11 +1282,13 @@ void process_commands() while(millis() < codenum && !CLICKED){ manage_heater(); manage_inactivity(1); + LCD_STATUS; } }else{ while(!CLICKED) { manage_heater(); manage_inactivity(1); + LCD_STATUS; } } } From b59724e42bc97d75aeea9eefe2f0141003fb3842 Mon Sep 17 00:00:00 2001 From: Daid Date: Sat, 19 May 2012 19:01:14 +0200 Subject: [PATCH 09/11] Add strigification for extruder amount in M115 report. --- Marlin/language.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Marlin/language.h b/Marlin/language.h index 5dfb06c2e3..aae99f7095 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -20,6 +20,9 @@ #define FIRMWARE_URL "http://www.mendel-parts.com" #endif +#define STRINGIFY_(n) #n +#define STRINGIFY(n) STRINGIFY_(n) + #if LANGUAGE_CHOICE == 1 // LCD Menu Messages @@ -126,7 +129,7 @@ #define MSG_HEATING_COMPLETE "Heating done." #define MSG_BED_HEATING "Bed Heating." #define MSG_BED_DONE "Bed done." - #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:1\n" + #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) "\n" #define MSG_COUNT_X " Count X:" #define MSG_ERR_KILLED "Printer halted. kill() called !!" #define MSG_ERR_STOPPED "Printer stopped deu to errors. Fix the error and use M999 to restart!. (Temperature is reset. Set it before restarting)" @@ -273,7 +276,7 @@ #define MSG_HEATING_COMPLETE "Heating done." #define MSG_BED_HEATING "Bed Heating." #define MSG_BED_DONE "Bed done." - #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:\n" + #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) "\n" #define MSG_COUNT_X " Count X:" #define MSG_ERR_KILLED "Printer halted. kill() called !!" #define MSG_ERR_STOPPED "Printer stopped due to errors. Fix the error and use M999 to restart!" From 4d7fe7115fa24eac63175330d8b992690bde1bbd Mon Sep 17 00:00:00 2001 From: Daid Date: Sun, 20 May 2012 14:37:30 +0200 Subject: [PATCH 10/11] Changed M401 to M0/M1 as suggested, so they match normal CNC stop commands. --- Marlin/Marlin.pde | 60 ++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index 185c9f7817..e450f74183 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -56,6 +56,8 @@ // G92 - Set current position to cordinates given //RepRap M Codes +// M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled) +// M1 - Same as M0 // M104 - Set extruder target temp // M105 - Read current temp // M106 - Fan on @@ -107,7 +109,6 @@ // M302 - Allow cold extrudes // M303 - PID relay autotune S sets the target temperature. (default target temperature = 150C) // M400 - Finish all moves -// M401 - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled) // M500 - stores paramters in EEPROM // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily). // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. @@ -709,6 +710,35 @@ void process_commands() { switch( (int)code_value() ) { +#ifdef ULTRA_LCD + case 0: // M0 - Unconditional stop - Wait for user button press on LCD + case 1: // M1 - Conditional stop - Wait for user button press on LCD + { + LCD_MESSAGEPGM(MSG_USERWAIT); + codenum = 0; + if(code_seen('P')) codenum = code_value(); // milliseconds to wait + if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait + + st_synchronize(); + previous_millis_cmd = millis(); + if (codenum > 0) + { + codenum += millis(); // keep track of when we started waiting + while(millis() < codenum && !CLICKED){ + manage_heater(); + manage_inactivity(1); + LCD_STATUS; + } + }else{ + while(!CLICKED) { + manage_heater(); + manage_inactivity(1); + LCD_STATUS; + } + } + } + break; +#endif case 17: LCD_MESSAGEPGM(MSG_NO_MOVE); enable_x(); @@ -1266,34 +1296,6 @@ void process_commands() st_synchronize(); } break; -#ifdef ULTRA_LCD - case 401: // M401 - Wait for user button press on LCD - { - LCD_MESSAGEPGM(MSG_USERWAIT); - codenum = 0; - if(code_seen('P')) codenum = code_value(); // milliseconds to wait - if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait - - st_synchronize(); - previous_millis_cmd = millis(); - if (codenum > 0) - { - codenum += millis(); // keep track of when we started waiting - while(millis() < codenum && !CLICKED){ - manage_heater(); - manage_inactivity(1); - LCD_STATUS; - } - }else{ - while(!CLICKED) { - manage_heater(); - manage_inactivity(1); - LCD_STATUS; - } - } - } - break; -#endif case 500: // Store settings in EEPROM { EEPROM_StoreSettings(); From e9bec9b6fef576762cef4f4001417ae5cb7bdff7 Mon Sep 17 00:00:00 2001 From: Daid Date: Thu, 24 May 2012 18:36:55 +0200 Subject: [PATCH 11/11] Fixed E1_ENABLE pin for Ultimaker. This was wrong for the 1.5.4 and 1.5.3 PCB (I cannot check the 1.5.6) --- Marlin/pins.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/pins.h b/Marlin/pins.h index 95a0369686..c4d56590f7 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -684,7 +684,7 @@ #define E1_STEP_PIN 49 #define E1_DIR_PIN 47 -#define E1_ENABLE_PIN 51 +#define E1_ENABLE_PIN 48 #define SDPOWER -1 #define SDSS 53