Merge pull request #1065 from PavelSindler/mmu_v2_continue_loading

Mmu v2: continue loading command
This commit is contained in:
PavelSindler 2018-08-25 20:03:12 +02:00 committed by GitHub
commit 85358342bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 2 deletions

View File

@ -6803,7 +6803,7 @@ if (mmu_enabled)
mmu_command(MMU_CMD_T0 + tmp_extruder);
manage_response(true, true);
mmu_command(MMU_CMD_C0);
mmu_extruder = tmp_extruder; //filament change is finished
if (*(strchr_pointer + index) == '?')// for single material usage with mmu

View File

@ -24,6 +24,7 @@ extern char choose_extruder_menu();
#define MMU_HWRESET
#define MMU_RST_PIN 76
#define MMU_REQUIRED_FW_BUILDNR 81
bool mmu_enabled = false;
@ -138,6 +139,9 @@ void mmu_loop(void)
{
fscanf_P(uart2io, PSTR("%u"), &mmu_buildnr); //scan buildnr from buffer
printf_P(PSTR("MMU => '%dok'\n"), mmu_buildnr);
bool version_valid = mmu_check_version();
if (!version_valid) mmu_show_warning();
else puts_P(PSTR("MMU version valid"));
puts_P(PSTR("MMU <= 'P0'"));
mmu_puts_P(PSTR("P0\n")); //send 'read finda' request
mmu_state = -4;
@ -170,6 +174,12 @@ void mmu_loop(void)
mmu_printf_P(PSTR("L%d\n"), filament);
mmu_state = 3; // wait for response
}
else if (mmu_cmd == MMU_CMD_C0)
{
printf_P(PSTR("MMU <= 'C0'\n"));
mmu_puts_P(PSTR("C0\n")); //send continue loading
mmu_state = 3;
}
mmu_cmd = 0;
}
else if ((mmu_last_response + 1000) < millis()) //request every 1s
@ -196,7 +206,7 @@ void mmu_loop(void)
case 3: //response to commands T0-T4
if (mmu_rx_ok() > 0)
{
printf_P(PSTR("MMU => 'ok'\n"), mmu_finda);
printf_P(PSTR("MMU => 'ok'\n"));
mmu_ready = true;
mmu_state = 1;
}
@ -404,6 +414,7 @@ void mmu_M600_load_filament(bool automatic)
mmu_command(MMU_CMD_T0 + tmp_extruder);
manage_response(false, true);
mmu_command(MMU_CMD_C0);
mmu_extruder = tmp_extruder; //filament change is finished
mmu_load_to_nozzle();
@ -820,3 +831,14 @@ void extr_unload_4()
change_extr(4);
extr_unload();
}
bool mmu_check_version()
{
return (mmu_buildnr >= MMU_REQUIRED_FW_BUILDNR);
}
void mmu_show_warning()
{
printf_P(PSTR("MMU2 firmware version invalid. Required version: build number %d or higher."), MMU_REQUIRED_FW_BUILDNR);
kill(_i("Please update firmware in your MMU2. Waiting for reset."));
}

View File

@ -28,6 +28,7 @@ extern int16_t mmu_buildnr;
#define MMU_CMD_L2 0x22
#define MMU_CMD_L3 0x23
#define MMU_CMD_L4 0x24
#define MMU_CMD_C0 0x30
extern int mmu_puts_P(const char* str);
@ -79,3 +80,7 @@ extern void extr_unload_1();
extern void extr_unload_2();
extern void extr_unload_3();
extern void extr_unload_4();
extern bool mmu_check_version();
extern void mmu_show_warning();