Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FormerLurker/ArcWelderLib.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFormerLurker <hochgebe@gmail.com>2021-03-28 19:48:09 +0300
committerFormerLurker <hochgebe@gmail.com>2021-03-28 19:48:09 +0300
commit65768d59a9ed785ddb740fc6df67d2912d2a5bdf (patch)
tree9f63c36e347259d5d03ef8e3b8bea7c258c8c668
parent3649ab7fe0ff3ad61769d7c311bc052bedf2f098 (diff)
Fix relative extrusion for #49.
-rw-r--r--ArcWelderInverseProcessor/inverse_processor.cpp5
-rw-r--r--ArcWelderInverseProcessor/inverse_processor.h1
2 files changed, 5 insertions, 1 deletions
diff --git a/ArcWelderInverseProcessor/inverse_processor.cpp b/ArcWelderInverseProcessor/inverse_processor.cpp
index c2f0b4d..c6edb6f 100644
--- a/ArcWelderInverseProcessor/inverse_processor.cpp
+++ b/ArcWelderInverseProcessor/inverse_processor.cpp
@@ -60,6 +60,7 @@ inverse_processor::inverse_processor(std::string source_path, std::string target
target_path_ = target_path;
p_source_position_ = new gcode_position(get_args_(g90_g91_influences_extruder, buffer_size));
cs_ = cs;
+ offset_absolute_e_ = 0;
// ** Gloabal Variable Definition **
// 20200417 - FormerLurker - Declare two globals and pre-calculate some values that will reduce the
// amount of trig funcitons we need to call while printing. For the price of having two globals we
@@ -200,6 +201,7 @@ void inverse_processor::process()
float radius = hypot(offset[X_AXIS], offset[Y_AXIS]); // Compute arc radius for mc_arc
uint8_t isclockwise = cmd.command == "G2" ? 1 : 0;
output_relative_ = p_cur_pos->is_extruder_relative;
+ offset_absolute_e_ = p_pre_pos->get_current_extruder().get_offset_e();
mc_arc(position, target, offset, static_cast<float>(p_cur_pos->f), radius, isclockwise, 0);
}
else
@@ -425,7 +427,8 @@ void inverse_processor::plan_buffer_line(float x, float y, bool has_z, float z,
double output_e = e;
if (previous_pos->is_extruder_relative)
{
- output_e = e - previous_pos->get_current_extruder().get_offset_e();
+ output_e = e - offset_absolute_e_;
+ offset_absolute_e_ = e;
}
stream << std::setprecision(5) << " E" << output_e;
diff --git a/ArcWelderInverseProcessor/inverse_processor.h b/ArcWelderInverseProcessor/inverse_processor.h
index 42dd8bc..ab33133 100644
--- a/ArcWelderInverseProcessor/inverse_processor.h
+++ b/ArcWelderInverseProcessor/inverse_processor.h
@@ -77,6 +77,7 @@ private:
gcode_position* p_source_position_;
std::ofstream output_file_;
bool output_relative_;
+ double offset_absolute_e_;
float arc_max_radius_threshold;
//float arc_min_radius_threshold;
float total_e_adjustment;