ENH: refine long retraction ui
1. associate button display logic 2. Add valid range tip 3. seperate the printer into three types jira:NEW Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: Ie14c8746eb20456dacd5c129a5449c1e7c7db372
This commit is contained in:
parent
510bc20696
commit
abb2356e6e
|
@ -21,7 +21,7 @@
|
|||
"Bambu PLA Basic @BBL X1"
|
||||
],
|
||||
"default_print_profile": "0.20mm Standard @BBL X1C",
|
||||
"enable_long_retraction_when_cut" : "1",
|
||||
"enable_long_retraction_when_cut" : "2",
|
||||
"extruder_offset": [
|
||||
"0x2"
|
||||
],
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"extruder_offset": [
|
||||
"0x2"
|
||||
],
|
||||
"enable_long_retraction_when_cut" : "1",
|
||||
"enable_long_retraction_when_cut" : "2",
|
||||
"machine_load_filament_time": "29",
|
||||
"machine_unload_filament_time": "28",
|
||||
"nozzle_height": "4.2",
|
||||
|
|
|
@ -230,6 +230,9 @@ static t_config_option_keys print_config_diffs(
|
|||
if (opt_new == nullptr)
|
||||
//FIXME This may happen when executing some test cases.
|
||||
continue;
|
||||
if ((opt_key == "long_retractions_when_cut" || opt_key == "retraction_distances_when_cut")
|
||||
&& current_config.enable_long_retraction_when_cut.getInt() != 2)
|
||||
continue; //BBS: hard code here, remove it later if the machine firwmare support
|
||||
const ConfigOption *opt_new_filament = std::binary_search(extruder_retract_keys.begin(), extruder_retract_keys.end(), opt_key) ? new_full_config.option(filament_prefix + opt_key) : nullptr;
|
||||
if (opt_new_filament != nullptr && ! opt_new_filament->is_nil()) {
|
||||
// An extruder retract override is available at some of the filament presets.
|
||||
|
|
|
@ -2700,9 +2700,9 @@ void PrintConfigDef::init_fff_params()
|
|||
def->mode = comSimple;
|
||||
def->set_default_value(new ConfigOptionFloats { 0.8 });
|
||||
|
||||
def = this->add("enable_long_retraction_when_cut",coBool);
|
||||
def = this->add("enable_long_retraction_when_cut",coInt);
|
||||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionBool {false});
|
||||
def->set_default_value(new ConfigOptionInt {0});
|
||||
|
||||
def = this->add("long_retractions_when_cut", coBools);
|
||||
def->label = L("Long retraction when cut(experimental)");
|
||||
|
@ -3873,7 +3873,9 @@ void PrintConfigDef::init_fff_params()
|
|||
def->max = it_opt->second.max;
|
||||
//BBS: shown specific filament retract config because we hide the machine retract into comDevelop mode
|
||||
if ((strcmp(opt_key, "retraction_length") == 0) ||
|
||||
(strcmp(opt_key, "z_hop") == 0))
|
||||
(strcmp(opt_key, "z_hop") == 0)||
|
||||
(strcmp(opt_key, "long_retractions_when_cut") == 0)||
|
||||
(strcmp(opt_key, "retraction_distances_when_cut") == 0))
|
||||
def->mode = comSimple;
|
||||
else
|
||||
def->mode = comAdvanced;
|
||||
|
|
|
@ -916,7 +916,7 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||
((ConfigOptionPercents, retract_before_wipe))
|
||||
((ConfigOptionFloats, retraction_length))
|
||||
((ConfigOptionFloats, retract_length_toolchange))
|
||||
((ConfigOptionBool, enable_long_retraction_when_cut))
|
||||
((ConfigOptionInt, enable_long_retraction_when_cut))
|
||||
((ConfigOptionFloats, retraction_distances_when_cut))
|
||||
((ConfigOptionBools, long_retractions_when_cut))
|
||||
((ConfigOptionFloats, z_hop))
|
||||
|
|
|
@ -294,6 +294,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
|
|||
m_value.clear();
|
||||
break;
|
||||
}
|
||||
std::string opt_key_without_idx = m_opt_id.substr(0, m_opt_id.find('#'));
|
||||
if (m_opt_id == "filament_flow_ratio") {
|
||||
if (m_value.empty() || boost::any_cast<double>(m_value) != val) {
|
||||
wxString msg_text = format_wxstr(_L("Value %s is out of range, continue?"), str);
|
||||
|
@ -310,6 +311,19 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(m_opt_id == "filament_retraction_distances_when_cut" || opt_key_without_idx == "retraction_distances_when_cut"){
|
||||
wxString msg_text = format_wxstr(_L("Value %s is out of range. The valid range is from %d to %d."), str, m_opt.min, m_opt.max);
|
||||
WarningDialog dialog(m_parent, msg_text, _L("Parameter validation") + ": " + m_opt_id, wxYES);
|
||||
if (dialog.ShowModal()) {
|
||||
if (m_value.empty()) {
|
||||
if (m_opt.min > val) val = m_opt.min;
|
||||
if (val > m_opt.max) val = m_opt.max;
|
||||
}
|
||||
else
|
||||
val = boost::any_cast<double>(m_value);
|
||||
set_value(double_to_string(val), true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
show_error(m_parent, _L("Value is out of range."));
|
||||
if (m_opt.min > val) val = m_opt.min;
|
||||
|
|
|
@ -472,7 +472,7 @@ std::vector<int> get_min_flush_volumes()
|
|||
ConfigOption* nozzle_volume_opt = printer_config.option("nozzle_volume");
|
||||
int nozzle_volume_val = nozzle_volume_opt ? (int)nozzle_volume_opt->getFloat() : 0;
|
||||
|
||||
bool machine_enabled = printer_config.option<ConfigOptionBool>("enable_long_retraction_when_cut")->value;
|
||||
int machine_enabled_level = printer_config.option<ConfigOptionInt>("enable_long_retraction_when_cut")->value;
|
||||
bool machine_activated = printer_config.option<ConfigOptionBools>("long_retractions_when_cut")->values[0] == 1;
|
||||
|
||||
auto filament_retraction_distance_when_cut = full_config.option<ConfigOptionFloats>("filament_retraction_distances_when_cut");
|
||||
|
@ -482,14 +482,14 @@ std::vector<int> get_min_flush_volumes()
|
|||
size_t filament_size = filament_retraction_distance_when_cut->values.size();
|
||||
for (size_t idx = 0; idx < filament_size; ++idx) {
|
||||
int extra_flush_volume = nozzle_volume_val;
|
||||
int retract_length = machine_enabled && machine_activated ? printer_retraction_distance_when_cut->values[0] : 0;
|
||||
int retract_length = machine_enabled_level && machine_activated ? printer_retraction_distance_when_cut->values[0] : 0;
|
||||
|
||||
char filament_activated = filament_long_retractions_when_cut->values[idx];
|
||||
double filament_retract_length = filament_retraction_distance_when_cut->values[idx];
|
||||
|
||||
if(filament_activated == 0)
|
||||
if (filament_activated == 0)
|
||||
retract_length = 0;
|
||||
else if (filament_activated == 1 && machine_enabled) {
|
||||
else if (filament_activated == 1 && machine_enabled_level == LongRectrationLevel::EnableFilament) {
|
||||
if (!std::isnan(filament_retract_length))
|
||||
retract_length = (int)filament_retraction_distance_when_cut->values[idx];
|
||||
else
|
||||
|
|
|
@ -54,6 +54,13 @@ class Ams;
|
|||
|
||||
using ModelInstancePtrs = std::vector<ModelInstance*>;
|
||||
|
||||
enum LongRectrationLevel
|
||||
{
|
||||
Disabled=0,
|
||||
EnableMachine,
|
||||
EnableFilament
|
||||
};
|
||||
|
||||
namespace UndoRedo {
|
||||
class Stack;
|
||||
enum class SnapshotType : unsigned char;
|
||||
|
|
|
@ -1573,7 +1573,7 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
|||
if (activate == 1) {
|
||||
MessageDialog dialog(wxGetApp().plater(),
|
||||
_L("Experimental feature: Retracting and cutting off the filament at a greater distance during filament changes to minimize flush."
|
||||
"Although it can notably reduce flush, it may also elevate the risk of nozzle clogs or other printing complications."), "", wxICON_WARNING | wxOK);
|
||||
"Although it can notably reduce flush, it may also elevate the risk of nozzle clogs or other printing complications.Please use with the latest printer firmware."), "", wxICON_WARNING | wxOK);
|
||||
dialog.ShowModal();
|
||||
}
|
||||
update_flush_volume();
|
||||
|
@ -2976,12 +2976,16 @@ void TabFilament::update_filament_overrides_page()
|
|||
Field* field = optgroup->get_fieldc(opt_key, extruder_idx);
|
||||
if (field != nullptr) {
|
||||
if (opt_key == "filament_long_retractions_when_cut") {
|
||||
bool machine_enabled = wxGetApp().preset_bundle->printers.get_edited_preset().config.option<ConfigOptionBool>("enable_long_retraction_when_cut")->value;
|
||||
field->toggle(is_checked&&machine_enabled);
|
||||
int machine_enabled_level = wxGetApp().preset_bundle->printers.get_edited_preset().config.option<ConfigOptionInt>("enable_long_retraction_when_cut")->value;
|
||||
bool machine_enabled = machine_enabled_level == LongRectrationLevel::EnableFilament;
|
||||
toggle_line(opt_key, machine_enabled);
|
||||
field->toggle(is_checked && machine_enabled);
|
||||
}
|
||||
else if (opt_key == "filament_retraction_distances_when_cut") {
|
||||
bool machine_enabled = wxGetApp().preset_bundle->printers.get_edited_preset().config.option<ConfigOptionBool>("enable_long_retraction_when_cut")->value;
|
||||
bool filament_enabled = m_config->option<ConfigOptionBools>("filament_long_retractions_when_cut")->values[extruder_idx]==1;
|
||||
int machine_enabled_level = wxGetApp().preset_bundle->printers.get_edited_preset().config.option<ConfigOptionInt>("enable_long_retraction_when_cut")->value;
|
||||
bool machine_enabled = machine_enabled_level == LongRectrationLevel::EnableFilament;
|
||||
bool filament_enabled = m_config->option<ConfigOptionBools>("filament_long_retractions_when_cut")->values[extruder_idx] == 1;
|
||||
toggle_line(opt_key, filament_enabled && machine_enabled);
|
||||
field->toggle(is_checked && filament_enabled && machine_enabled);
|
||||
}
|
||||
else
|
||||
|
@ -4190,9 +4194,9 @@ void TabPrinter::toggle_options()
|
|||
bool toolchange_retraction = m_config->opt_float("retract_length_toolchange", i) > 0;
|
||||
toggle_option("retract_restart_extra_toolchange", have_multiple_extruders && toolchange_retraction, i);
|
||||
|
||||
// do not display this extruder param now
|
||||
toggle_option("long_retractions_when_cut", !use_firmware_retraction && m_config->opt_bool("enable_long_retraction_when_cut"),i);
|
||||
toggle_option("retraction_distances_when_cut", m_config->opt_bool("long_retractions_when_cut",i),i);
|
||||
toggle_option("long_retractions_when_cut", !use_firmware_retraction && m_config->opt_int("enable_long_retraction_when_cut"),i);
|
||||
toggle_line("retraction_distances_when_cut#0", m_config->opt_bool("long_retractions_when_cut", i));
|
||||
//toggle_option("retraction_distances_when_cut", m_config->opt_bool("long_retractions_when_cut",i),i);
|
||||
}
|
||||
|
||||
if (m_active_page->title() == "Motion ability") {
|
||||
|
|
Loading…
Reference in New Issue