mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-30 15:38:43 +03:00
Volume and Pressure Advance
This commit is contained in:
@@ -754,7 +754,14 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||
int min_fan_speed = EXTRUDER_CONFIG(min_fan_speed);
|
||||
//B15
|
||||
int enable_auxiliary_fan = EXTRUDER_CONFIG(enable_auxiliary_fan);
|
||||
//B25
|
||||
int enable_volume_fan = EXTRUDER_CONFIG(enable_volume_fan);
|
||||
int fan_speed_new = EXTRUDER_CONFIG(fan_always_on) ? min_fan_speed : 0;
|
||||
//B26
|
||||
bool enable_advance_pressure = EXTRUDER_CONFIG(enable_advance_pressure);
|
||||
float advance_pressure = float(EXTRUDER_CONFIG(advance_pressure));
|
||||
float smooth_time = float(EXTRUDER_CONFIG(smooth_time));
|
||||
|
||||
std::pair<int, int> custom_fan_speed_limits{fan_speed_new, 100 };
|
||||
int disable_fan_first_layers = EXTRUDER_CONFIG(disable_fan_first_layers);
|
||||
// Is the fan speed ramp enabled?
|
||||
@@ -798,11 +805,24 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||
custom_fan_speed_limits.second = 0;
|
||||
}
|
||||
//B15
|
||||
if (int(layer_id) == disable_fan_first_layers && enable_auxiliary_fan != 0 && fan_speed_new != m_fan_speed) {
|
||||
if (int(layer_id) >= disable_fan_first_layers && fan_speed_new != m_fan_speed) {
|
||||
std::ostringstream fan_gcode;
|
||||
fan_gcode << "M106 P2 S" << 255.0 * enable_auxiliary_fan / 100.0 << "\n";
|
||||
new_gcode += fan_gcode.str();
|
||||
}
|
||||
//B25
|
||||
if (int(layer_id) == disable_fan_first_layers && enable_volume_fan != 0 && fan_speed_new != m_fan_speed) {
|
||||
std::ostringstream fan_gcode;
|
||||
fan_gcode << "M106 P3 S" << 255.0 * enable_volume_fan / 100.0 << "\n";
|
||||
new_gcode += fan_gcode.str();
|
||||
}
|
||||
//B26
|
||||
if (enable_advance_pressure && fan_speed_new != m_fan_speed) {
|
||||
std::ostringstream pressure_advance_gcode;
|
||||
pressure_advance_gcode << "M900 K" << advance_pressure << " T" << smooth_time << "\n";
|
||||
new_gcode += pressure_advance_gcode.str();
|
||||
}
|
||||
|
||||
if (fan_speed_new != m_fan_speed) {
|
||||
m_fan_speed = fan_speed_new;
|
||||
new_gcode += GCodeWriter::set_fan(m_config.gcode_flavor, m_config.gcode_comments, m_fan_speed);
|
||||
|
||||
@@ -548,8 +548,8 @@ std::string GCodeWriter::set_fan(const GCodeFlavor gcode_flavor, bool gcode_comm
|
||||
case gcfSailfish:
|
||||
gcode << "M127"; break;
|
||||
default:
|
||||
//B15
|
||||
gcode << "M107\nM106 P2 S0"; break;
|
||||
//B15 //B25
|
||||
gcode << "M107\nM106 P2 S0\nM106 P3 S0"; break;
|
||||
}
|
||||
if (gcode_comments)
|
||||
gcode << " ; disable fan";
|
||||
|
||||
@@ -503,7 +503,15 @@ static std::vector<std::string> s_Preset_filament_options {
|
||||
//B15
|
||||
"enable_auxiliary_fan",
|
||||
//B24
|
||||
"volume_temperature", "first_layer_volume_temperature"
|
||||
"volume_temperature", "first_layer_volume_temperature",
|
||||
//B25
|
||||
"enable_volume_fan",
|
||||
//B26
|
||||
"enable_advance_pressure",
|
||||
//B26
|
||||
"advance_pressure",
|
||||
//B26
|
||||
"smooth_time"
|
||||
};
|
||||
|
||||
static std::vector<std::string> s_Preset_machine_limits_options {
|
||||
|
||||
@@ -728,12 +728,6 @@ void PrintConfigDef::init_fff_params()
|
||||
"and fan speed according to layer printing time.");
|
||||
def->set_default_value(new ConfigOptionBools { true });
|
||||
|
||||
//B15
|
||||
// def = this->add("enable_auxiliary_fan", coBools);
|
||||
// def->label = L("Enable Auxiliary Fan");
|
||||
// def->tooltip = L("This flag enables the automatic cooling logic that adjusts print speed "
|
||||
// "and fan speed according to layer printing time.");
|
||||
// def->set_default_value(new ConfigOptionBools { true });
|
||||
|
||||
def = this->add("cooling_tube_retraction", coFloat);
|
||||
def->label = L("Cooling tube position");
|
||||
@@ -1944,6 +1938,15 @@ void PrintConfigDef::init_fff_params()
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionInts { 35 });
|
||||
|
||||
//B25
|
||||
def = this->add("enable_volume_fan", coInts);
|
||||
def->label = L("Volume Fan Speed");
|
||||
def->tooltip = L("This setting represents the PWM your volume fan needs to work.");
|
||||
def->sidetext = L("%");
|
||||
def->min = 0;
|
||||
def->max = 100;
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionInts { 35 });
|
||||
|
||||
def = this->add("min_layer_height", coFloats);
|
||||
def->label = L("Min");
|
||||
@@ -3828,6 +3831,31 @@ void PrintConfigDef::init_sla_params()
|
||||
def->min = 0;
|
||||
def->max = max_temp;
|
||||
def->set_default_value(new ConfigOptionIntsNullable { ConfigOptionIntsNullable::nil_value() });
|
||||
//B26
|
||||
def = this->add("enable_advance_pressure", coBools);
|
||||
def->label = L("Enable pressure advance");
|
||||
def->tooltip = L("Enable pressure advance, auto calibration result will be overwriten once enabled.");
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionBools{ false });
|
||||
|
||||
//B26
|
||||
def = this->add("advance_pressure", coFloats);
|
||||
def->label = L("Pressure advance");
|
||||
def->tooltip = L("Pressure advance(Klipper) AKA Linear advance factor(Marlin)");
|
||||
def->sidetext = L("mm/s");
|
||||
def->min = 0;
|
||||
def->max = 2;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloats { 0.02 });
|
||||
//B26
|
||||
def = this->add("smooth_time", coFloats);
|
||||
def->label = L("Smooth Time");
|
||||
def->tooltip = L("PSmooth Time(Klipper) AKA Linear advance factor(Marlin)");
|
||||
def->sidetext = L("s");
|
||||
def->min = 0;
|
||||
def->max = 1;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloats { 0.02 });
|
||||
|
||||
def = this->add("bottle_volume", coFloat);
|
||||
def->label = L("Bottle volume");
|
||||
|
||||
@@ -764,9 +764,9 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
||||
((ConfigOptionBool, complete_objects))
|
||||
((ConfigOptionFloats, colorprint_heights))
|
||||
((ConfigOptionBools, cooling))
|
||||
//B25
|
||||
((ConfigOptionInts, enable_volume_fan))
|
||||
//B15
|
||||
// ((ConfigOptionBools, enable_auxiliary_fan))
|
||||
// ((ConfigOptionInts, enable_auxiliary_fan))
|
||||
((ConfigOptionInts, enable_auxiliary_fan))
|
||||
((ConfigOptionFloat, default_acceleration))
|
||||
((ConfigOptionInts, disable_fan_first_layers))
|
||||
@@ -790,6 +790,10 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
||||
((ConfigOptionFloatOrPercent, first_layer_speed))
|
||||
((ConfigOptionInts, first_layer_temperature))
|
||||
((ConfigOptionIntsNullable, idle_temperature))
|
||||
//B26
|
||||
((ConfigOptionBools, enable_advance_pressure))
|
||||
((ConfigOptionFloats, advance_pressure))
|
||||
((ConfigOptionFloats, smooth_time))
|
||||
((ConfigOptionInts, full_fan_speed_layer))
|
||||
((ConfigOptionFloat, infill_acceleration))
|
||||
((ConfigOptionBool, infill_first))
|
||||
|
||||
@@ -1863,6 +1863,7 @@ void TabFilament::create_line_with_near_label_widget(ConfigOptionsGroupShp optgr
|
||||
optgroup->append_line(line);
|
||||
}
|
||||
|
||||
|
||||
void TabFilament::update_line_with_near_label_widget(ConfigOptionsGroupShp optgroup, const std::string& opt_key, int opt_index/* = 0*/, bool is_checked/* = true*/)
|
||||
{
|
||||
if (!m_overrides_options[opt_key])
|
||||
@@ -2005,6 +2006,10 @@ void TabFilament::build()
|
||||
optgroup->append_single_option_line("filament_cost");
|
||||
optgroup->append_single_option_line("filament_spool_weight");
|
||||
|
||||
optgroup->append_single_option_line("enable_advance_pressure");
|
||||
optgroup->append_single_option_line("advance_pressure");
|
||||
optgroup->append_single_option_line("smooth_time");
|
||||
|
||||
optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value)
|
||||
{
|
||||
update_dirty();
|
||||
@@ -2020,7 +2025,6 @@ void TabFilament::build()
|
||||
optgroup = page->new_optgroup(L("Temperature"));
|
||||
|
||||
create_line_with_near_label_widget(optgroup, "idle_temperature");
|
||||
|
||||
Line line = { L("Nozzle"), "" };
|
||||
line.append_option(optgroup->get_option("first_layer_temperature"));
|
||||
line.append_option(optgroup->get_option("temperature"));
|
||||
@@ -2060,6 +2064,8 @@ void TabFilament::build()
|
||||
//B15
|
||||
// optgroup->append_single_option_line("auxiliary_fan_speed", category_path + "fan-settings");
|
||||
optgroup->append_single_option_line("enable_auxiliary_fan", category_path + "fan-settings");
|
||||
//B25
|
||||
optgroup->append_single_option_line("enable_volume_fan", category_path + "fan-settings");
|
||||
optgroup->append_single_option_line("disable_fan_first_layers", category_path + "fan-settings");
|
||||
optgroup->append_single_option_line("full_fan_speed_layer", category_path + "fan-settings");
|
||||
|
||||
@@ -2234,10 +2240,18 @@ void TabFilament::toggle_options()
|
||||
|
||||
if (m_active_page->title() == "Filament") {
|
||||
Page* page = m_active_page;
|
||||
|
||||
//B26
|
||||
const auto og_it = std::find_if(page->m_optgroups.begin(), page->m_optgroups.end(), [](const ConfigOptionsGroupShp og) { return og->title == "Temperature"; });
|
||||
if (og_it != page->m_optgroups.end())
|
||||
update_line_with_near_label_widget(*og_it, "idle_temperature");
|
||||
{
|
||||
update_line_with_near_label_widget(*og_it, "idle_temperature");
|
||||
}
|
||||
//B26
|
||||
if (m_active_page->title() == "Filament") {
|
||||
bool pa = m_config->opt_bool("enable_advance_pressure", 0);
|
||||
toggle_option("advance_pressure", pa);
|
||||
toggle_option("smooth_time", pa);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user