Explorar el Código

PFW-1397 Increment toolchange statistic

Guðni Már Gilbert hace 2 años
padre
commit
5a60a85467
Se han modificado 1 ficheros con 11 adiciones y 0 borrados
  1. 11 0
      Firmware/mmu2.cpp

+ 11 - 0
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;