added mmu_loop case 20:

This commit is contained in:
TheZeroBeast 2018-11-07 01:01:16 +10:00 committed by GitHub
parent e81af1a06e
commit 4e21d7482c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 8 deletions

View File

@ -9207,4 +9207,4 @@ void M600_load_filament() {
lcd_update_enable(false);
}
#define FIL_LOAD_LENGTH 60
#define FIL_LOAD_LENGTH 60

View File

@ -409,7 +409,7 @@ void mmu_loop(void)
}
mmu_cmd = 0;
}
else if ((mmu_last_response + 300) < millis()) //request every 300ms
else if ((mmu_last_response + 500) < millis()) //request every 500ms
{
mmu_puts_P(PSTR("P0\n")); //send 'read finda' request
mmu_state = 2;
@ -457,6 +457,8 @@ void mmu_loop(void)
}
} else if (mmu_rx_not_ok() > 0) {
printf_P(PSTR("MMU => 'Error State, do something here??'\n"));
mmu_ready = false;
mmu_state = 20;
}
/*else if ((mmu_last_request + MMU_CMD_TIMEOUT) < millis())
{ //resend request after timeout (5 min)
@ -474,6 +476,15 @@ void mmu_loop(void)
mmu_state = 1;
}
return;
case 20: //
if (mmu_rx_ok() > 0)
{
//if ok received then go back to ready
mmu_state = 1;
mmu_ready = true;
} else if (mmu_rx_not_ok() > 0) {
//do nothing at this stage
}
}
}
@ -511,13 +522,12 @@ bool mmu_get_response(void)
KEEPALIVE_STATE(IN_PROCESS);
while (mmu_cmd != 0)
{
// mmu_loop();
delay_keep_alive(100);
}
while (!mmu_ready)
{
// mmu_loop();
if (mmu_state != 3 || mmu_state != 10) break;
//if ((mmu_last_response + MMU_CMD_TIMEOUT) < millis()) break;
if ((mmu_state != 3) || (mmu_state != 10)) break;
delay_keep_alive(100);
}
bool ret = mmu_ready;
@ -1350,4 +1360,4 @@ void mmu_eject_filament(uint8_t filament, bool recover)
{
puts_P(PSTR("Filament nr out of range!"));
}
}
}

View File

@ -35,7 +35,9 @@ extern int16_t mmu_buildnr;
#define MMU_CMD_E3 0x53
#define MMU_CMD_E4 0x54
#define MMU_CMD_R0 0x60
#define MMU_CMD_P0 0x70
#define MMU_CMD_FS0 0x80
#define MMU_CMD_FS1 0x81
extern int mmu_puts_P(const char* str);
@ -101,4 +103,4 @@ extern void mmu_eject_fil_0();
extern void mmu_eject_fil_1();
extern void mmu_eject_fil_2();
extern void mmu_eject_fil_3();
extern void mmu_eject_fil_4();
extern void mmu_eject_fil_4();