check for required mmu2 firmware buildnr

This commit is contained in:
PavelSindler 2018-08-25 16:15:35 +02:00
parent 32723d8d6f
commit 1f5bece0db
2 changed files with 19 additions and 0 deletions

View file

@ -23,6 +23,7 @@ extern char choose_extruder_menu();
#define MMU_HWRESET #define MMU_HWRESET
#define MMU_RST_PIN 76 #define MMU_RST_PIN 76
#define MMU_REQUIRED_FW_BUILDNR 81
bool mmu_enabled = false; bool mmu_enabled = false;
@ -137,6 +138,9 @@ void mmu_loop(void)
{ {
fscanf_P(uart2io, PSTR("%u"), &mmu_buildnr); //scan buildnr from buffer fscanf_P(uart2io, PSTR("%u"), &mmu_buildnr); //scan buildnr from buffer
printf_P(PSTR("MMU => '%dok'\n"), mmu_buildnr); 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'")); puts_P(PSTR("MMU <= 'P0'"));
mmu_puts_P(PSTR("P0\n")); //send 'read finda' request mmu_puts_P(PSTR("P0\n")); //send 'read finda' request
mmu_state = -4; mmu_state = -4;
@ -826,3 +830,14 @@ void extr_unload_4()
change_extr(4); change_extr(4);
extr_unload(); 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

@ -80,3 +80,7 @@ extern void extr_unload_1();
extern void extr_unload_2(); extern void extr_unload_2();
extern void extr_unload_3(); extern void extr_unload_3();
extern void extr_unload_4(); extern void extr_unload_4();
extern bool mmu_check_version();
extern void mmu_show_warning();