diff --git a/Firmware/Configuration_prusa.h b/Firmware/Configuration_prusa.h index e2c70b8a..2827a944 100644 --- a/Firmware/Configuration_prusa.h +++ b/Firmware/Configuration_prusa.h @@ -225,7 +225,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #endif // Extrude mintemp -#define EXTRUDE_MINTEMP 130 +#define EXTRUDE_MINTEMP 190 // Extruder cooling fans #define EXTRUDER_0_AUTO_FAN_PIN 8 diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 124a910b..d72cb905 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -5599,15 +5599,21 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp //load_filament_time = millis(); KEEPALIVE_STATE(PAUSED_FOR_USER); #ifdef PAT9125 - if (filament_autoload_enabled && fsensor_M600) fsensor_autoload_check_start(); + if (filament_autoload_enabled && (old_fsensor_enabled || fsensor_M600)) fsensor_autoload_check_start(); #endif //PAT9125 +// printf_P(PSTR("M600 PAT9125 filament_autoload_enabled=%d, old_fsensor_enabled=%d, fsensor_M600=%d"), filament_autoload_enabled, old_fsensor_enabled, fsensor_M600); while(!lcd_clicked()) { manage_heater(); manage_inactivity(true); #ifdef PAT9125 - if (filament_autoload_enabled && fsensor_M600 && fsensor_check_autoload()) + if (filament_autoload_enabled && (old_fsensor_enabled || fsensor_M600) && fsensor_check_autoload()) + { + tone(BEEPER, 1000); + delay_keep_alive(50); + noTone(BEEPER); break; + } #endif //PAT9125 /*#ifdef SNMM target[E_AXIS] += 0.002; @@ -5617,7 +5623,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp } #ifdef PAT9125 - if (filament_autoload_enabled && fsensor_M600) fsensor_autoload_check_stop(); + if (filament_autoload_enabled && (old_fsensor_enabled || fsensor_M600)) fsensor_autoload_check_stop(); #endif //PAT9125 //WRITE(BEEPER, LOW); KEEPALIVE_STATE(IN_HANDLER); @@ -6400,6 +6406,9 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s if (fsensor_check_autoload()) { fsensor_autoload_check_stop(); + tone(BEEPER, 1000); + delay_keep_alive(50); + noTone(BEEPER); enquecommand_front_P((PSTR("M701"))); } } diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index d35a71bb..2a199e19 100644 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -46,6 +46,7 @@ bool fsensor_autoload_enabled = false; uint16_t fsensor_autoload_y = 0; uint8_t fsensor_autoload_c = 0; uint32_t fsensor_autoload_last_millis = 0; +uint8_t fsensor_autoload_sum = 0; void fsensor_block() { @@ -108,6 +109,7 @@ void fsensor_autoload_check_start(void) pat9125_update_y(); //update sensor fsensor_autoload_y = pat9125_y; //save current y value fsensor_autoload_c = 0; //reset number of changes counter + fsensor_autoload_sum = 0; fsensor_autoload_last_millis = millis(); fsensor_autoload_enabled = true; fsensor_err_cnt = 0; @@ -116,36 +118,36 @@ void fsensor_autoload_check_start(void) void fsensor_autoload_check_stop(void) { puts_P(PSTR("fsensor_autoload_check_stop\n")); + fsensor_autoload_sum = 0; fsensor_autoload_enabled = false; fsensor_err_cnt = 0; } bool fsensor_check_autoload(void) { - if ((millis() - fsensor_autoload_last_millis) < 50) return false; + uint8_t fsensor_autoload_c_old = fsensor_autoload_c; + if ((millis() - fsensor_autoload_last_millis) < 25) return false; fsensor_autoload_last_millis = millis(); pat9125_update_y(); //update sensor - uint16_t dy = fsensor_autoload_y - pat9125_y; + int16_t dy = fsensor_autoload_y - pat9125_y; if (dy) //? y value is different { - if (dy > 0) //? delta-y value is positive (inserting) + if (dy < 0) //? delta-y value is positive (inserting) { - fsensor_autoload_c+=3; //increment change counter -// printf_P(PSTR("fsensor_check_autoload dy=%d c=%d\n"), dy, fsensor_autoload_c); - } - else if (fsensor_autoload_c > 0) - { - fsensor_autoload_c--; -// printf_P(PSTR("fsensor_check_autoload dy=%d c=%d\n"), dy, fsensor_autoload_c); + fsensor_autoload_sum -= dy; + fsensor_autoload_c += 3; //increment change counter by 3 } + else if (fsensor_autoload_c > 1) + fsensor_autoload_c -= 2; //decrement change counter by 2 fsensor_autoload_y = pat9125_y; //save current value - if (fsensor_autoload_c > 10) return true; //number of positive changes > 10, start loading } else if (fsensor_autoload_c > 0) - { fsensor_autoload_c--; -// printf_P(PSTR("fsensor_check_autoload dy=%d c=%d\n"), dy, fsensor_autoload_c); - } + if (fsensor_autoload_c == 0) fsensor_autoload_sum = 0; +// if (fsensor_autoload_c != fsensor_autoload_c_old) +// printf_P(PSTR("fsensor_check_autoload dy=%d c=%d sum=%d\n"), dy, fsensor_autoload_c, fsensor_autoload_sum); + if ((fsensor_autoload_c >= 15) && (fsensor_autoload_sum > 30)) + return true; return false; } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index bf864e3b..3dfeafc7 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5027,8 +5027,8 @@ static void lcd_main_menu() if (!filament_autoload_enabled) { MENU_ITEM(function, MSG_LOAD_FILAMENT, lcd_LoadFilament); - MENU_ITEM(function, MSG_UNLOAD_FILAMENT, lcd_unLoadFilament); } + MENU_ITEM(function, MSG_UNLOAD_FILAMENT, lcd_unLoadFilament); #endif #ifdef SNMM MENU_ITEM(submenu, MSG_LOAD_FILAMENT, fil_load_menu); @@ -5043,12 +5043,13 @@ static void lcd_main_menu() { MENU_ITEM(submenu, MSG_STATISTICS, lcd_menu_statistics); } - MENU_ITEM(submenu, MSG_SUPPORT, lcd_support_menu); MENU_ITEM(submenu, PSTR("Fail stats"), lcd_menu_fails_stats); MENU_ITEM(submenu, PSTR("Debug"), lcd_menu_debug); + MENU_ITEM(submenu, MSG_SUPPORT, lcd_support_menu); + END_MENU(); }