ENABLE_GIT_3010_FIX set as default

This commit is contained in:
Enrico Turri 2019-10-14 10:03:27 +02:00
parent 76c9ddfd3e
commit 658b1e219e
5 changed files with 0 additions and 139 deletions

View File

@ -141,9 +141,7 @@ void GCodeAnalyzer::reset()
_set_start_extrusion(DEFAULT_START_EXTRUSION);
_set_fan_speed(DEFAULT_FAN_SPEED);
_reset_axes_position();
#if ENABLE_GIT_3010_FIX
_reset_axes_origin();
#endif // ENABLE_GIT_3010_FIX
_reset_cached_position();
m_moves_map.clear();
@ -313,24 +311,8 @@ void GCodeAnalyzer::_process_gcode_line(GCodeReader&, const GCodeReader::GCodeLi
m_process_output += line.raw() + "\n";
}
#if !ENABLE_GIT_3010_FIX
// Returns the new absolute position on the given axis in dependence of the given parameters
float axis_absolute_position_from_G1_line(GCodeAnalyzer::EAxis axis, const GCodeReader::GCodeLine& lineG1, GCodeAnalyzer::EUnits units, bool is_relative, float current_absolute_position)
{
float lengthsScaleFactor = (units == GCodeAnalyzer::Inches) ? INCHES_TO_MM : 1.0f;
if (lineG1.has(Slic3r::Axis(axis)))
{
float ret = lineG1.value(Slic3r::Axis(axis)) * lengthsScaleFactor;
return is_relative ? current_absolute_position + ret : ret;
}
else
return current_absolute_position;
}
#endif // !ENABLE_GIT_3010_FIX
void GCodeAnalyzer::_processG1(const GCodeReader::GCodeLine& line)
{
#if ENABLE_GIT_3010_FIX
auto axis_absolute_position = [this](GCodeAnalyzer::EAxis axis, const GCodeReader::GCodeLine& lineG1) -> float
{
float current_absolute_position = _get_axis_position(axis);
@ -349,26 +331,12 @@ void GCodeAnalyzer::_processG1(const GCodeReader::GCodeLine& line)
else
return current_absolute_position;
};
#endif // ENABLE_GIT_3010_FIX
// updates axes positions from line
#if !ENABLE_GIT_3010_FIX
EUnits units = _get_units();
#endif // !ENABLE_GIT_3010_FIX
float new_pos[Num_Axis];
for (unsigned char a = X; a < Num_Axis; ++a)
{
#if !ENABLE_GIT_3010_FIX
bool is_relative = (_get_global_positioning_type() == Relative);
if (a == E)
is_relative |= (_get_e_local_positioning_type() == Relative);
#endif // !ENABLE_GIT_3010_FIX
#if ENABLE_GIT_3010_FIX
new_pos[a] = axis_absolute_position((EAxis)a, line);
#else
new_pos[a] = axis_absolute_position_from_G1_line((EAxis)a, line, units, is_relative, _get_axis_position((EAxis)a));
#endif // ENABLE_GIT_3010_FIX
}
// updates feedrate from line, if present
@ -458,41 +426,25 @@ void GCodeAnalyzer::_processG92(const GCodeReader::GCodeLine& line)
if (line.has_x())
{
#if ENABLE_GIT_3010_FIX
_set_axis_origin(X, _get_axis_position(X) - line.x() * lengthsScaleFactor);
#else
_set_axis_position(X, line.x() * lengthsScaleFactor);
#endif // ENABLE_GIT_3010_FIX
anyFound = true;
}
if (line.has_y())
{
#if ENABLE_GIT_3010_FIX
_set_axis_origin(Y, _get_axis_position(Y) - line.y() * lengthsScaleFactor);
#else
_set_axis_position(Y, line.y() * lengthsScaleFactor);
#endif // ENABLE_GIT_3010_FIX
anyFound = true;
}
if (line.has_z())
{
#if ENABLE_GIT_3010_FIX
_set_axis_origin(Z, _get_axis_position(Z) - line.z() * lengthsScaleFactor);
#else
_set_axis_position(Z, line.z() * lengthsScaleFactor);
#endif // ENABLE_GIT_3010_FIX
anyFound = true;
}
if (line.has_e())
{
#if ENABLE_GIT_3010_FIX
_set_axis_origin(E, _get_axis_position(E) - line.e() * lengthsScaleFactor);
#else
_set_axis_position(E, line.e() * lengthsScaleFactor);
#endif // ENABLE_GIT_3010_FIX
anyFound = true;
}
@ -500,11 +452,7 @@ void GCodeAnalyzer::_processG92(const GCodeReader::GCodeLine& line)
{
for (unsigned char a = X; a < Num_Axis; ++a)
{
#if ENABLE_GIT_3010_FIX
_set_axis_origin((EAxis)a, _get_axis_position((EAxis)a));
#else
_set_axis_position((EAxis)a, 0.0f);
#endif // ENABLE_GIT_3010_FIX
}
}
}
@ -835,7 +783,6 @@ float GCodeAnalyzer::_get_axis_position(EAxis axis) const
return m_state.position[axis];
}
#if ENABLE_GIT_3010_FIX
void GCodeAnalyzer::_set_axis_origin(EAxis axis, float position)
{
m_state.origin[axis] = position;
@ -845,19 +792,16 @@ float GCodeAnalyzer::_get_axis_origin(EAxis axis) const
{
return m_state.origin[axis];
}
#endif // ENABLE_GIT_3010_FIX
void GCodeAnalyzer::_reset_axes_position()
{
::memset((void*)m_state.position, 0, Num_Axis * sizeof(float));
}
#if ENABLE_GIT_3010_FIX
void GCodeAnalyzer::_reset_axes_origin()
{
::memset((void*)m_state.origin, 0, Num_Axis * sizeof(float));
}
#endif // ENABLE_GIT_3010_FIX
void GCodeAnalyzer::_set_start_position(const Vec3d& position)
{

View File

@ -101,9 +101,7 @@ private:
float cached_position[5];
float start_extrusion;
float position[Num_Axis];
#if ENABLE_GIT_3010_FIX
float origin[Num_Axis];
#endif // ENABLE_GIT_3010_FIX
unsigned int cur_cp_color_id = 0;
};
@ -249,17 +247,13 @@ private:
void _set_axis_position(EAxis axis, float position);
float _get_axis_position(EAxis axis) const;
#if ENABLE_GIT_3010_FIX
void _set_axis_origin(EAxis axis, float position);
float _get_axis_origin(EAxis axis) const;
#endif // ENABLE_GIT_3010_FIX
// Sets axes position to zero
void _reset_axes_position();
#if ENABLE_GIT_3010_FIX
// Sets origin position to zero
void _reset_axes_origin();
#endif // ENABLE_GIT_3010_FIX
void _set_start_position(const Vec3d& position);
const Vec3d& _get_start_position() const;

View File

@ -318,23 +318,16 @@ namespace Slic3r {
assert((g1_line_id >= (int)data->g1_line_ids.size()) || (data->g1_line_ids[g1_line_id].first >= g1_lines_count));
const Block* block = nullptr;
#if ENABLE_GIT_3010_FIX
if (g1_line_id < (int)data->g1_line_ids.size())
{
const G1LineIdToBlockId& map_item = data->g1_line_ids[g1_line_id];
if (map_item.first == g1_lines_count)
#else
const G1LineIdToBlockId& map_item = data->g1_line_ids[g1_line_id];
if ((g1_line_id < (int)data->g1_line_ids.size()) && (map_item.first == g1_lines_count))
#endif // ENABLE_GIT_3010_FIX
{
if (line.has_e() && (map_item.second < (unsigned int)data->blocks.size()))
block = &data->blocks[map_item.second];
++g1_line_id;
}
#if ENABLE_GIT_3010_FIX
}
#endif // ENABLE_GIT_3010_FIX
if ((block != nullptr) && (block->elapsed_time != -1.0f))
{
@ -422,12 +415,10 @@ namespace Slic3r {
m_state.axis[axis].position = position;
}
#if ENABLE_GIT_3010_FIX
void GCodeTimeEstimator::set_axis_origin(EAxis axis, float position)
{
m_state.axis[axis].origin = position;
}
#endif // ENABLE_GIT_3010_FIX
void GCodeTimeEstimator::set_axis_max_feedrate(EAxis axis, float feedrate_mm_sec)
{
@ -449,12 +440,10 @@ namespace Slic3r {
return m_state.axis[axis].position;
}
#if ENABLE_GIT_3010_FIX
float GCodeTimeEstimator::get_axis_origin(EAxis axis) const
{
return m_state.axis[axis].origin;
}
#endif // ENABLE_GIT_3010_FIX
float GCodeTimeEstimator::get_axis_max_feedrate(EAxis axis) const
{
@ -782,11 +771,9 @@ namespace Slic3r {
set_axis_position(X, 0.0f);
set_axis_position(Y, 0.0f);
set_axis_position(Z, 0.0f);
#if ENABLE_GIT_3010_FIX
set_axis_origin(X, 0.0f);
set_axis_origin(Y, 0.0f);
set_axis_origin(Z, 0.0f);
#endif // ENABLE_GIT_3010_FIX
if (get_e_local_positioning_type() == Absolute)
set_axis_position(E, 0.0f);
@ -984,24 +971,8 @@ namespace Slic3r {
}
}
#if !ENABLE_GIT_3010_FIX
// Returns the new absolute position on the given axis in dependence of the given parameters
float axis_absolute_position_from_G1_line(GCodeTimeEstimator::EAxis axis, const GCodeReader::GCodeLine& lineG1, GCodeTimeEstimator::EUnits units, bool is_relative, float current_absolute_position)
{
float lengthsScaleFactor = (units == GCodeTimeEstimator::Inches) ? INCHES_TO_MM : 1.0f;
if (lineG1.has(Slic3r::Axis(axis)))
{
float ret = lineG1.value(Slic3r::Axis(axis)) * lengthsScaleFactor;
return is_relative ? current_absolute_position + ret : ret;
}
else
return current_absolute_position;
}
#endif // !ENABLE_GIT_3010_FIX
void GCodeTimeEstimator::_processG1(const GCodeReader::GCodeLine& line)
{
#if ENABLE_GIT_3010_FIX
auto axis_absolute_position = [this](GCodeTimeEstimator::EAxis axis, const GCodeReader::GCodeLine& lineG1) -> float
{
float current_absolute_position = get_axis_position(axis);
@ -1020,29 +991,15 @@ namespace Slic3r {
else
return current_absolute_position;
};
#endif // ENABLE_GIT_3010_FIX
PROFILE_FUNC();
increment_g1_line_id();
// updates axes positions from line
#if !ENABLE_GIT_3010_FIX
EUnits units = get_units();
#endif // !ENABLE_GIT_3010_FIX
float new_pos[Num_Axis];
for (unsigned char a = X; a < Num_Axis; ++a)
{
#if !ENABLE_GIT_3010_FIX
bool is_relative = (get_global_positioning_type() == Relative);
if (a == E)
is_relative |= (get_e_local_positioning_type() == Relative);
#endif // !ENABLE_GIT_3010_FIX
#if ENABLE_GIT_3010_FIX
new_pos[a] = axis_absolute_position((EAxis)a, line);
#else
new_pos[a] = axis_absolute_position_from_G1_line((EAxis)a, line, units, is_relative, get_axis_position((EAxis)a));
#endif // !ENABLE_GIT_3010_FIX
}
// updates feedrate from line, if present
@ -1286,41 +1243,25 @@ namespace Slic3r {
if (line.has_x())
{
#if ENABLE_GIT_3010_FIX
set_axis_origin(X, get_axis_position(X) - line.x() * lengthsScaleFactor);
#else
set_axis_position(X, line.x() * lengthsScaleFactor);
#endif // ENABLE_GIT_3010_FIX
anyFound = true;
}
if (line.has_y())
{
#if ENABLE_GIT_3010_FIX
set_axis_origin(Y, get_axis_position(Y) - line.y() * lengthsScaleFactor);
#else
set_axis_position(Y, line.y() * lengthsScaleFactor);
#endif // ENABLE_GIT_3010_FIX
anyFound = true;
}
if (line.has_z())
{
#if ENABLE_GIT_3010_FIX
set_axis_origin(Z, get_axis_position(Z) - line.z() * lengthsScaleFactor);
#else
set_axis_position(Z, line.z() * lengthsScaleFactor);
#endif // ENABLE_GIT_3010_FIX
anyFound = true;
}
if (line.has_e())
{
#if ENABLE_GIT_3010_FIX
set_axis_origin(E, get_axis_position(E) - line.e() * lengthsScaleFactor);
#else
set_axis_position(E, line.e() * lengthsScaleFactor);
#endif // ENABLE_GIT_3010_FIX
anyFound = true;
}
else
@ -1330,11 +1271,7 @@ namespace Slic3r {
{
for (unsigned char a = X; a < Num_Axis; ++a)
{
#if ENABLE_GIT_3010_FIX
set_axis_origin((EAxis)a, get_axis_position((EAxis)a));
#else
set_axis_position((EAxis)a, 0.0f);
#endif // ENABLE_GIT_3010_FIX
}
}
}

View File

@ -55,9 +55,7 @@ namespace Slic3r {
struct Axis
{
float position; // mm
#if ENABLE_GIT_3010_FIX
float origin; // mm
#endif // ENABLE_GIT_3010_FIX
float max_feedrate; // mm/s
float max_acceleration; // mm/s^2
float max_jerk; // mm/s
@ -285,10 +283,8 @@ namespace Slic3r {
// Set current position on the given axis with the given value
void set_axis_position(EAxis axis, float position);
#if ENABLE_GIT_3010_FIX
// Set current origin on the given axis with the given value
void set_axis_origin(EAxis axis, float position);
#endif // ENABLE_GIT_3010_FIX
void set_axis_max_feedrate(EAxis axis, float feedrate_mm_sec);
void set_axis_max_acceleration(EAxis axis, float acceleration);
@ -296,10 +292,8 @@ namespace Slic3r {
// Returns current position on the given axis
float get_axis_position(EAxis axis) const;
#if ENABLE_GIT_3010_FIX
// Returns current origin on the given axis
float get_axis_origin(EAxis axis) const;
#endif // ENABLE_GIT_3010_FIX
float get_axis_max_feedrate(EAxis axis) const;
float get_axis_max_acceleration(EAxis axis) const;

View File

@ -32,12 +32,4 @@
#define ENABLE_NONCUSTOM_DATA_VIEW_RENDERING (0 && ENABLE_1_42_0_ALPHA1)
//===================
// 2.2.0.alpha1 techs
//===================
#define ENABLE_2_2_0_ALPHA1 1
// Fixes git issue 3010
#define ENABLE_GIT_3010_FIX (1 && ENABLE_2_2_0_ALPHA1)
#endif // _technologies_h_