Merge pull request #1062 from mkbel/refactor_tmp_extruder

Refactor tmp extruder
This commit is contained in:
PavelSindler 2018-08-24 16:26:32 +02:00 committed by GitHub
commit 467fad00b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 19 deletions

View file

@ -5808,10 +5808,10 @@ Sigma_Exit:
case 200: // M200 D<millimeters> set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
{
tmp_extruder = active_extruder;
uint8_t extruder = active_extruder;
if(code_seen('T')) {
tmp_extruder = code_value();
if(tmp_extruder >= EXTRUDERS) {
extruder = code_value();
if(extruder >= EXTRUDERS) {
SERIAL_ECHO_START;
SERIAL_ECHO(_i("M200 Invalid extruder "));////MSG_M200_INVALID_EXTRUDER c=0 r=0
break;
@ -5825,7 +5825,7 @@ Sigma_Exit:
// for all extruders
volumetric_enabled = false;
} else {
filament_size[tmp_extruder] = (float)code_value();
filament_size[extruder] = (float)code_value();
// make sure all extruders have some sane value for the filament size
filament_size[0] = (filament_size[0] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : filament_size[0]);
#if EXTRUDERS > 1

View file

@ -28,12 +28,13 @@ bool mmu_enabled = false;
bool mmu_ready = false;
int8_t mmu_state = 0;
static int8_t mmu_state = 0;
uint8_t mmu_cmd = 0;
uint8_t mmu_extruder = 0;
//! This variable probably has no meaning and is planed to be removed
uint8_t tmp_extruder = 0;
int8_t mmu_finda = -1;
@ -363,29 +364,27 @@ void mmu_load_to_nozzle()
void mmu_M600_load_filament(bool automatic)
{
//load filament for mmu v2
bool yes = false;
uint8_t filament = mmu_extruder;
if (!automatic) {
yes = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Do you want to switch extruder?"), false);
if(yes) tmp_extruder = choose_extruder_menu();
else tmp_extruder = mmu_extruder;
bool yes = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Do you want to switch extruder?"), false);
if(yes) filament = choose_extruder_menu();
}
else {
tmp_extruder = (tmp_extruder+1)%5;
filament = (filament+1)%5;
}
lcd_update_enable(false);
lcd_clear();
lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_LOADING_FILAMENT));
lcd_print(" ");
lcd_print(tmp_extruder + 1);
snmm_filaments_used |= (1 << tmp_extruder); //for stop print
lcd_print(filament + 1);
snmm_filaments_used |= (1 << filament); //for stop print
// printf_P(PSTR("T code: %d \n"), tmp_extruder);
// mmu_printf_P(PSTR("T%d\n"), tmp_extruder);
mmu_command(MMU_CMD_T0 + tmp_extruder);
// printf_P(PSTR("T code: %d \n"), filament);
// mmu_printf_P(PSTR("T%d\n"), filament);
mmu_command(MMU_CMD_T0 + filament);
manage_response(false, true);
mmu_extruder = tmp_extruder; //filament change is finished
mmu_extruder = filament; //filament change is finished
mmu_load_to_nozzle();

View file

@ -5,8 +5,6 @@
extern bool mmu_enabled;
extern int8_t mmu_state;
extern uint8_t mmu_extruder;
extern uint8_t tmp_extruder;