From d658bf56cf795c4b16b9bbae89135b37cc7069a4 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 11 Jul 2018 18:52:58 +0200 Subject: [PATCH 01/10] ShippingPrep Reset statistics reset by shipping preparation & filament sensor force --- Firmware/Marlin_main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 225883bf..d0375db2 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -848,6 +848,15 @@ void factory_reset(char level, bool quiet) farm_mode = false; eeprom_update_byte((uint8_t*)EEPROM_FARM_MODE, farm_mode); EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no); + + eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, 0); + eeprom_update_dword((uint32_t *)EEPROM_FILAMENTUSED, 0); + eeprom_update_word((uint16_t *)EEPROM_CRASH_COUNT_X_TOT, 0); + eeprom_update_word((uint16_t *)EEPROM_CRASH_COUNT_Y_TOT, 0); + eeprom_update_word((uint16_t *)EEPROM_FERROR_COUNT_TOT, 0); + eeprom_update_word((uint16_t *)EEPROM_POWER_COUNT_TOT, 0); + + fsensor_enable(); WRITE(BEEPER, HIGH); _delay_ms(100); From 1357e27b55cc1068651a4bfbd92522916ecc6d51 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 11 Jul 2018 20:45:56 +0200 Subject: [PATCH 02/10] FilamentAutoload setting by shipping preparation --- Firmware/Marlin_main.cpp | 1 + Firmware/fsensor.cpp | 6 ++++++ Firmware/fsensor.h | 3 +++ Firmware/ultralcd.cpp | 4 ++-- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d0375db2..d45c8e5a 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -857,6 +857,7 @@ void factory_reset(char level, bool quiet) eeprom_update_word((uint16_t *)EEPROM_POWER_COUNT_TOT, 0); fsensor_enable(); + fautoload_set(true); WRITE(BEEPER, HIGH); _delay_ms(100); diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index bebcf810..1e4f17d3 100644 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -86,6 +86,12 @@ void fsensor_disable() FSensorStateMenu = 0; } +void fautoload_set(bool State) +{ + filament_autoload_enabled = State; + eeprom_update_byte((unsigned char *)EEPROM_FSENS_AUTOLOAD_ENABLED, filament_autoload_enabled); +} + void pciSetup(byte pin) { *digitalPinToPCMSK(pin) |= bit (digitalPinToPCMSKbit(pin)); // enable pin diff --git a/Firmware/fsensor.h b/Firmware/fsensor.h index 0c5543bc..486331a0 100644 --- a/Firmware/fsensor.h +++ b/Firmware/fsensor.h @@ -15,6 +15,9 @@ extern void fsensor_unblock(); extern bool fsensor_enable(); extern void fsensor_disable(); +extern bool filament_autoload_enabled; +extern void fautoload_set(bool State); + //update (perform M600 on filament runout) extern void fsensor_update(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0d3801d8..30335261 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1,5 +1,6 @@ #include "temperature.h" #include "ultralcd.h" +#include "fsensor.h" #ifdef ULTRA_LCD #include "MenuStack.h" #include "Marlin.h" @@ -1845,8 +1846,7 @@ void lcd_set_fan_check() { } void lcd_set_filament_autoload() { - filament_autoload_enabled = !filament_autoload_enabled; - eeprom_update_byte((unsigned char *)EEPROM_FSENS_AUTOLOAD_ENABLED, filament_autoload_enabled); + fautoload_set(!filament_autoload_enabled); } void lcd_unLoadFilament() From d18160cab5783b86882593d6a6eacd34d5a968f5 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 11 Jul 2018 21:58:06 +0200 Subject: [PATCH 03/10] splash screen --- Firmware/Marlin_main.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d45c8e5a..3bcc8256 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1152,10 +1152,6 @@ void list_sec_lang_from_external_flash() // are initialized by the main() routine provided by the Arduino framework. void setup() { -#ifdef W25X20CL - // Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory. - optiboot_w25x20cl_enter(); -#endif lcd_init(); fdev_setup_stream(lcdout, lcd_putchar, NULL, _FDEV_SETUP_WRITE); //setup lcdout stream @@ -1163,6 +1159,11 @@ void setup() lcd_splash(); + #ifdef W25X20CL + // Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory. + optiboot_w25x20cl_enter(); + #endif + #if (LANG_MODE != 0) //secondary language support #ifdef W25X20CL if (w25x20cl_init()) From 11aa775322758c63b92710bdd5324ada2ded7f67 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 11 Jul 2018 18:21:05 +0200 Subject: [PATCH 04/10] move in Z before filament loading: intial version --- Firmware/Marlin_main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3bcc8256..e0d9b4fb 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3114,6 +3114,14 @@ void gcode_M701() custom_message = true; custom_message_type = 2; + if (current_position[Z_AXIS] < 20) { + lcd_setstatuspgm(_T(MSG_PLEASE_WAIT)); + current_position[Z_AXIS] += 30; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence + st_synchronize(); + lcd_show_fullscreen_message_and_wait_P(_i("Please insert filament and press the knob.")); + } + lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); current_position[E_AXIS] += 70; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence From 9b7cc60b4204837bad258f8c28a229c48a089754 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 11 Jul 2018 19:35:22 +0200 Subject: [PATCH 05/10] filament statistics hotfix, load filament move Z simplified --- Firmware/Marlin_main.cpp | 8 +------- Firmware/ultralcd.cpp | 6 +++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index e0d9b4fb..99526477 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3114,13 +3114,7 @@ void gcode_M701() custom_message = true; custom_message_type = 2; - if (current_position[Z_AXIS] < 20) { - lcd_setstatuspgm(_T(MSG_PLEASE_WAIT)); - current_position[Z_AXIS] += 30; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence - st_synchronize(); - lcd_show_fullscreen_message_and_wait_P(_i("Please insert filament and press the knob.")); - } + if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30; lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); current_position[E_AXIS] += 70; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 30335261..64412bc9 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2110,7 +2110,7 @@ void lcd_menu_statistics() { if (IS_SD_PRINTING) { - int _met = total_filament_used / 100000; + float _met = ((float)total_filament_used) / (100000.f); int _cm = (total_filament_used - (_met * 100000)) / 10; int _t = (millis() - starttime) / 1000; int _h = _t / 3600; @@ -2125,12 +2125,12 @@ void lcd_menu_statistics() lcd_printf_P(_N( ESC_2J "%S:" - ESC_H(6,1) "%8.2f m\n" + ESC_H(6,1) "%8.2fm \n" "%S :" ESC_H(8,3) "%2dh %02dm %02d" ), _i("Filament used"), - _met, _cm, + _met, _i("Print time"), _h, _m, _s ); From 07f6ddfb698c56da094fd4a538ab9a566a9b9ea5 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 11 Jul 2018 22:34:32 +0200 Subject: [PATCH 06/10] filament loading corrected --- Firmware/Marlin_main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 99526477..97fa26f3 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3114,12 +3114,17 @@ void gcode_M701() custom_message = true; custom_message_type = 2; - if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30; + lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); - current_position[E_AXIS] += 70; + current_position[E_AXIS] += 40; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence + st_synchronize(); + if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30; + current_position[E_AXIS] += 30; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence + st_synchronize(); current_position[E_AXIS] += 25; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence st_synchronize(); From 6824ab65dd41f974edeae3a7bd2f626d2c730862 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Sun, 15 Jul 2018 20:00:29 +0200 Subject: [PATCH 07/10] G28 fix --- Firmware/Marlin.h | 4 +++- Firmware/Marlin_main.cpp | 52 ++++++++++++++++++++++++++-------------- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index a839ef9a..4b14d251 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -451,7 +451,9 @@ void force_high_power_mode(bool start_high_power_section); #endif //TMC2130 // G-codes -void gcode_G28(bool home_x, bool home_y, bool home_z, bool calib); +void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool calib, bool without_mbl); +void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis); + bool gcode_M45(bool onlyZ, int8_t verbosity_level); void gcode_M114(); void gcode_M701(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 97fa26f3..de269fcb 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -734,7 +734,7 @@ void crashdet_detected(uint8_t mask) lcd_update_enable(true); lcd_update(2); lcd_setstatuspgm(_T(MSG_CRASH_DETECTED)); - gcode_G28(true, true, false, false); //home X and Y + gcode_G28(true, true, false); //home X and Y st_synchronize(); if (automatic_recovery_after_crash) { @@ -2614,7 +2614,11 @@ void force_high_power_mode(bool start_high_power_section) { } #endif //TMC2130 -void gcode_G28(bool home_x, bool home_y, bool home_z, bool calib) { +void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis) { + gcode_G28(home_x_axis, 0, home_y_axis, 0, home_z_axis, 0, false, true); +} + +void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_y_value, bool home_z_axis, long home_z_value, bool calib, bool without_mbl) { st_synchronize(); #if 0 @@ -2625,6 +2629,11 @@ void gcode_G28(bool home_x, bool home_y, bool home_z, bool calib) { // Flag for the display update routine and to disable the print cancelation during homing. homing_flag = true; + // Which axes should be homed? + bool home_x = home_x_axis; + bool home_y = home_y_axis; + bool home_z = home_z_axis; + // Either all X,Y,Z codes are present, or none of them. bool home_all_axes = home_x == home_y && home_x == home_z; if (home_all_axes) @@ -2733,11 +2742,11 @@ void gcode_G28(bool home_x, bool home_y, bool home_z, bool calib) { #endif //TMC2130 - if(code_seen(axis_codes[X_AXIS]) && code_value_long() != 0) - current_position[X_AXIS]=code_value()+add_homing[X_AXIS]; + if(home_x_axis && home_x_value != 0) + current_position[X_AXIS]=home_x_value+add_homing[X_AXIS]; - if(code_seen(axis_codes[Y_AXIS]) && code_value_long() != 0) - current_position[Y_AXIS]=code_value()+add_homing[Y_AXIS]; + if(home_y_axis && home_y_value != 0) + current_position[Y_AXIS]=home_y_value+add_homing[Y_AXIS]; #if Z_HOME_DIR < 0 // If homing towards BED do Z last #ifndef Z_SAFE_HOMING @@ -2832,8 +2841,8 @@ void gcode_G28(bool home_x, bool home_y, bool home_z, bool calib) { #endif // Z_SAFE_HOMING #endif // Z_HOME_DIR < 0 - if(code_seen(axis_codes[Z_AXIS]) && code_value_long() != 0) - current_position[Z_AXIS]=code_value()+add_homing[Z_AXIS]; + if(home_z_axis && home_z_value != 0) + current_position[Z_AXIS]=home_z_value+add_homing[Z_AXIS]; #ifdef ENABLE_AUTO_BED_LEVELING if(home_z) current_position[Z_AXIS] += zprobe_zoffset; //Add Z_Probe offset (the distance is negative) @@ -2865,7 +2874,7 @@ void gcode_G28(bool home_x, bool home_y, bool home_z, bool calib) { world2machine_update_current(); #if (defined(MESH_BED_LEVELING) && !defined(MK1BP)) - if (code_seen(axis_codes[X_AXIS]) || code_seen(axis_codes[Y_AXIS]) || code_seen('W') || code_seen(axis_codes[Z_AXIS])) + if (home_x_axis || home_y_axis || without_mbl || home_z_axis) { if (! home_z && mbl_was_active) { // Re-enable the mesh bed leveling if only the X and Y axes were re-homed. @@ -2878,10 +2887,6 @@ void gcode_G28(bool home_x, bool home_y, bool home_z, bool calib) { { st_synchronize(); homing_flag = false; - // Push the commands to the front of the message queue in the reverse order! - // There shall be always enough space reserved for these commands. - enquecommand_front_P((PSTR("G80"))); - //goto case_G80; } #endif @@ -3613,15 +3618,26 @@ void process_commands() #endif //FWRETRACT case 28: //G28 Home all Axis one at a time { - // Which axes should be homed? + long home_x_value = 0; + long home_y_value = 0; + long home_z_value = 0; + // Which axes should be homed? bool home_x = code_seen(axis_codes[X_AXIS]); + home_x_value = code_value_long(); bool home_y = code_seen(axis_codes[Y_AXIS]); - bool home_z = code_seen(axis_codes[Z_AXIS]); + home_y_value = code_value_long(); + bool home_z = code_seen(axis_codes[Z_AXIS]); + home_z_value = code_value_long(); + bool without_mbl = code_seen('W'); // calibrate? bool calib = code_seen('C'); - gcode_G28(home_x, home_y, home_z, calib); - + gcode_G28(home_x, home_x_value, home_y, home_y_value, home_z, home_z_value, calib, without_mbl); + if ((home_x || home_y || without_mbl || home_z) == false) { + // Push the commands to the front of the message queue in the reverse order! + // There shall be always enough space reserved for these commands. + goto case_G80; + } break; } #ifdef ENABLE_AUTO_BED_LEVELING @@ -3862,7 +3878,7 @@ void process_commands() current_position[X_AXIS] = pgm_read_float(bed_ref_points_4); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); st_synchronize(); - gcode_G28(false, false, true, false); + gcode_G28(false, false, true); } if ((current_temperature_pinda > 35) && (farm_mode == false)) { From 0e15a4025b6281a8d15ae3f91684c85162df79b9 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Sun, 15 Jul 2018 20:24:24 +0200 Subject: [PATCH 08/10] whitespace --- Firmware/Marlin_main.cpp | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index de269fcb..e78c8241 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2630,9 +2630,9 @@ void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_ homing_flag = true; // Which axes should be homed? - bool home_x = home_x_axis; - bool home_y = home_y_axis; - bool home_z = home_z_axis; + bool home_x = home_x_axis; + bool home_y = home_y_axis; + bool home_z = home_z_axis; // Either all X,Y,Z codes are present, or none of them. bool home_all_axes = home_x == home_y && home_x == home_z; @@ -2746,7 +2746,7 @@ void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_ current_position[X_AXIS]=home_x_value+add_homing[X_AXIS]; if(home_y_axis && home_y_value != 0) - current_position[Y_AXIS]=home_y_value+add_homing[Y_AXIS]; + current_position[Y_AXIS]=home_y_value+add_homing[Y_AXIS]; #if Z_HOME_DIR < 0 // If homing towards BED do Z last #ifndef Z_SAFE_HOMING @@ -3618,27 +3618,26 @@ void process_commands() #endif //FWRETRACT case 28: //G28 Home all Axis one at a time { - long home_x_value = 0; + long home_x_value = 0; long home_y_value = 0; - long home_z_value = 0; - // Which axes should be homed? + long home_z_value = 0; + // Which axes should be homed? bool home_x = code_seen(axis_codes[X_AXIS]); - home_x_value = code_value_long(); + home_x_value = code_value_long(); bool home_y = code_seen(axis_codes[Y_AXIS]); home_y_value = code_value_long(); - bool home_z = code_seen(axis_codes[Z_AXIS]); - home_z_value = code_value_long(); - bool without_mbl = code_seen('W'); + bool home_z = code_seen(axis_codes[Z_AXIS]); + home_z_value = code_value_long(); + bool without_mbl = code_seen('W'); // calibrate? bool calib = code_seen('C'); - - gcode_G28(home_x, home_x_value, home_y, home_y_value, home_z, home_z_value, calib, without_mbl); - if ((home_x || home_y || without_mbl || home_z) == false) { - // Push the commands to the front of the message queue in the reverse order! - // There shall be always enough space reserved for these commands. - goto case_G80; - } - break; + gcode_G28(home_x, home_x_value, home_y, home_y_value, home_z, home_z_value, calib, without_mbl); + if ((home_x || home_y || without_mbl || home_z) == false) { + // Push the commands to the front of the message queue in the reverse order! + // There shall be always enough space reserved for these commands. + goto case_G80; + } + break; } #ifdef ENABLE_AUTO_BED_LEVELING case 29: // G29 Detailed Z-Probe, probes the bed at 3 or more points. From a575c028bf0fcd37c23b982b18690b13bf0e23a5 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 16 Jul 2018 19:20:39 +0200 Subject: [PATCH 09/10] resend request sends OK --- Firmware/cmdqueue.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Firmware/cmdqueue.cpp b/Firmware/cmdqueue.cpp index 9ad24333..1b18acfe 100644 --- a/Firmware/cmdqueue.cpp +++ b/Firmware/cmdqueue.cpp @@ -476,6 +476,7 @@ void get_command() SERIAL_ERROR_START; SERIAL_ERRORRPGM(_n("No Line Number with checksum, Last Line: "));////MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM c=0 r=0 SERIAL_ERRORLN(gcode_LastN); + FlushSerialRequestResend(); serial_count = 0; return; } From fddc02adfae6aec37da317331f9cca10a587b66a Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 16 Jul 2018 21:01:40 +0200 Subject: [PATCH 10/10] version changed --- Firmware/Configuration.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 9a9304a2..d95a4e0d 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.3.0" -#define FW_COMMIT_NR 830 +#define FW_VERSION "3.3.1" +#define FW_COMMIT_NR 845 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN