finda filament runout: initial version

This commit is contained in:
PavelSindler 2018-08-27 04:21:43 +02:00
parent 85358342bc
commit ceb49d1262
5 changed files with 34 additions and 3 deletions

View File

@ -359,6 +359,9 @@ extern uint8_t print_percent_done_normal;
extern uint32_t print_time_remaining_normal; extern uint32_t print_time_remaining_normal;
extern uint8_t print_percent_done_silent; extern uint8_t print_percent_done_silent;
extern uint32_t print_time_remaining_silent; extern uint32_t print_time_remaining_silent;
extern uint16_t mcode_in_progress;
extern uint16_t gcode_in_progress;
#define PRINT_TIME_REMAINING_INIT 0xffffffff #define PRINT_TIME_REMAINING_INIT 0xffffffff
#define PRINT_PERCENT_DONE_INIT 0xff #define PRINT_PERCENT_DONE_INIT 0xff
#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CUSTOM_MSG_TYPE_TEMCAL) || saved_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL) || card.paused || mmu_print_saved) #define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CUSTOM_MSG_TYPE_TEMCAL) || saved_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL) || card.paused || mmu_print_saved)

View File

@ -3408,7 +3408,9 @@ void process_commands()
} }
#endif //BACKLASH_Y #endif //BACKLASH_Y
#endif //TMC2130 #endif //TMC2130
else if (code_seen("FSENSOR_RECOVER")) {
fsensor_restore_print_and_continue();
}
else if(code_seen("PRUSA")){ else if(code_seen("PRUSA")){
if (code_seen("Ping")) { //PRUSA Ping if (code_seen("Ping")) { //PRUSA Ping
if (farm_mode) { if (farm_mode) {

View File

@ -7,6 +7,8 @@
#include "uart2.h" #include "uart2.h"
#include "temperature.h" #include "temperature.h"
#include "Configuration_prusa.h" #include "Configuration_prusa.h"
#include "fsensor.h"
#include "cardreader.h"
extern const char* lcd_display_message_fullscreen_P(const char *msg); extern const char* lcd_display_message_fullscreen_P(const char *msg);
@ -16,6 +18,7 @@ extern void lcd_return_to_status();
extern void lcd_wait_for_heater(); extern void lcd_wait_for_heater();
extern char choose_extruder_menu(); extern char choose_extruder_menu();
#define CHECK_FINDA ((IS_SD_PRINTING || is_usb_printing) && (mcode_in_progress != 600) && !saved_printing && e_active())
#define MMU_TODELAY 100 #define MMU_TODELAY 100
#define MMU_TIMEOUT 10 #define MMU_TIMEOUT 10
@ -182,7 +185,7 @@ void mmu_loop(void)
} }
mmu_cmd = 0; mmu_cmd = 0;
} }
else if ((mmu_last_response + 1000) < millis()) //request every 1s else if ((mmu_last_response + 800) < millis()) //request every 800ms
{ {
puts_P(PSTR("MMU <= 'P0'")); puts_P(PSTR("MMU <= 'P0'"));
mmu_puts_P(PSTR("P0\n")); //send 'read finda' request mmu_puts_P(PSTR("P0\n")); //send 'read finda' request
@ -194,6 +197,12 @@ void mmu_loop(void)
{ {
fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer
printf_P(PSTR("MMU => '%dok'\n"), mmu_finda); printf_P(PSTR("MMU => '%dok'\n"), mmu_finda);
//printf_P(PSTR("Eact: %d\n"), int(e_active()));
if (!mmu_finda && CHECK_FINDA) {
fsensor_stop_and_save_print();
enquecommand_front_P(PSTR("FSENSOR_RECOVER")); //then recover
enquecommand_front_P(PSTR("M600")); //save print and run M600 command
}
mmu_state = 1; mmu_state = 1;
if (mmu_cmd == 0) if (mmu_cmd == 0)
mmu_ready = true; mmu_ready = true;

View File

@ -494,6 +494,23 @@ void getHighESpeed()
} }
#endif #endif
bool e_active()
{
unsigned char e_active = 0;
block_t *block;
if(block_buffer_tail != block_buffer_head)
{
uint8_t block_index = block_buffer_tail;
while(block_index != block_buffer_head)
{
block = &block_buffer[block_index];
if(block->steps_e.wide != 0) e_active++;
block_index = (block_index+1) & (BLOCK_BUFFER_SIZE - 1);
}
}
return (e_active > 0) ? true : false ;
}
void check_axes_activity() void check_axes_activity()
{ {
unsigned char x_active = 0; unsigned char x_active = 0;

View File

@ -154,7 +154,7 @@ void plan_set_position(float x, float y, float z, const float &e);
void plan_set_z_position(const float &z); void plan_set_z_position(const float &z);
void plan_set_e_position(const float &e); void plan_set_e_position(const float &e);
extern bool e_active();
void check_axes_activity(); void check_axes_activity();