mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-19 06:41:14 -06:00
ENH:calibration
1.adjust interaction of calibration add select my device add select multi-amstray modify ams selector 2.add some x1c calibration command Change-Id: I403446cc0cd3ae5e1dec5d2dc97920ff334522da
This commit is contained in:
parent
032bf107b8
commit
d53bd3394a
25 changed files with 3001 additions and 1122 deletions
|
@ -2705,7 +2705,7 @@ GCode::LayerResult GCode::process_layer(
|
|||
|
||||
if (print.calib_mode() == CalibMode::Calib_Temp_Tower) {
|
||||
auto offset = static_cast<unsigned int>(print_z / 10.001) * 5;
|
||||
gcode += writer().set_temperature(print.calib_params().start - offset);
|
||||
gcode += writer().set_temperature(print.calib_params().end - offset);
|
||||
}
|
||||
else if (print.calib_mode() == CalibMode::Calib_Vol_speed_Tower) {
|
||||
auto _speed = print.calib_params().start + print_z * print.calib_params().step;
|
||||
|
@ -3694,7 +3694,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
|||
}
|
||||
|
||||
// calculate extrusion length per distance unit
|
||||
auto _mm3_per_mm = path.mm3_per_mm * (m_curr_print->calib_mode() == CalibMode::Calib_Flow_Rate ? this->config().print_flow_ratio : 1);
|
||||
auto _mm3_per_mm = path.mm3_per_mm * double(m_curr_print->calib_mode() == CalibMode::Calib_Flow_Rate ? this->config().print_flow_ratio.value : 1);
|
||||
double e_per_mm = m_writer.extruder()->e_per_mm3() * _mm3_per_mm;
|
||||
|
||||
double min_speed = double(m_config.slow_down_min_speed.get_at(m_writer.extruder()->id()));
|
||||
|
|
|
@ -1939,8 +1939,9 @@ Preset& PresetCollection::load_preset(const std::string &path, const std::string
|
|||
}
|
||||
|
||||
//BBS: add project embedded preset logic
|
||||
void PresetCollection::save_current_preset(const std::string &new_name, bool detach, bool save_to_project)
|
||||
void PresetCollection::save_current_preset(const std::string &new_name, bool detach, bool save_to_project, Preset* _curr_preset)
|
||||
{
|
||||
Preset curr_preset = _curr_preset ? *_curr_preset : m_edited_preset;
|
||||
//BBS: add lock logic for sync preset in background
|
||||
std::string final_inherits;
|
||||
lock();
|
||||
|
@ -1959,7 +1960,7 @@ void PresetCollection::save_current_preset(const std::string &new_name, bool det
|
|||
return;
|
||||
}
|
||||
// Overwriting an existing preset.
|
||||
preset.config = std::move(m_edited_preset.config);
|
||||
preset.config = std::move(curr_preset.config);
|
||||
// The newly saved preset will be activated -> make it visible.
|
||||
preset.is_visible = true;
|
||||
//TODO: remove the detach logic
|
||||
|
@ -1976,7 +1977,7 @@ void PresetCollection::save_current_preset(const std::string &new_name, bool det
|
|||
unlock();
|
||||
} else {
|
||||
// Creating a new preset.
|
||||
Preset &preset = *m_presets.insert(it, m_edited_preset);
|
||||
Preset &preset = *m_presets.insert(it, curr_preset);
|
||||
std::string &inherits = preset.inherits();
|
||||
std::string old_name = preset.name;
|
||||
preset.name = new_name;
|
||||
|
|
|
@ -474,7 +474,7 @@ public:
|
|||
// a new preset is stored into the list of presets.
|
||||
// All presets are marked as not modified and the new preset is activated.
|
||||
//BBS: add project embedded preset logic
|
||||
void save_current_preset(const std::string &new_name, bool detach = false, bool save_to_project = false);
|
||||
void save_current_preset(const std::string &new_name, bool detach = false, bool save_to_project = false, Preset* _curr_preset = nullptr);
|
||||
|
||||
// Delete the current preset, activate the first visible preset.
|
||||
// returns true if the preset was deleted successfully.
|
||||
|
|
|
@ -255,6 +255,8 @@ PresetsConfigSubstitutions PresetBundle::load_presets(AppConfig &config, Forward
|
|||
|
||||
this->load_selections(config, preferred_selection);
|
||||
|
||||
set_calibrate_printer("");
|
||||
|
||||
//BBS: add config related logs
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" finished, returned substitutions %1%")%substitutions.size();
|
||||
return substitutions;
|
||||
|
@ -539,6 +541,9 @@ PresetsConfigSubstitutions PresetBundle::load_user_presets(std::string user, For
|
|||
if (!errors_cummulative.empty()) throw Slic3r::RuntimeError(errors_cummulative);
|
||||
this->update_multi_material_filament_presets();
|
||||
this->update_compatible(PresetSelectCompatibleType::Never);
|
||||
|
||||
set_calibrate_printer("");
|
||||
|
||||
return PresetsConfigSubstitutions();
|
||||
}
|
||||
|
||||
|
@ -606,6 +611,8 @@ PresetsConfigSubstitutions PresetBundle::load_user_presets(AppConfig &
|
|||
this->update_compatible(PresetSelectCompatibleType::Never);
|
||||
//this->load_selections(config, PresetPreferences());
|
||||
|
||||
set_calibrate_printer("");
|
||||
|
||||
if (! errors_cummulative.empty())
|
||||
throw Slic3r::RuntimeError(errors_cummulative);
|
||||
|
||||
|
@ -1441,7 +1448,8 @@ unsigned int PresetBundle::sync_ams_list(unsigned int &unknowns)
|
|||
{
|
||||
std::vector<std::string> filament_presets;
|
||||
std::vector<std::string> filament_colors;
|
||||
for (auto &ams : filament_ams_list) {
|
||||
for (auto &entry : filament_ams_list) {
|
||||
auto & ams = entry.second;
|
||||
auto filament_id = ams.opt_string("filament_id", 0u);
|
||||
auto filament_color = ams.opt_string("filament_colour", 0u);
|
||||
auto filament_changed = !ams.has("filament_changed") || ams.opt_bool("filament_changed");
|
||||
|
@ -1478,6 +1486,29 @@ unsigned int PresetBundle::sync_ams_list(unsigned int &unknowns)
|
|||
return filament_presets.size();
|
||||
}
|
||||
|
||||
void PresetBundle::set_calibrate_printer(std::string name)
|
||||
{
|
||||
if (name.empty()) {
|
||||
calibrate_filaments.clear();
|
||||
return;
|
||||
}
|
||||
if (!name.empty())
|
||||
calibrate_printer = printers.find_preset(name);
|
||||
const Preset & printer_preset = calibrate_printer ? *calibrate_printer : printers.get_edited_preset();
|
||||
const PresetWithVendorProfile active_printer = printers.get_preset_with_vendor_profile(printer_preset);
|
||||
DynamicPrintConfig config;
|
||||
config.set_key_value("printer_preset", new ConfigOptionString(active_printer.preset.name));
|
||||
const ConfigOption *opt = active_printer.preset.config.option("nozzle_diameter");
|
||||
if (opt) config.set_key_value("num_extruders", new ConfigOptionInt((int) static_cast<const ConfigOptionFloats *>(opt)->values.size()));
|
||||
calibrate_filaments.clear();
|
||||
for (size_t i = filaments.num_default_presets(); i < filaments.size(); ++i) {
|
||||
const Preset & preset = filaments.m_presets[i];
|
||||
const PresetWithVendorProfile this_preset_with_vendor_profile = filaments.get_preset_with_vendor_profile(preset);
|
||||
bool is_compatible = is_compatible_with_printer(this_preset_with_vendor_profile, active_printer, &config);
|
||||
if (is_compatible) calibrate_filaments.insert(&preset);
|
||||
}
|
||||
}
|
||||
|
||||
//BBS: check whether this is the only edited filament
|
||||
bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index)
|
||||
{
|
||||
|
|
|
@ -86,6 +86,8 @@ public:
|
|||
//BBS: check whether this is the only edited filament
|
||||
bool is_the_only_edited_filament(unsigned int filament_index);
|
||||
|
||||
void set_calibrate_printer(std::string name);
|
||||
|
||||
PresetCollection prints;
|
||||
PresetCollection sla_prints;
|
||||
PresetCollection filaments;
|
||||
|
@ -98,7 +100,10 @@ public:
|
|||
// extruders.size() should be the same as printers.get_edited_preset().config.nozzle_diameter.size()
|
||||
std::vector<std::string> filament_presets;
|
||||
// BBS: ams
|
||||
std::vector<DynamicPrintConfig> filament_ams_list;
|
||||
std::map<int, DynamicPrintConfig> filament_ams_list;
|
||||
// Calibrate
|
||||
Preset const * calibrate_printer = nullptr;
|
||||
std::set<Preset const *> calibrate_filaments;
|
||||
|
||||
// The project configuration values are kept separated from the print/filament/printer preset,
|
||||
// they are being serialized / deserialized from / to the .amf, .3mf, .config, .gcode,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue