FIX: Calibration adaptation encryption

jira: none
Change-Id: Ie42da224ca02261b0c32262be895c215878b7921
This commit is contained in:
zhimin.zeng 2024-12-27 20:27:45 +08:00 committed by Lane.Wei
parent b9f898d8d8
commit 7498d6e5f8
6 changed files with 55 additions and 48 deletions

View File

@ -201,9 +201,8 @@ void HistoryWindow::update(MachineObject* obj)
{
if (!obj) return;
if (obj->cali_version != history_version) {
if (obj->cali_version != obj->last_cali_version) {
if (obj->has_get_pa_calib_tab) {
history_version = obj->cali_version;
reqeust_history_result(obj);
}
}

View File

@ -36,7 +36,6 @@ protected:
bool& m_show_history_dialog;
std::vector<PACalibResult> m_calib_results_history;
MachineObject* curr_obj { nullptr };
int history_version = -1;
};
class EditCalibrationHistoryDialog : public DPIDialog

View File

@ -664,7 +664,7 @@ bool MachineObject::is_extrusion_cali_finished()
if (diff.count() < EXTRUSION_OMIT_TIME) {
return false;
}
if (boost::contains(m_gcode_file, "extrusion_cali")
&& this->mc_print_percent == 100)
return true;
@ -848,7 +848,7 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
}
}
// is_support_ams_mapping
if (!is_support_ams_mapping()) {
BOOST_LOG_TRIVIAL(info) << "ams_mapping: do not support, use order mapping";
@ -953,7 +953,7 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
}
continue;
}
if (distance_map[i][j].is_same_color
&& distance_map[i][j].is_type_match) {
if (min_val > distance_map[i][j].distance) {
@ -961,7 +961,7 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
min_val = distance_map[i][j].distance;
picked_src_idx = i;
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) {
picked_src_idx = i;
@ -1411,7 +1411,7 @@ void MachineObject::parse_status(int flag)
is_support_air_print_detection = ((flag >> 29) & 0x1) != 0;
ams_air_print_status = ((flag >> 28) & 0x1) != 0;
if (!is_support_p1s_plus) {
auto supported_plus = ((flag >> 27) & 0x1) != 0;
auto installed_plus = ((flag >> 26) & 0x1) != 0;
@ -1542,7 +1542,7 @@ int MachineObject::command_get_access_code() {
json j;
j["system"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
j["system"]["command"] = "get_access_code";
return this->publish_json(j.dump());
}
@ -1787,7 +1787,7 @@ int MachineObject::command_set_nozzle(int temp)
int MachineObject::command_set_chamber(int temp)
{
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"]["ctt_val"] = temp;
@ -2134,7 +2134,7 @@ int MachineObject::command_axis_control(std::string axis, double unit, double in
try {
json j;
j["axis_control"] = axis;
NetworkAgent* agent = GUI::wxGetApp().getAgent();
if (agent) agent->track_event("printer_control", j.dump());
}
@ -2788,7 +2788,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
else {
if (!printer_type.empty() && connection_type() == "lan")
print_json.load_compatible_settings(printer_type, "");
print_json.diff2all_base_reset(j_pre);
print_json.diff2all_base_reset(j_pre);
}
}
}
@ -3448,7 +3448,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
if (jj.contains("heatbreak_fan_speed")) {
heatbreak_fan_speed = stoi(jj["heatbreak_fan_speed"].get<std::string>());
}
/* parse speed */
try {
if (jj.contains("spd_lvl")) {
@ -3575,7 +3575,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
}
}
}
}
catch(...) {
@ -3772,7 +3772,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
virtual_camera = ipcam.value<std::string>("virtual_camera", "disabled") == "enabled";
if (ipcam.contains("rtsp_url")) {
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;
}
if (ipcam.contains("tutk_server")) {
@ -4001,7 +4001,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
;
}
}
if (it->contains("tray")) {
std::set<std::string> tray_id_set;
@ -4158,7 +4158,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
}
}
}
if (tray_it->contains("remain")) {
curr_tray->remain = (*tray_it)["remain"].get<int>();
} else {
@ -4653,17 +4653,26 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
}
}
}
}
}
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["result"].get<std::string>() == "fail") {
auto err_code = jj["err_code"].get<int>();
print_error = err_code;
if (jj.contains("err_code")) {
auto err_code = jj["err_code"].get<int>();
print_error = err_code;
}
is_succeed = false;
}
}
reset_pa_cali_history_result();
has_get_pa_calib_tab = true;
if (is_succeed) {
last_cali_version = cali_version;
has_get_pa_calib_tab = true;
}
if (jj.contains("nozzle_diameter")) {
if (jj["nozzle_diameter"].is_number_float()) {
@ -4682,11 +4691,6 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
if (jj.contains("filaments") && jj["filaments"].is_array()) {
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++) {
PACalibResult pa_calib_result;
pa_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
@ -4725,23 +4729,25 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
// notify cali history to update
}
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["result"].get<std::string>() == "fail") {
auto err_code = jj["err_code"].get<int>();
print_error = err_code;
if (jj.contains("err_code")) {
auto err_code = jj["err_code"].get<int>();
print_error = err_code;
is_succeed = false;
}
}
}
reset_pa_cali_result();
get_pa_calib_result = true;
if (is_succeed)
get_pa_calib_result = true;
if (jj.contains("filaments") && jj["filaments"].is_array()) {
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++) {
PACalibResult pa_calib_result;
pa_calib_result.tray_id = (*it)["tray_id"].get<int>();
@ -4803,7 +4809,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
if (it->contains("confidence")) {
flow_ratio_calib_result.confidence = (*it)["confidence"].get<int>();
} else {
flow_ratio_calib_result.confidence = 0;
flow_ratio_calib_result.confidence = 0;
}
flow_ratio_results.push_back(flow_ratio_calib_result);
@ -5466,7 +5472,7 @@ void DeviceManager::on_machine_alive(std::string json_str)
if(obj->dev_connection_name.empty()){obj->dev_connection_name = connection_name;}
obj->dev_ip = dev_ip;
}
}
/* ip changed reconnect mqtt */
}
@ -6145,7 +6151,7 @@ void DeviceManager::check_filaments_in_blacklist(std::string tag_vendor, std::st
{
{"TPU: not supported", _L("TPU is not supported by AMS.")},
{"Bambu PET-CF/PA6-CF: not supported", _L("Bambu PET-CF/PA6-CF is not supported by AMS.")},
{"PVA: flexible", _L("Damp PVA will become flexible and get stuck inside AMS,please take care to dry it before use.")},
{"PVA: flexible", _L("Damp PVA will become flexible and get stuck inside AMS,please take care to dry it before use.")},
{"CF/GF: hard and brittle", _L("CF/GF filaments are hard and brittle, It's easy to break or get stuck in AMS, please use with caution.")}
};

View File

@ -624,6 +624,7 @@ public:
bool is_support_layer_num { false };
bool nozzle_blob_detection_enabled{ false };
int last_cali_version = -1;
int cali_version = -1;
float cali_selected_nozzle_dia { 0.0 };
// 1: record when start calibration in preset page

View File

@ -310,11 +310,13 @@ void MonitorPanel::select_machine(std::string machine_sn)
set_default();
update_all();
m_status_info_panel->last_cali_version.reset();
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_);
}
Layout();
}

View File

@ -823,7 +823,7 @@ void PrintingTaskPanel::market_scoring_show()
m_score_subtask_info->Show();
}
bool PrintingTaskPanel::is_market_scoring_show() {
bool PrintingTaskPanel::is_market_scoring_show() {
return m_score_staticline->IsShown() && m_score_subtask_info->IsShown(); }
void PrintingTaskPanel::market_scoring_hide()
@ -2040,12 +2040,12 @@ bool StatusPanel::is_task_changed(MachineObject* obj)
void StatusPanel::update(MachineObject *obj)
{
if (!obj) return;
m_project_task_panel->Freeze();
update_subtask(obj);
m_project_task_panel->Thaw();
#if !BBL_RELEASE_TO_PUBLIC
auto delay1 = std::chrono::duration_cast<std::chrono::milliseconds>(obj->last_utc_time - std::chrono::system_clock::now()).count();
auto delay2 = std::chrono::duration_cast<std::chrono::milliseconds>(obj->last_push_time - std::chrono::system_clock::now()).count();
@ -2111,7 +2111,7 @@ void StatusPanel::update(MachineObject *obj)
if (obj->get_printer_series() == PrinterSeries::SERIES_X1) {
m_tempCtrl_chamber->SetTagTemp(TEMP_BLANK_STR);
}
if (obj->get_printer_series() == PrinterSeries::SERIES_P1P)
{
m_tempCtrl_chamber->SetLabel(TEMP_BLANK_STR);
@ -2573,7 +2573,7 @@ void StatusPanel::update_ams(MachineObject *obj)
}
if (m_filament_setting_dlg) { m_filament_setting_dlg->obj = obj; }
if (obj && (!last_cali_version.has_value() || last_cali_version != obj->cali_version)) {
if (obj && (obj->last_cali_version != obj->cali_version)) {
last_cali_version = obj->cali_version;
CalibUtils::emit_get_PA_calib_info(obj->nozzle_diameter, "");
}
@ -3776,7 +3776,7 @@ void StatusPanel::on_ext_spool_edit(wxCommandEvent &event)
else {
m_filament_setting_dlg->set_color(color);
}
m_filament_setting_dlg->m_is_third = !MachineObject::is_bbl_filament(obj->vt_tray.tag_uid);
if (!m_filament_setting_dlg->m_is_third) {
sn_number = obj->vt_tray.uuid;