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>2020-12-28 02:02:04 +0300
committerFormerLurker <hochgebe@gmail.com>2020-12-28 02:02:04 +0300
commitb0ffde1402a0fe3b1fd448bd00f0a18a0050d678 (patch)
tree51ee5a3f937147ace7c56ff02f4cd3e19bc813f2 /GcodeProcessorLib
parentd3376dd37104846f9125c06bfd42807e21859351 (diff)
Implement #29
Diffstat (limited to 'GcodeProcessorLib')
-rw-r--r--GcodeProcessorLib/gcode_position.cpp9
-rw-r--r--GcodeProcessorLib/utilities.cpp4
2 files changed, 10 insertions, 3 deletions
diff --git a/GcodeProcessorLib/gcode_position.cpp b/GcodeProcessorLib/gcode_position.cpp
index 3ba1514..fc469cd 100644
--- a/GcodeProcessorLib/gcode_position.cpp
+++ b/GcodeProcessorLib/gcode_position.cpp
@@ -925,10 +925,12 @@ void gcode_position::process_g2(position* pos, parsed_command& cmd)
{
bool update_x = false;
bool update_y = false;
+ bool update_z = false;
bool update_e = false;
bool update_f = false;
double x = 0;
double y = 0;
+ double z = 0;
double e = 0;
double f = 0;
for (unsigned int index = 0; index < cmd.parameters.size(); index++)
@@ -944,6 +946,11 @@ void gcode_position::process_g2(position* pos, parsed_command& cmd)
update_y = true;
y = p_cur_param.double_value;
}
+ else if (p_cur_param.name == "Z")
+ {
+ update_z = true;
+ z = p_cur_param.double_value;
+ }
else if (p_cur_param.name == "E")
{
update_e = true;
@@ -955,7 +962,7 @@ void gcode_position::process_g2(position* pos, parsed_command& cmd)
f = p_cur_param.double_value;
}
}
- update_position(pos, x, update_x, y, update_y, 0, false, e, update_e, f, update_f, false, true);
+ update_position(pos, x, update_x, y, update_y, z, update_z, e, update_e, f, update_f, false, true);
}
void gcode_position::process_g3(position* pos, parsed_command& cmd)
diff --git a/GcodeProcessorLib/utilities.cpp b/GcodeProcessorLib/utilities.cpp
index d98e639..dbe23fb 100644
--- a/GcodeProcessorLib/utilities.cpp
+++ b/GcodeProcessorLib/utilities.cpp
@@ -32,7 +32,7 @@ const bool utilities::GUID_DASHES[] = { 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0
bool utilities::is_zero(double x, double tolerance)
{
- return std::abs(x) < tolerance;
+ return std::fabs(x) < tolerance;
}
int utilities::round_up_to_int(double x, double tolerance)
@@ -42,7 +42,7 @@ int utilities::round_up_to_int(double x, double tolerance)
bool utilities::is_equal(double x, double y, double tolerance)
{
- double abs_difference = std::abs(x - y);
+ double abs_difference = std::fabs(x - y);
return abs_difference < tolerance;
}