snmm: stop print unloads only used filaments, disable steppers (M84) resets used filaments

This commit is contained in:
PavelSindler 2017-05-29 17:35:45 +02:00
parent 36091dcde4
commit bc61622d21
4 changed files with 39 additions and 4 deletions

View File

@ -299,6 +299,7 @@ extern unsigned int heating_status_counter;
extern bool custom_message;
extern unsigned int custom_message_type;
extern unsigned int custom_message_state;
extern char snmm_filaments_used;
extern unsigned long PingTime;

View File

@ -285,6 +285,7 @@ bool custom_message;
bool loading_flag = false;
unsigned int custom_message_type;
unsigned int custom_message_state;
char snmm_filaments_used = 0;
bool volumetric_enabled = false;
float filament_size[EXTRUDERS] = { DEFAULT_NOMINAL_FILAMENT_DIA
@ -4301,6 +4302,7 @@ Sigma_Exit:
#endif
}
}
snmm_filaments_used = 0;
break;
case 85: // M85
if(code_seen('S')) {
@ -4451,7 +4453,7 @@ Sigma_Exit:
tmp_extruder = active_extruder;
if(code_seen('T')) {
tmp_extruder = code_value();
if(tmp_extruder >= EXTRUDERS) {
if(tmp_extruder >= EXTRUDERS) {
SERIAL_ECHO_START;
SERIAL_ECHO(MSG_M200_INVALID_EXTRUDER);
break;
@ -5441,7 +5443,12 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
case 702:
{
#ifdef SNMM
extr_unload_all();
if (code_seen('U')) {
extr_unload_used();
}
else {
extr_unload_all();
}
#else
custom_message = true;
custom_message_type = 2;
@ -5479,6 +5486,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
}
else {
tmp_extruder = code_value();
snmm_filaments_used |= (1 << tmp_extruder); //for stop print
#ifdef SNMM
snmm_extruder = tmp_extruder;

View File

@ -671,7 +671,7 @@ void lcd_commands()
lcd_commands_step = 5;
}
if (lcd_commands_step == 7 && !blocks_queued()) {
enquecommand_P(PSTR("M702"));
enquecommand_P(PSTR("M702 U"));
lcd_commands_step = 3;
}
}
@ -3254,6 +3254,30 @@ void extr_unload_all() {
}
}
//unloading just used filament (for snmm)
void extr_unload_used() {
if (degHotend0() > EXTRUDE_MINTEMP) {
for (int i = 0; i < 4; i++) {
if (snmm_filaments_used & (1 << i)) {
change_extr(i);
extr_unload();
}
}
snmm_filaments_used = 0;
}
else {
lcd_implementation_clear();
lcd.setCursor(0, 0);
lcd_printPGM(MSG_ERROR);
lcd.setCursor(0, 2);
lcd_printPGM(MSG_PREHEAT_NOZZLE);
delay(2000);
lcd_implementation_clear();
lcd_return_to_status();
}
}
static void extr_unload_0() {

View File

@ -222,9 +222,11 @@ static void extr_unload_1();
static void extr_unload_2();
static void extr_unload_3();
static void lcd_disable_farm_mode();
void extr_unload_all();
void extr_unload_all();
void extr_unload_used();
static void extr_unload();
void stack_error();
static void lcd_ping_allert();
void lcd_printer_connected();