mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-05 17:17:42 +00:00
Input Shaping Damping
Damping Fix spanish comments
This commit is contained in:
@@ -3768,8 +3768,15 @@ LayerResult GCode::process_layer(
|
||||
writer().config.apply(_cfg);
|
||||
sprintf(buf, "; Calib_Retraction_tower: Z_HEIGHT: %g, length:%g\n", print_z, _length);
|
||||
gcode += buf;
|
||||
} else if (print.calib_mode() == CalibMode::Calib_Input_shaping) {
|
||||
gcode += writer().set_input_shaping(m_layer_index < 2 ? 0.f : (print.calib_params().start) + ((print.calib_params().end)-(print.calib_params().start)) * (m_layer_index - 2) / (m_layer_count - 3), (print.calib_params().step));
|
||||
} else if (print.calib_mode() == CalibMode::Calib_Input_shaping_freq) {
|
||||
gcode += writer().set_input_shaping('A', print.calib_params().step, m_layer_index < 2 ? 0.f : (print.calib_params().start) + ((print.calib_params().end)-(print.calib_params().start)) * (m_layer_index - 2) / (m_layer_count - 3));
|
||||
} else if (print.calib_mode() == CalibMode::Calib_Input_shaping_damp) {
|
||||
if (m_layer_index == 1){
|
||||
gcode += writer().set_input_shaping('X', 0.f, print.calib_params().start);
|
||||
gcode += writer().set_input_shaping('Y', 0.f, print.calib_params().end);
|
||||
} else {
|
||||
gcode += writer().set_input_shaping('A', float(m_layer_index) / float(m_layer_count), 0.f);
|
||||
}
|
||||
}
|
||||
|
||||
//BBS
|
||||
|
||||
@@ -333,21 +333,29 @@ std::string GCodeWriter::set_pressure_advance(double pa) const
|
||||
return gcode.str();
|
||||
}
|
||||
|
||||
std::string GCodeWriter::set_input_shaping(float freq, float damp) const
|
||||
std::string GCodeWriter::set_input_shaping(char axis, float damp, float freq) const
|
||||
{
|
||||
std::ostringstream gcode;
|
||||
if (FLAVOR_IS(gcfKlipper))
|
||||
{
|
||||
throw std::runtime_error("M593 - ZV Input Shaping is NOT supported by Klipper");
|
||||
}
|
||||
if (freq < 0.0f || damp < 0.f || damp > 1.0f)
|
||||
if (freq < 0.0f || damp < 0.f || damp > 1.0f || (axis != 'X' && axis != 'Y' && axis != 'Z' && axis != 'A'))// A = all axis
|
||||
{
|
||||
throw std::runtime_error("Invalid input shaping parameters: freq=" + std::to_string(freq) + ", damp=" + std::to_string(damp));
|
||||
}
|
||||
gcode << "M593 F" << freq;
|
||||
if (damp != 0.0f)
|
||||
gcode << "M593";
|
||||
if (axis != 'A')
|
||||
{
|
||||
gcode << " D" << damp;
|
||||
gcode << " " << axis;
|
||||
}
|
||||
if (freq > 0.0f)
|
||||
{
|
||||
gcode << " F" << std::fixed << std::setprecision(2) << freq;
|
||||
}
|
||||
if (damp > 0.0f)
|
||||
{
|
||||
gcode << " D" << std::fixed << std::setprecision(2) << damp;
|
||||
}
|
||||
gcode << "; Override input shaping value\n";
|
||||
return gcode.str();
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
// Orca: set acceleration and jerk in one command for Klipper
|
||||
std::string set_accel_and_jerk(unsigned int acceleration, double jerk);
|
||||
std::string set_pressure_advance(double pa) const;
|
||||
std::string set_input_shaping(float freq, float damp) const;
|
||||
std::string set_input_shaping(char axis, float damp, float freq) const;
|
||||
std::string reset_e(bool force = false);
|
||||
std::string update_progress(unsigned int num, unsigned int tot, bool allow_100 = false) const;
|
||||
// return false if this extruder was already selected
|
||||
|
||||
@@ -22,7 +22,8 @@ enum class CalibMode : int {
|
||||
Calib_Vol_speed_Tower,
|
||||
Calib_VFA_Tower,
|
||||
Calib_Retraction_tower,
|
||||
Calib_Input_shaping
|
||||
Calib_Input_shaping_freq,
|
||||
Calib_Input_shaping_damp
|
||||
};
|
||||
|
||||
enum class CalibState { Start = 0, Preset, Calibration, CoarseSave, FineCalibration, Save, Finish };
|
||||
@@ -31,13 +32,13 @@ struct Calib_Params
|
||||
{
|
||||
Calib_Params() : mode(CalibMode::Calib_None){};
|
||||
double start, end, step;
|
||||
bool print_numbers;
|
||||
bool print_numbers;
|
||||
|
||||
std::vector<double> accelerations;
|
||||
std::vector<double> speeds;
|
||||
|
||||
CalibMode mode;
|
||||
};
|
||||
};
|
||||
|
||||
enum FlowRatioCalibrationType {
|
||||
COMPLETE_CALIBRATION = 0,
|
||||
|
||||
Reference in New Issue
Block a user