mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-22 02:12:13 +00:00
Add firmware print-option toggles to the print options dialog
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "DevPrintOptions.h"
|
||||
#include "DevUtil.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
namespace Slic3r
|
||||
@@ -356,5 +358,75 @@ int DevPrintOptions::command_set_filament_tangle_detect(bool filament_tangle_det
|
||||
return obj->publish_json(j);
|
||||
}
|
||||
|
||||
int DevPrintOptions::command_xcam_control_build_plate_align_detector(bool on_off)
|
||||
{
|
||||
m_buildplate_align_detection.current_detect_value = on_off;
|
||||
m_buildplate_align_detection.detect_hold_start = time(nullptr);
|
||||
return command_xcam_control("plate_offset_switch", on_off, m_obj);
|
||||
}
|
||||
|
||||
int DevPrintOptions::command_xcam_control_fod_check(bool on_off)
|
||||
{
|
||||
m_fod_check_detection.current_detect_value = on_off;
|
||||
m_fod_check_detection.detect_hold_start = time(nullptr);
|
||||
return command_xcam_control("fod_check", on_off, m_obj);
|
||||
}
|
||||
|
||||
int DevPrintOptions::command_xcam_control_displacement_detection(bool on_off)
|
||||
{
|
||||
m_displacement_detection.current_detect_value = on_off;
|
||||
m_displacement_detection.detect_hold_start = time(nullptr);
|
||||
return command_xcam_control("model_movement_check", on_off, m_obj);
|
||||
}
|
||||
|
||||
int DevPrintOptions::command_xcam_control_purify_air_at_print_end(int on_off)
|
||||
{
|
||||
m_purify_air_at_print_end.current_detect_value = on_off;
|
||||
m_purify_air_at_print_end.detect_hold_start = time(nullptr);
|
||||
return command_set_purify_air_at_print_end((PurifyAirAtPrintEndState) on_off, m_obj);
|
||||
}
|
||||
|
||||
int DevPrintOptions::command_set_purify_air_at_print_end(PurifyAirAtPrintEndState state, MachineObject *obj)
|
||||
{
|
||||
json j;
|
||||
j["print"]["command"] = "print_option";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
switch (state)
|
||||
{
|
||||
case PurifyAirAtPrintEndState::PurifyAirDisable: j["print"]["air_purification"] = 0; break;
|
||||
case PurifyAirAtPrintEndState::PurifyAirByInside: j["print"]["air_purification"] = 1; break;
|
||||
case PurifyAirAtPrintEndState::PurifyAirByOutside: j["print"]["air_purification"] = 2; break;
|
||||
default: assert(0);
|
||||
}
|
||||
return obj->publish_json(j);
|
||||
}
|
||||
|
||||
int DevPrintOptions::command_snapshot_control(int on_off)
|
||||
{
|
||||
m_snapshot_detection.current_detect_value = on_off;
|
||||
m_snapshot_detection.detect_hold_start = time(nullptr);
|
||||
return command_set_snapshot_control(on_off, m_obj);
|
||||
}
|
||||
|
||||
int DevPrintOptions::command_set_snapshot_control(int on_off, MachineObject *obj)
|
||||
{
|
||||
json j;
|
||||
j["camera"]["command"] = "ipcam_cap_pic_set";
|
||||
j["camera"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["camera"]["control"] = on_off ? "enable" : "disable";
|
||||
return obj->publish_json(j);
|
||||
}
|
||||
|
||||
int DevPrintOptions::command_smart_nozzle_blob_detect_mode(int mode)
|
||||
{
|
||||
json j;
|
||||
j["print"]["command"] = "print_option";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["nozzle_blob_detect_v2"] = mode; // int: 0=off, 1=on, 2=auto
|
||||
m_smart_nozzle_blob_detection.current_detect_value = mode;
|
||||
m_smart_nozzle_blob_detection.detect_hold_start = time(nullptr);
|
||||
return m_obj->publish_json(j);
|
||||
}
|
||||
|
||||
}
|
||||
// namespace Slic3r
|
||||
|
||||
@@ -43,6 +43,12 @@ class DevPrintOptions
|
||||
public:
|
||||
DevPrintOptions(MachineObject* obj);
|
||||
|
||||
// Tri-state for the purify-air-at-print-end firmware option (matches the MQTT air_purification value).
|
||||
enum class PurifyAirAtPrintEndState : int {
|
||||
PurifyAirDisable = 0,
|
||||
PurifyAirByInside = 1,
|
||||
PurifyAirByOutside = 2,
|
||||
};
|
||||
|
||||
public:
|
||||
void SetPrintingSpeedLevel(DevPrintingSpeedLevel speed_level);
|
||||
@@ -60,6 +66,13 @@ public:
|
||||
int command_xcam_control_filament_tangle_detect(bool on_off);
|
||||
int command_xcam_control_idelheatingprotect_detector(bool on_off);
|
||||
|
||||
// Firmware print-option toggles (each gated on a fun2 capability bit).
|
||||
int command_xcam_control_build_plate_align_detector(bool on_off);
|
||||
int command_xcam_control_fod_check(bool on_off);
|
||||
int command_xcam_control_displacement_detection(bool on_off);
|
||||
int command_xcam_control_purify_air_at_print_end(int on_off);
|
||||
int command_smart_nozzle_blob_detect_mode(int mode); // 0=off, 1=on, 2=auto
|
||||
int command_snapshot_control(int on_off);
|
||||
|
||||
int command_xcam_control(std::string module_name, bool on_off, MachineObject *obj ,std::string lvl = "");
|
||||
// set print option
|
||||
@@ -70,6 +83,8 @@ public:
|
||||
int command_set_filament_tangle_detect(bool fliament_tangle_detect, MachineObject *obj);
|
||||
|
||||
int command_set_against_continued_heating_mode(bool on_off);
|
||||
int command_set_purify_air_at_print_end(PurifyAirAtPrintEndState state, MachineObject *obj);
|
||||
int command_set_snapshot_control(int on_off, MachineObject *obj);
|
||||
|
||||
void parse_auto_recovery_step_loss_status(int flag);
|
||||
void parse_allow_prompt_sound_status(int flag);
|
||||
|
||||
Reference in New Issue
Block a user