RAISE_Z_ON_TOOLCHANGE is not stored in eeprom. But it would solve your problem if you just used it instead of trying to raise your self making the G91/G90/G1 Z unneeded.
Here you also see where the problem might happen (Extruder::selectById)
if(Printer::isHomedAll()) {
Printer::moveToReal(cx, cy, cz, IGNORE_COORDINATE, EXTRUDER_SWITCH_XY_SPEED);
}
#endif
Printer::feedrate = oldfeedrate;
Printer::updateCurrentPosition(true);
#if USE_ADVANCE
HAL::resetExtruderDirection();
#endif // USE_ADVANCE
#if NUM_EXTRUDER > 1 && MIXING_EXTRUDER == 0
if(executeSelect) {// Run only when changing
Commands::waitUntilEndOfAllMoves();
GCode::executeFString(next->selectCommands);
}
#endif
#endifYou see it moves to starting position and THEN it executes your command.
Thinking about it, it should better end like this#if NUM_EXTRUDER > 1 && MIXING_EXTRUDER == 0 if(executeSelect) {// Run only when changing Commands::waitUntilEndOfAllMoves(); GCode::executeFString(next->selectCommands); }#endif#if DUAL_X_AXIS == 0 || LAZY_DUAL_X_AXIS == 0#if RAISE_Z_ON_TOOLCHANGE > 0 && !LAZY_DUAL_X_AXIS if (Printer::isZHomed()) { Printer::moveToReal(IGNORE_COORDINATE, IGNORE_COORDINATE, cz, IGNORE_COORDINATE, Printer::homingFeedrate[Z_AXIS]); Printer::lastCmdPos[Z_AXIS] = lastZ; }#endif
if(Printer::isHomedAll()) { Printer::moveToReal(cx, cy, cz, IGNORE_COORDINATE, EXTRUDER_SWITCH_XY_SPEED); }#endif Printer::feedrate = oldfeedrate; Printer::updateCurrentPosition(true);#endif
}so positioning to start position is the last and not the deselect command.