eject filament: initial version
This commit is contained in:
parent
27bd31e255
commit
705f098b1c
@ -103,6 +103,7 @@ void mmu_init(void)
|
||||
//mmu main loop - state machine processing
|
||||
void mmu_loop(void)
|
||||
{
|
||||
int filament = 0;
|
||||
// printf_P(PSTR("MMU loop, state=%d\n"), mmu_state);
|
||||
switch (mmu_state)
|
||||
{
|
||||
@ -160,14 +161,14 @@ void mmu_loop(void)
|
||||
{
|
||||
if ((mmu_cmd >= MMU_CMD_T0) && (mmu_cmd <= MMU_CMD_T4))
|
||||
{
|
||||
int extruder = mmu_cmd - MMU_CMD_T0;
|
||||
printf_P(PSTR("MMU <= 'T%d'\n"), extruder);
|
||||
mmu_printf_P(PSTR("T%d\n"), extruder);
|
||||
filament = mmu_cmd - MMU_CMD_T0;
|
||||
printf_P(PSTR("MMU <= 'T%d'\n"), filament);
|
||||
mmu_printf_P(PSTR("T%d\n"), filament);
|
||||
mmu_state = 3; // wait for response
|
||||
}
|
||||
else if ((mmu_cmd >= MMU_CMD_L0) && (mmu_cmd <= MMU_CMD_L4))
|
||||
{
|
||||
int filament = mmu_cmd - MMU_CMD_L0;
|
||||
filament = mmu_cmd - MMU_CMD_L0;
|
||||
printf_P(PSTR("MMU <= 'L%d'\n"), filament);
|
||||
mmu_printf_P(PSTR("L%d\n"), filament);
|
||||
mmu_state = 3; // wait for response
|
||||
@ -184,6 +185,19 @@ void mmu_loop(void)
|
||||
mmu_puts_P(PSTR("U0\n")); //send 'unload current filament'
|
||||
mmu_state = 3;
|
||||
}
|
||||
else if ((mmu_cmd >= MMU_CMD_E0) && (mmu_cmd <= MMU_CMD_E4))
|
||||
{
|
||||
int filament = mmu_cmd - MMU_CMD_E0;
|
||||
printf_P(PSTR("MMU <= 'E%d'\n"), filament);
|
||||
mmu_printf_P(PSTR("E%d\n"), filament); //send eject filament
|
||||
mmu_state = 3; // wait for response
|
||||
}
|
||||
else if (mmu_cmd == MMU_CMD_R0)
|
||||
{
|
||||
printf_P(PSTR("MMU <= 'R0'\n"));
|
||||
mmu_puts_P(PSTR("R0\n")); //send recover after eject
|
||||
mmu_state = 3; // wait for response
|
||||
}
|
||||
mmu_cmd = 0;
|
||||
}
|
||||
else if ((mmu_last_response + 300) < millis()) //request every 300ms
|
||||
@ -214,7 +228,7 @@ void mmu_loop(void)
|
||||
mmu_state = 1;
|
||||
}
|
||||
return;
|
||||
case 3: //response to commands T0-T4
|
||||
case 3: //response to mmu commands
|
||||
if (mmu_rx_ok() > 0)
|
||||
{
|
||||
printf_P(PSTR("MMU => 'ok'\n"));
|
||||
@ -900,3 +914,8 @@ 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."));
|
||||
}
|
||||
|
||||
static void mmu_eject_filament(uint8_t filament)
|
||||
{
|
||||
if (filament < 5) mmu_command(MMU_CMD_E0 + filament);
|
||||
}
|
@ -30,6 +30,13 @@ extern int16_t mmu_buildnr;
|
||||
#define MMU_CMD_L4 0x24
|
||||
#define MMU_CMD_C0 0x30
|
||||
#define MMU_CMD_U0 0x40
|
||||
#define MMU_CMD_E0 0x50
|
||||
#define MMU_CMD_E1 0x51
|
||||
#define MMU_CMD_E2 0x52
|
||||
#define MMU_CMD_E3 0x53
|
||||
#define MMU_CMD_E4 0x54
|
||||
#define MMU_CMD_R0 0x60
|
||||
|
||||
|
||||
extern int mmu_puts_P(const char* str);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user