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

This commit is contained in:
Marek Bel 2018-08-28 18:52:16 +02:00
parent 55eaa1de83
commit 8aeb7e04f1
2 changed files with 9 additions and 3 deletions

View file

@ -6797,7 +6797,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
st_synchronize(); st_synchronize();
for (index = 1; *(strchr_pointer + index) == ' ' || *(strchr_pointer + index) == '\t'; index++); 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."); SERIAL_ECHOLNPGM("Invalid T code.");
} }
else { else {
@ -6811,8 +6811,6 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
if (mmu_enabled) 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); mmu_command(MMU_CMD_T0 + tmp_extruder);
manage_response(true, true); 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 mmu_extruder = tmp_extruder; //filament change is finished
if (*(strchr_pointer + index) == '?')// for single material usage with mmu if (*(strchr_pointer + index) == '?')// for single material usage with mmu
{
mmu_load_to_nozzle(); mmu_load_to_nozzle();
}
} }
else else
{ {

View file

@ -380,6 +380,12 @@ void manage_response(bool move_axes, bool turn_off_nozzle)
if (lcd_update_was_enabled) lcd_update_enable(true); 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() void mmu_load_to_nozzle()
{ {
st_synchronize(); st_synchronize();