FIX: use time to hold the control
jira: [STUDIO-10923] Change-Id: I7069ed1ea0112837080c59895081e798d6a83e6e
This commit is contained in:
parent
39d49701ae
commit
c47759dd1f
|
@ -2820,7 +2820,7 @@ int MachineObject::command_xcam_control_ai_monitoring(bool on_off, std::string l
|
|||
bool print_halt = (lvl == "never_halt") ? false:true;
|
||||
|
||||
xcam_ai_monitoring = on_off;
|
||||
xcam_ai_monitoring_hold_count = HOLD_COUNT_MAX;
|
||||
xcam_ai_monitoring_hold_start = time(nullptr);
|
||||
xcam_ai_monitoring_sensitivity = lvl;
|
||||
return command_xcam_control("printing_monitor", on_off, lvl);
|
||||
}
|
||||
|
@ -4297,9 +4297,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
|
||||
try {
|
||||
if (jj.contains("xcam")) {
|
||||
if (xcam_ai_monitoring_hold_count > 0)
|
||||
xcam_ai_monitoring_hold_count--;
|
||||
else {
|
||||
if (time(nullptr) - xcam_ai_monitoring_hold_start > HOLD_TIME_MAX) {
|
||||
if (jj["xcam"].contains("printing_monitor")) {
|
||||
// new protocol
|
||||
xcam_ai_monitoring = jj["xcam"]["printing_monitor"].get<bool>();
|
||||
|
@ -4957,7 +4955,6 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
}
|
||||
else if (jj["module_name"].get<std::string>() == "printing_monitor") {
|
||||
xcam_ai_monitoring = enable;
|
||||
xcam_ai_monitoring_hold_count = HOLD_COUNT_MAX;
|
||||
if (jj.contains("halt_print_sensitivity")) {
|
||||
xcam_ai_monitoring_sensitivity = jj["halt_print_sensitivity"].get<std::string>();
|
||||
}
|
||||
|
@ -4965,7 +4962,6 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
else if (jj["module_name"].get<std::string>() == "spaghetti_detector") {
|
||||
// old protocol
|
||||
xcam_ai_monitoring = enable;
|
||||
xcam_ai_monitoring_hold_count = HOLD_COUNT_MAX;
|
||||
if (jj.contains("print_halt")) {
|
||||
if (jj["print_halt"].get<bool>())
|
||||
xcam_ai_monitoring_sensitivity = "medium";
|
||||
|
@ -5972,7 +5968,6 @@ void MachineObject::parse_new_info(json print)
|
|||
if (camera_timelapse_hold_count > 0) camera_timelapse_hold_count--;
|
||||
//if (xcam_buildplate_marker_hold_count > 0) xcam_buildplate_marker_hold_count--;first_layer_inspector
|
||||
if (xcam_first_layer_hold_count > 0) xcam_first_layer_hold_count--;
|
||||
if (xcam_ai_monitoring_hold_count > 0) xcam_ai_monitoring_hold_count--;
|
||||
if (xcam_auto_recovery_hold_count > 0) xcam_auto_recovery_hold_count--;
|
||||
if (xcam_prompt_sound_hold_count > 0) xcam_prompt_sound_hold_count--;
|
||||
if (xcam_filament_tangle_detect_count > 0)xcam_filament_tangle_detect_count--;
|
||||
|
@ -6037,7 +6032,11 @@ void MachineObject::parse_new_info(json print)
|
|||
break;
|
||||
}
|
||||
|
||||
xcam_ai_monitoring = get_flag_bits(cfg, 15);
|
||||
if (time(nullptr) - xcam_ai_monitoring_hold_start > HOLD_COUNT_MAX)
|
||||
{
|
||||
xcam_ai_monitoring = get_flag_bits(cfg, 15);
|
||||
}
|
||||
|
||||
xcam_auto_recovery_step_loss = get_flag_bits(cfg, 16);
|
||||
|
||||
if (time(nullptr) - ams_user_setting_start > HOLD_COUNT_MAX)
|
||||
|
|
|
@ -1011,7 +1011,7 @@ public:
|
|||
int nozzle_setting_hold_count = 0;
|
||||
|
||||
bool xcam_ai_monitoring{ false };
|
||||
int xcam_ai_monitoring_hold_count = 0;
|
||||
time_t xcam_ai_monitoring_hold_start = 0;
|
||||
std::string xcam_ai_monitoring_sensitivity;
|
||||
bool xcam_buildplate_marker_detector{ false };
|
||||
int xcam_buildplate_marker_hold_count = 0;
|
||||
|
|
Loading…
Reference in New Issue