diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index d9ff5559a..f5242255c 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -1569,9 +1569,8 @@ void MachineObject::parse_status(int flag) sdcard_state = MachineObject::SdcardState(get_flag_bits(flag, 8, 2)); - if (ams_print_option_count > 0) - ams_print_option_count--; - else { + if (time(nullptr) - ams_switch_filament_start > HOLD_TIME_MAX) + { ams_auto_switch_filament_flag = ((flag >> 10) & 0x1) != 0; } @@ -2421,7 +2420,7 @@ int MachineObject::command_ams_switch_filament(bool switch_filament) ams_auto_switch_filament_flag = switch_filament; BOOST_LOG_TRIVIAL(trace) << "command_ams_filament_settings:" << switch_filament; - ams_print_option_count = HOLD_COUNT_MAX; + ams_switch_filament_start = time(nullptr); return this->publish_json(j.dump()); } @@ -5851,7 +5850,6 @@ void MachineObject::parse_new_info(json print) 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 (ams_print_option_count > 0) ams_print_option_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--; if (nozzle_setting_hold_count > 0)nozzle_setting_hold_count--; @@ -5923,7 +5921,11 @@ void MachineObject::parse_new_info(json print) ams_calibrate_remain_flag = get_flag_bits(cfg, 17); } - ams_auto_switch_filament_flag = get_flag_bits(cfg, 18); + if (time(nullptr) - ams_switch_filament_start > HOLD_TIME_MAX) + { + ams_auto_switch_filament_flag = get_flag_bits(cfg, 18); + } + xcam_allow_prompt_sound = get_flag_bits(cfg, 22); xcam_filament_tangle_detect = get_flag_bits(cfg, 23); nozzle_blob_detection_enabled = get_flag_bits(cfg, 24); diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 3f4e493d3..76baa0709 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -682,6 +682,7 @@ public: bool ams_support_virtual_tray { true }; int ams_humidity; time_t ams_user_setting_start = 0; + time_t ams_switch_filament_start = 0; AmsStatusMain ams_status_main; int ams_status_sub; int ams_version = 0; @@ -953,7 +954,6 @@ public: int xcam_auto_recovery_hold_count = 0; int xcam_prompt_sound_hold_count = 0; int xcam_filament_tangle_detect_count = 0; - int ams_print_option_count = 0; int nozzle_selected_count = 0; bool flag_update_nozzle = {true};