Skip to content

Commit

Permalink
Also apply precision and fixed to speed rewrite.
Browse files Browse the repository at this point in the history
  • Loading branch information
lordofhyphens committed Mar 31, 2019
1 parent 205cb02 commit 8cf8736
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ set(SLIC3R_TEST_SOURCES
${TESTDIR}/libslic3r/test_fill.cpp
${TESTDIR}/libslic3r/test_flow.cpp
${TESTDIR}/libslic3r/test_gcodewriter.cpp
${TESTDIR}/libslic3r/test_gcode.cpp
${TESTDIR}/libslic3r/test_geometry.cpp
${TESTDIR}/libslic3r/test_log.cpp
${TESTDIR}/libslic3r/test_model.cpp
Expand Down Expand Up @@ -544,6 +545,7 @@ if (SLIC3R_BUILD_TESTS)
endif()
configure_file("${TESTDIR}/test_options.hpp.in" "${TESTDIR}/test_options.hpp")
add_executable(slic3r_test ${SLIC3R_TEST_SOURCES})
target_compile_options(slic3r_test PUBLIC -DSLIC3R_TEST)
add_test(NAME TestSlic3r COMMAND slic3r_test)
target_compile_features(slic3r_test PUBLIC cxx_std_14)
target_include_directories(slic3r_test PUBLIC cxx_std_14 ${SLIC3R_INCLUDES})
Expand Down
3 changes: 2 additions & 1 deletion xs/src/libslic3r/GCode/CoolingBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ apply_speed_factor(std::string &line, float speed_factor, float min_print_speed)
// replace speed in string
{
std::ostringstream oss;
oss << speed;
oss.precision(3);
oss << std::fixed << speed;
line.replace(pos+1, (last_pos-pos), oss.str());
}
}
Expand Down
4 changes: 4 additions & 0 deletions xs/src/libslic3r/GCode/CoolingBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class CoolingBuffer {
float _min_print_speed;
};

#ifdef SLIC3R_TEST
void apply_speed_factor(std::string &line, float speed_factor, float min_print_speed);
#endif

}

#endif

0 comments on commit 8cf8736

Please sign in to comment.