From 5a60a854678a47f8d7579b94aaff429a54312d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sat, 22 Oct 2022 17:46:23 +0000 Subject: [PATCH] PFW-1397 Increment toolchange statistic --- Firmware/mmu2.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Firmware/mmu2.cpp b/Firmware/mmu2.cpp index a084a8839..3affaffdc 100644 --- a/Firmware/mmu2.cpp +++ b/Firmware/mmu2.cpp @@ -331,6 +331,10 @@ bool MMU2::tool_change(uint8_t index) { // @@TODO really report onto the serial? May be for the Octoprint? Not important now // SERIAL_ECHO_START(); // SERIAL_ECHOLNPAIR(MSG_ACTIVE_EXTRUDER, int(extruder)); + + // Update toolchange counter + uint32_t toolchanges = eeprom_read_dword((uint32_t*)EEPROM_TOTAL_TOOLCHANGE_COUNT); + eeprom_write_dword((uint32_t *)EEPROM_TOTAL_TOOLCHANGE_COUNT, ++toolchanges); } return true; } @@ -361,6 +365,9 @@ bool MMU2::tool_change(char code, uint8_t slot) { extruder = slot; SpoolJoin::spooljoin.setSlot(slot); set_extrude_min_temp(EXTRUDE_MINTEMP); + // Update toolchange counter + uint32_t toolchanges = eeprom_read_dword((uint32_t*)EEPROM_TOTAL_TOOLCHANGE_COUNT); + eeprom_write_dword((uint32_t *)EEPROM_TOTAL_TOOLCHANGE_COUNT, ++toolchanges); } break; case 'c': { @@ -511,6 +518,10 @@ bool MMU2::load_filament_to_nozzle(uint8_t index) { SpoolJoin::spooljoin.setSlot(index); Sound_MakeSound(e_SOUND_TYPE_StandardConfirm); + + // Update toolchange count + uint32_t toolchanges = eeprom_read_dword((uint32_t*)EEPROM_TOTAL_TOOLCHANGE_COUNT); + eeprom_write_dword((uint32_t *)EEPROM_TOTAL_TOOLCHANGE_COUNT, ++toolchanges); } lcd_update_enable(true); return true;