FIX: remember the flow ratio calibration type
Jira: STUDIO-5181 Signed-off-by: wenjie.guo <wenjie.guo@bambulab.com> Change-Id: Id6125d1d4ea58972ce55c2c2498259596b25111e (cherry picked from commit 1af1038fd4824d989e992cb630cf34e00c787af7)
This commit is contained in:
parent
57a9e676a4
commit
f2b8d78230
|
@ -522,6 +522,8 @@ std::string AppConfig::load()
|
|||
cali_info.cali_finished = bool(calis_j["cali_finished"].get<int>());
|
||||
if (calis_j.contains("flow_ratio"))
|
||||
cali_info.cache_flow_ratio = calis_j["flow_ratio"].get<float>();
|
||||
if (calis_j.contains("cache_flow_rate_calibration_type"))
|
||||
cali_info.cache_flow_rate_calibration_type = static_cast<FlowRatioCalibrationType>(calis_j["cache_flow_rate_calibration_type"].get<int>());
|
||||
if (calis_j.contains("presets")) {
|
||||
cali_info.selected_presets.clear();
|
||||
for (auto cali_it = calis_j["presets"].begin(); cali_it != calis_j["presets"].end(); cali_it++) {
|
||||
|
@ -640,6 +642,7 @@ void AppConfig::save()
|
|||
cali_json["dev_id"] = cali_info.dev_id;
|
||||
cali_json["flow_ratio"] = cali_info.cache_flow_ratio;
|
||||
cali_json["cali_finished"] = cali_info.cali_finished ? 1 : 0;
|
||||
cali_json["cache_flow_rate_calibration_type"] = static_cast<int>(cali_info.cache_flow_rate_calibration_type);
|
||||
for (auto filament_preset : cali_info.selected_presets) {
|
||||
json preset_json;
|
||||
preset_json["tray_id"] = filament_preset.tray_id;
|
||||
|
@ -988,6 +991,7 @@ void AppConfig::save_printer_cali_infos(const PrinterCaliInfo &cali_info, bool n
|
|||
}
|
||||
(*iter).cache_flow_ratio = cali_info.cache_flow_ratio;
|
||||
(*iter).selected_presets = cali_info.selected_presets;
|
||||
(*iter).cache_flow_rate_calibration_type = cali_info.cache_flow_rate_calibration_type;
|
||||
}
|
||||
m_dirty = true;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,11 @@ struct Calib_Params
|
|||
CalibMode mode;
|
||||
};
|
||||
|
||||
enum FlowRatioCalibrationType {
|
||||
COMPLETE_CALIBRATION = 0,
|
||||
FINE_CALIBRATION,
|
||||
};
|
||||
|
||||
class X1CCalibInfos
|
||||
{
|
||||
public:
|
||||
|
@ -83,6 +88,7 @@ struct PrinterCaliInfo
|
|||
bool cali_finished = true;
|
||||
float cache_flow_ratio;
|
||||
std::vector<CaliPresetInfo> selected_presets;
|
||||
FlowRatioCalibrationType cache_flow_rate_calibration_type = FlowRatioCalibrationType::COMPLETE_CALIBRATION;
|
||||
};
|
||||
|
||||
class PACalibResult
|
||||
|
|
|
@ -295,6 +295,7 @@ void CalibrationWizard::recover_preset_info(MachineObject *obj)
|
|||
obj->cali_finished = back_info.cali_finished;
|
||||
obj->cache_flow_ratio = back_info.cache_flow_ratio;
|
||||
obj->selected_cali_preset = back_info.selected_presets;
|
||||
obj->flow_ratio_calibration_type = back_info.cache_flow_rate_calibration_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -306,6 +307,7 @@ void CalibrationWizard::back_preset_info(MachineObject *obj, bool cali_finish, b
|
|||
printer_cali_info.cali_finished = cali_finish;
|
||||
printer_cali_info.cache_flow_ratio = obj->cache_flow_ratio;
|
||||
printer_cali_info.selected_presets = obj->selected_cali_preset;
|
||||
printer_cali_info.cache_flow_rate_calibration_type = obj->flow_ratio_calibration_type;
|
||||
wxGetApp().app_config->save_printer_cali_infos(printer_cali_info, back_cali_flag);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,16 +35,16 @@ void CaliPresetCaliStagePanel::create_panel(wxWindow* parent)
|
|||
|
||||
m_complete_radioBox = new wxRadioButton(parent, wxID_ANY, _L("Complete Calibration"));
|
||||
m_complete_radioBox->SetForegroundColour(*wxBLACK);
|
||||
|
||||
m_complete_radioBox->SetValue(true);
|
||||
m_stage = CALI_MANUAL_STAGE_1;
|
||||
m_top_sizer->Add(m_complete_radioBox);
|
||||
m_top_sizer->AddSpacer(FromDIP(10));
|
||||
|
||||
m_fine_radioBox = new wxRadioButton(parent, wxID_ANY, _L("Fine Calibration based on flow ratio"));
|
||||
m_fine_radioBox->SetForegroundColour(*wxBLACK);
|
||||
m_top_sizer->Add(m_fine_radioBox);
|
||||
|
||||
auto input_panel = new wxPanel(parent);
|
||||
input_panel = new wxPanel(parent);
|
||||
input_panel->Hide();
|
||||
auto input_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
input_panel->SetSizer(input_sizer);
|
||||
|
@ -58,15 +58,16 @@ void CaliPresetCaliStagePanel::create_panel(wxWindow* parent)
|
|||
m_top_sizer->Add(input_panel);
|
||||
|
||||
m_top_sizer->AddSpacer(PRESET_GAP);
|
||||
|
||||
// events
|
||||
m_complete_radioBox->Bind(wxEVT_RADIOBUTTON, [this, input_panel](auto& e) {
|
||||
m_complete_radioBox->Bind(wxEVT_RADIOBUTTON, [this](auto& e) {
|
||||
m_stage_panel_parent->get_current_object()->flow_ratio_calibration_type = COMPLETE_CALIBRATION;
|
||||
input_panel->Show(false);
|
||||
m_stage = CALI_MANUAL_STAGE_1;
|
||||
GetParent()->Layout();
|
||||
GetParent()->Fit();
|
||||
});
|
||||
m_fine_radioBox->Bind(wxEVT_RADIOBUTTON, [this, input_panel](auto& e) {
|
||||
m_fine_radioBox->Bind(wxEVT_RADIOBUTTON, [this](auto& e) {
|
||||
m_stage_panel_parent->get_current_object()->flow_ratio_calibration_type = FINE_CALIBRATION;
|
||||
input_panel->Show();
|
||||
m_stage = CALI_MANUAL_STAGE_2;
|
||||
GetParent()->Layout();
|
||||
|
@ -127,6 +128,19 @@ void CaliPresetCaliStagePanel::set_flow_ratio_value(float flow_ratio)
|
|||
m_flow_ratio_value = flow_ratio;
|
||||
}
|
||||
|
||||
void CaliPresetCaliStagePanel::set_flow_ratio_calibration_type(FlowRatioCalibrationType type) {
|
||||
if (type == COMPLETE_CALIBRATION) {
|
||||
m_complete_radioBox->SetValue(true);
|
||||
input_panel->Hide();
|
||||
}
|
||||
else if (type == FINE_CALIBRATION) {
|
||||
m_fine_radioBox->SetValue(true);
|
||||
input_panel->Show();
|
||||
}
|
||||
GetParent()->Layout();
|
||||
GetParent()->Fit();
|
||||
}
|
||||
|
||||
CaliComboBox::CaliComboBox(wxWindow* parent,
|
||||
wxString title,
|
||||
wxArrayString values,
|
||||
|
@ -674,6 +688,7 @@ void CalibrationPresetPage::create_page(wxWindow* parent)
|
|||
m_top_sizer->Add(m_step_panel, 0, wxEXPAND, 0);
|
||||
|
||||
m_cali_stage_panel = new CaliPresetCaliStagePanel(parent);
|
||||
m_cali_stage_panel->set_parent(this);
|
||||
m_top_sizer->Add(m_cali_stage_panel, 0);
|
||||
|
||||
m_selection_panel = new wxPanel(parent);
|
||||
|
@ -1469,6 +1484,8 @@ void CalibrationPresetPage::init_with_machine(MachineObject* obj)
|
|||
{
|
||||
if (!obj) return;
|
||||
|
||||
//set flow ratio calibration type
|
||||
m_cali_stage_panel->set_flow_ratio_calibration_type(obj->flow_ratio_calibration_type);
|
||||
// set nozzle value from machine
|
||||
bool nozzle_is_set = false;
|
||||
for (int i = 0; i < NOZZLE_LIST_COUNT; i++) {
|
||||
|
|
|
@ -16,6 +16,8 @@ enum FlowRatioCaliSource {
|
|||
FROM_COARSE_PAGE,
|
||||
};
|
||||
|
||||
class CalibrationPresetPage;
|
||||
|
||||
class CaliPresetCaliStagePanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
|
@ -30,14 +32,17 @@ public:
|
|||
void get_cali_stage(CaliPresetStage& stage, float& value);
|
||||
|
||||
void set_flow_ratio_value(float flow_ratio);
|
||||
|
||||
void set_parent(CalibrationPresetPage* parent) { m_stage_panel_parent = parent; }
|
||||
void set_flow_ratio_calibration_type(FlowRatioCalibrationType type);
|
||||
protected:
|
||||
CaliPresetStage m_stage;
|
||||
wxBoxSizer* m_top_sizer;
|
||||
wxRadioButton* m_complete_radioBox;
|
||||
wxRadioButton* m_fine_radioBox;
|
||||
TextInput * flow_ratio_input;
|
||||
wxPanel* input_panel;
|
||||
float m_flow_ratio_value;
|
||||
CalibrationPresetPage* m_stage_panel_parent;
|
||||
};
|
||||
|
||||
class CaliComboBox : public wxPanel
|
||||
|
@ -162,6 +167,7 @@ public:
|
|||
void stripWhiteSpace(std::string& str);
|
||||
void update_priner_status_msg(wxString msg, bool is_warning);
|
||||
void update(MachineObject* obj) override;
|
||||
void update_flow_ratio_type(FlowRatioCalibrationType type) { curr_obj->flow_ratio_calibration_type = type; }
|
||||
|
||||
void on_device_connected(MachineObject* obj) override;
|
||||
|
||||
|
@ -206,7 +212,7 @@ public:
|
|||
CalibMode get_pa_cali_method();
|
||||
|
||||
CaliPresetPageStatus get_page_status() { return m_page_status; }
|
||||
|
||||
MachineObject* get_current_object() { return curr_obj; }
|
||||
void msw_rescale() override;
|
||||
void on_sys_color_changed() override;
|
||||
|
||||
|
@ -306,4 +312,4 @@ public:
|
|||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -133,6 +133,7 @@ enum ManualPaCaliMethod {
|
|||
PA_PATTERN,
|
||||
};
|
||||
|
||||
|
||||
struct RatingInfo {
|
||||
bool request_successful;
|
||||
int http_code;
|
||||
|
@ -619,6 +620,7 @@ public:
|
|||
std::vector<CaliPresetInfo> selected_cali_preset;
|
||||
float cache_flow_ratio { 0.0 };
|
||||
bool cali_finished = true;
|
||||
FlowRatioCalibrationType flow_ratio_calibration_type = FlowRatioCalibrationType::COMPLETE_CALIBRATION;
|
||||
|
||||
ManualPaCaliMethod manual_pa_cali_method = ManualPaCaliMethod::PA_LINE;
|
||||
bool has_get_pa_calib_tab{ false };
|
||||
|
|
Loading…
Reference in New Issue