mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-27 04:42:33 +00:00
FIX: Calibration adaptation encryption
jira: none Change-Id: Ie42da224ca02261b0c32262be895c215878b7921 (cherry picked from commit 7498d6e5f89751d4f576ba073485238baba53d0f)
This commit is contained in:
@@ -201,9 +201,8 @@ void HistoryWindow::update(MachineObject* obj)
|
|||||||
{
|
{
|
||||||
if (!obj) return;
|
if (!obj) return;
|
||||||
|
|
||||||
if (obj->cali_version != history_version) {
|
if (obj->cali_version != obj->last_cali_version) {
|
||||||
if (obj->has_get_pa_calib_tab) {
|
if (obj->has_get_pa_calib_tab) {
|
||||||
history_version = obj->cali_version;
|
|
||||||
reqeust_history_result(obj);
|
reqeust_history_result(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ protected:
|
|||||||
bool& m_show_history_dialog;
|
bool& m_show_history_dialog;
|
||||||
std::vector<PACalibResult> m_calib_results_history;
|
std::vector<PACalibResult> m_calib_results_history;
|
||||||
MachineObject* curr_obj { nullptr };
|
MachineObject* curr_obj { nullptr };
|
||||||
int history_version = -1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditCalibrationHistoryDialog : public DPIDialog
|
class EditCalibrationHistoryDialog : public DPIDialog
|
||||||
|
|||||||
@@ -706,7 +706,7 @@ bool MachineObject::is_extrusion_cali_finished()
|
|||||||
if (diff.count() < EXTRUSION_OMIT_TIME) {
|
if (diff.count() < EXTRUSION_OMIT_TIME) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boost::contains(m_gcode_file, "extrusion_cali")
|
if (boost::contains(m_gcode_file, "extrusion_cali")
|
||||||
&& this->mc_print_percent == 100)
|
&& this->mc_print_percent == 100)
|
||||||
return true;
|
return true;
|
||||||
@@ -929,6 +929,7 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// is_support_ams_mapping
|
// is_support_ams_mapping
|
||||||
if (!is_support_ams_mapping()) {
|
if (!is_support_ams_mapping()) {
|
||||||
BOOST_LOG_TRIVIAL(info) << "ams_mapping: do not support, use order mapping";
|
BOOST_LOG_TRIVIAL(info) << "ams_mapping: do not support, use order mapping";
|
||||||
@@ -1033,7 +1034,7 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (distance_map[i][j].is_same_color
|
if (distance_map[i][j].is_same_color
|
||||||
&& distance_map[i][j].is_type_match) {
|
&& distance_map[i][j].is_type_match) {
|
||||||
if (min_val > distance_map[i][j].distance) {
|
if (min_val > distance_map[i][j].distance) {
|
||||||
@@ -1041,7 +1042,7 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
|
|||||||
min_val = distance_map[i][j].distance;
|
min_val = distance_map[i][j].distance;
|
||||||
picked_src_idx = i;
|
picked_src_idx = i;
|
||||||
picked_tar_idx = j;
|
picked_tar_idx = j;
|
||||||
}
|
}
|
||||||
else if (min_val == distance_map[i][j].distance&& filaments[picked_src_idx].filament_id!= tray_filaments[picked_tar_idx].filament_id && filaments[i].filament_id == tray_filaments[j].filament_id) {
|
else if (min_val == distance_map[i][j].distance&& filaments[picked_src_idx].filament_id!= tray_filaments[picked_tar_idx].filament_id && filaments[i].filament_id == tray_filaments[j].filament_id) {
|
||||||
|
|
||||||
picked_src_idx = i;
|
picked_src_idx = i;
|
||||||
@@ -1682,7 +1683,7 @@ int MachineObject::command_get_access_code() {
|
|||||||
json j;
|
json j;
|
||||||
j["system"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
j["system"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
j["system"]["command"] = "get_access_code";
|
j["system"]["command"] = "get_access_code";
|
||||||
|
|
||||||
return this->publish_json(j.dump());
|
return this->publish_json(j.dump());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1884,7 +1885,7 @@ int MachineObject::command_set_nozzle(int temp)
|
|||||||
int MachineObject::command_set_chamber(int temp)
|
int MachineObject::command_set_chamber(int temp)
|
||||||
{
|
{
|
||||||
json j;
|
json j;
|
||||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
j["print"]["command"] = "set_ctt";
|
j["print"]["command"] = "set_ctt";
|
||||||
j["print"]["ctt_val"] = temp;
|
j["print"]["ctt_val"] = temp;
|
||||||
|
|
||||||
@@ -2914,7 +2915,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||||||
else {
|
else {
|
||||||
if (!printer_type.empty() && connection_type() == "lan")
|
if (!printer_type.empty() && connection_type() == "lan")
|
||||||
print_json.load_compatible_settings(printer_type, "");
|
print_json.load_compatible_settings(printer_type, "");
|
||||||
print_json.diff2all_base_reset(j_pre);
|
print_json.diff2all_base_reset(j_pre);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3587,7 +3588,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||||||
if (jj.contains("heatbreak_fan_speed")) {
|
if (jj.contains("heatbreak_fan_speed")) {
|
||||||
heatbreak_fan_speed = stoi(jj["heatbreak_fan_speed"].get<std::string>());
|
heatbreak_fan_speed = stoi(jj["heatbreak_fan_speed"].get<std::string>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parse speed */
|
/* parse speed */
|
||||||
try {
|
try {
|
||||||
if (jj.contains("spd_lvl")) {
|
if (jj.contains("spd_lvl")) {
|
||||||
@@ -3918,7 +3919,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||||||
virtual_camera = ipcam.value<std::string>("virtual_camera", "disabled") == "enabled";
|
virtual_camera = ipcam.value<std::string>("virtual_camera", "disabled") == "enabled";
|
||||||
if (ipcam.contains("rtsp_url")) {
|
if (ipcam.contains("rtsp_url")) {
|
||||||
local_rtsp_url = ipcam["rtsp_url"].get<std::string>();
|
local_rtsp_url = ipcam["rtsp_url"].get<std::string>();
|
||||||
liveview_local = local_rtsp_url.empty() ? LVL_None : local_rtsp_url == "disable"
|
liveview_local = local_rtsp_url.empty() ? LVL_None : local_rtsp_url == "disable"
|
||||||
? LVL_Disable : boost::algorithm::starts_with(local_rtsp_url, "rtsps") ? LVL_Rtsps : LVL_Rtsp;
|
? LVL_Disable : boost::algorithm::starts_with(local_rtsp_url, "rtsps") ? LVL_Rtsps : LVL_Rtsp;
|
||||||
}
|
}
|
||||||
if (ipcam.contains("tutk_server")) {
|
if (ipcam.contains("tutk_server")) {
|
||||||
@@ -4680,17 +4681,26 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (jj["command"].get<std::string>() == "extrusion_cali_get") {
|
else if (jj["command"].get<std::string>() == "extrusion_cali_get") {
|
||||||
|
std::string str = jj.dump();
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_get: " << str;
|
||||||
|
reset_pa_cali_history_result();
|
||||||
|
bool is_succeed = true;
|
||||||
if (jj.contains("result") && jj.contains("reason")) {
|
if (jj.contains("result") && jj.contains("reason")) {
|
||||||
if (jj["result"].get<std::string>() == "fail") {
|
if (jj["result"].get<std::string>() == "fail") {
|
||||||
auto err_code = jj["err_code"].get<int>();
|
if (jj.contains("err_code")) {
|
||||||
print_error = err_code;
|
auto err_code = jj["err_code"].get<int>();
|
||||||
|
print_error = err_code;
|
||||||
|
}
|
||||||
|
is_succeed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_pa_cali_history_result();
|
if (is_succeed) {
|
||||||
has_get_pa_calib_tab = true;
|
last_cali_version = cali_version;
|
||||||
|
has_get_pa_calib_tab = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (jj.contains("nozzle_diameter")) {
|
if (jj.contains("nozzle_diameter")) {
|
||||||
if (jj["nozzle_diameter"].is_number_float()) {
|
if (jj["nozzle_diameter"].is_number_float()) {
|
||||||
@@ -4717,11 +4727,6 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||||||
|
|
||||||
if (jj.contains("filaments") && jj["filaments"].is_array()) {
|
if (jj.contains("filaments") && jj["filaments"].is_array()) {
|
||||||
try {
|
try {
|
||||||
#ifdef CALI_DEBUG
|
|
||||||
std::string str = jj.dump();
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_get: " << str;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
||||||
PACalibResult pa_calib_result;
|
PACalibResult pa_calib_result;
|
||||||
pa_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
|
pa_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
|
||||||
@@ -4760,23 +4765,25 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||||||
// notify cali history to update
|
// notify cali history to update
|
||||||
}
|
}
|
||||||
else if (jj["command"].get<std::string>() == "extrusion_cali_get_result") {
|
else if (jj["command"].get<std::string>() == "extrusion_cali_get_result") {
|
||||||
|
std::string str = jj.dump();
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_get_result: " << str;
|
||||||
|
reset_pa_cali_result();
|
||||||
|
bool is_succeed = true;
|
||||||
if (jj.contains("result") && jj.contains("reason")) {
|
if (jj.contains("result") && jj.contains("reason")) {
|
||||||
if (jj["result"].get<std::string>() == "fail") {
|
if (jj["result"].get<std::string>() == "fail") {
|
||||||
auto err_code = jj["err_code"].get<int>();
|
if (jj.contains("err_code")) {
|
||||||
print_error = err_code;
|
auto err_code = jj["err_code"].get<int>();
|
||||||
|
print_error = err_code;
|
||||||
|
is_succeed = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_pa_cali_result();
|
if (is_succeed)
|
||||||
get_pa_calib_result = true;
|
get_pa_calib_result = true;
|
||||||
|
|
||||||
if (jj.contains("filaments") && jj["filaments"].is_array()) {
|
if (jj.contains("filaments") && jj["filaments"].is_array()) {
|
||||||
try {
|
try {
|
||||||
#ifdef CALI_DEBUG
|
|
||||||
std::string str = jj.dump();
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_get_result: " << str;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
||||||
PACalibResult pa_calib_result;
|
PACalibResult pa_calib_result;
|
||||||
pa_calib_result.tray_id = (*it)["tray_id"].get<int>();
|
pa_calib_result.tray_id = (*it)["tray_id"].get<int>();
|
||||||
@@ -4862,7 +4869,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||||||
if (it->contains("confidence")) {
|
if (it->contains("confidence")) {
|
||||||
flow_ratio_calib_result.confidence = (*it)["confidence"].get<int>();
|
flow_ratio_calib_result.confidence = (*it)["confidence"].get<int>();
|
||||||
} else {
|
} else {
|
||||||
flow_ratio_calib_result.confidence = 0;
|
flow_ratio_calib_result.confidence = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
flow_ratio_results.push_back(flow_ratio_calib_result);
|
flow_ratio_results.push_back(flow_ratio_calib_result);
|
||||||
@@ -6194,7 +6201,7 @@ void DeviceManager::on_machine_alive(std::string json_str)
|
|||||||
if(obj->dev_connection_name.empty()){obj->dev_connection_name = connection_name;}
|
if(obj->dev_connection_name.empty()){obj->dev_connection_name = connection_name;}
|
||||||
obj->dev_ip = dev_ip;
|
obj->dev_ip = dev_ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/* ip changed reconnect mqtt */
|
/* ip changed reconnect mqtt */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -710,6 +710,7 @@ public:
|
|||||||
bool is_support_layer_num { false };
|
bool is_support_layer_num { false };
|
||||||
bool nozzle_blob_detection_enabled{ false };
|
bool nozzle_blob_detection_enabled{ false };
|
||||||
|
|
||||||
|
int last_cali_version = -1;
|
||||||
int cali_version = -1;
|
int cali_version = -1;
|
||||||
float cali_selected_nozzle_dia { 0.0 };
|
float cali_selected_nozzle_dia { 0.0 };
|
||||||
// 1: record when start calibration in preset page
|
// 1: record when start calibration in preset page
|
||||||
|
|||||||
@@ -297,8 +297,12 @@ void MonitorPanel::on_update_all(wxMouseEvent &event)
|
|||||||
update_all();
|
update_all();
|
||||||
|
|
||||||
MachineObject *obj_ = dev->get_selected_machine();
|
MachineObject *obj_ = dev->get_selected_machine();
|
||||||
if (obj_)
|
if (obj_) {
|
||||||
|
obj_->last_cali_version = -1;
|
||||||
|
obj_->reset_pa_cali_history_result();
|
||||||
|
obj_->reset_pa_cali_result();
|
||||||
GUI::wxGetApp().sidebar().load_ams_list(obj_->dev_id, obj_);
|
GUI::wxGetApp().sidebar().load_ams_list(obj_->dev_id, obj_);
|
||||||
|
}
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|||||||
@@ -2584,7 +2584,7 @@ void StatusPanel::update_ams(MachineObject *obj)
|
|||||||
}
|
}
|
||||||
if (m_filament_setting_dlg) { m_filament_setting_dlg->obj = obj; }
|
if (m_filament_setting_dlg) { m_filament_setting_dlg->obj = obj; }
|
||||||
|
|
||||||
if (obj->cali_version != -1 && last_cali_version != obj->cali_version) {
|
if (obj && (obj->last_cali_version != obj->cali_version)) {
|
||||||
last_cali_version = obj->cali_version;
|
last_cali_version = obj->cali_version;
|
||||||
PACalibExtruderInfo cali_info;
|
PACalibExtruderInfo cali_info;
|
||||||
cali_info.nozzle_diameter = obj->m_extder_data.extders[0].current_nozzle_diameter;
|
cali_info.nozzle_diameter = obj->m_extder_data.extders[0].current_nozzle_diameter;
|
||||||
|
|||||||
Reference in New Issue
Block a user