Enhance GCode handling for Z-axis movements (#10803)

* Enhance GCode handling for Z-axis movements

- Updated `travel_to_z` method to include a `force` parameter, allowing forced Z movements.
- Modified GCode generation logic to ensure Z position is restored after unknown last positions.
- Enforce z restoreation after tool changer

* Improve filament_multitool_ramming logic

* fix indent
This commit is contained in:
SoftFever
2025-09-21 22:03:54 +08:00
committed by GitHub
parent 23ee1daac0
commit b483dff617
5 changed files with 21 additions and 9 deletions

View File

@@ -1350,7 +1350,7 @@ void WipeTower2::set_extruder(size_t idx, const PrintConfig& config)
// We will use the same variables internally, but the correspondence to the configuration options will be different.
float vol = config.filament_multitool_ramming_volume.get_at(idx);
float flow = config.filament_multitool_ramming_flow.get_at(idx);
m_filpar[idx].multitool_ramming = config.filament_multitool_ramming.get_at(idx);
m_filpar[idx].multitool_ramming = config.filament_multitool_ramming.get_at(idx) && vol > 0.f && flow > 0.f;
m_filpar[idx].ramming_line_width_multiplicator = 2.;
m_filpar[idx].ramming_step_multiplicator = 1.;
@@ -1360,7 +1360,7 @@ void WipeTower2::set_extruder(size_t idx, const PrintConfig& config)
// ramming_speed vector that would respect both the volume and flow (because of
// rounding issues with small volumes and high flow).
m_filpar[idx].ramming_speed.push_back(flow);
m_filpar[idx].multitool_ramming_time = vol/flow;
m_filpar[idx].multitool_ramming_time = flow > 0.f ? vol/flow : 0.f;
}
m_used_filament_length.resize(std::max(m_used_filament_length.size(), idx + 1)); // makes sure that the vector is big enough so we don't have to check later