From 8cbd08c6c27bb792d28345d24ffc7a7765c35079 Mon Sep 17 00:00:00 2001 From: FormerLurker Date: Mon, 30 Nov 2020 11:33:11 -0600 Subject: Replace current_arc when aborted via firmware compensation. --- ArcWelder/segmented_arc.cpp | 3 ++- ArcWelder/segmented_shape.cpp | 2 +- .../ArcWelderInverseProcessor.vcxproj | 4 ++-- ArcWelderTest/ArcWelderTest.cpp | 17 +++++++++-------- ArcWelderTest/ArcWelderTest.h | 1 + CMakeLists.txt | 6 ++++++ CMakeSettings.json | 2 +- 7 files changed, 22 insertions(+), 13 deletions(-) diff --git a/ArcWelder/segmented_arc.cpp b/ArcWelder/segmented_arc.cpp index 9f02049..c92809f 100644 --- a/ArcWelder/segmented_arc.cpp +++ b/ArcWelder/segmented_arc.cpp @@ -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 @@ -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_++; } } diff --git a/ArcWelder/segmented_shape.cpp b/ArcWelder/segmented_shape.cpp index d9041eb..65995b4 100644 --- a/ArcWelder/segmented_shape.cpp +++ b/ArcWelder/segmented_shape.cpp @@ -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; diff --git a/ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj b/ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj index f3afd41..08f2524 100644 --- a/ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj +++ b/ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj @@ -97,11 +97,11 @@ true - $(SolutionDir)\GcodeProcessorLib\;$(SolutionDir)\ArcWelder\;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(SolutionDir)\GcodeProcessorLib\;$(SolutionDir)\ArcWelder\;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\TCLAP\ true - $(SolutionDir)\GcodeProcessorLib\;$(SolutionDir)\ArcWelder\;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(SolutionDir)\GcodeProcessorLib\;$(SolutionDir)\ArcWelder\;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\TCLAP\ true diff --git a/ArcWelderTest/ArcWelderTest.cpp b/ArcWelderTest/ArcWelderTest.cpp index 4b893cb..ab33d83 100644 --- a/ArcWelderTest/ArcWelderTest.cpp +++ b/ArcWelderTest/ArcWelderTest.cpp @@ -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 logger_names; logger_names.push_back("arc_welder.gcode_conversion"); @@ -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(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, diff --git a/ArcWelderTest/ArcWelderTest.h b/ArcWelderTest/ArcWelderTest.h index ea3fdf9..e6d843a 100644 --- a/ArcWelderTest/ArcWelderTest.h +++ b/ArcWelderTest/ArcWelderTest.h @@ -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"; diff --git a/CMakeLists.txt b/CMakeLists.txt index b2a7831..3140c3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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. diff --git a/CMakeSettings.json b/CMakeSettings.json index 009eb97..08f94ad 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -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}", -- cgit v1.2.3