FIX: fix a typo in GCodeProcessor
Change-Id: I56b9eaedc3cb062d17facf7352eb469524db5b60 (cherry picked from commit 1bb3b64cfc1aabad9ece3e5d5c0f55a9cb3367c5)
This commit is contained in:
parent
ee0fe83744
commit
ced9e43be6
|
@ -94,16 +94,16 @@ static float intersection_distance(float initial_rate, float final_rate, float a
|
|||
|
||||
static float speed_from_distance(float initial_feedrate, float distance, float acceleration)
|
||||
{
|
||||
// to avoid invalid negative numbers due to numerical errors
|
||||
// to avoid invalid negative numbers due to numerical errors
|
||||
float value = std::max(0.0f, sqr(initial_feedrate) + 2.0f * acceleration * distance);
|
||||
return ::sqrt(value);
|
||||
}
|
||||
|
||||
// Calculates the maximum allowable speed at this point when you must be able to reach target_velocity using the
|
||||
// Calculates the maximum allowable speed at this point when you must be able to reach target_velocity using the
|
||||
// acceleration within the allotted distance.
|
||||
static float max_allowable_speed(float acceleration, float target_velocity, float distance)
|
||||
{
|
||||
// to avoid invalid negative numbers due to numerical errors
|
||||
// to avoid invalid negative numbers due to numerical errors
|
||||
float value = std::max(0.0f, sqr(target_velocity) - 2.0f * acceleration * distance);
|
||||
return std::sqrt(value);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ void GCodeProcessor::TimeBlock::calculate_trapezoid()
|
|||
float cruise_distance = distance - accelerate_distance - decelerate_distance;
|
||||
|
||||
// Not enough space to reach the nominal feedrate.
|
||||
// This means no cruising, and we'll have to use intersection_distance() to calculate when to abort acceleration
|
||||
// This means no cruising, and we'll have to use intersection_distance() to calculate when to abort acceleration
|
||||
// and start braking in order to reach the exit_feedrate exactly at the end of this block.
|
||||
if (cruise_distance < 0.0f) {
|
||||
accelerate_distance = std::clamp(intersection_distance(feedrate_profile.entry, feedrate_profile.exit, acceleration, distance), 0.0f, distance);
|
||||
|
@ -629,7 +629,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
|||
if (processed && lines_added_count > 0)
|
||||
offsets.push_back({ line_id, lines_added_count });
|
||||
if (! processed && ! is_temporary_decoration(gcode_line) &&
|
||||
(GCodeReader::GCodeLine::cmd_is(gcode_line, "G1") ||
|
||||
(GCodeReader::GCodeLine::cmd_is(gcode_line, "G1") ||
|
||||
GCodeReader::GCodeLine::cmd_is(gcode_line, "G2") ||
|
||||
GCodeReader::GCodeLine::cmd_is(gcode_line, "G3"))) {
|
||||
// remove temporary lines, add lines M73 where needed
|
||||
|
@ -644,7 +644,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
|||
gcode_line.clear();
|
||||
}
|
||||
// Skip EOL.
|
||||
it = it_end;
|
||||
it = it_end;
|
||||
if (it != it_bufend && *it == '\r')
|
||||
++ it;
|
||||
if (it != it_bufend && *it == '\n')
|
||||
|
@ -1073,7 +1073,7 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (m_extruder_offsets.size() < m_result.extruders_count) {
|
||||
for (size_t i = m_extruder_offsets.size(); i < m_result.extruders_count; ++i) {
|
||||
m_extruder_offsets.emplace_back(DEFAULT_EXTRUDER_OFFSET);
|
||||
|
@ -1224,7 +1224,7 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
|||
m_spiral_vase_active = spiral_vase->value;
|
||||
|
||||
const ConfigOptionEnumGeneric *bed_type = config.option<ConfigOptionEnumGeneric>("curr_bed_type");
|
||||
if (bed_type != nullptr)
|
||||
if (bed_type != nullptr)
|
||||
m_result.bed_type = (BedType)bed_type->value;
|
||||
|
||||
}
|
||||
|
@ -1403,7 +1403,7 @@ void GCodeProcessor::initialize(const std::string& filename)
|
|||
void GCodeProcessor::process_buffer(const std::string &buffer)
|
||||
{
|
||||
//FIXME maybe cache GCodeLine gline to be over multiple parse_buffer() invocations.
|
||||
m_parser.parse_buffer(buffer, [this](GCodeReader&, const GCodeReader::GCodeLine& line) {
|
||||
m_parser.parse_buffer(buffer, [this](GCodeReader&, const GCodeReader::GCodeLine& line) {
|
||||
this->process_gcode_line(line, false);
|
||||
});
|
||||
}
|
||||
|
@ -1445,7 +1445,7 @@ void GCodeProcessor::finalize(bool post_process)
|
|||
else
|
||||
m_result.moves[i].layer_duration = 0;
|
||||
}
|
||||
|
||||
|
||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||
std::cout << "\n";
|
||||
m_mm3_per_mm_compare.output();
|
||||
|
@ -1601,7 +1601,7 @@ void GCodeProcessor::apply_config_simplify3d(const std::string& filename)
|
|||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
begin = skip_whitespaces(begin, end);
|
||||
end = remove_eols(begin, end);
|
||||
if (begin != end) {
|
||||
|
@ -1683,7 +1683,7 @@ void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line, bool
|
|||
case '2':
|
||||
case '3': { process_G2_G3(line); break; } // Move
|
||||
//BBS
|
||||
case 4: { process_G4(line); break; } // Delay
|
||||
case '4': { process_G4(line); break; } // Delay
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
|
@ -1883,7 +1883,7 @@ template<typename T>
|
|||
auto str_end = sv.data() + sv.size();
|
||||
auto [end_ptr, error_code] = std::from_chars(sv.data(), str_end, out);
|
||||
return error_code == std::errc() && end_ptr == str_end;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
|
@ -2174,7 +2174,7 @@ bool GCodeProcessor::process_producers_tags(const std::string_view comment)
|
|||
switch (m_producer)
|
||||
{
|
||||
case EProducer::Slic3rPE:
|
||||
case EProducer::Slic3r:
|
||||
case EProducer::Slic3r:
|
||||
case EProducer::SuperSlicer:
|
||||
case EProducer::BambuStudio: { return process_bambuslicer_tags(comment); }
|
||||
case EProducer::Cura: { return process_cura_tags(comment); }
|
||||
|
@ -2281,7 +2281,7 @@ bool GCodeProcessor::process_simplify3d_tags(const std::string_view comment)
|
|||
set_extrusion_role(erSkirt);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ; outer perimeter
|
||||
pos = cmt.find(" outer perimeter");
|
||||
if (pos == 0) {
|
||||
|
@ -2675,7 +2675,7 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
|
|||
type = (delta_pos[Z] == 0.0f) ? EMoveType::Unretract : EMoveType::Travel;
|
||||
else if (delta_pos[X] != 0.0f || delta_pos[Y] != 0.0f)
|
||||
type = EMoveType::Extrude;
|
||||
}
|
||||
}
|
||||
else if (delta_pos[X] != 0.0f || delta_pos[Y] != 0.0f || delta_pos[Z] != 0.0f)
|
||||
type = EMoveType::Travel;
|
||||
|
||||
|
@ -2873,7 +2873,7 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
|
|||
}
|
||||
|
||||
// calculates block acceleration
|
||||
float acceleration =
|
||||
float acceleration =
|
||||
(type == EMoveType::Travel) ? get_travel_acceleration(static_cast<PrintEstimatedStatistics::ETimeMode>(i)) :
|
||||
(is_extrusion_only_move(delta_pos) ?
|
||||
get_retract_acceleration(static_cast<PrintEstimatedStatistics::ETimeMode>(i)) :
|
||||
|
@ -3348,7 +3348,7 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line)
|
|||
}
|
||||
else if (a == Y || a == Z) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
float v_exit = prev.axis_feedrate[a];
|
||||
float v_entry = curr.axis_feedrate[a];
|
||||
|
@ -3571,7 +3571,7 @@ void GCodeProcessor::process_G92(const GCodeReader::GCodeLine& line)
|
|||
simulate_st_synchronize();
|
||||
|
||||
if (!any_found && !line.has_unknown_axis()) {
|
||||
// The G92 may be called for axes that PrusaSlicer does not recognize, for example see GH issue #3510,
|
||||
// The G92 may be called for axes that PrusaSlicer does not recognize, for example see GH issue #3510,
|
||||
// where G92 A0 B0 is called although the extruder axis is till E.
|
||||
for (unsigned char a = X; a <= E; ++a) {
|
||||
m_origin[a] = m_end_position[a];
|
||||
|
|
Loading…
Reference in New Issue