mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-03-13 06:46:11 -06:00
FIX: use time to hold the control
jira: [STUDIO-10923] Change-Id: I7069ed1ea0112837080c59895081e798d6a83e6e (cherry picked from commit c47759dd1fe17c840fa92ab3fec803a58d2d1785)
This commit is contained in:
parent
01d059912b
commit
7ca7ca18fb
2 changed files with 8 additions and 9 deletions
|
|
@ -2750,7 +2750,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);
|
||||
}
|
||||
|
|
@ -4238,9 +4238,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>();
|
||||
|
|
@ -4887,7 +4885,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>();
|
||||
}
|
||||
|
|
@ -4895,7 +4892,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";
|
||||
|
|
@ -5923,7 +5919,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--;
|
||||
|
|
@ -5988,7 +5983,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)
|
||||
|
|
|
|||
|
|
@ -1012,7 +1012,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…
Add table
Add a link
Reference in a new issue