Merge branch 'main' into bugfox/fov

This commit is contained in:
SoftFever 2025-02-19 19:15:41 +08:00 committed by GitHub
commit a6e53707ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 68 additions and 38 deletions

View file

@ -4415,18 +4415,22 @@ void GCodeProcessor::run_post_process()
}
}
}
}
else if (line == reserved_tag(ETags::Estimated_Printing_Time_Placeholder)) {
} else if (line == reserved_tag(ETags::Estimated_Printing_Time_Placeholder)) {
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
const TimeMachine& machine = m_time_processor.machines[i];
PrintEstimatedStatistics::ETimeMode mode = static_cast<PrintEstimatedStatistics::ETimeMode>(i);
if (mode == PrintEstimatedStatistics::ETimeMode::Normal || machine.enabled) {
char buf[128];
if (!s_IsBBLPrinter)
// Orca: compatibility with klipper_estimator
sprintf(buf, "; estimated printing time (%s mode) = %s\n",
(mode == PrintEstimatedStatistics::ETimeMode::Normal) ? "normal" : "silent",
get_time_dhms(machine.time).c_str());
else {
sprintf(buf, "; model printing time: %s; total estimated time: %s\n",
get_time_dhms(machine.time - machine.prepare_time).c_str(), get_time_dhms(machine.time).c_str());
}
export_lines.append_line(buf);
processed = true;
}
}
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
@ -4442,6 +4446,12 @@ void GCodeProcessor::run_post_process()
}
}
}
// Orca: write total layer number, this is used by Bambu printers only as of now
else if (line == reserved_tag(ETags::Total_Layer_Number_Placeholder)) {
char buf[128];
sprintf(buf, "; total layer number: %u\n", m_layer_id);
export_lines.append_line(buf);
}
}
return processed;

View file

@ -380,7 +380,7 @@ class Print;
EMoveType move_type{ EMoveType::Noop };
ExtrusionRole role{ erNone };
unsigned int g1_line_id{ 0 };
unsigned int remaining_internal_g1_lines;
unsigned int remaining_internal_g1_lines{ 0 };
unsigned int layer_id{ 0 };
float distance{ 0.0f }; // mm
float acceleration{ 0.0f }; // mm/s^2
@ -429,7 +429,7 @@ class Print;
struct G1LinesCacheItem
{
unsigned int id;
unsigned int remaining_internal_g1_lines;
unsigned int remaining_internal_g1_lines{ 0 };
float elapsed_time;
};

View file

@ -14,6 +14,7 @@
namespace Slic3r
{
static const double wipe_tower_wall_infill_overlap = 0.0;
inline float align_round(float value, float base)
{
@ -802,12 +803,30 @@ WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool extrude_per
box_coordinates wt_box(Vec2f(0.f, (m_current_shape == SHAPE_REVERSED) ? m_layer_info->toolchanges_depth() - m_layer_info->depth : 0.f),
m_wipe_tower_width, m_layer_info->depth + m_perimeter_width);
// align the perimeter
Vec2f pos = initial_position;
switch (m_cur_layer_id % 4){
case 0:
pos = wt_box.ld;
break;
case 1:
pos = wt_box.rd;
break;
case 2:
pos = wt_box.ru;
break;
case 3:
pos = wt_box.lu;
break;
default: break;
}
writer.set_initial_position(pos, m_wipe_tower_width, m_wipe_tower_depth, m_internal_rotation);
wt_box = align_perimeter(wt_box);
writer.rectangle(wt_box);
writer.travel(initial_position);
}
if (first_toolchange_to_nonsoluble) {
{
writer.travel(Vec2f(0, 0));
writer.travel(initial_position);
}
@ -1108,9 +1127,9 @@ void WipeTower::toolchange_Wipe(
}
if (m_left_to_right)
writer.extrude(xr + 0.25f * m_perimeter_width, writer.y(), wipe_speed);
writer.extrude(xr + wipe_tower_wall_infill_overlap * m_perimeter_width, writer.y(), wipe_speed);
else
writer.extrude(xl - 0.25f * m_perimeter_width, writer.y(), wipe_speed);
writer.extrude(xl - wipe_tower_wall_infill_overlap * m_perimeter_width, writer.y(), wipe_speed);
// BBS: recover the flow in non-bridging area
if (need_change_flow) {
@ -1600,10 +1619,11 @@ void WipeTower::generate(std::vector<std::vector<WipeTower::ToolChangeResult>> &
used = 0.f;
m_old_temperature = -1; // reset last temperature written in the gcode
int index = 0;
std::vector<WipeTower::ToolChangeResult> layer_result;
for (auto layer : m_plan)
{
m_cur_layer_id = index++;
set_layer(layer.z, layer.height, 0, false/*layer.z == m_plan.front().z*/, layer.z == m_plan.back().z);
// BBS
//m_internal_rotation += 180.f;

View file

@ -304,7 +304,7 @@ private:
float m_travel_speed = 0.f;
float m_first_layer_speed = 0.f;
size_t m_first_layer_idx = size_t(-1);
size_t m_cur_layer_id;
// G-code generator parameters.
float m_cooling_tube_retraction = 0.f;
float m_cooling_tube_length = 0.f;