GCodeProcessor use new flavor gcfMarlinFirmware

This commit is contained in:
enricoturri1966 2021-03-31 12:34:28 +02:00 committed by Lukas Matena
parent 8c89bf748b
commit 52af90ed8f

View file

@ -823,7 +823,7 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
m_filament_diameters[i] = static_cast<float>(config.filament_diameter.values[i]);
}
if (m_flavor == gcfMarlinLegacy && config.machine_limits_usage.value != MachineLimitsUsage::Ignore)
if ((m_flavor == gcfMarlinLegacy || m_flavor == gcfMarlinFirmware) && config.machine_limits_usage.value != MachineLimitsUsage::Ignore)
m_time_processor.machine_limits = reinterpret_cast<const MachineEnvelopeConfig&>(config);
// Filament load / unload times are not specific to a firmware flavor. Let anybody use it if they find it useful.
@ -934,7 +934,7 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
}
}
if (m_flavor == gcfMarlinLegacy) {
if (m_flavor == gcfMarlinLegacy || m_flavor == gcfMarlinFirmware) {
const ConfigOptionFloats* machine_max_acceleration_x = config.option<ConfigOptionFloats>("machine_max_acceleration_x");
if (machine_max_acceleration_x != nullptr)
m_time_processor.machine_limits.machine_max_acceleration_x.values = machine_max_acceleration_x->values;
@ -991,6 +991,10 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
if (machine_max_acceleration_retracting != nullptr)
m_time_processor.machine_limits.machine_max_acceleration_retracting.values = machine_max_acceleration_retracting->values;
const ConfigOptionFloats* machine_max_acceleration_travel = config.option<ConfigOptionFloats>("machine_max_acceleration_travel");
if (machine_max_acceleration_travel != nullptr)
m_time_processor.machine_limits.machine_max_acceleration_travel.values = machine_max_acceleration_travel->values;
const ConfigOptionFloats* machine_min_extruding_rate = config.option<ConfigOptionFloats>("machine_min_extruding_rate");
if (machine_min_extruding_rate != nullptr)
m_time_processor.machine_limits.machine_min_extruding_rate.values = machine_min_extruding_rate->values;
@ -1646,17 +1650,17 @@ bool GCodeProcessor::process_cura_tags(const std::string_view comment)
if (pos != comment.npos) {
const std::string_view flavor = comment.substr(pos + tag.length());
if (flavor == "BFB")
m_flavor = gcfMarlinLegacy; // << ???????????????????????
m_flavor = gcfMarlinLegacy; // is this correct ?
else if (flavor == "Mach3")
m_flavor = gcfMach3;
else if (flavor == "Makerbot")
m_flavor = gcfMakerWare;
else if (flavor == "UltiGCode")
m_flavor = gcfMarlinLegacy; // << ???????????????????????
m_flavor = gcfMarlinLegacy; // is this correct ?
else if (flavor == "Marlin(Volumetric)")
m_flavor = gcfMarlinLegacy; // << ???????????????????????
m_flavor = gcfMarlinLegacy; // is this correct ?
else if (flavor == "Griffin")
m_flavor = gcfMarlinLegacy; // << ???????????????????????
m_flavor = gcfMarlinLegacy; // is this correct ?
else if (flavor == "Repetier")
m_flavor = gcfRepetier;
else if (flavor == "RepRap")
@ -2575,7 +2579,7 @@ void GCodeProcessor::process_M203(const GCodeReader::GCodeLine& line)
// see http://reprap.org/wiki/G-code#M203:_Set_maximum_feedrate
// http://smoothieware.org/supported-g-codes
float factor = (m_flavor == gcfMarlinLegacy || m_flavor == gcfSmoothie) ? 1.0f : MMMIN_TO_MMSEC;
float factor = (m_flavor == gcfMarlinLegacy || m_flavor == gcfMarlinFirmware || m_flavor == gcfSmoothie) ? 1.0f : MMMIN_TO_MMSEC;
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedTimeStatistics::ETimeMode::Count); ++i) {
if (static_cast<PrintEstimatedTimeStatistics::ETimeMode>(i) == PrintEstimatedTimeStatistics::ETimeMode::Normal ||
@ -2749,7 +2753,7 @@ void GCodeProcessor::process_T(const std::string_view command)
int eid = 0;
if (! parse_number(command.substr(1), eid) || eid < 0 || eid > 255) {
// Specific to the MMU2 V2 (see https://www.help.prusa3d.com/en/article/prusa-specific-g-codes_112173):
if (m_flavor == gcfMarlinLegacy && (command == "Tx" || command == "Tc" || command == "T?"))
if ((m_flavor == gcfMarlinLegacy || m_flavor == gcfMarlinFirmware) && (command == "Tx" || command == "Tc" || command == "T?"))
return;
// T-1 is a valid gcode line for RepRap Firmwares (used to deselects all tools) see https://github.com/prusa3d/PrusaSlicer/issues/5677