Merge pull request #1412 from XPila/V3_5
Repeat last MMU command after timeout
This commit is contained in:
commit
d1ca73597b
@ -6518,6 +6518,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|||||||
#endif //FILAMENTCHANGEENABLE
|
#endif //FILAMENTCHANGEENABLE
|
||||||
case 601: //! M601 - Pause print
|
case 601: //! M601 - Pause print
|
||||||
{
|
{
|
||||||
|
cmdqueue_pop_front(); //trick because we want skip this command (M601) after restore
|
||||||
lcd_pause_print();
|
lcd_pause_print();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -51,6 +51,8 @@ int16_t mmu_buildnr = -1;
|
|||||||
uint32_t mmu_last_request = 0;
|
uint32_t mmu_last_request = 0;
|
||||||
uint32_t mmu_last_response = 0;
|
uint32_t mmu_last_response = 0;
|
||||||
|
|
||||||
|
uint8_t mmu_last_cmd = 0;
|
||||||
|
|
||||||
|
|
||||||
//clear rx buffer
|
//clear rx buffer
|
||||||
void mmu_clr_rx_buf(void)
|
void mmu_clr_rx_buf(void)
|
||||||
@ -251,6 +253,7 @@ void mmu_loop(void)
|
|||||||
mmu_puts_P(PSTR("R0\n")); //send recover after eject
|
mmu_puts_P(PSTR("R0\n")); //send recover after eject
|
||||||
mmu_state = 3; // wait for response
|
mmu_state = 3; // wait for response
|
||||||
}
|
}
|
||||||
|
mmu_last_cmd = mmu_cmd;
|
||||||
mmu_cmd = 0;
|
mmu_cmd = 0;
|
||||||
}
|
}
|
||||||
else if ((mmu_last_response + 300) < millis()) //request every 300ms
|
else if ((mmu_last_response + 300) < millis()) //request every 300ms
|
||||||
@ -291,11 +294,20 @@ void mmu_loop(void)
|
|||||||
#ifdef MMU_DEBUG
|
#ifdef MMU_DEBUG
|
||||||
printf_P(PSTR("MMU => 'ok'\n"));
|
printf_P(PSTR("MMU => 'ok'\n"));
|
||||||
#endif //MMU_DEBUG
|
#endif //MMU_DEBUG
|
||||||
|
mmu_last_cmd = 0;
|
||||||
mmu_ready = true;
|
mmu_ready = true;
|
||||||
mmu_state = 1;
|
mmu_state = 1;
|
||||||
}
|
}
|
||||||
else if ((mmu_last_request + MMU_CMD_TIMEOUT) < millis())
|
else if ((mmu_last_request + MMU_CMD_TIMEOUT) < millis())
|
||||||
{ //resend request after timeout (5 min)
|
{ //resend request after timeout (5 min)
|
||||||
|
if (mmu_last_cmd)
|
||||||
|
{
|
||||||
|
#ifdef MMU_DEBUG
|
||||||
|
printf_P(PSTR("MMU retry\n"));
|
||||||
|
#endif //MMU_DEBUG
|
||||||
|
mmu_cmd = mmu_last_cmd;
|
||||||
|
// mmu_last_cmd = 0; //resend just once
|
||||||
|
}
|
||||||
mmu_state = 1;
|
mmu_state = 1;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user