duplicit T-codes execution improved, E-stepper movements when waiting for ok from mmu, continue loading function improved, eeprom: fail stats for mmu
This commit is contained in:
parent
c256af0a1c
commit
29ecd4ec7a
6 changed files with 118 additions and 19 deletions
|
@ -6875,13 +6875,13 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|||
if (mmu_enabled)
|
||||
{
|
||||
tmp_extruder = choose_menu_P(_T(MSG_CHOOSE_FILAMENT), _T(MSG_FILAMENT));
|
||||
if (tmp_extruder == mmu_extruder) {
|
||||
if ((tmp_extruder == mmu_extruder) && mmu_fil_loaded) {
|
||||
printf_P(PSTR("Duplicit T-code ignored.\n"));
|
||||
return; //dont execute the same T-code twice in a row
|
||||
}
|
||||
st_synchronize();
|
||||
mmu_command(MMU_CMD_T0 + tmp_extruder);
|
||||
manage_response(true, true);
|
||||
manage_response(true, true, MMU_TCODE_MOVE);
|
||||
}
|
||||
}
|
||||
else if (*(strchr_pointer + index) == 'c') { //load to from bondtech gears to nozzle (nozzle should be preheated)
|
||||
|
@ -6913,13 +6913,13 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|||
|
||||
if (mmu_enabled)
|
||||
{
|
||||
if (tmp_extruder == mmu_extruder) {
|
||||
if ((tmp_extruder == mmu_extruder) && mmu_fil_loaded) {
|
||||
printf_P(PSTR("Duplicit T-code ignored.\n"));
|
||||
return; //dont execute the same T-code twice in a row
|
||||
}
|
||||
mmu_command(MMU_CMD_T0 + tmp_extruder);
|
||||
|
||||
manage_response(true, true);
|
||||
manage_response(true, true, MMU_TCODE_MOVE);
|
||||
mmu_continue_loading();
|
||||
mmu_extruder = tmp_extruder; //filament change is finished
|
||||
|
||||
|
|
|
@ -148,6 +148,12 @@
|
|||
|
||||
#define EEPROM_FSENS_OQ_MEASS_ENABLED (EEPROM_AUTO_DEPLETE - 1) //bool
|
||||
|
||||
#define EEPROM_MMU_FAIL_TOT (EEPROM_FSENS_OQ_MEASS_ENABLED - 2) //uint16_t
|
||||
#define EEPROM_MMU_FAIL (EEPROM_MMU_FAIL_TOT - 1) //uint8_t
|
||||
|
||||
#define EEPROM_MMU_LOAD_FAIL_TOT (EEPROM_MMU_FAIL - 2) //uint16_t
|
||||
#define EEPROM_MMU_LOAD_FAIL (EEPROM_MMU_LOAD_FAIL_TOT - 1) //uint8_t
|
||||
|
||||
// !!!!!
|
||||
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
|
||||
// !!!!!
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
#endif //MMU_HWRESET
|
||||
|
||||
bool mmu_enabled = false;
|
||||
|
||||
bool mmu_ready = false;
|
||||
bool mmu_fil_loaded = false; //if true: blocks execution of duplicit T-codes
|
||||
|
||||
static int8_t mmu_state = 0;
|
||||
|
||||
|
@ -217,6 +217,7 @@ void mmu_loop(void)
|
|||
#endif //MMU_DEBUG
|
||||
mmu_printf_P(PSTR("T%d\n"), filament);
|
||||
mmu_state = 3; // wait for response
|
||||
mmu_fil_loaded = true;
|
||||
#ifdef MMU_IDLER_SENSOR_PIN
|
||||
mmu_idl_sens = 1; //enable idler sensor
|
||||
#endif //MMU_IDLER_SENSOR_PIN
|
||||
|
@ -247,6 +248,7 @@ void mmu_loop(void)
|
|||
printf_P(PSTR("MMU <= 'U0'\n"));
|
||||
#endif //MMU_DEBUG
|
||||
mmu_puts_P(PSTR("U0\n")); //send 'unload current filament'
|
||||
mmu_fil_loaded = false;
|
||||
mmu_state = 3;
|
||||
}
|
||||
else if ((mmu_cmd >= MMU_CMD_E0) && (mmu_cmd <= MMU_CMD_E4))
|
||||
|
@ -256,6 +258,7 @@ void mmu_loop(void)
|
|||
printf_P(PSTR("MMU <= 'E%d'\n"), filament);
|
||||
#endif //MMU_DEBUG
|
||||
mmu_printf_P(PSTR("E%d\n"), filament); //send eject filament
|
||||
mmu_fil_loaded = false;
|
||||
mmu_state = 3; // wait for response
|
||||
}
|
||||
else if (mmu_cmd == MMU_CMD_R0)
|
||||
|
@ -369,21 +372,52 @@ void mmu_command(uint8_t cmd)
|
|||
mmu_ready = false;
|
||||
}
|
||||
|
||||
bool mmu_get_response(void)
|
||||
void mmu_load_step() {
|
||||
current_position[E_AXIS] = current_position[E_AXIS] + MMU_LOAD_FEEDRATE * 0.1;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder);
|
||||
st_synchronize();
|
||||
}
|
||||
|
||||
void mmu_unload_step() {
|
||||
current_position[E_AXIS] = current_position[E_AXIS] - MMU_LOAD_FEEDRATE * 0.1;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder);
|
||||
st_synchronize();
|
||||
}
|
||||
|
||||
bool mmu_get_response(uint8_t move)
|
||||
{
|
||||
// printf_P(PSTR("mmu_get_response - begin\n"));
|
||||
printf_P(PSTR("mmu_get_response - begin move:%d\n"), move);
|
||||
KEEPALIVE_STATE(IN_PROCESS);
|
||||
while (mmu_cmd != 0)
|
||||
{
|
||||
// mmu_loop();
|
||||
delay_keep_alive(100);
|
||||
}
|
||||
|
||||
while (!mmu_ready)
|
||||
{
|
||||
// mmu_loop();
|
||||
|
||||
if (mmu_state != 3)
|
||||
break;
|
||||
delay_keep_alive(100);
|
||||
|
||||
switch (move) {
|
||||
case MMU_LOAD_MOVE:
|
||||
mmu_load_step();
|
||||
break;
|
||||
case MMU_UNLOAD_MOVE:
|
||||
mmu_unload_step();
|
||||
break;
|
||||
case MMU_TCODE_MOVE: //first do unload and then continue with infinite loading
|
||||
current_position[E_AXIS] = current_position[E_AXIS] - MMU_LOAD_FEEDRATE * MMU_LOAD_TIME;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], MMU_LOAD_FEEDRATE, active_extruder);
|
||||
st_synchronize();
|
||||
move = MMU_LOAD_MOVE;
|
||||
break;
|
||||
default:
|
||||
delay_keep_alive(100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool ret = mmu_ready;
|
||||
mmu_ready = false;
|
||||
|
@ -411,7 +445,7 @@ bool mmu_get_response(void)
|
|||
}
|
||||
|
||||
|
||||
void manage_response(bool move_axes, bool turn_off_nozzle)
|
||||
void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move)
|
||||
{
|
||||
bool response = false;
|
||||
mmu_print_saved = false;
|
||||
|
@ -423,7 +457,7 @@ void manage_response(bool move_axes, bool turn_off_nozzle)
|
|||
uint8_t screen = 0; //used for showing multiscreen messages
|
||||
while(!response)
|
||||
{
|
||||
response = mmu_get_response(); //wait for "ok" from mmu
|
||||
response = mmu_get_response(move); //wait for "ok" from mmu
|
||||
if (!response) { //no "ok" was received in reserved time frame, user will fix the issue on mmu unit
|
||||
if (!mmu_print_saved) { //first occurence, we are saving current position, park print head in certain position and disable nozzle heater
|
||||
if (lcd_update_enabled) {
|
||||
|
@ -618,9 +652,10 @@ void mmu_M600_load_filament(bool automatic)
|
|||
// mmu_printf_P(PSTR("T%d\n"), tmp_extruder);
|
||||
mmu_command(MMU_CMD_T0 + tmp_extruder);
|
||||
|
||||
manage_response(false, true);
|
||||
manage_response(false, true, MMU_LOAD_MOVE);
|
||||
mmu_continue_loading();
|
||||
mmu_extruder = tmp_extruder; //filament change is finished
|
||||
|
||||
mmu_load_to_nozzle();
|
||||
load_filament_final_feed();
|
||||
st_synchronize();
|
||||
|
@ -829,7 +864,7 @@ void extr_unload()
|
|||
|
||||
mmu_command(MMU_CMD_U0);
|
||||
// get response
|
||||
manage_response(false, true);
|
||||
manage_response(false, true, MMU_UNLOAD_MOVE);
|
||||
|
||||
lcd_update_enable(true);
|
||||
#else //SNMM
|
||||
|
@ -1125,7 +1160,7 @@ void lcd_mmu_load_to_nozzle(uint8_t filament_nr)
|
|||
lcd_print(" ");
|
||||
lcd_print(tmp_extruder + 1);
|
||||
mmu_command(MMU_CMD_T0 + tmp_extruder);
|
||||
manage_response(true, true);
|
||||
manage_response(true, true, MMU_TCODE_MOVE);
|
||||
mmu_continue_loading();
|
||||
mmu_extruder = tmp_extruder; //filament change is finished
|
||||
mmu_load_to_nozzle();
|
||||
|
@ -1162,7 +1197,7 @@ void mmu_eject_filament(uint8_t filament, bool recover)
|
|||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 2500 / 60, active_extruder);
|
||||
st_synchronize();
|
||||
mmu_command(MMU_CMD_E0 + filament);
|
||||
manage_response(false, false);
|
||||
manage_response(false, false, MMU_UNLOAD_MOVE);
|
||||
if (recover)
|
||||
{
|
||||
lcd_show_fullscreen_message_and_wait_P(_i("Please remove filament and then press the knob."));
|
||||
|
@ -1187,12 +1222,25 @@ void mmu_continue_loading()
|
|||
{
|
||||
#ifdef MMU_IDLER_SENSOR_PIN
|
||||
for (uint8_t i = 0; i < MMU_IDLER_SENSOR_ATTEMPTS_NR; i++) {
|
||||
|
||||
if (PIN_GET(MMU_IDLER_SENSOR_PIN) == 0) return;
|
||||
#ifdef MMU_DEBUG
|
||||
printf_P(PSTR("Additional load attempt nr. %d\n"), i);
|
||||
#endif // MMU_DEBUG
|
||||
if (PIN_GET(MMU_IDLER_SENSOR_PIN) == 0) break;
|
||||
mmu_command(MMU_CMD_C0);
|
||||
manage_response(true, true);
|
||||
manage_response(true, true, MMU_LOAD_MOVE);
|
||||
}
|
||||
if (PIN_GET(MMU_IDLER_SENSOR_PIN) != 0) {
|
||||
//pause print, show error message and then repeat last T-code
|
||||
if (card.sdprinting) {
|
||||
lcd_pause_print();
|
||||
}
|
||||
else
|
||||
{
|
||||
setTargetHotend0(0);
|
||||
SERIAL_ECHOLNPGM("// action:pause"); //for octoprint
|
||||
}
|
||||
LCD_ALERTMESSAGEPGM("MMU Load Error");
|
||||
}
|
||||
#else
|
||||
mmu_command(MMU_CMD_C0);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
|
||||
extern bool mmu_enabled;
|
||||
extern bool mmu_fil_loaded;
|
||||
|
||||
extern uint8_t mmu_extruder;
|
||||
|
||||
|
@ -16,6 +17,13 @@ extern int16_t mmu_buildnr;
|
|||
|
||||
#define MMU_FILAMENT_UNKNOWN 255
|
||||
|
||||
#define MMU_UNLOAD_MOVE 1
|
||||
#define MMU_LOAD_MOVE 2
|
||||
#define MMU_TCODE_MOVE 3
|
||||
|
||||
#define MMU_LOAD_FEEDRATE 19.02f //mm/s
|
||||
#define MMU_LOAD_TIME 1 //1000ms is load time for shortest allowed PTFE tubing and maximum loading speed
|
||||
|
||||
#define MMU_CMD_NONE 0
|
||||
#define MMU_CMD_T0 0x10
|
||||
#define MMU_CMD_T1 0x11
|
||||
|
@ -55,9 +63,9 @@ extern int8_t mmu_set_filament_type(uint8_t extruder, uint8_t filament);
|
|||
|
||||
extern void mmu_command(uint8_t cmd);
|
||||
|
||||
extern bool mmu_get_response(void);
|
||||
extern bool mmu_get_response(uint8_t move = 0);
|
||||
|
||||
extern void manage_response(bool move_axes, bool turn_off_nozzle);
|
||||
extern void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move = 0);
|
||||
|
||||
extern void mmu_load_to_nozzle();
|
||||
|
||||
|
|
|
@ -1955,6 +1955,43 @@ static void lcd_menu_fails_stats_print()
|
|||
lcd_printf_P(PSTR(ESC_H(0,0) "%S" ESC_H(1,1) "%S %-3d" ESC_H(1,2) "%S %-3d" ESC_H(1,3) "%S X %-3d Y %-3d"), _i("Last print failures"), _i("Power failures"), power, _i("Filam. runouts"), filam, _i("Crash"), crashX, crashY);
|
||||
menu_back_if_clicked_fb();
|
||||
}
|
||||
/*
|
||||
static void lcd_menu_fails_stats_mmu_print()
|
||||
{
|
||||
//01234567890123456789
|
||||
//Last print failures
|
||||
// Power failures 000
|
||||
// Filam. runouts 000
|
||||
// Crash X 000 Y 000
|
||||
//////////////////////
|
||||
lcd_timeoutToStatus.stop(); //infinite timeout
|
||||
uint8_t power = eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT);
|
||||
uint8_t filam = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT);
|
||||
uint8_t crashX = eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_X);
|
||||
uint8_t crashY = eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_Y);
|
||||
// lcd_printf_P(PSTR(ESC_H(0,0) "Last print failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY);
|
||||
lcd_printf_P(PSTR(ESC_H(0,0) "%S" ESC_H(1,1) "%S %-3d" ESC_H(1,2) "%S %-3d" ESC_H(1,3) "%S X %-3d Y %-3d"), _i("Last print failures"), _i("Power failures"), power, _i("Filam. runouts"), filam, _i("Crash"), crashX, crashY);
|
||||
menu_back_if_clicked_fb();
|
||||
}
|
||||
|
||||
static void lcd_menu_fails_stats_mmu_total()
|
||||
{
|
||||
//01234567890123456789
|
||||
//Total failures
|
||||
// Power failures 000
|
||||
// Filam. runouts 000
|
||||
// Crash X 000 Y 000
|
||||
//////////////////////
|
||||
lcd_timeoutToStatus.stop(); //infinite timeout
|
||||
uint16_t power = eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT);
|
||||
uint16_t filam = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT);
|
||||
uint16_t crashX = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT);
|
||||
uint16_t crashY = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT);
|
||||
// lcd_printf_P(PSTR(ESC_H(0,0) "Total failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY);
|
||||
lcd_printf_P(PSTR(ESC_H(0,0) "%S" ESC_H(1,1) "%S %-3d" ESC_H(1,2) "%S %-3d" ESC_H(1,3) "%S X %-3d Y %-3d"), _i("Total failures"), _i("Power failures"), power, _i("Filam. runouts"), filam, _i("Crash"), crashX, crashY);
|
||||
menu_back_if_clicked_fb();
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* @brief Open fail statistics menu
|
||||
*
|
||||
|
|
|
@ -615,6 +615,6 @@
|
|||
#define MMU_HWRESET
|
||||
//#define MMU_DEBUG //print communication between MMU2 and printer on serial
|
||||
#define MMU_IDLER_SENSOR_PIN 62 //idler sensor @PK0 (digital pin 62/A8)
|
||||
#define MMU_IDLER_SENSOR_ATTEMPTS_NR 4 //max. number of attempts to load filament if first load failed
|
||||
#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning
|
||||
|
||||
#endif //__CONFIGURATION_PRUSA_H
|
||||
|
|
Loading…
Reference in a new issue