fix linux build failed bug.

This commit is contained in:
alves
2026-02-28 15:45:36 +08:00
parent e05a99b261
commit c0899d5895

View File

@@ -30,7 +30,6 @@ void GCodeWriter::apply_print_config(const PrintConfig &print_config)
m_physical_extruder_count = print_config.nozzle_diameter.values.size();
if (m_physical_extruder_count == 0) {
m_physical_extruder_count = 1; // 防止除零默认为1
BOOST_LOG_TRIVIAL(warning) << "GCodeWriter::apply_print_config: nozzle_diameter is empty, using default physical_extruder_count=1";
}
bool use_mach_limits = print_config.gcode_flavor.value == gcfMarlinLegacy || print_config.gcode_flavor.value == gcfMarlinFirmware ||
print_config.gcode_flavor.value == gcfKlipper || print_config.gcode_flavor.value == gcfRepRapFirmware;
@@ -50,7 +49,6 @@ void GCodeWriter::apply_print_config(const PrintConfig &print_config)
void GCodeWriter::set_extruders(std::vector<unsigned int> extruder_ids)
{
BOOST_LOG_TRIVIAL(info) << "GCodeWriter::set_extruders: START - Creating Extruder objects for " << extruder_ids.size() << " extruders";
std::sort(extruder_ids.begin(), extruder_ids.end());
m_extruder = nullptr; // this points to object inside `m_extruders`, so should be cleared too
@@ -58,16 +56,11 @@ void GCodeWriter::set_extruders(std::vector<unsigned int> extruder_ids)
m_extruders.reserve(extruder_ids.size());
for (unsigned int extruder_id : extruder_ids) {
int physical_extruder_id = get_physical_extruder(extruder_id);
BOOST_LOG_TRIVIAL(info) << "GCodeWriter::set_extruders: Creating Extruder - filament_id=" << extruder_id
<< " -> physical_extruder_id=" << physical_extruder_id;
m_extruders.emplace_back(Extruder(extruder_id, physical_extruder_id, &this->config, config.single_extruder_multi_material.value));
}
/* we enable support for multiple extruder if any extruder greater than 0 is used
(even if prints only uses that one) since we need to output Tx commands
first extruder has index 0 */
this->multiple_extruders = (*std::max_element(extruder_ids.begin(), extruder_ids.end())) > 0;
BOOST_LOG_TRIVIAL(info) << "GCodeWriter::set_extruders: END - multiple_extruders=" << this->multiple_extruders;
this->multiple_extruders = (*std::max_element(extruder_ids.begin(), extruder_ids.end())) > 0;
}
std::string GCodeWriter::preamble()
@@ -504,13 +497,6 @@ std::string GCodeWriter::set_speed(double F, const std::string &comment, const s
std::string GCodeWriter::travel_to_xy(const Vec2d &point, const std::string &comment)
{
if (std::isnan(point(0)) || std::isinf(point(0)) || std::isnan(point(1)) || std::isinf(point(1))) {
BOOST_LOG_TRIVIAL(error) << "SM Orca: travel_to_xy received NaN/inf point"
<< " extruder=" << (m_extruder ? m_extruder->id() : -1)
<< " point=(" << point(0) << ", " << point(1) << ")"
<< " comment=" << comment;
}
m_pos(0) = point(0);
m_pos(1) = point(1);
@@ -731,14 +717,6 @@ bool GCodeWriter::will_move_z(double z) const
std::string GCodeWriter::extrude_to_xy(const Vec2d &point, double dE, const std::string &comment, bool force_no_extrusion)
{
if (std::isnan(point(0)) || std::isinf(point(0)) || std::isnan(point(1)) || std::isinf(point(1))) {
BOOST_LOG_TRIVIAL(error) << "SM Orca: extrude_to_xy received NaN/inf point"
<< " extruder=" << (m_extruder ? m_extruder->id() : -1)
<< " point=(" << point(0) << ", " << point(1) << ")"
<< " dE=" << dE
<< " comment=" << comment;
}
m_pos(0) = point(0);
m_pos(1) = point(1);
if(std::abs(dE) <= std::numeric_limits<double>::epsilon())