Skip to content

Commit

Permalink
Replace current_arc when aborted via firmware compensation.
Browse files Browse the repository at this point in the history
  • Loading branch information
FormerLurker committed Nov 30, 2020
1 parent 356e87a commit 8cbd08c
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 13 deletions.
3 changes: 2 additions & 1 deletion ArcWelder/segmented_arc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ bool segmented_arc::try_add_point_internal_(point p, double pd)
points_.push_back(p);
double previous_shape_length = original_shape_length_;
original_shape_length_ += pd;

arc original_arc = current_arc_;
if (arc::try_create_arc(points_, current_arc_, original_shape_length_, max_radius_mm_, resolution_mm_, path_tolerance_percent_, min_arc_segments_, mm_per_arc_segment_, xyz_precision_, allow_3d_arcs_))
{
// See how many arcs will be interpolated
Expand All @@ -223,6 +223,7 @@ bool segmented_arc::try_add_point_internal_(point p, double pd)
num_segments = (int)std::floor(circumference / original_shape_length_);
if (num_segments < min_arc_segments_) {
firmware_corrected = true;
current_arc_ = original_arc;
num_firmware_compensations_++;
}
}
Expand Down
2 changes: 1 addition & 1 deletion ArcWelder/segmented_shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ bool arc::try_create_arc(
// We may be traveling in 3 space, calculate the arc_length of the spiral
if (start_point.z != end_point.z)
{
test_arc_length = utilities::hypot(arc_length, end_point.z - start_point.z);
test_arc_length = utilities::hypot(test_arc_length, end_point.z - start_point.z);
}
}
difference = (test_arc_length - approximate_length) / approximate_length;
Expand Down
4 changes: 2 additions & 2 deletions ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(SolutionDir)\GcodeProcessorLib\;$(SolutionDir)\ArcWelder\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<IncludePath>$(SolutionDir)\GcodeProcessorLib\;$(SolutionDir)\ArcWelder\;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\TCLAP\</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Remote_Pi|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(SolutionDir)\GcodeProcessorLib\;$(SolutionDir)\ArcWelder\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<IncludePath>$(SolutionDir)\GcodeProcessorLib\;$(SolutionDir)\ArcWelder\;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\TCLAP\</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
Expand Down
17 changes: 9 additions & 8 deletions ArcWelderTest/ArcWelderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,15 @@ static gcode_position_args get_5_extruder_position_args()

static void TestAntiStutter(std::string filePath)
{
double max_resolution = DEFAULT_RESOLUTION_MM;
//double max_resolution = 1;
double max_radius_mm = DEFAULT_MAX_RADIUS_MM;
//double max_resolution = DEFAULT_RESOLUTION_MM;
double max_resolution = 0.05;
double max_radius_mm = 100000;
//int min_arc_segments = DEFAULT_MIN_ARC_SEGMENTS;
int min_arc_segments = 24;
int min_arc_segments = 12;
double mm_per_arc_segment = 1;

double path_tolerance_percent = ARC_LENGTH_PERCENT_TOLERANCE_DEFAULT; // 1 percent
//double path_tolerance_percent = ARC_LENGTH_PERCENT_TOLERANCE_DEFAULT; // 1 percent
double path_tolerance_percent = 0.05;
//double path_tolerance_percent = 0.05;
std::vector<std::string> logger_names;
logger_names.push_back("arc_welder.gcode_conversion");
Expand All @@ -253,12 +254,12 @@ static void TestAntiStutter(std::string filePath)
logger_levels.push_back(log_levels::ERROR);
logger_levels.push_back(log_levels::CRITICAL);
logger* p_logger = new logger(logger_names, logger_levels);
//p_logger->set_log_level(INFO);
p_logger->set_log_level_by_value(5);
p_logger->set_log_level(INFO);
//p_logger->set_log_level_by_value(5);
//arc_welder arc_welder_obj(BENCHY_0_5_MM_NO_WIPE, "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\test_output.gcode", p_logger, max_resolution, false, 50, static_cast<progress_callback>(on_progress));
//arc_welder arc_welder_obj(SIX_SPEED_TEST, "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\test_output.gcode", p_logger, max_resolution, false, 50, on_progress);
arc_welder arc_welder_obj(
BENCHY_MIN_RADIUS_TEST,
ISSUE_85,
"C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\test_output.gcode",
p_logger,
max_resolution,
Expand Down
1 change: 1 addition & 0 deletions ArcWelderTest/ArcWelderTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ static std::string SPIRAL_VASE_TEST_PI_BOWL = "C:\\Users\\Brad\\Documents\\3DPri

static std::string FIRMWARE_COMPENSATION_TEST_1 = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\cylinder_tests\\cylinder_test_0.1_5.0_0.1.gcode";
static std::string BENCHY_MIN_RADIUS_TEST = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\BenchyMinRadiusTest.gcode";
static std::string ISSUE_85 = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\Issue85.gcode";



Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
option(USE_CXX_EXCEPTIONS "Enable C++ exception support" ON)

# Add -O0 to remove optimizations when using gcc
IF(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
ENDIF(CMAKE_COMPILER_IS_GNUCC)

# add a definition so our libraries know that the version info is available
add_definitions("-DHAS_GENERATED_VERSION")
# include the generated header.
Expand Down
2 changes: 1 addition & 1 deletion CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux_arm" ],
"remoteMachineName": "${defaultRemoteMachineName}",
"remoteMachineName": "1047335263;Tako3 (username=pi, port=22, authentication=Password)",
"remoteCMakeListsRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/src",
"remoteBuildRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/out/build/${name}",
"remoteInstallRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/out/install/${name}",
Expand Down

0 comments on commit 8cbd08c

Please sign in to comment.