mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	ENH: get result for pa and flow ratio cali
Change-Id: I78c967abcdaf8c75fe6b31f1697377b72ad10e06 (cherry picked from commit fb6cd5a7c71fe6e5c4e9fed71f0c61f3a7a0c8e4)
This commit is contained in:
		
							parent
							
								
									03054a3b80
								
							
						
					
					
						commit
						e6a03b48ad
					
				
					 7 changed files with 224 additions and 52 deletions
				
			
		| 
						 | 
				
			
			@ -24,6 +24,7 @@ enum class CalibState {
 | 
			
		|||
    CoarseSave,
 | 
			
		||||
    FineCalibration,
 | 
			
		||||
    Save,
 | 
			
		||||
    Finish
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct PrinterCaliInfo
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -775,6 +775,7 @@ void CalibrationWizard::on_click_btn_next(IntEvent& event)
 | 
			
		|||
 | 
			
		||||
        std::vector<int> tray_ids = get_selected_tray();
 | 
			
		||||
        if (start_calibration(tray_ids)) {
 | 
			
		||||
            is_between_start_and_runing = true;
 | 
			
		||||
            if (m_mode != CalibMode::Calib_Flow_Rate) {
 | 
			
		||||
                save_to_printer_calib_info(PageType::Calibration);
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -851,10 +852,13 @@ void CalibrationWizard::update_print_progress()
 | 
			
		|||
        m_staticText_layers->Hide();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (curr_obj->print_status == "RUNNING")
 | 
			
		||||
        is_between_start_and_runing = false;
 | 
			
		||||
 | 
			
		||||
    if (curr_obj->is_system_printing()) {
 | 
			
		||||
        reset_printing_values();
 | 
			
		||||
    }
 | 
			
		||||
    else if (curr_obj->is_in_printing() || curr_obj->print_status == "FINISH") {
 | 
			
		||||
    else if (curr_obj->is_in_printing() || curr_obj->print_status == "FINISH" || curr_obj->print_status == "IDLE" || curr_obj->print_status == "FAILED") {
 | 
			
		||||
        if (curr_obj->is_in_prepare() || curr_obj->print_status == "SLICING") {
 | 
			
		||||
            reset_printing_values();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -895,12 +899,17 @@ void CalibrationWizard::update_print_progress()
 | 
			
		|||
                if (m_button_pause_resume->GetToolTipText() != _L("Pause")) { m_button_pause_resume->SetToolTip(_L("Pause")); }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (curr_obj->print_status == "FINISH") {// curr_obj->is_extrusion_cali_finished() also can get in
 | 
			
		||||
            if ((curr_obj->print_status == "FINISH" || curr_obj->print_status == "IDLE" || curr_obj->print_status == "FAILED") &&
 | 
			
		||||
                m_curr_page->get_page_type() == PageType::Calibration) { // curr_obj->is_extrusion_cali_finished() also can get in
 | 
			
		||||
                if (is_between_start_and_runing)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                m_button_abort->Enable(false);
 | 
			
		||||
                m_button_abort->SetBitmap(m_bitmap_abort_disable.bmp());
 | 
			
		||||
                m_button_pause_resume->Enable(false);
 | 
			
		||||
                m_button_pause_resume->SetBitmap(m_bitmap_resume_disable.bmp());
 | 
			
		||||
                m_btn_next->Enable(true);
 | 
			
		||||
                request_calib_result();
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                m_button_abort->Enable(true);
 | 
			
		||||
| 
						 | 
				
			
			@ -949,6 +958,9 @@ void CalibrationWizard::update_print_progress()
 | 
			
		|||
    else { // "IDLE" or
 | 
			
		||||
        reset_printing_values();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    check_sync_printer_status();
 | 
			
		||||
 | 
			
		||||
    m_print_panel->Layout();
 | 
			
		||||
 | 
			
		||||
    m_print_panel->Thaw();
 | 
			
		||||
| 
						 | 
				
			
			@ -1542,11 +1554,6 @@ PressureAdvanceWizard::PressureAdvanceWizard(wxWindow* parent, wxWindowID id, co
 | 
			
		|||
    set_ams_select_mode(FSMCheckBoxMode);
 | 
			
		||||
 | 
			
		||||
    Bind(EVT_CALIBRATION_NOTIFY_CHANGE_PAGES, &PressureAdvanceWizard::switch_pages, this);
 | 
			
		||||
    m_page2->get_next_btn()->Bind(wxEVT_BUTTON, [this](auto& e) {
 | 
			
		||||
        if (is_high_end_type(curr_obj))
 | 
			
		||||
            request_calib_result(); // todo evaluate which ways : timer or button event
 | 
			
		||||
        e.Skip();
 | 
			
		||||
        });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PressureAdvanceWizard::create_save_panel_content(wxBoxSizer* sizer)
 | 
			
		||||
| 
						 | 
				
			
			@ -1688,9 +1695,6 @@ CalibrationWizardPage* PressureAdvanceWizard::create_start_page()
 | 
			
		|||
    page_prev_btn->SetButtonType(ButtonType::Back);
 | 
			
		||||
    page_prev_btn->Bind(wxEVT_BUTTON, [this](auto& e) {
 | 
			
		||||
        if (is_high_end_type(curr_obj)) {
 | 
			
		||||
            // todo emit once and loop to get
 | 
			
		||||
            CalibUtils::emit_get_PA_calib_infos();
 | 
			
		||||
            CalibUtils::get_PA_calib_tab(m_calib_results_history);
 | 
			
		||||
            sync_history_window_data();
 | 
			
		||||
        }
 | 
			
		||||
        m_history_page->ShowModal();
 | 
			
		||||
| 
						 | 
				
			
			@ -1741,10 +1745,12 @@ void PressureAdvanceWizard::create_history_window()
 | 
			
		|||
void PressureAdvanceWizard::request_calib_result() {
 | 
			
		||||
    // todo emit once and loop to get
 | 
			
		||||
    if (is_high_end_type(curr_obj)) {
 | 
			
		||||
        CalibUtils::emit_get_PA_calib_results();
 | 
			
		||||
        if (is_first_time_get_result) {
 | 
			
		||||
            float nozzle_diameter = dynamic_cast<ConfigOptionFloats *>(m_printer_preset->config.option("nozzle_diameter"))->get_at(0);
 | 
			
		||||
            CalibUtils::emit_get_PA_calib_results(nozzle_diameter);
 | 
			
		||||
            is_first_time_get_result = false;
 | 
			
		||||
        }
 | 
			
		||||
        CalibUtils::get_PA_calib_results(m_calib_results);
 | 
			
		||||
        CalibUtils::emit_get_PA_calib_infos();
 | 
			
		||||
        CalibUtils::get_PA_calib_tab(m_calib_results_history);
 | 
			
		||||
        // todo if failed to get result
 | 
			
		||||
        // pass m_calib_results info to page3
 | 
			
		||||
        if (m_calib_results.size() > 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -1960,6 +1966,7 @@ bool PressureAdvanceWizard::start_calibration(std::vector<int> tray_ids)
 | 
			
		|||
            msg_dlg.ShowModal();
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        is_first_time_get_result = true;
 | 
			
		||||
        show_page(get_curr_page()->get_next_page());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -2076,6 +2083,58 @@ void PressureAdvanceWizard::init_bitmaps()
 | 
			
		|||
    m_record_picture->SetBitmap(create_scaled_bitmap("extrusion_calibration_tips_en", nullptr, 400));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PressureAdvanceWizard::check_sync_printer_status()
 | 
			
		||||
{
 | 
			
		||||
    // todo: sync the printer result
 | 
			
		||||
    DeviceManager *dev  = Slic3r::GUI::wxGetApp().getDeviceManager();
 | 
			
		||||
    if (!dev)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    MachineObject *obj_ = dev->get_selected_machine();
 | 
			
		||||
    if (!obj_)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    if (!m_printer_preset || !m_filament_preset)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    if (m_cali_version != obj_->cali_version) {
 | 
			
		||||
        m_cali_version        = obj_->cali_version;
 | 
			
		||||
        float nozzle_diameter = dynamic_cast<ConfigOptionFloats *>(m_printer_preset->config.option("nozzle_diameter"))->get_at(0);
 | 
			
		||||
        CalibUtils::emit_get_PA_calib_info(nozzle_diameter, m_filament_preset->filament_id);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    if (CalibUtils::get_PA_calib_tab(m_calib_results_history)) {
 | 
			
		||||
        has_get_history_result = true;
 | 
			
		||||
 | 
			
		||||
        DeviceManager *dev         = Slic3r::GUI::wxGetApp().getDeviceManager();
 | 
			
		||||
        MachineObject *obj_        = dev->get_selected_machine();
 | 
			
		||||
        obj_->has_get_pa_calib_tab = false;
 | 
			
		||||
 | 
			
		||||
        //PACalibIndexInfo cali_info;
 | 
			
		||||
        //PACalibResult result_0 = m_calib_results_history[0];
 | 
			
		||||
 | 
			
		||||
        //cali_info.tray_id = 0;
 | 
			
		||||
        //cali_info.cali_idx = result_0.cali_idx;
 | 
			
		||||
        //cali_info.nozzle_diameter = result_0.nozzle_diameter;
 | 
			
		||||
        //cali_info.filament_id = result_0.filament_id;
 | 
			
		||||
        //CalibUtils::select_PA_calib_result(cali_info);
 | 
			
		||||
 | 
			
		||||
        //result_0                  = m_calib_results_history[2];
 | 
			
		||||
        //cali_info.tray_id         = 2;
 | 
			
		||||
        //cali_info.cali_idx        = result_0.cali_idx;
 | 
			
		||||
        //cali_info.nozzle_diameter = result_0.nozzle_diameter;
 | 
			
		||||
        //cali_info.filament_id     = result_0.filament_id;
 | 
			
		||||
        //CalibUtils::select_PA_calib_result(cali_info);
 | 
			
		||||
 | 
			
		||||
        //result_0                  = m_calib_results_history[3];
 | 
			
		||||
        //cali_info.tray_id         = 3;
 | 
			
		||||
        //cali_info.cali_idx        = result_0.cali_idx;
 | 
			
		||||
        //cali_info.nozzle_diameter = result_0.nozzle_diameter;
 | 
			
		||||
        //cali_info.filament_id     = result_0.filament_id;
 | 
			
		||||
        //CalibUtils::select_PA_calib_result(cali_info);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
FlowRateWizard::FlowRateWizard(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
 | 
			
		||||
    : CalibrationWizard(parent, CalibMode::Calib_Flow_Rate, id, pos, size, style)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -2325,12 +2384,6 @@ void FlowRateWizard::create_high_end_pages() {
 | 
			
		|||
    // link page
 | 
			
		||||
    m_page2->chain(m_high_end_page3);
 | 
			
		||||
    show_page(m_curr_page);
 | 
			
		||||
 | 
			
		||||
    m_page2->get_next_btn()->Bind(wxEVT_BUTTON, [this](auto& e) {
 | 
			
		||||
        if (is_high_end_type(curr_obj))
 | 
			
		||||
            request_calib_result(); // todo evaluate which ways : timer or button event
 | 
			
		||||
        e.Skip();
 | 
			
		||||
        });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
CalibrationWizardPage* FlowRateWizard::create_start_page()
 | 
			
		||||
| 
						 | 
				
			
			@ -2468,11 +2521,18 @@ void FlowRateWizard::create_pages()
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void FlowRateWizard::request_calib_result() {
 | 
			
		||||
    // todo emit once and loop to get
 | 
			
		||||
    CalibUtils::emit_get_flow_ratio_calib_results();
 | 
			
		||||
    CalibUtils::get_flow_ratio_calib_results(m_calib_results);
 | 
			
		||||
    // todo if get result failed
 | 
			
		||||
    sync_save_page_data();
 | 
			
		||||
 | 
			
		||||
    if (is_high_end_type(curr_obj)) {
 | 
			
		||||
        if (is_first_time_get_result) {
 | 
			
		||||
            float nozzle_diameter = dynamic_cast<ConfigOptionFloats *>(m_printer_preset->config.option("nozzle_diameter"))->get_at(0);
 | 
			
		||||
            CalibUtils::emit_get_flow_ratio_calib_results(nozzle_diameter);
 | 
			
		||||
            is_first_time_get_result = false;
 | 
			
		||||
        }
 | 
			
		||||
        CalibUtils::get_flow_ratio_calib_results(m_calib_results);
 | 
			
		||||
        // todo if failed to get result
 | 
			
		||||
        if (m_calib_results.size() > 0)
 | 
			
		||||
            sync_save_page_data();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void FlowRateWizard::sync_save_page_data() {
 | 
			
		||||
| 
						 | 
				
			
			@ -2605,6 +2665,7 @@ bool FlowRateWizard::start_calibration(std::vector<int> tray_ids)
 | 
			
		|||
            calib_info.bed_temp = bed_temp;
 | 
			
		||||
            calib_info.nozzle_temp = nozzle_temp;
 | 
			
		||||
            calib_info.max_volumetric_speed = max_volumetric_speed;
 | 
			
		||||
            calib_info.flow_rate = m_filament_preset->config.option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0);
 | 
			
		||||
            calib_infos.calib_datas.push_back(calib_info);
 | 
			
		||||
        }
 | 
			
		||||
        std::string error_message;
 | 
			
		||||
| 
						 | 
				
			
			@ -2614,6 +2675,7 @@ bool FlowRateWizard::start_calibration(std::vector<int> tray_ids)
 | 
			
		|||
            msg_dlg.ShowModal();
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        is_first_time_get_result = true;
 | 
			
		||||
        show_page(get_curr_page()->get_next_page());
 | 
			
		||||
        save_to_printer_calib_info(PageType::Calibration);
 | 
			
		||||
        return true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,6 +85,7 @@ protected:
 | 
			
		|||
    virtual void jump_to_page(PageType page_type);
 | 
			
		||||
    virtual void change_ams_select_mode() {};
 | 
			
		||||
    virtual void init_bitmaps();
 | 
			
		||||
    virtual void check_sync_printer_status() {};
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    ScalableBitmap m_bitmap_pause;
 | 
			
		||||
| 
						 | 
				
			
			@ -99,7 +100,7 @@ private:
 | 
			
		|||
 | 
			
		||||
protected:
 | 
			
		||||
    std::map<std::string, PrinterCaliInfo> m_printer_calib_infos;
 | 
			
		||||
 | 
			
		||||
    bool is_between_start_and_runing = false;
 | 
			
		||||
    CalibMode m_mode;
 | 
			
		||||
    MachineObject* curr_obj{ nullptr };
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -219,6 +220,7 @@ protected:
 | 
			
		|||
    virtual void request_calib_result() override;
 | 
			
		||||
    virtual void change_ams_select_mode() override;
 | 
			
		||||
    virtual void init_bitmaps() override;
 | 
			
		||||
    virtual void check_sync_printer_status() override;
 | 
			
		||||
 | 
			
		||||
    void sync_history_window_data();
 | 
			
		||||
    void sync_save_page_data();
 | 
			
		||||
| 
						 | 
				
			
			@ -248,6 +250,13 @@ private:
 | 
			
		|||
    std::vector<PACalibResult> m_calib_results;
 | 
			
		||||
    std::vector<PACalibResult> m_calib_results_history;
 | 
			
		||||
    wxPanel* m_grid_panel;
 | 
			
		||||
 | 
			
		||||
    bool is_first_time_get_result = true;
 | 
			
		||||
    
 | 
			
		||||
    bool is_history_result_dirty  = true;
 | 
			
		||||
    bool has_get_history_result = false;
 | 
			
		||||
 | 
			
		||||
    int m_cali_version = -1;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class FlowRateWizard : public CalibrationWizard {
 | 
			
		||||
| 
						 | 
				
			
			@ -310,6 +319,7 @@ private:
 | 
			
		|||
    float m_fine_calc_result;
 | 
			
		||||
    TextInput* m_save_name_input2;
 | 
			
		||||
    std::string m_save_name;
 | 
			
		||||
    bool is_first_time_get_result = true;
 | 
			
		||||
 | 
			
		||||
    void reset_print_panel_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer);
 | 
			
		||||
    void reset_send_progress_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,6 +17,7 @@
 | 
			
		|||
#include <boost/uuid/uuid_generators.hpp>
 | 
			
		||||
#include <boost/uuid/uuid_io.hpp>
 | 
			
		||||
 | 
			
		||||
#define CALI_DEBUG
 | 
			
		||||
 | 
			
		||||
namespace pt = boost::property_tree;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -102,6 +103,24 @@ wxString get_stage_string(int stage)
 | 
			
		|||
    return "";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::string to_string_nozzle_diameter(float nozzle_diameter)
 | 
			
		||||
{
 | 
			
		||||
    float eps = 1e-3;
 | 
			
		||||
    if (abs(nozzle_diameter - 0.2) < eps) {
 | 
			
		||||
        return "0.2";
 | 
			
		||||
    }
 | 
			
		||||
    else if (abs(nozzle_diameter - 0.4) < eps) {
 | 
			
		||||
        return "0.4";
 | 
			
		||||
    }
 | 
			
		||||
    else if (abs(nozzle_diameter - 0.6) < eps) {
 | 
			
		||||
        return "0.6";
 | 
			
		||||
    }
 | 
			
		||||
    else if (abs(nozzle_diameter - 0.8) < eps) {
 | 
			
		||||
        return "0.8";
 | 
			
		||||
    }
 | 
			
		||||
    return "0";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace Slic3r {
 | 
			
		||||
 | 
			
		||||
/* Common Functions */
 | 
			
		||||
| 
						 | 
				
			
			@ -1938,10 +1957,11 @@ int MachineObject::command_start_pa_calibration(const X1CCalibInfos& pa_data)
 | 
			
		|||
 | 
			
		||||
int MachineObject::command_set_pa_calibration(const std::vector<PACalibResult>& pa_calib_values)
 | 
			
		||||
{
 | 
			
		||||
    if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
 | 
			
		||||
    if ((printer_type == "BL-P001" || printer_type == "BL-P002") && pa_calib_values.size() > 0) {
 | 
			
		||||
        json j;
 | 
			
		||||
        j["print"]["command"]     = "extrusion_cali_set";
 | 
			
		||||
        j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
 | 
			
		||||
        j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib_values[0].nozzle_diameter);
 | 
			
		||||
 | 
			
		||||
        for (int i = 0; i < pa_calib_values.size(); ++i) {
 | 
			
		||||
            j["print"]["filaments"][i]["tray_id"]     = pa_calib_values[i].tray_id;
 | 
			
		||||
| 
						 | 
				
			
			@ -1964,35 +1984,36 @@ int MachineObject::command_delete_pa_calibration(const PACalibIndexInfo& pa_cali
 | 
			
		|||
        json j;
 | 
			
		||||
        j["print"]["command"]     = "extrusion_cali_del";
 | 
			
		||||
        j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
 | 
			
		||||
        j["print"]["tray_id"]     = pa_calib.tray_id; // no need
 | 
			
		||||
        j["print"]["filament_id"] = pa_calib.filament_id;
 | 
			
		||||
        j["print"]["index"]       = pa_calib.index;
 | 
			
		||||
        j["print"]["nozzle_diameter"] = std::to_string(pa_calib.nozzle_diameter);
 | 
			
		||||
        j["print"]["cali_idx"]        = pa_calib.cali_idx;
 | 
			
		||||
        j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib.nozzle_diameter);
 | 
			
		||||
 | 
			
		||||
        return this->publish_json(j.dump());
 | 
			
		||||
    }
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int MachineObject::command_get_pa_calibration_tab(const std::string &filament_id)
 | 
			
		||||
int MachineObject::command_get_pa_calibration_tab(float nozzle_diameter, const std::string &filament_id)
 | 
			
		||||
{
 | 
			
		||||
    if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
 | 
			
		||||
        json j;
 | 
			
		||||
        j["print"]["command"]     = "extrusion_cali_get";
 | 
			
		||||
        j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
 | 
			
		||||
        j["print"]["filament_id"] = filament_id;
 | 
			
		||||
        j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(nozzle_diameter);
 | 
			
		||||
 | 
			
		||||
        return this->publish_json(j.dump());
 | 
			
		||||
    }
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int MachineObject::command_get_pa_calibration_result()
 | 
			
		||||
int MachineObject::command_get_pa_calibration_result(float nozzle_diameter)
 | 
			
		||||
{
 | 
			
		||||
    if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
 | 
			
		||||
        json j;
 | 
			
		||||
        j["print"]["command"]     = "extrusion_cali_get_result";
 | 
			
		||||
        j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
 | 
			
		||||
        j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(nozzle_diameter);
 | 
			
		||||
 | 
			
		||||
        return this->publish_json(j.dump());
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -2006,9 +2027,9 @@ int MachineObject::commnad_select_pa_calibration(const PACalibIndexInfo& pa_cali
 | 
			
		|||
        j["print"]["command"]     = "extrusion_cali_sel";
 | 
			
		||||
        j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
 | 
			
		||||
        j["print"]["tray_id"]     = pa_calib_info.tray_id;
 | 
			
		||||
        j["print"]["index"]       = pa_calib_info.index;
 | 
			
		||||
        j["print"]["cali_idx"]        = pa_calib_info.cali_idx;
 | 
			
		||||
        j["print"]["filament_id"] = pa_calib_info.filament_id;
 | 
			
		||||
        j["print"]["nozzle_diameter"] = std::to_string(pa_calib_info.nozzle_diameter);
 | 
			
		||||
        j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib_info.nozzle_diameter);
 | 
			
		||||
 | 
			
		||||
        return this->publish_json(j.dump());
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -2017,18 +2038,21 @@ int MachineObject::commnad_select_pa_calibration(const PACalibIndexInfo& pa_cali
 | 
			
		|||
 | 
			
		||||
int MachineObject::command_start_flow_ratio_calibration(const X1CCalibInfos& calib_data)
 | 
			
		||||
{
 | 
			
		||||
    if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
 | 
			
		||||
    if ((printer_type == "BL-P001" || printer_type == "BL-P002") && calib_data.calib_datas.size() > 0) {
 | 
			
		||||
        json j;
 | 
			
		||||
        j["print"]["command"]     = "flowrate_cali";
 | 
			
		||||
        j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
 | 
			
		||||
        j["print"]["tray_id"] = calib_data.calib_datas[0].tray_id;
 | 
			
		||||
        j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(calib_data.calib_datas[0].nozzle_diameter);
 | 
			
		||||
 | 
			
		||||
        for (int i = 0; i < calib_data.calib_datas.size(); ++i) {
 | 
			
		||||
            j["print"]["filaments"][i]["tray_id"]              = calib_data.calib_datas[i].tray_id;
 | 
			
		||||
            j["print"]["filaments"][i]["nozzle_diameter"]      = std::to_string(calib_data.calib_datas[i].nozzle_diameter);
 | 
			
		||||
            j["print"]["filaments"][i]["bed_temp"]             = calib_data.calib_datas[i].bed_temp;
 | 
			
		||||
            j["print"]["filaments"][i]["filament_id"]          = calib_data.calib_datas[i].filament_id;
 | 
			
		||||
            j["print"]["filaments"][i]["setting_id"]           = calib_data.calib_datas[i].setting_id;
 | 
			
		||||
            j["print"]["filaments"][i]["nozzle_temp"]          = calib_data.calib_datas[i].nozzle_temp;
 | 
			
		||||
            // todo: new version need
 | 
			
		||||
            //j["print"]["filaments"][i]["def_flow_ratio"]       = std::to_string(calib_data.calib_datas[i].flow_rate);
 | 
			
		||||
            j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(calib_data.calib_datas[i].max_volumetric_speed);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2037,12 +2061,13 @@ int MachineObject::command_start_flow_ratio_calibration(const X1CCalibInfos& cal
 | 
			
		|||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int MachineObject::command_get_flow_ratio_calibration_result()
 | 
			
		||||
int MachineObject::command_get_flow_ratio_calibration_result(float nozzle_diameter)
 | 
			
		||||
{
 | 
			
		||||
    if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
 | 
			
		||||
        json j;
 | 
			
		||||
        j["print"]["command"]     = "flowrate_get_result";
 | 
			
		||||
        j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
 | 
			
		||||
        j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(nozzle_diameter);
 | 
			
		||||
 | 
			
		||||
        return this->publish_json(j.dump());
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -3195,6 +3220,9 @@ int MachineObject::parse_json(std::string payload)
 | 
			
		|||
                            int ams_status = jj["ams_status"].get<int>();
 | 
			
		||||
                            this->_parse_ams_status(ams_status);
 | 
			
		||||
                        }
 | 
			
		||||
                        if (jj.contains("cali_version")) {
 | 
			
		||||
                            cali_version = jj["cali_version"].get<int>();
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    catch (...) {
 | 
			
		||||
                        ;
 | 
			
		||||
| 
						 | 
				
			
			@ -3455,6 +3483,10 @@ int MachineObject::parse_json(std::string payload)
 | 
			
		|||
                                                curr_tray->n = (*tray_it)["n"].get<float>();
 | 
			
		||||
                                            }
 | 
			
		||||
                                        }
 | 
			
		||||
 | 
			
		||||
                                        if (tray_it->contains("cali_idx")) {
 | 
			
		||||
                                            curr_tray->cali_idx = (*tray_it)["cali_idx"].get<int>();
 | 
			
		||||
                                        }
 | 
			
		||||
                                    }
 | 
			
		||||
                                    // remove not in trayList
 | 
			
		||||
                                    for (auto tray_it = tray_id_set.begin(); tray_it != tray_id_set.end(); tray_it++) {
 | 
			
		||||
| 
						 | 
				
			
			@ -3732,6 +3764,10 @@ int MachineObject::parse_json(std::string payload)
 | 
			
		|||
                        // enter extrusion cali
 | 
			
		||||
                    }
 | 
			
		||||
                } else if (jj["command"].get<std::string>() == "extrusion_cali_set") {
 | 
			
		||||
#ifdef CALI_DEBUG
 | 
			
		||||
                    std::string str = jj.dump();
 | 
			
		||||
                    BOOST_LOG_TRIVIAL(info) << "extrusion_cali_set: " << str;
 | 
			
		||||
#endif
 | 
			
		||||
                    int ams_id = -1;
 | 
			
		||||
                    int tray_id = -1;
 | 
			
		||||
                    int curr_tray_id = -1;
 | 
			
		||||
| 
						 | 
				
			
			@ -3774,12 +3810,23 @@ int MachineObject::parse_json(std::string payload)
 | 
			
		|||
                else if (jj["command"].get<std::string>() == "extrusion_cali_get") {
 | 
			
		||||
                    if (jj["filaments"].is_array()) {
 | 
			
		||||
                        try {
 | 
			
		||||
#ifdef CALI_DEBUG
 | 
			
		||||
                            std::string str = jj.dump();
 | 
			
		||||
                            BOOST_LOG_TRIVIAL(info) << "extrusion_cali_get: " << str;
 | 
			
		||||
#endif
 | 
			
		||||
                            pa_calib_tab.clear();
 | 
			
		||||
                            for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
 | 
			
		||||
                                PACalibResult pa_calib_result;
 | 
			
		||||
                                pa_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
 | 
			
		||||
                                pa_calib_result.setting_id  = (*it)["setting_id"].get<std::string>();
 | 
			
		||||
                                pa_calib_result.name        = (*it)["name"].get<std::string>();
 | 
			
		||||
                                pa_calib_result.cali_idx    = (*it)["cali_idx"].get<int>();
 | 
			
		||||
 | 
			
		||||
                                if (jj["nozzle_diameter"].is_number_float()) {
 | 
			
		||||
                                    pa_calib_result.nozzle_diameter = jj["nozzle_diameter"].get<float>();
 | 
			
		||||
                                } else if (jj["nozzle_diameter"].is_string()) {
 | 
			
		||||
                                    pa_calib_result.nozzle_diameter = stof(jj["nozzle_diameter"].get<std::string>().c_str());
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
                                if ((*it)["k_value"].is_number_float())
 | 
			
		||||
                                    pa_calib_result.k_value = (*it)["k_value"].get<float>();
 | 
			
		||||
| 
						 | 
				
			
			@ -3793,6 +3840,7 @@ int MachineObject::parse_json(std::string payload)
 | 
			
		|||
 | 
			
		||||
                                pa_calib_tab.push_back(pa_calib_result);
 | 
			
		||||
                            }
 | 
			
		||||
                            has_get_pa_calib_tab = true;
 | 
			
		||||
                        }
 | 
			
		||||
                        catch (...) {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -3802,13 +3850,22 @@ int MachineObject::parse_json(std::string payload)
 | 
			
		|||
                else if (jj["command"].get<std::string>() == "extrusion_cali_get_result") {
 | 
			
		||||
                    if (jj["filaments"].is_array()) {
 | 
			
		||||
                        try {
 | 
			
		||||
#ifdef CALI_DEBUG
 | 
			
		||||
                            std::string str = jj.dump();
 | 
			
		||||
                            BOOST_LOG_TRIVIAL(info) << "extrusion_cali_get_result: " << str;
 | 
			
		||||
#endif
 | 
			
		||||
                            pa_calib_results.clear();
 | 
			
		||||
                            for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
 | 
			
		||||
                                PACalibResult pa_calib_result;
 | 
			
		||||
                                pa_calib_result.tray_id     = (*it)["tray_id"].get<int>();
 | 
			
		||||
                                pa_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
 | 
			
		||||
                                pa_calib_result.setting_id  = (*it)["setting_id"].get<std::string>();
 | 
			
		||||
                                pa_calib_result.nozzle_diameter = stof(jj["nozzle_diameter"].get<std::string>().c_str());
 | 
			
		||||
 | 
			
		||||
                                if (jj["nozzle_diameter"].is_number_float()) {
 | 
			
		||||
                                    pa_calib_result.nozzle_diameter = jj["nozzle_diameter"].get<float>();
 | 
			
		||||
                                } else if (jj["nozzle_diameter"].is_string()) {
 | 
			
		||||
                                    pa_calib_result.nozzle_diameter = stof(jj["nozzle_diameter"].get<std::string>().c_str());
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
                                if ((*it)["k_value"].is_number_float())
 | 
			
		||||
                                    pa_calib_result.k_value = (*it)["k_value"].get<float>();
 | 
			
		||||
| 
						 | 
				
			
			@ -3828,6 +3885,10 @@ int MachineObject::parse_json(std::string payload)
 | 
			
		|||
                else if (jj["command"].get<std::string>() == "flowrate_get_result") {
 | 
			
		||||
                    if (jj["filaments"].is_array()) {
 | 
			
		||||
                        try {
 | 
			
		||||
#ifdef CALI_DEBUG
 | 
			
		||||
                            std::string str = jj.dump();
 | 
			
		||||
                            BOOST_LOG_TRIVIAL(info) << "flowrate_get_result: " << str;
 | 
			
		||||
#endif
 | 
			
		||||
                            flow_ratio_results.clear();
 | 
			
		||||
                            for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
 | 
			
		||||
                                FlowRatioCalibResult flow_ratio_calib_result;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -209,6 +209,7 @@ public:
 | 
			
		|||
    std::string     uuid;
 | 
			
		||||
    float           k = 0.0f;       // k range: 0 ~ 0.5
 | 
			
		||||
    float           n = 0.0f;       // k range: 0.6 ~ 2.0
 | 
			
		||||
    int             cali_idx = 0;
 | 
			
		||||
 | 
			
		||||
    wxColour        wx_color;
 | 
			
		||||
    bool            is_bbl;
 | 
			
		||||
| 
						 | 
				
			
			@ -320,6 +321,7 @@ public:
 | 
			
		|||
        std::string filament_id;
 | 
			
		||||
        std::string setting_id;
 | 
			
		||||
        float max_volumetric_speed;
 | 
			
		||||
        float flow_rate = 0.98f; // for flow ratio
 | 
			
		||||
    };
 | 
			
		||||
   
 | 
			
		||||
    std::vector<X1CCalibInfo> calib_datas;
 | 
			
		||||
| 
						 | 
				
			
			@ -329,6 +331,7 @@ class PACalibResult
 | 
			
		|||
{
 | 
			
		||||
public:
 | 
			
		||||
    int tray_id;
 | 
			
		||||
    int         cali_idx;
 | 
			
		||||
    float       nozzle_diameter;
 | 
			
		||||
    std::string filament_id;
 | 
			
		||||
    std::string setting_id;
 | 
			
		||||
| 
						 | 
				
			
			@ -340,7 +343,7 @@ public:
 | 
			
		|||
struct PACalibIndexInfo
 | 
			
		||||
{
 | 
			
		||||
    int         tray_id;
 | 
			
		||||
    int         index;
 | 
			
		||||
    int         cali_idx;
 | 
			
		||||
    float       nozzle_diameter;
 | 
			
		||||
    std::string filament_id;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -654,6 +657,8 @@ public:
 | 
			
		|||
    int     total_layers = 0;
 | 
			
		||||
    bool    is_support_layer_num { false };
 | 
			
		||||
 | 
			
		||||
    int cali_version = -1;
 | 
			
		||||
    bool has_get_pa_calib_tab = false;
 | 
			
		||||
    std::vector<PACalibResult> pa_calib_tab;
 | 
			
		||||
    std::vector<PACalibResult> pa_calib_results;
 | 
			
		||||
    std::vector<FlowRatioCalibResult> flow_ratio_results;
 | 
			
		||||
| 
						 | 
				
			
			@ -821,13 +826,13 @@ public:
 | 
			
		|||
    int command_start_pa_calibration(const X1CCalibInfos& pa_data);
 | 
			
		||||
    int command_set_pa_calibration(const std::vector<PACalibResult>& pa_calib_values);
 | 
			
		||||
    int command_delete_pa_calibration(const PACalibIndexInfo& pa_calib);
 | 
			
		||||
    int command_get_pa_calibration_tab(const std::string& filament_id = "");
 | 
			
		||||
    int command_get_pa_calibration_result();
 | 
			
		||||
    int command_get_pa_calibration_tab(float nozzle_diameter, const std::string &filament_id = "");
 | 
			
		||||
    int command_get_pa_calibration_result(float nozzle_diameter);
 | 
			
		||||
    int commnad_select_pa_calibration(const PACalibIndexInfo& pa_calib_info);
 | 
			
		||||
 | 
			
		||||
    // flow ratio calibration
 | 
			
		||||
    int command_start_flow_ratio_calibration(const X1CCalibInfos& calib_data);
 | 
			
		||||
    int command_get_flow_ratio_calibration_result();
 | 
			
		||||
    int command_get_flow_ratio_calibration_result(float nozzle_diameter);
 | 
			
		||||
 | 
			
		||||
    int command_unload_filament();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -106,7 +106,7 @@ void CalibUtils::calib_PA(const X1CCalibInfos& calib_infos, std::string& error_m
 | 
			
		|||
        obj_->command_start_pa_calibration(calib_infos);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CalibUtils::emit_get_PA_calib_results()
 | 
			
		||||
void CalibUtils::emit_get_PA_calib_results(float nozzle_diameter)
 | 
			
		||||
{
 | 
			
		||||
    DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
 | 
			
		||||
    if (!dev)
 | 
			
		||||
| 
						 | 
				
			
			@ -116,7 +116,7 @@ void CalibUtils::emit_get_PA_calib_results()
 | 
			
		|||
    if (obj_ == nullptr)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    obj_->command_get_pa_calibration_result();
 | 
			
		||||
    obj_->command_get_pa_calibration_result(nozzle_diameter);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool CalibUtils::get_PA_calib_results(std::vector<PACalibResult>& pa_calib_results)
 | 
			
		||||
| 
						 | 
				
			
			@ -133,7 +133,7 @@ bool CalibUtils::get_PA_calib_results(std::vector<PACalibResult>& pa_calib_resul
 | 
			
		|||
    return pa_calib_results.size() > 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CalibUtils::emit_get_PA_calib_infos()
 | 
			
		||||
void CalibUtils::emit_get_PA_calib_infos(float nozzle_diameter)
 | 
			
		||||
{
 | 
			
		||||
    DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
 | 
			
		||||
    if (!dev)
 | 
			
		||||
| 
						 | 
				
			
			@ -143,7 +143,7 @@ void CalibUtils::emit_get_PA_calib_infos()
 | 
			
		|||
    if (obj_ == nullptr)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    obj_->command_get_pa_calibration_tab();
 | 
			
		||||
    obj_->command_get_pa_calibration_tab(nozzle_diameter);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool CalibUtils::get_PA_calib_tab(std::vector<PACalibResult> &pa_calib_infos)
 | 
			
		||||
| 
						 | 
				
			
			@ -156,8 +156,35 @@ bool CalibUtils::get_PA_calib_tab(std::vector<PACalibResult> &pa_calib_infos)
 | 
			
		|||
    if (obj_ == nullptr)
 | 
			
		||||
        return false;
 | 
			
		||||
 | 
			
		||||
    pa_calib_infos = obj_->pa_calib_tab;
 | 
			
		||||
    return pa_calib_infos.size() > 0;
 | 
			
		||||
    if (obj_->has_get_pa_calib_tab) {
 | 
			
		||||
        pa_calib_infos.assign(obj_->pa_calib_tab.begin(), obj_->pa_calib_tab.end());
 | 
			
		||||
    }
 | 
			
		||||
    return obj_->has_get_pa_calib_tab;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CalibUtils::emit_get_PA_calib_info(float nozzle_diameter, const std::string &filament_id)
 | 
			
		||||
{
 | 
			
		||||
    DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
 | 
			
		||||
    if (!dev) return;
 | 
			
		||||
 | 
			
		||||
    MachineObject *obj_ = dev->get_selected_machine();
 | 
			
		||||
    if (obj_ == nullptr) return;
 | 
			
		||||
 | 
			
		||||
    obj_->command_get_pa_calibration_tab(nozzle_diameter, filament_id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool CalibUtils::get_PA_calib_info(PACalibResult & pa_calib_info) {
 | 
			
		||||
    DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
 | 
			
		||||
    if (!dev) return false;
 | 
			
		||||
 | 
			
		||||
    MachineObject *obj_ = dev->get_selected_machine();
 | 
			
		||||
    if (obj_ == nullptr) return false;
 | 
			
		||||
 | 
			
		||||
    if (!obj_->pa_calib_tab.empty()) {
 | 
			
		||||
        pa_calib_info = obj_->pa_calib_tab.front();
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CalibUtils::set_PA_calib_result(const std::vector<PACalibResult>& pa_calib_values)
 | 
			
		||||
| 
						 | 
				
			
			@ -213,7 +240,7 @@ void CalibUtils::calib_flowrate_X1C(const X1CCalibInfos& calib_infos, std::strin
 | 
			
		|||
        obj_->command_start_flow_ratio_calibration(calib_infos);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CalibUtils::emit_get_flow_ratio_calib_results()
 | 
			
		||||
void CalibUtils::emit_get_flow_ratio_calib_results(float nozzle_diameter)
 | 
			
		||||
{
 | 
			
		||||
    DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
 | 
			
		||||
    if (!dev)
 | 
			
		||||
| 
						 | 
				
			
			@ -223,7 +250,7 @@ void CalibUtils::emit_get_flow_ratio_calib_results()
 | 
			
		|||
    if (obj_ == nullptr)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    obj_->command_get_flow_ratio_calibration_result();
 | 
			
		||||
    obj_->command_get_flow_ratio_calibration_result(nozzle_diameter);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool CalibUtils::get_flow_ratio_calib_results(std::vector<FlowRatioCalibResult>& flow_ratio_calib_results)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,16 +31,22 @@ public:
 | 
			
		|||
    static CalibMode get_calib_mode_by_name(const std::string &name);
 | 
			
		||||
 | 
			
		||||
    static void calib_PA(const X1CCalibInfos& calib_infos, std::string& error_message);
 | 
			
		||||
    static void emit_get_PA_calib_results();
 | 
			
		||||
    
 | 
			
		||||
    static void emit_get_PA_calib_results(float nozzle_diameter);
 | 
			
		||||
    static bool get_PA_calib_results(std::vector<PACalibResult> &pa_calib_results);
 | 
			
		||||
    static void emit_get_PA_calib_infos();
 | 
			
		||||
    
 | 
			
		||||
    static void emit_get_PA_calib_infos(float nozzle_diameter);
 | 
			
		||||
    static bool get_PA_calib_tab(std::vector<PACalibResult> &pa_calib_infos);
 | 
			
		||||
 | 
			
		||||
    static void emit_get_PA_calib_info(float nozzle_diameter, const std::string &filament_id);
 | 
			
		||||
    static bool get_PA_calib_info(PACalibResult &pa_calib_info);
 | 
			
		||||
 | 
			
		||||
    static void set_PA_calib_result(const std::vector<PACalibResult>& pa_calib_values);
 | 
			
		||||
    static void select_PA_calib_result(const PACalibIndexInfo &pa_calib_info);
 | 
			
		||||
    static void delete_PA_calib_result(const PACalibIndexInfo &pa_calib_info);
 | 
			
		||||
 | 
			
		||||
    static void calib_flowrate_X1C(const X1CCalibInfos& calib_infos, std::string& error_message);
 | 
			
		||||
    static void emit_get_flow_ratio_calib_results();
 | 
			
		||||
    static void emit_get_flow_ratio_calib_results(float nozzle_diameter);
 | 
			
		||||
    static bool get_flow_ratio_calib_results(std::vector<FlowRatioCalibResult> &flow_ratio_calib_results);
 | 
			
		||||
    static void calib_flowrate(int pass, const CalibInfo& calib_info, std::string& error_message);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue