Junction Deviation Machine Limit (#9234)

* Junction Deviation Machine Limit

jd 3

JD menu 2

JD operativo

limpieza

final

* default JD print menu without warnings

* to fix multiple instances

* Only at first layer

* Calibs upgrade

* Shown on Marlin2

Shown on Marlin2
CodeCleaning

* Update Calibration.md

* set on writer

---------

Co-authored-by: Ian Bassi <ian.bassi@outlook.com>
This commit is contained in:
Rodrigo 2025-04-15 10:49:17 -03:00 committed by GitHub
parent 035b047fef
commit 8cdc9c02df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 82 additions and 20 deletions

View file

@ -37,6 +37,7 @@ void GCodeWriter::apply_print_config(const PrintConfig &print_config)
if (use_mach_limits) {
m_max_jerk_x = std::lrint(print_config.machine_max_jerk_x.values.front());
m_max_jerk_y = std::lrint(print_config.machine_max_jerk_y.values.front());
m_max_junction_deviation = (print_config.machine_max_junction_deviation.values.front());
};
m_max_jerk_z = print_config.machine_max_jerk_z.values.front();
m_max_jerk_e = print_config.machine_max_jerk_e.values.front();
@ -315,14 +316,22 @@ std::string GCodeWriter::set_accel_and_jerk(unsigned int acceleration, double je
std::string GCodeWriter::set_junction_deviation(double junction_deviation){
std::ostringstream gcode;
if (FLAVOR_IS_NOT(gcfMarlinFirmware)) {
throw std::runtime_error("Junction deviation is only supported by Marlin firmware");
if (FLAVOR_IS(gcfMarlinFirmware) && junction_deviation > 0 && m_max_junction_deviation > 0) {
// Clamp the junction deviation to the allowed maximum.
gcode << "M205 J";
if (junction_deviation <= m_max_junction_deviation) {
gcode << std::fixed << std::setprecision(3) << junction_deviation;
} else {
gcode << std::fixed << std::setprecision(3) << m_max_junction_deviation;
}
if (GCodeWriter::full_gcode_comment) {
gcode << " ; Junction Deviation";
}
gcode << "\n";
}
gcode << "M205 J" << std::fixed << std::setprecision(3) << junction_deviation << " ; Junction Deviation\n";
return gcode.str();
}
std::string GCodeWriter::set_pressure_advance(double pa) const
{
std::ostringstream gcode;