Minor tweaks in machine limits handling:
- renamed some variables so the names are not misleading - improved readability a bit - disabled silent mode for RRF (it was apparently enabled by mistake) - set default value of machine_limits_usage to TimeEstimateOnly
This commit is contained in:
parent
bfb721f302
commit
f3e14865e5
@ -1685,9 +1685,10 @@ static bool custom_gcode_sets_temperature(const std::string &gcode, const int mc
|
||||
// Do not process this piece of G-code by the time estimator, it already knows the values through another sources.
|
||||
void GCode::print_machine_envelope(GCodeOutputStream &file, Print &print)
|
||||
{
|
||||
if ((print.config().gcode_flavor.value == gcfMarlinLegacy || print.config().gcode_flavor.value == gcfMarlinFirmware || print.config().gcode_flavor.value == gcfRepRapFirmware)
|
||||
const GCodeFlavor flavor = print.config().gcode_flavor.value;
|
||||
if ( (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware || flavor == gcfRepRapFirmware)
|
||||
&& print.config().machine_limits_usage.value == MachineLimitsUsage::EmitToGCode) {
|
||||
int factor = print.config().gcode_flavor.value == gcfRepRapFirmware ? 60 : 1; // RRF M203 and M566 are in mm/min
|
||||
int factor = flavor == gcfRepRapFirmware ? 60 : 1; // RRF M203 and M566 are in mm/min
|
||||
file.write_format("M201 X%d Y%d Z%d E%d ; sets maximum accelerations, mm/sec^2\n",
|
||||
int(print.config().machine_max_acceleration_x.values.front() + 0.5),
|
||||
int(print.config().machine_max_acceleration_y.values.front() + 0.5),
|
||||
@ -1703,11 +1704,11 @@ void GCode::print_machine_envelope(GCodeOutputStream &file, Print &print)
|
||||
// backwards compatibility: https://github.com/prusa3d/PrusaSlicer/issues/1089
|
||||
// Legacy Marlin should export travel acceleration the same as printing acceleration.
|
||||
// MarlinFirmware has the two separated.
|
||||
int travel_acc = print.config().gcode_flavor == gcfMarlinLegacy
|
||||
int travel_acc = flavor == gcfMarlinLegacy
|
||||
? int(print.config().machine_max_acceleration_extruding.values.front() + 0.5)
|
||||
: int(print.config().machine_max_acceleration_travel.values.front() + 0.5);
|
||||
// Retract acceleration not accepeted in M204 in RRF
|
||||
if (print.config().gcode_flavor.value == gcfRepRapFirmware)
|
||||
if (flavor == gcfRepRapFirmware)
|
||||
file.write_format("M204 P%d T%d ; sets acceleration (P, T), mm/sec^2\n",
|
||||
int(print.config().machine_max_acceleration_extruding.values.front() + 0.5),
|
||||
travel_acc);
|
||||
@ -1718,13 +1719,15 @@ void GCode::print_machine_envelope(GCodeOutputStream &file, Print &print)
|
||||
travel_acc);
|
||||
|
||||
assert(is_decimal_separator_point());
|
||||
file.write_format(print.config().gcode_flavor.value == gcfRepRapFirmware ? "M566 X%.2lf Y%.2lf Z%.2lf E%.2lf ; sets the jerk limits, mm/min\n" : "M205 X%.2lf Y%.2lf Z%.2lf E%.2lf ; sets the jerk limits, mm/sec\n",
|
||||
file.write_format(flavor == gcfRepRapFirmware
|
||||
? "M566 X%.2lf Y%.2lf Z%.2lf E%.2lf ; sets the jerk limits, mm/min\n"
|
||||
: "M205 X%.2lf Y%.2lf Z%.2lf E%.2lf ; sets the jerk limits, mm/sec\n",
|
||||
print.config().machine_max_jerk_x.values.front() * factor,
|
||||
print.config().machine_max_jerk_y.values.front() * factor,
|
||||
print.config().machine_max_jerk_z.values.front() * factor,
|
||||
print.config().machine_max_jerk_e.values.front() * factor);
|
||||
// M205 Sn Tn not supported in RRF
|
||||
if (print.config().gcode_flavor.value != gcfRepRapFirmware)
|
||||
if (flavor != gcfRepRapFirmware)
|
||||
file.write_format("M205 S%d T%d ; sets the minimum extruding and travel feed rate, mm/sec\n",
|
||||
int(print.config().machine_min_extruding_rate.values.front() + 0.5),
|
||||
int(print.config().machine_min_travel_rate.values.front() + 0.5));
|
||||
|
@ -20,8 +20,10 @@ void GCodeWriter::apply_print_config(const PrintConfig &print_config)
|
||||
this->config.apply(print_config, true);
|
||||
m_extrusion_axis = get_extrusion_axis(this->config);
|
||||
m_single_extruder_multi_material = print_config.single_extruder_multi_material.value;
|
||||
bool is_marlin = print_config.gcode_flavor.value == gcfMarlinLegacy || print_config.gcode_flavor.value == gcfMarlinFirmware || print_config.gcode_flavor.value == gcfRepRapFirmware;
|
||||
m_max_acceleration = std::lrint((is_marlin && print_config.machine_limits_usage.value == MachineLimitsUsage::EmitToGCode) ?
|
||||
bool use_mach_limits = print_config.gcode_flavor.value == gcfMarlinLegacy
|
||||
|| print_config.gcode_flavor.value == gcfMarlinFirmware
|
||||
|| print_config.gcode_flavor.value == gcfRepRapFirmware;
|
||||
m_max_acceleration = std::lrint((use_mach_limits && print_config.machine_limits_usage.value == MachineLimitsUsage::EmitToGCode) ?
|
||||
print_config.machine_max_acceleration_extruding.values.front() : 0);
|
||||
}
|
||||
|
||||
|
@ -1614,7 +1614,7 @@ void PrintConfigDef::init_fff_params()
|
||||
def->enum_labels.push_back(L("Use for time estimate"));
|
||||
def->enum_labels.push_back(L("Ignore"));
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionEnum<MachineLimitsUsage>(MachineLimitsUsage::EmitToGCode));
|
||||
def->set_default_value(new ConfigOptionEnum<MachineLimitsUsage>(MachineLimitsUsage::TimeEstimateOnly));
|
||||
|
||||
{
|
||||
struct AxisDefault {
|
||||
|
@ -2656,7 +2656,7 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/)
|
||||
{
|
||||
size_t n_before_extruders = 2; // Count of pages before Extruder pages
|
||||
auto flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
|
||||
bool is_marlin_flavor = (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware || flavor == gcfRepRapFirmware);
|
||||
bool show_mach_limits = (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware || flavor == gcfRepRapFirmware);
|
||||
|
||||
/* ! Freeze/Thaw in this function is needed to avoid call OnPaint() for erased pages
|
||||
* and be cause of application crash, when try to change Preset in moment,
|
||||
@ -2664,26 +2664,26 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/)
|
||||
* */
|
||||
Freeze();
|
||||
|
||||
// Add/delete Kinematics page according to is_marlin_flavor
|
||||
// Add/delete Kinematics page according to show_mach_limits
|
||||
size_t existed_page = 0;
|
||||
for (size_t i = n_before_extruders; i < m_pages.size(); ++i) // first make sure it's not there already
|
||||
if (m_pages[i]->title().find(L("Machine limits")) != std::string::npos) {
|
||||
if (!is_marlin_flavor || m_rebuild_kinematics_page)
|
||||
if (!show_mach_limits || m_rebuild_kinematics_page)
|
||||
m_pages.erase(m_pages.begin() + i);
|
||||
else
|
||||
existed_page = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (existed_page < n_before_extruders && (is_marlin_flavor || from_initial_build)) {
|
||||
if (existed_page < n_before_extruders && (show_mach_limits || from_initial_build)) {
|
||||
auto page = build_kinematics_page();
|
||||
if (from_initial_build && !is_marlin_flavor)
|
||||
if (from_initial_build && !show_mach_limits)
|
||||
page->clear();
|
||||
else
|
||||
m_pages.insert(m_pages.begin() + n_before_extruders, page);
|
||||
}
|
||||
|
||||
if (is_marlin_flavor)
|
||||
if (show_mach_limits)
|
||||
n_before_extruders++;
|
||||
size_t n_after_single_extruder_MM = 2; // Count of pages after single_extruder_multi_material page
|
||||
|
||||
@ -2928,7 +2928,7 @@ void TabPrinter::toggle_options()
|
||||
toggle_option("single_extruder_multi_material", have_multiple_extruders);
|
||||
|
||||
auto flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
|
||||
bool is_marlin_flavor = flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware || flavor == gcfRepRapFirmware;
|
||||
bool is_marlin_flavor = flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware;
|
||||
// Disable silent mode for non-marlin firmwares.
|
||||
toggle_option("silent_mode", is_marlin_flavor);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user