mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
FIX: k value of ams control is not correct
modify the method for using printer type Change-Id: Ica864c19f4ad3e58e4f478e078b55fc11485901a
This commit is contained in:
parent
2ad8d08def
commit
e010fad242
8 changed files with 104 additions and 34 deletions
|
@ -94,8 +94,8 @@ public:
|
|||
std::string filament_id;
|
||||
std::string setting_id;
|
||||
std::string name;
|
||||
float k_value;
|
||||
float n_coef;
|
||||
float k_value = 0.0;
|
||||
float n_coef = 0.0;
|
||||
int confidence = -1; // 0: success 1: uncertain 2: failed
|
||||
};
|
||||
|
||||
|
|
|
@ -1561,7 +1561,7 @@ void CalibrationPresetPage::sync_ams_info(MachineObject* obj)
|
|||
AMSinfo info;
|
||||
info.ams_id = ams->first;
|
||||
if (ams->second->is_exists
|
||||
&& info.parse_ams_info(ams->second, obj->ams_calibrate_remain_flag, obj->is_support_ams_humidity)) {
|
||||
&& info.parse_ams_info(obj, ams->second, obj->ams_calibrate_remain_flag, obj->is_support_ams_humidity)) {
|
||||
ams_info.push_back(info);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -415,7 +415,7 @@ bool MachineObject::is_lan_mode_printer()
|
|||
|
||||
bool MachineObject::is_high_printer_type()
|
||||
{
|
||||
return this->printer_type == "BL-P001" || this->printer_type == "BL-P002";
|
||||
return get_printer_series() == PrinterSeries::SERIES_X1;
|
||||
}
|
||||
|
||||
PrinterSeries MachineObject::get_printer_series() const
|
||||
|
@ -693,7 +693,7 @@ bool MachineObject::is_U0_firmware()
|
|||
|
||||
bool MachineObject::is_support_ams_mapping()
|
||||
{
|
||||
if (printer_type == "BL-P001" || printer_type == "BL-P002") {
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1) {
|
||||
AppConfig* config = Slic3r::GUI::wxGetApp().app_config;
|
||||
if (config) {
|
||||
if (config->get("check_ams_version") == "0")
|
||||
|
@ -1324,7 +1324,7 @@ PrintingSpeedLevel MachineObject::_parse_printing_speed_lvl(int lvl)
|
|||
|
||||
int MachineObject::get_bed_temperature_limit()
|
||||
{
|
||||
if (printer_type == "BL-P001" || printer_type == "BL-P002") {
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1) {
|
||||
if (is_220V_voltage)
|
||||
return 110;
|
||||
else {
|
||||
|
@ -1379,8 +1379,7 @@ void MachineObject::parse_version_func()
|
|||
auto ota_version = module_vers.find("ota");
|
||||
auto esp32_version = module_vers.find("esp32");
|
||||
auto rv1126_version = module_vers.find("rv1126");
|
||||
if (printer_type == "BL-P001" ||
|
||||
printer_type == "BL-P002") {
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1) {
|
||||
if (ota_version != module_vers.end()) {
|
||||
if (ota_version->second.sw_ver.compare("01.01.01.00") <= 0) {
|
||||
ams_support_remain = false;
|
||||
|
@ -1938,8 +1937,7 @@ int MachineObject::command_axis_control(std::string axis, double unit, double va
|
|||
|
||||
bool MachineObject::is_support_command_calibration()
|
||||
{
|
||||
if (printer_type == "BL-P001"
|
||||
|| printer_type == "BL-P002") {
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1) {
|
||||
auto ap_ver_it = module_vers.find("rv1126");
|
||||
if (ap_ver_it != module_vers.end()) {
|
||||
if (ap_ver_it->second.sw_ver.compare("00.00.15.79") < 0)
|
||||
|
@ -1972,7 +1970,7 @@ int MachineObject::command_start_calibration(bool vibration, bool bed_leveling,
|
|||
int MachineObject::command_start_pa_calibration(const X1CCalibInfos &pa_data, int mode)
|
||||
{
|
||||
pa_calib_results.clear();
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1) {
|
||||
json j;
|
||||
j["print"]["command"] = "extrusion_cali";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
@ -1998,7 +1996,7 @@ int MachineObject::command_set_pa_calibration(const std::vector<PACalibResult>&
|
|||
{
|
||||
CNumericLocalesSetter locales_setter;
|
||||
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002") && pa_calib_values.size() > 0) {
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1 && pa_calib_values.size() > 0) {
|
||||
json j;
|
||||
j["print"]["command"] = "extrusion_cali_set";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
@ -2026,7 +2024,7 @@ int MachineObject::command_set_pa_calibration(const std::vector<PACalibResult>&
|
|||
|
||||
int MachineObject::command_delete_pa_calibration(const PACalibIndexInfo& pa_calib)
|
||||
{
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1) {
|
||||
json j;
|
||||
j["print"]["command"] = "extrusion_cali_del";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
@ -2044,7 +2042,7 @@ int MachineObject::command_get_pa_calibration_tab(float nozzle_diameter, const s
|
|||
{
|
||||
reset_pa_cali_history_result();
|
||||
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1) {
|
||||
json j;
|
||||
j["print"]["command"] = "extrusion_cali_get";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
@ -2059,7 +2057,7 @@ int MachineObject::command_get_pa_calibration_tab(float nozzle_diameter, const s
|
|||
|
||||
int MachineObject::command_get_pa_calibration_result(float nozzle_diameter)
|
||||
{
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1) {
|
||||
json j;
|
||||
j["print"]["command"] = "extrusion_cali_get_result";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
@ -2073,7 +2071,7 @@ int MachineObject::command_get_pa_calibration_result(float nozzle_diameter)
|
|||
|
||||
int MachineObject::commnad_select_pa_calibration(const PACalibIndexInfo& pa_calib_info)
|
||||
{
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1) {
|
||||
json j;
|
||||
j["print"]["command"] = "extrusion_cali_sel";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
@ -2090,7 +2088,7 @@ 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") && calib_data.calib_datas.size() > 0) {
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1 && calib_data.calib_datas.size() > 0) {
|
||||
json j;
|
||||
j["print"]["command"] = "flowrate_cali";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
@ -2115,7 +2113,7 @@ int MachineObject::command_start_flow_ratio_calibration(const X1CCalibInfos& cal
|
|||
|
||||
int MachineObject::command_get_flow_ratio_calibration_result(float nozzle_diameter)
|
||||
{
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1) {
|
||||
json j;
|
||||
j["print"]["command"] = "flowrate_get_result";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
@ -2129,7 +2127,7 @@ int MachineObject::command_get_flow_ratio_calibration_result(float nozzle_diamet
|
|||
|
||||
int MachineObject::command_unload_filament()
|
||||
{
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1
|
||||
&& !this->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY)) {
|
||||
// fixed gcode file
|
||||
json j;
|
||||
|
@ -2139,7 +2137,7 @@ int MachineObject::command_unload_filament()
|
|||
return this->publish_json(j.dump());
|
||||
}
|
||||
else if (printer_type == "C11"
|
||||
|| ((printer_type == "BL-P001" || printer_type == "BL-P002")
|
||||
|| (get_printer_series() == PrinterSeries::SERIES_X1
|
||||
&& this->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY))
|
||||
) {
|
||||
std::string gcode = DeviceManager::load_gcode(printer_type, "ams_unload.gcode");
|
||||
|
@ -3437,10 +3435,10 @@ int MachineObject::parse_json(std::string payload)
|
|||
}
|
||||
if (!curr_tray) continue;
|
||||
|
||||
//if (curr_tray->hold_count > 0) {
|
||||
// curr_tray->hold_count--;
|
||||
// continue;
|
||||
//}
|
||||
if (curr_tray->hold_count > 0) {
|
||||
curr_tray->hold_count--;
|
||||
continue;
|
||||
}
|
||||
|
||||
curr_tray->id = (*tray_it)["id"].get<std::string>();
|
||||
if (tray_it->contains("tag_uid"))
|
||||
|
@ -3904,6 +3902,47 @@ int MachineObject::parse_json(std::string payload)
|
|||
extrusion_cali_set_tray_id = curr_tray_id;
|
||||
extrusion_cali_set_hold_start = std::chrono::system_clock::now();
|
||||
}
|
||||
else if (jj["command"].get<std::string>() == "extrusion_cali_sel") {
|
||||
#ifdef CALI_DEBUG
|
||||
std::string str = jj.dump();
|
||||
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_sel: " << str;
|
||||
#endif
|
||||
int ams_id = -1;
|
||||
int tray_id = -1;
|
||||
int curr_tray_id = -1;
|
||||
if (jj.contains("tray_id")) {
|
||||
try {
|
||||
curr_tray_id = jj["tray_id"].get<int>();
|
||||
if (curr_tray_id == VIRTUAL_TRAY_ID)
|
||||
tray_id = curr_tray_id;
|
||||
else if (curr_tray_id >= 0 && curr_tray_id < 16) {
|
||||
ams_id = curr_tray_id / 4;
|
||||
tray_id = curr_tray_id % 4;
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(trace) << "extrusion_cali_sel: unsupported tray_id = " << curr_tray_id;
|
||||
}
|
||||
} catch (...) {
|
||||
;
|
||||
}
|
||||
}
|
||||
if (tray_id == VIRTUAL_TRAY_ID) {
|
||||
if (jj.contains("cali_idx")) {
|
||||
vt_tray.cali_idx = jj["cali_idx"].get<int>();
|
||||
vt_tray.set_hold_count();
|
||||
}
|
||||
} else {
|
||||
auto ams_item = this->amsList.find(std::to_string(ams_id));
|
||||
if (ams_item != this->amsList.end()) {
|
||||
auto tray_item = ams_item->second->trayList.find(std::to_string(tray_id));
|
||||
if (tray_item != ams_item->second->trayList.end()) {
|
||||
if (jj.contains("cali_idx")) {
|
||||
tray_item->second->cali_idx = jj["cali_idx"].get<int>();
|
||||
tray_item->second->set_hold_count();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (jj["command"].get<std::string>() == "extrusion_cali_get") {
|
||||
reset_pa_cali_history_result();
|
||||
has_get_pa_calib_tab = true;
|
||||
|
|
|
@ -2177,7 +2177,7 @@ void StatusPanel::update_ams(MachineObject *obj)
|
|||
for (auto ams = obj->amsList.begin(); ams != obj->amsList.end(); ams++) {
|
||||
AMSinfo info;
|
||||
info.ams_id = ams->first;
|
||||
if (ams->second->is_exists && info.parse_ams_info(ams->second, obj->ams_calibrate_remain_flag, obj->is_support_ams_humidity)) ams_info.push_back(info);
|
||||
if (ams->second->is_exists && info.parse_ams_info(obj, ams->second, obj->ams_calibrate_remain_flag, obj->is_support_ams_humidity)) ams_info.push_back(info);
|
||||
}
|
||||
//if (obj->ams_exist_bits != last_ams_exist_bits || obj->tray_exist_bits != last_tray_exist_bits || obj->tray_is_bbl_bits != last_tray_is_bbl_bits ||
|
||||
// obj->tray_read_done_bits != last_read_done_bits || obj->ams_version != last_ams_version) {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <wx/simplebook.h>
|
||||
#include <wx/dcgraph.h>
|
||||
#include "CalibUtils.hpp"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
|
@ -33,7 +34,7 @@ wxDEFINE_EVENT(EVT_AMS_SHOW_HUMIDITY_TIPS, wxCommandEvent);
|
|||
wxDEFINE_EVENT(EVT_AMS_UNSELETED_VAMS, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_CLEAR_SPEED_CONTROL, wxCommandEvent);
|
||||
|
||||
bool AMSinfo::parse_ams_info(Ams *ams, bool remain_flag, bool humidity_flag)
|
||||
bool AMSinfo::parse_ams_info(MachineObject *obj, Ams *ams, bool remain_flag, bool humidity_flag)
|
||||
{
|
||||
if (!ams) return false;
|
||||
this->ams_id = ams->id;
|
||||
|
@ -87,9 +88,13 @@ bool AMSinfo::parse_ams_info(Ams *ams, bool remain_flag, bool humidity_flag)
|
|||
wxColour(255, 255, 255);
|
||||
}
|
||||
|
||||
if (obj->get_printer_series() == PrinterSeries::SERIES_X1) {
|
||||
CalibUtils::get_pa_k_n_value_by_cali_idx(obj, it->second->cali_idx, info.k, info.n);
|
||||
}
|
||||
else {
|
||||
info.k = it->second->k;
|
||||
info.n = it->second->n;
|
||||
|
||||
}
|
||||
} else {
|
||||
info.can_id = i;
|
||||
info.material_state = AMSCanType::AMS_CAN_TYPE_EMPTY;
|
||||
|
@ -2689,10 +2694,21 @@ void AMSControl::show_vams_kn_value(bool show)
|
|||
void AMSControl::update_vams_kn_value(AmsTray tray, MachineObject* obj)
|
||||
{
|
||||
m_vams_lib->m_obj = obj;
|
||||
if (obj->get_printer_series() == PrinterSeries::SERIES_X1) {
|
||||
float k_value = 0;
|
||||
float n_value = 0;
|
||||
CalibUtils::get_pa_k_n_value_by_cali_idx(obj, tray.cali_idx, k_value, n_value);
|
||||
m_vams_info.k = k_value;
|
||||
m_vams_info.n = n_value;
|
||||
m_vams_lib->m_info.k = k_value;
|
||||
m_vams_lib->m_info.n = n_value;
|
||||
}
|
||||
else { // the remaining printer types
|
||||
m_vams_info.k = tray.k;
|
||||
m_vams_info.n = tray.n;
|
||||
m_vams_lib->m_info.k = tray.k;
|
||||
m_vams_lib->m_info.n = tray.n;
|
||||
}
|
||||
m_vams_info.material_name = tray.get_display_filament_type();
|
||||
m_vams_info.material_colour = tray.get_color();
|
||||
m_vams_lib->m_info.material_name = tray.get_display_filament_type();
|
||||
|
|
|
@ -150,7 +150,7 @@ public:
|
|||
int curreent_filamentstep;
|
||||
int ams_humidity = 0;
|
||||
|
||||
bool parse_ams_info(Ams *ams, bool remain_flag = false, bool humidity_flag = false);
|
||||
bool parse_ams_info(MachineObject* obj, Ams *ams, bool remain_flag = false, bool humidity_flag = false);
|
||||
};
|
||||
|
||||
/*************************************************
|
||||
|
|
|
@ -737,6 +737,20 @@ int CalibUtils::get_selected_calib_idx(const std::vector<PACalibResult> &pa_cali
|
|||
return -1;
|
||||
}
|
||||
|
||||
bool CalibUtils::get_pa_k_n_value_by_cali_idx(const MachineObject *obj, int cali_idx, float &out_k, float &out_n) {
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
for (auto pa_calib_info : obj->pa_calib_tab) {
|
||||
if (pa_calib_info.cali_idx == cali_idx) {
|
||||
out_k = pa_calib_info.k_value;
|
||||
out_n = pa_calib_info.n_coef;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& full_config, const Calib_Params& params, std::string& error_message)
|
||||
{
|
||||
Pointfs bedfs = full_config.opt<ConfigOptionPoints>("printable_area")->values;
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
|
||||
//help function
|
||||
static int get_selected_calib_idx(const std::vector<PACalibResult> &pa_calib_values, int cali_idx);
|
||||
static bool get_pa_k_n_value_by_cali_idx(const MachineObject* obj, int cali_idx, float& out_k, float& out_n);
|
||||
|
||||
static bool validate_input_k_value(wxString k_text, float* output_value);
|
||||
static bool validate_input_flow_ratio(wxString flow_ratio, float* output_value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue