From 30bbf59cb08e4446b53bd9f1f7b0f23c24b513ab Mon Sep 17 00:00:00 2001 From: David Ramiro Date: Fri, 22 Feb 2019 22:26:58 +0100 Subject: [PATCH 1/4] Increase filament rounout trigger delay In some cases, the filament runout was triggered erratically, we are now waiting for the trigger to last a few moments until we start the routine. --- Marlin/AnycubicTFT.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/AnycubicTFT.cpp b/Marlin/AnycubicTFT.cpp index 0c298be..6327510 100644 --- a/Marlin/AnycubicTFT.cpp +++ b/Marlin/AnycubicTFT.cpp @@ -606,7 +606,7 @@ void AnycubicTFTClass::FilamentRunout() if(FilamentTestStatus>FilamentTestLastStatus) { FilamentRunoutCounter++; - if(FilamentRunoutCounter>=15800) + if(FilamentRunoutCounter>=31600) { FilamentRunoutCounter=0; #ifdef SDSUPPORT From 8448c678469b1c285caaec29c7ee65eb1f699450 Mon Sep 17 00:00:00 2001 From: David Ramiro Date: Sat, 23 Feb 2019 00:31:25 +0100 Subject: [PATCH 2/4] Streamline build identification --- Marlin/Configuration.h | 6 +++--- Marlin/Marlin_main.cpp | 4 ++++ Marlin/Version.h | 12 +++++++++--- Marlin/language.h | 3 ++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 27fd0d8..995eeb8 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -81,10 +81,10 @@ // User-specified version info of this build to display in [Pronterface, etc] terminal window during // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. -#define STRING_CONFIG_H_AUTHOR "davidramiro - v1.4.0" // Who made the changes. +#define STRING_CONFIG_H_AUTHOR "(davidramiro)" // Who made the changes. #define SHOW_BOOTSCREEN -#define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1 -#define STRING_SPLASH_LINE2 WEBSITE_URL // will be shown during bootup in line 2 +#define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1 +#define STRING_SPLASH_LINE2 CUSTOM_BUILD_VERSION // will be shown during bootup in line 2 /** * *** VENDORS PLEASE READ *** diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 3db125f..00e7a58 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -15132,6 +15132,10 @@ void setup() { SERIAL_ECHOPGM(MSG_MARLIN); SERIAL_CHAR(' '); SERIAL_ECHOLNPGM(SHORT_BUILD_VERSION); + SERIAL_CHAR(' '); + SERIAL_ECHOPGM(MSG_MARLIN_AI3M); + SERIAL_CHAR(' '); + SERIAL_ECHOLNPGM(CUSTOM_BUILD_VERSION); SERIAL_EOL(); #if defined(STRING_DISTRIBUTION_DATE) && defined(STRING_CONFIG_H_AUTHOR) diff --git a/Marlin/Version.h b/Marlin/Version.h index 29669ef..2a79e7e 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -37,18 +37,24 @@ */ #define SHORT_BUILD_VERSION "1.1.9" + /** + * Defines the version of the Marlin-AI3M build. Not to be confused with + * Marlin's own build number, e.g. 1.1.9. + */ + #define CUSTOM_BUILD_VERSION "v1.4.0" + /** * Verbose version identifier which should contain a reference to the location * from where the binary was downloaded or the source code was compiled. */ - #define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " (Github, davidramiro)" + #define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION "(Github, davidramiro)" /** * The STRING_DISTRIBUTION_DATE represents when the binary file was built, * here we define this default string as the date where the latest release * version was tagged. */ - #define STRING_DISTRIBUTION_DATE "2019-02-18" + #define STRING_DISTRIBUTION_DATE "2019-02-23" /** * Required minimum Configuration.h and Configuration_adv.h file versions. @@ -78,7 +84,7 @@ * has a distinct Github fork— the Source Code URL should just be the main * Marlin repository. */ - #define SOURCE_CODE_URL "https://github.com/MarlinFirmware/Marlin" + #define SOURCE_CODE_URL "https://github.com/davidramiro/Marlin-AI3M" /** * Default generic printer UUID. diff --git a/Marlin/language.h b/Marlin/language.h index d0eea74..8530ee9 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -137,7 +137,8 @@ #define MSG_INVALID_EXTRUDER "Invalid extruder" #define MSG_INVALID_SOLENOID "Invalid solenoid" #define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature" -#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID +#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID " MARLIN-AI3M_VERSION:" CUSTOM_BUILD_VERSION +#define MSG_MARLIN_AI3M "Marlin-AI3M" #define MSG_COUNT_X " Count X:" #define MSG_COUNT_A " Count A:" #define MSG_ERR_KILLED "Printer halted. kill() called!" From 8fc01144f18727888a33fc37a91b23b80f32e967 Mon Sep 17 00:00:00 2001 From: David Ramiro Date: Sat, 23 Feb 2019 11:16:29 +0100 Subject: [PATCH 3/4] Set SDPAUSE state on M600 regardless of prior TFTstate Move the routine to a better position and set the state regardless of SDPRINT status. This ensures that M600 makes the display show a continue button every time. Before, it was only behaving correctly for the first instance of M600. --- Marlin/Marlin_main.cpp | 19 +++++++++++++------ Marlin/Version.h | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 00e7a58..82519fd 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -10992,12 +10992,6 @@ inline void gcode_M502() { * Default values are used for omitted arguments. */ inline void gcode_M600() { - #ifdef SDSUPPORT - if ((AnycubicTFT.TFTstate==ANYCUBIC_TFT_STATE_SDPRINT)){ - AnycubicTFT.TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; - AnycubicTFT.PausedByFilamentChange=true; - } - #endif point_t park_point = NOZZLE_PARK_POINT; if (get_target_extruder_from_command(600)) return; @@ -11060,6 +11054,19 @@ inline void gcode_M502() { const bool job_running = print_job_timer.isRunning(); if (pause_print(retract, park_point, unload_length, true)) { + #ifdef SDSUPPORT + #ifdef ANYCUBIC_TFT_DEBUG + SERIAL_ECHOLNPGM("DEBUG: Enter TFTstate routine"); + #endif + AnycubicTFT.TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; // enter correct display state to show resume button + #ifdef ANYCUBIC_TFT_DEBUG + SERIAL_ECHOLNPGM("DEBUG: Set TFTState to SDPAUSE_REQ"); + #endif + AnycubicTFT.PausedByFilamentChange=true; // set flag to ensure correct resume routine gets executed + #ifdef ANYCUBIC_TFT_DEBUG + SERIAL_ECHOLNPGM("DEBUG: Set filament change flag"); + #endif + #endif wait_for_filament_reload(beep_count); resume_print(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH, beep_count); } diff --git a/Marlin/Version.h b/Marlin/Version.h index 2a79e7e..cfa63ed 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * Defines the version of the Marlin-AI3M build. Not to be confused with * Marlin's own build number, e.g. 1.1.9. */ - #define CUSTOM_BUILD_VERSION "v1.4.0" + #define CUSTOM_BUILD_VERSION "v1.4.1" /** * Verbose version identifier which should contain a reference to the location From 2c53c33d524fd4f1d9a85e5c57db92d963a318ff Mon Sep 17 00:00:00 2001 From: David Ramiro Date: Sun, 24 Feb 2019 15:48:03 +0100 Subject: [PATCH 4/4] Tweak M600 display resume - Add startFileprint(); call to M108 display routine to fix progress and ensure "printing done" gets shown - Add SD printing check in marlin_main.cpp M600 routine to skip TFTstate if not necessary (e.g. USB printing) - Move routine to the top again to ensure immediate execution --- Marlin/AnycubicTFT.cpp | 4 +-- Marlin/Marlin_main.cpp | 59 ++++++++++++++++++++++-------------------- Marlin/Version.h | 4 +-- 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/Marlin/AnycubicTFT.cpp b/Marlin/AnycubicTFT.cpp index 6327510..61dab2d 100644 --- a/Marlin/AnycubicTFT.cpp +++ b/Marlin/AnycubicTFT.cpp @@ -264,13 +264,14 @@ void AnycubicTFTClass::FilamentChangeResume(){ HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e); // resume heating if timed out wait_for_heatup = false; wait_for_user = false; // remove waiting flags - // TFTstate=ANYCUBIC_TFT_STATE_SDPRINT; + card.startFileprint(); // resume with proper progress state #ifdef ANYCUBIC_TFT_DEBUG SERIAL_ECHOLNPGM("DEBUG: M108 Resume called"); #endif } void AnycubicTFTClass::FilamentChangePause(){ + PausedByFilamentChange=true; enqueue_and_echo_commands_P(PSTR("M600")); TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; // set TFT state to paused #ifdef ANYCUBIC_TFT_DEBUG @@ -329,7 +330,6 @@ void AnycubicTFTClass::HandleSpecialMenu() enqueue_and_echo_commands_P(PSTR("G91\nG1 Z-0.1\nG90")); } else if (strcmp(SelectedDirectory, "")==0) { SERIAL_PROTOCOLLNPGM("Special Menu: FilamentChange Pause"); - PausedByFilamentChange=true; FilamentChangePause(); } else if (strcmp(SelectedDirectory, "")==0) { SERIAL_PROTOCOLLNPGM("Special Menu: FilamentChange Resume"); diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 82519fd..4ea80df 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -8508,7 +8508,7 @@ inline void gcode_M109() { #ifdef ANYCUBIC_TFT_MODEL AnycubicTFT.CommandScan(); #endif - + #if TEMP_RESIDENCY_TIME > 0 const float temp_diff = ABS(target_temp - temp); @@ -8547,11 +8547,11 @@ inline void gcode_M109() { #ifdef ANYCUBIC_TFT_MODEL AnycubicTFT.HeatingDone(); #endif - + #if DISABLED(BUSY_WHILE_HEATING) KEEPALIVE_STATE(IN_HANDLER); #endif - + // flush the serial buffer after heating to prevent lockup by m105 SERIAL_FLUSH(); @@ -8665,11 +8665,11 @@ inline void gcode_M109() { } } #endif - + #ifdef ANYCUBIC_TFT_MODEL AnycubicTFT.CommandScan(); #endif - + #if TEMP_BED_RESIDENCY_TIME > 0 const float temp_diff = ABS(target_temp - temp); @@ -8697,16 +8697,16 @@ inline void gcode_M109() { } } while (wait_for_heatup && TEMP_BED_CONDITIONS); - + #ifdef ANYCUBIC_TFT_MODEL AnycubicTFT.BedHeatingDone(); #endif - + if (wait_for_heatup) lcd_reset_status(); #if DISABLED(BUSY_WHILE_HEATING) KEEPALIVE_STATE(IN_HANDLER); #endif - + // flush the serial buffer after heating to prevent lockup by m105 SERIAL_FLUSH(); } @@ -8904,7 +8904,7 @@ inline void gcode_M111() { #if ENABLED(ULTIPANEL) lcd_reset_status(); #endif - + #ifdef ANYCUBIC_TFT_MODEL AnycubicTFT.CommandScan(); #endif @@ -8940,7 +8940,7 @@ inline void gcode_M81() { #if ENABLED(ULTIPANEL) LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF "."); #endif - + #ifdef ANYCUBIC_TFT_MODEL AnycubicTFT.CommandScan(); #endif @@ -10992,6 +10992,23 @@ inline void gcode_M502() { * Default values are used for omitted arguments. */ inline void gcode_M600() { + + #ifdef SDSUPPORT + if (card.sdprinting) { // are we printing from sd? + #ifdef ANYCUBIC_TFT_DEBUG + SERIAL_ECHOLNPGM("DEBUG: Enter M600 TFTstate routine"); + #endif + AnycubicTFT.TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; // enter correct display state to show resume button + #ifdef ANYCUBIC_TFT_DEBUG + SERIAL_ECHOLNPGM("DEBUG: Set TFTstate to SDPAUSE_REQ"); + #endif + AnycubicTFT.PausedByFilamentChange=true; // set flag to ensure correct resume routine gets executed + #ifdef ANYCUBIC_TFT_DEBUG + SERIAL_ECHOLNPGM("DEBUG: Set filament change flag"); + #endif + } + #endif + point_t park_point = NOZZLE_PARK_POINT; if (get_target_extruder_from_command(600)) return; @@ -11054,19 +11071,6 @@ inline void gcode_M502() { const bool job_running = print_job_timer.isRunning(); if (pause_print(retract, park_point, unload_length, true)) { - #ifdef SDSUPPORT - #ifdef ANYCUBIC_TFT_DEBUG - SERIAL_ECHOLNPGM("DEBUG: Enter TFTstate routine"); - #endif - AnycubicTFT.TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; // enter correct display state to show resume button - #ifdef ANYCUBIC_TFT_DEBUG - SERIAL_ECHOLNPGM("DEBUG: Set TFTState to SDPAUSE_REQ"); - #endif - AnycubicTFT.PausedByFilamentChange=true; // set flag to ensure correct resume routine gets executed - #ifdef ANYCUBIC_TFT_DEBUG - SERIAL_ECHOLNPGM("DEBUG: Set filament change flag"); - #endif - #endif wait_for_filament_reload(beep_count); resume_print(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH, beep_count); } @@ -14753,7 +14757,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { #if ENABLED(FILAMENT_RUNOUT_SENSOR) runout.run(); #endif - + #if ENABLED(ANYCUBIC_TFT_MODEL) && ENABLED(ANYCUBIC_FILAMENT_RUNOUT_SENSOR) AnycubicTFT.FilamentRunout(); #endif @@ -14961,7 +14965,7 @@ void idle( #ifdef ANYCUBIC_TFT_MODEL AnycubicTFT.CommandScan(); #endif - + lcd_update(); host_keepalive(); @@ -15018,7 +15022,7 @@ void kill(const char* lcd_msg) { #else UNUSED(lcd_msg); #endif - + #ifdef ANYCUBIC_TFT_MODEL // Kill AnycubicTFT AnycubicTFT.KillTFT(); @@ -15113,7 +15117,7 @@ void setup() { MYSERIAL0.begin(BAUDRATE); SERIAL_PROTOCOLLNPGM("start"); SERIAL_ECHO_START(); - + #ifdef ANYCUBIC_TFT_MODEL // Setup AnycubicTFT AnycubicTFT.Setup(); @@ -15139,7 +15143,6 @@ void setup() { SERIAL_ECHOPGM(MSG_MARLIN); SERIAL_CHAR(' '); SERIAL_ECHOLNPGM(SHORT_BUILD_VERSION); - SERIAL_CHAR(' '); SERIAL_ECHOPGM(MSG_MARLIN_AI3M); SERIAL_CHAR(' '); SERIAL_ECHOLNPGM(CUSTOM_BUILD_VERSION); diff --git a/Marlin/Version.h b/Marlin/Version.h index cfa63ed..514be4d 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * Defines the version of the Marlin-AI3M build. Not to be confused with * Marlin's own build number, e.g. 1.1.9. */ - #define CUSTOM_BUILD_VERSION "v1.4.1" + #define CUSTOM_BUILD_VERSION "v1.4.2" /** * Verbose version identifier which should contain a reference to the location @@ -54,7 +54,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ - #define STRING_DISTRIBUTION_DATE "2019-02-23" + #define STRING_DISTRIBUTION_DATE "2019-02-24" /** * Required minimum Configuration.h and Configuration_adv.h file versions.