Quellcode durchsuchen

Fix bound check for T0 .. T4 command. Document mmu_load_to_nozzle().

Marek Bel vor 6 Jahren
Ursprung
Commit
8aeb7e04f1
2 geänderte Dateien mit 9 neuen und 3 gelöschten Zeilen
  1. 3 3
      Firmware/Marlin_main.cpp
  2. 6 0
      Firmware/mmu.cpp

+ 3 - 3
Firmware/Marlin_main.cpp

@@ -6797,7 +6797,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
       st_synchronize();
       for (index = 1; *(strchr_pointer + index) == ' ' || *(strchr_pointer + index) == '\t'; index++);
 
-      if ((*(strchr_pointer + index) < '0' || *(strchr_pointer + index) > '9') && *(strchr_pointer + index) != '?') {
+      if ((*(strchr_pointer + index) < '0' || *(strchr_pointer + index) > '4') && *(strchr_pointer + index) != '?') {
           SERIAL_ECHOLNPGM("Invalid T code.");
       }
       else {
@@ -6811,8 +6811,6 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
 
           if (mmu_enabled)
           {
-              //printf_P(PSTR("T code: %d \n"), tmp_extruder);
-              //mmu_printf_P(PSTR("T%d\n"), tmp_extruder);
               mmu_command(MMU_CMD_T0 + tmp_extruder);
 
               manage_response(true, true);
@@ -6820,7 +6818,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
               mmu_extruder = tmp_extruder; //filament change is finished
 
               if (*(strchr_pointer + index) == '?')// for single material usage with mmu
+              {
                   mmu_load_to_nozzle();
+              }
           }
           else
           {

+ 6 - 0
Firmware/mmu.cpp

@@ -380,6 +380,12 @@ void manage_response(bool move_axes, bool turn_off_nozzle)
 	if (lcd_update_was_enabled) lcd_update_enable(true);
 }
 
+//! @brief load filament to nozzle of multimaterial printer
+//!
+//! This function is used only only after T? (user select filament) and M600 (change filament).
+//! It is not used after T0 .. T4 command (select filament), in such case, gcode is responsible for loading
+//! filament to nozzle.
+//!
 void mmu_load_to_nozzle()
 {
 	st_synchronize();