FIX:add idel heating protection

jira:[STUDIO-14359][STUDIO-14431]

Change-Id: I2ecb6c78c4b28d6f14c45dbb1f905b95a9d8c4ab
(cherry picked from commit f6eee61915b47321c1cb44e3ff2306875c32466b)
This commit is contained in:
milk
2025-09-15 21:41:05 +08:00
committed by Noisyfox
parent 434d2142e4
commit 7608195e17
7 changed files with 197 additions and 49 deletions

View File

@@ -107,7 +107,6 @@ void DevPrintOptionsParser::ParseDetectionV1_2(DevPrintOptions *opts, MachineObj
}
}
if (time(nullptr) - opts->xcam_auto_recovery_hold_start > HOLD_TIME_3SEC) {
if (print_json.contains("auto_recovery")) { opts->xcam_auto_recovery_step_loss = print_json["auto_recovery"].get<bool>(); }
}
@@ -145,7 +144,11 @@ void DevPrintOptionsParser::ParseDetectionV2_0(DevPrintOptions *opts, std::strin
if (time(nullptr) - opts->xcam_filament_tangle_detect_hold_start > HOLD_TIME_3SEC) {
opts->xcam_filament_tangle_detect = DevUtil::get_flag_bits(print_json, 23);
}
}
void DevPrintOptionsParser::ParseDetectionV2_1(DevPrintOptions *opts, std::string cfg) {
if (time(nullptr) - opts->idel_heating_protect_hold_strat > HOLD_TIME_3SEC)
opts->idel_heating_protect_enabled = DevUtil::get_flag_bits(cfg, 32, 2);
}
void DevPrintOptions::SetPrintingSpeedLevel(DevPrintingSpeedLevel speed_level)
@@ -168,8 +171,15 @@ int DevPrintOptions::command_xcam_control_ai_monitoring(bool on_off, std::string
xcam_ai_monitoring_hold_start = time(nullptr);
xcam_ai_monitoring_sensitivity = lvl;
return command_xcam_control("printing_monitor", on_off, m_obj, lvl);
}
int DevPrintOptions::command_xcam_control_idelheatingprotect_detector(bool on_off)
{
idel_heating_protect_enabled = on_off;
idel_heating_protect_hold_strat = time(nullptr);
return command_set_against_continued_heating_mode(on_off);
}
int DevPrintOptions::command_xcam_control_buildplate_marker_detector(bool on_off)
{
xcam_buildplate_marker_detector = on_off;
@@ -239,6 +249,15 @@ int DevPrintOptions::command_xcam_control(std::string module_name, bool on_off ,
return obj->publish_json(j);
}
int DevPrintOptions::command_set_against_continued_heating_mode(bool on_off)
{
json j;
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
j["print"]["command"] = "set_against_continued_heating_mode";
j["print"]["enable"] = on_off;
return m_obj->publish_json(j);
}
int DevPrintOptions::command_set_printing_option(bool auto_recovery, MachineObject *obj)
{
json j;

View File

@@ -27,6 +27,7 @@ public:
int command_xcam_control_auto_recovery_step_loss(bool on_off);
int command_xcam_control_allow_prompt_sound(bool on_off);
int command_xcam_control_filament_tangle_detect(bool on_off);
int command_xcam_control_idelheatingprotect_detector(bool on_off);
int command_xcam_control(std::string module_name, bool on_off, MachineObject *obj ,std::string lvl = "");
@@ -37,19 +38,20 @@ public:
// set fliament tangle detect
int command_set_filament_tangle_detect(bool fliament_tangle_detect, MachineObject *obj);
int command_set_against_continued_heating_mode(bool on_off);
void parse_auto_recovery_step_loss_status(int flag);
void parse_allow_prompt_sound_status(int flag);
void parse_filament_tangle_detect_status(int flag);
bool GetAiMonitoring() const { return xcam_ai_monitoring; };
bool GetFirstLayerInspector() const{ return xcam_first_layer_inspector; };
bool GetBuildplateMarkerDetector() const { return xcam_buildplate_marker_detector; };
bool GetAutoRecoveryStepLoss() const { return xcam_auto_recovery_step_loss; };
bool GetAllowPromptSound() const { return xcam_allow_prompt_sound; };
bool GetFilamentTangleDetect() const { return xcam_filament_tangle_detect; };
string GetAiMonitoringSensitivity() const { return xcam_ai_monitoring_sensitivity; };
bool GetAiMonitoring() const { return xcam_ai_monitoring; }
bool GetFirstLayerInspector() const{ return xcam_first_layer_inspector; }
bool GetBuildplateMarkerDetector() const { return xcam_buildplate_marker_detector; }
bool GetAutoRecoveryStepLoss() const { return xcam_auto_recovery_step_loss; }
bool GetAllowPromptSound() const { return xcam_allow_prompt_sound; }
bool GetFilamentTangleDetect() const { return xcam_filament_tangle_detect; }
int GetIdelHeatingProtectEenabled() const { return idel_heating_protect_enabled; }
string GetAiMonitoringSensitivity() const { return xcam_ai_monitoring_sensitivity; }
private:
@@ -65,12 +67,14 @@ private:
bool xcam_auto_recovery_step_loss{false};
bool xcam_allow_prompt_sound{false};
bool xcam_filament_tangle_detect{false};
int idel_heating_protect_enabled = -1;
time_t xcam_ai_monitoring_hold_start = 0;
time_t xcam_buildplate_marker_hold_start = 0;
time_t xcam_first_layer_hold_start = 0;
time_t xcam_auto_recovery_hold_start = 0;
time_t xcam_prompt_sound_hold_start = 0;
time_t xcam_filament_tangle_detect_hold_start = 0;
time_t idel_heating_protect_hold_strat = 0;
MachineObject* m_obj;/*owner*/
};
@@ -85,7 +89,8 @@ public:
static void ParseDetectionV1_1(DevPrintOptions *opts, MachineObject *obj, const nlohmann::json &print_json, bool enable);
static void ParseDetectionV1_2(DevPrintOptions *opts, MachineObject *obj, const nlohmann::json &print_json);
static void ParseDetectionV2_0(DevPrintOptions *opts, std::string print_json);
static void ParseDetectionV2_0(DevPrintOptions *opts, std::string cfg);
static void ParseDetectionV2_1(DevPrintOptions *opts, std::string cfg);
};
} // namespace Slic3r