PFW-1397 Implement new function increment_tool_change_counter()
Reduces flash consumption by 44 bytes
This commit is contained in:
parent
fcfb868167
commit
3120bf0aa2
|
|
@ -301,6 +301,12 @@ void MMU2::DecrementRetryAttempts(){
|
|||
}
|
||||
}
|
||||
|
||||
void MMU2::increment_tool_change_counter()
|
||||
{
|
||||
uint32_t toolchanges = eeprom_read_dword((uint32_t*)EEPROM_TOTAL_TOOLCHANGE_COUNT);
|
||||
eeprom_write_dword((uint32_t *)EEPROM_TOTAL_TOOLCHANGE_COUNT, ++toolchanges);
|
||||
}
|
||||
|
||||
bool MMU2::tool_change(uint8_t index) {
|
||||
if( ! WaitForMMUReady())
|
||||
return false;
|
||||
|
|
@ -331,10 +337,7 @@ 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);
|
||||
increment_tool_change_counter();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -365,9 +368,7 @@ 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);
|
||||
increment_tool_change_counter();
|
||||
} break;
|
||||
|
||||
case 'c': {
|
||||
|
|
@ -518,10 +519,7 @@ 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);
|
||||
increment_tool_change_counter();
|
||||
}
|
||||
lcd_update_enable(true);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -194,6 +194,9 @@ public:
|
|||
void DecrementRetryAttempts();
|
||||
|
||||
private:
|
||||
/// increments tool change counter in EEPROM
|
||||
void increment_tool_change_counter();
|
||||
|
||||
/// Reset the retryAttempts back to the default value
|
||||
void ResetRetryAttempts();
|
||||
/// Perform software self-reset of the MMU (sends an X0 command)
|
||||
|
|
|
|||
Loading…
Reference in New Issue