mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-15 02:37:51 -06:00
support RRF firmware(experiment)
This commit is contained in:
parent
4a20f7c22a
commit
264b0ee891
6 changed files with 48 additions and 30 deletions
|
@ -2092,40 +2092,45 @@ 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.
|
// 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)
|
void GCode::print_machine_envelope(GCodeOutputStream &file, Print &print)
|
||||||
{
|
{
|
||||||
if (print.config().gcode_flavor.value == gcfMarlinLegacy || print.config().gcode_flavor.value == gcfMarlinFirmware) {
|
const auto flavor = print.config().gcode_flavor.value;
|
||||||
|
if (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware) {
|
||||||
|
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\n",
|
file.write_format("M201 X%d Y%d Z%d E%d\n",
|
||||||
int(print.config().machine_max_acceleration_x.values.front() + 0.5),
|
int(print.config().machine_max_acceleration_x.values.front() + 0.5),
|
||||||
int(print.config().machine_max_acceleration_y.values.front() + 0.5),
|
int(print.config().machine_max_acceleration_y.values.front() + 0.5),
|
||||||
int(print.config().machine_max_acceleration_z.values.front() + 0.5),
|
int(print.config().machine_max_acceleration_z.values.front() + 0.5),
|
||||||
int(print.config().machine_max_acceleration_e.values.front() + 0.5));
|
int(print.config().machine_max_acceleration_e.values.front() + 0.5));
|
||||||
file.write_format("M203 X%d Y%d Z%d E%d\n",
|
file.write_format("M203 X%d Y%d Z%d E%d\n",
|
||||||
int(print.config().machine_max_speed_x.values.front() + 0.5),
|
int(print.config().machine_max_speed_x.values.front() * factor + 0.5),
|
||||||
int(print.config().machine_max_speed_y.values.front() + 0.5),
|
int(print.config().machine_max_speed_y.values.front() * factor + 0.5),
|
||||||
int(print.config().machine_max_speed_z.values.front() + 0.5),
|
int(print.config().machine_max_speed_z.values.front() * factor + 0.5),
|
||||||
int(print.config().machine_max_speed_e.values.front() + 0.5));
|
int(print.config().machine_max_speed_e.values.front() * factor + 0.5));
|
||||||
|
|
||||||
// Now M204 - acceleration. This one is quite hairy thanks to how Marlin guys care about
|
// Now M204 - acceleration. This one is quite hairy thanks to how Marlin guys care about
|
||||||
// Legacy Marlin should export travel acceleration the same as printing acceleration.
|
// Legacy Marlin should export travel acceleration the same as printing acceleration.
|
||||||
// MarlinFirmware has the two separated.
|
// 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_extruding.values.front() + 0.5)
|
||||||
: int(print.config().machine_max_acceleration_travel.values.front() + 0.5);
|
: int(print.config().machine_max_acceleration_travel.values.front() + 0.5);
|
||||||
|
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);
|
||||||
|
else
|
||||||
file.write_format("M204 P%d R%d T%d\n",
|
file.write_format("M204 P%d R%d T%d\n",
|
||||||
int(print.config().machine_max_acceleration_extruding.values.front() + 0.5),
|
int(print.config().machine_max_acceleration_extruding.values.front() + 0.5),
|
||||||
int(print.config().machine_max_acceleration_retracting.values.front() + 0.5),
|
int(print.config().machine_max_acceleration_retracting.values.front() + 0.5),
|
||||||
travel_acc);
|
travel_acc);
|
||||||
|
|
||||||
|
|
||||||
assert(is_decimal_separator_point());
|
assert(is_decimal_separator_point());
|
||||||
file.write_format("M205 X%.2lf Y%.2lf Z%.2lf E%.2lf\n",
|
file.write_format(flavor == gcfRepRapFirmware
|
||||||
print.config().machine_max_jerk_x.values.front(),
|
? "M566 X%.2lf Y%.2lf Z%.2lf E%.2lf ; sets the jerk limits, mm/min\n"
|
||||||
print.config().machine_max_jerk_y.values.front(),
|
: "M205 X%.2lf Y%.2lf Z%.2lf E%.2lf ; sets the jerk limits, mm/sec\n",
|
||||||
print.config().machine_max_jerk_z.values.front(),
|
print.config().machine_max_jerk_x.values.front() * factor,
|
||||||
print.config().machine_max_jerk_e.values.front());
|
print.config().machine_max_jerk_y.values.front() * factor,
|
||||||
//BBS: don't support M205 Sx Tx
|
print.config().machine_max_jerk_z.values.front() * factor,
|
||||||
//file.write_format("M205 S%d T%d\n",
|
print.config().machine_max_jerk_e.values.front() * factor);
|
||||||
// int(print.config().machine_min_extruding_rate.values.front() + 0.5),
|
|
||||||
// int(print.config().machine_min_travel_rate.values.front() + 0.5));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -911,12 +911,17 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
|
||||||
m_result.filament_vitrification_temperature[i] = static_cast<float>(config.temperature_vitrification.get_at(i));
|
m_result.filament_vitrification_temperature[i] = static_cast<float>(config.temperature_vitrification.get_at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_flavor == gcfMarlinLegacy || m_flavor == gcfMarlinFirmware || m_flavor == gcfKlipper) {
|
if (m_flavor == gcfMarlinLegacy || m_flavor == gcfMarlinFirmware || m_flavor == gcfKlipper || m_flavor == gcfRepRapFirmware) {
|
||||||
m_time_processor.machine_limits = reinterpret_cast<const MachineEnvelopeConfig&>(config);
|
m_time_processor.machine_limits = reinterpret_cast<const MachineEnvelopeConfig&>(config);
|
||||||
if (m_flavor == gcfMarlinLegacy) {
|
if (m_flavor == gcfMarlinLegacy) {
|
||||||
// Legacy Marlin does not have separate travel acceleration, it uses the 'extruding' value instead.
|
// Legacy Marlin does not have separate travel acceleration, it uses the 'extruding' value instead.
|
||||||
m_time_processor.machine_limits.machine_max_acceleration_travel = m_time_processor.machine_limits.machine_max_acceleration_extruding;
|
m_time_processor.machine_limits.machine_max_acceleration_travel = m_time_processor.machine_limits.machine_max_acceleration_extruding;
|
||||||
}
|
}
|
||||||
|
if (m_flavor == gcfRepRapFirmware) {
|
||||||
|
// RRF does not support setting min feedrates. Set them to zero.
|
||||||
|
m_time_processor.machine_limits.machine_min_travel_rate.values.assign(m_time_processor.machine_limits.machine_min_travel_rate.size(), 0.);
|
||||||
|
m_time_processor.machine_limits.machine_min_extruding_rate.values.assign(m_time_processor.machine_limits.machine_min_extruding_rate.size(), 0.);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filament load / unload times are not specific to a firmware flavor. Let anybody use it if they find it useful.
|
// Filament load / unload times are not specific to a firmware flavor. Let anybody use it if they find it useful.
|
||||||
|
|
|
@ -99,8 +99,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
WipeTowerWriter& disable_linear_advance() {
|
WipeTowerWriter& disable_linear_advance() {
|
||||||
m_gcode += (m_gcode_flavor == gcfKlipper ? (std::string("SET_PRESSURE_ADVANCE ADVANCE=0\n"))
|
if(m_gcode_flavor == gcfKlipper)
|
||||||
: std::string("M900 K0\n"));
|
m_gcode += "SET_PRESSURE_ADVANCE ADVANCE=0\n";
|
||||||
|
else if(m_gcode_flavor == gcfRepRapFirmware)
|
||||||
|
m_gcode += std::string("M572 D") + std::to_string(m_current_tool) + " S0\n";
|
||||||
|
else
|
||||||
|
m_gcode += "M900 K0\n";
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,12 @@ void GCodeWriter::apply_print_config(const PrintConfig &print_config)
|
||||||
{
|
{
|
||||||
this->config.apply(print_config, true);
|
this->config.apply(print_config, true);
|
||||||
m_single_extruder_multi_material = print_config.single_extruder_multi_material.value;
|
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 == gcfKlipper;
|
bool use_mach_limits = print_config.gcode_flavor.value == gcfMarlinLegacy ||
|
||||||
m_max_acceleration = std::lrint(is_marlin ? print_config.machine_max_acceleration_extruding.values.front() : 0);
|
print_config.gcode_flavor.value == gcfMarlinFirmware ||
|
||||||
m_max_jerk = std::lrint(is_marlin ? std::min(print_config.machine_max_jerk_x.values.front(), print_config.machine_max_jerk_y.values.front()) : 0);
|
print_config.gcode_flavor.value == gcfKlipper ||
|
||||||
|
print_config.gcode_flavor.value == gcfRepRapFirmware;
|
||||||
|
m_max_acceleration = std::lrint(use_mach_limits ? print_config.machine_max_acceleration_extruding.values.front() : 0);
|
||||||
|
m_max_jerk = std::lrint(use_mach_limits ? std::min(print_config.machine_max_jerk_x.values.front(), print_config.machine_max_jerk_y.values.front()) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCodeWriter::set_extruders(std::vector<unsigned int> extruder_ids)
|
void GCodeWriter::set_extruders(std::vector<unsigned int> extruder_ids)
|
||||||
|
|
|
@ -1567,7 +1567,7 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->enum_keys_map = &ConfigOptionEnum<GCodeFlavor>::get_enum_values();
|
def->enum_keys_map = &ConfigOptionEnum<GCodeFlavor>::get_enum_values();
|
||||||
def->enum_values.push_back("marlin");
|
def->enum_values.push_back("marlin");
|
||||||
def->enum_values.push_back("klipper");
|
def->enum_values.push_back("klipper");
|
||||||
//def->enum_values.push_back("reprapfirmware");
|
def->enum_values.push_back("reprapfirmware");
|
||||||
//def->enum_values.push_back("repetier");
|
//def->enum_values.push_back("repetier");
|
||||||
//def->enum_values.push_back("teacup");
|
//def->enum_values.push_back("teacup");
|
||||||
//def->enum_values.push_back("makerware");
|
//def->enum_values.push_back("makerware");
|
||||||
|
@ -1578,8 +1578,9 @@ void PrintConfigDef::init_fff_params()
|
||||||
//def->enum_values.push_back("smoothie");
|
//def->enum_values.push_back("smoothie");
|
||||||
//def->enum_values.push_back("no-extrusion");
|
//def->enum_values.push_back("no-extrusion");
|
||||||
def->enum_labels.push_back("Marlin(legacy)");
|
def->enum_labels.push_back("Marlin(legacy)");
|
||||||
|
def->enum_labels.push_back(L("Klipper"));
|
||||||
|
def->enum_labels.push_back("RepRapFirmware");
|
||||||
//def->enum_labels.push_back("RepRap/Sprinter");
|
//def->enum_labels.push_back("RepRap/Sprinter");
|
||||||
//def->enum_labels.push_back("RepRapFirmware");
|
|
||||||
//def->enum_labels.push_back("Repetier");
|
//def->enum_labels.push_back("Repetier");
|
||||||
//def->enum_labels.push_back("Teacup");
|
//def->enum_labels.push_back("Teacup");
|
||||||
//def->enum_labels.push_back("MakerWare (MakerBot)");
|
//def->enum_labels.push_back("MakerWare (MakerBot)");
|
||||||
|
@ -1589,7 +1590,6 @@ void PrintConfigDef::init_fff_params()
|
||||||
//def->enum_labels.push_back("Machinekit");
|
//def->enum_labels.push_back("Machinekit");
|
||||||
//def->enum_labels.push_back("Smoothie");
|
//def->enum_labels.push_back("Smoothie");
|
||||||
//def->enum_labels.push_back(L("No extrusion"));
|
//def->enum_labels.push_back(L("No extrusion"));
|
||||||
def->enum_labels.push_back(L("Klipper"));
|
|
||||||
def->mode = comAdvanced;
|
def->mode = comAdvanced;
|
||||||
def->readonly = false;
|
def->readonly = false;
|
||||||
def->set_default_value(new ConfigOptionEnum<GCodeFlavor>(gcfMarlinLegacy));
|
def->set_default_value(new ConfigOptionEnum<GCodeFlavor>(gcfMarlinLegacy));
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
enum GCodeFlavor : unsigned char {
|
enum GCodeFlavor : unsigned char {
|
||||||
gcfMarlinLegacy, gcfKlipper, gcfRepRapSprinter, gcfRepRapFirmware, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlinFirmware, gcfSailfish, gcfMach3, gcfMachinekit,
|
gcfMarlinLegacy, gcfKlipper, gcfRepRapFirmware, gcfRepRapSprinter, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlinFirmware, gcfSailfish, gcfMach3, gcfMachinekit,
|
||||||
gcfSmoothie, gcfNoExtrusion
|
gcfSmoothie, gcfNoExtrusion
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue