ENH:handling dirty data after nozzle settings

jira:[STUDIO-6332]

Change-Id: I00d6d1324376f973ec3cf9f2154ae83ef3302705
This commit is contained in:
tao wang 2024-03-02 14:54:41 +08:00 committed by Lane.Wei
parent d59d2fd014
commit 8b00cfc276
2 changed files with 23 additions and 6 deletions

View File

@ -1909,6 +1909,7 @@ int MachineObject::command_set_chamber_light(LIGHT_EFFECT effect, int on_time, i
int MachineObject::command_set_printer_nozzle(std::string nozzle_type, float diameter)
{
nozzle_setting_hold_count = HOLD_COUNT_MAX * 2;
BOOST_LOG_TRIVIAL(info) << "command_set_printer_nozzle, nozzle_type = " << nozzle_type << " diameter = " << diameter;
json j;
j["system"]["command"] = "set_accessories";
@ -3426,11 +3427,19 @@ int MachineObject::parse_json(std::string payload)
#pragma endregion
try {
if (jj.contains("nozzle_diameter")) {
if (jj["nozzle_diameter"].is_number_float()) {
nozzle_diameter = jj["nozzle_diameter"].get<float>();
} else if (jj["nozzle_diameter"].is_string()) {
nozzle_diameter = string_to_float(jj["nozzle_diameter"].get<std::string>());
if (nozzle_setting_hold_count > 0) {
nozzle_setting_hold_count--;
} else {
if (jj["nozzle_diameter"].is_number_float()) {
nozzle_diameter = jj["nozzle_diameter"].get<float>();
}
else if (jj["nozzle_diameter"].is_string()) {
nozzle_diameter = string_to_float(jj["nozzle_diameter"].get<std::string>());
}
}
}
}
catch(...) {
@ -3439,8 +3448,14 @@ int MachineObject::parse_json(std::string payload)
try {
if (jj.contains("nozzle_type")) {
if (jj["nozzle_type"].is_string()) {
nozzle_type = jj["nozzle_type"].get<std::string>();
if (nozzle_setting_hold_count > 0) {
nozzle_setting_hold_count--;
}
else {
if (jj["nozzle_type"].is_string()) {
nozzle_type = jj["nozzle_type"].get<std::string>();
}
}
}
}

View File

@ -708,6 +708,8 @@ public:
bool file_model_download{false};
bool virtual_camera{false};
int nozzle_setting_hold_count = 0;
bool xcam_ai_monitoring{ false };
int xcam_ai_monitoring_hold_count = 0;
std::string xcam_ai_monitoring_sensitivity;