NEW:[STUDIO-4012] support prompt sound

support modifying whether to turn on prompt sound from the print option pop-up window

Change-Id: I3206bfcefc9292dd2a7acb7294addc901ad21d4d
(cherry picked from commit ecc13666689d7f644ed3db36088b32b239728779)
This commit is contained in:
hu.wang 2023-08-15 16:05:13 +08:00 committed by Lane.Wei
parent 44eaa75110
commit 28376584a3
5 changed files with 74 additions and 8 deletions

View File

@ -14,9 +14,10 @@
"FUNC_VIRTUAL_CAMERA": false, "FUNC_VIRTUAL_CAMERA": false,
"FUNC_PRINT_WITHOUT_SD": false, "FUNC_PRINT_WITHOUT_SD": false,
"FUNC_ALTER_RESOLUTION": false, "FUNC_ALTER_RESOLUTION": false,
"FUNC_PRINT_ALL": false, "FUNC_PRINT_ALL": false,
"FUNC_EXTRUSION_CALI": true "FUNC_EXTRUSION_CALI": true,
"FUNC_VIRTUAL_TYAY": true,
"FUNC_PROMPT_SOUND": false
}, },
"camera_resolution": [ "720p" ], "camera_resolution": [ "720p" ],
"bed_temperature_limit": 100, "bed_temperature_limit": 100,
@ -42,7 +43,8 @@
"FUNC_ALTER_RESOLUTION": false, "FUNC_ALTER_RESOLUTION": false,
"FUNC_PRINT_ALL": false, "FUNC_PRINT_ALL": false,
"FUNC_VIRTUAL_TYAY": true, "FUNC_VIRTUAL_TYAY": true,
"FUNC_EXTRUSION_CALI": true "FUNC_EXTRUSION_CALI": true,
"FUNC_PROMPT_SOUND": false
}, },
"camera_resolution": [ "720p" ], "camera_resolution": [ "720p" ],
"bed_temperature_limit": 100, "bed_temperature_limit": 100,
@ -58,7 +60,8 @@
"FUNC_VIRTUAL_TYAY": true, "FUNC_VIRTUAL_TYAY": true,
"FUNC_EXTRUSION_CALI": false, "FUNC_EXTRUSION_CALI": false,
"FUNC_LOCAL_TUNNEL": false, "FUNC_LOCAL_TUNNEL": false,
"FUNC_CHAMBER_TEMP": false "FUNC_CHAMBER_TEMP": false,
"FUNC_PROMPT_SOUND": false
}, },
"model_id": "BL-P002", "model_id": "BL-P002",
"compatible_machine": [ "BL-P001", "C11", "C12"], "compatible_machine": [ "BL-P001", "C11", "C12"],
@ -72,7 +75,8 @@
"FUNC_CHAMBER_TEMP": false, "FUNC_CHAMBER_TEMP": false,
"FUNC_VIRTUAL_TYAY": true, "FUNC_VIRTUAL_TYAY": true,
"FUNC_EXTRUSION_CALI": false, "FUNC_EXTRUSION_CALI": false,
"FUNC_LOCAL_TUNNEL": false "FUNC_LOCAL_TUNNEL": false,
"FUNC_PROMPT_SOUND": false
}, },
"model_id": "BL-P001", "model_id": "BL-P001",
"compatible_machine": [ "BL-P002", "C11", "C12"], "compatible_machine": [ "BL-P002", "C11", "C12"],

View File

@ -1350,6 +1350,12 @@ void MachineObject::parse_status(int flag)
ams_auto_switch_filament_flag = ((flag >> 10) & 0x1) != 0; ams_auto_switch_filament_flag = ((flag >> 10) & 0x1) != 0;
} }
if (xcam_prompt_sound_hold_count > 0)
xcam_prompt_sound_hold_count--;
else {
xcam_allow_prompt_sound = ((flag >> 17) & 0x1) != 0;
}
sdcard_state = MachineObject::SdcardState((flag >> 8) & 0x11); sdcard_state = MachineObject::SdcardState((flag >> 8) & 0x11);
} }
@ -1920,6 +1926,15 @@ int MachineObject::command_set_printing_option(bool auto_recovery)
return this->publish_json(j.dump()); return this->publish_json(j.dump());
} }
int MachineObject::command_set_prompt_sound(bool prompt_sound){
json j;
j["print"]["command"] = "print_option";
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
j["print"]["sound_enable"] = prompt_sound;
return this->publish_json(j.dump());
}
int MachineObject::command_ams_switch_filament(bool switch_filament) int MachineObject::command_ams_switch_filament(bool switch_filament)
{ {
json j; json j;
@ -2279,6 +2294,13 @@ int MachineObject::command_xcam_control_auto_recovery_step_loss(bool on_off)
return command_set_printing_option(on_off); return command_set_printing_option(on_off);
} }
int MachineObject::command_xcam_control_allow_prompt_sound(bool on_off)
{
xcam_allow_prompt_sound = on_off;
xcam_prompt_sound_hold_count = HOLD_COUNT_MAX;
return command_set_prompt_sound(on_off);
}
void MachineObject::set_bind_status(std::string status) void MachineObject::set_bind_status(std::string status)
{ {
bind_user_name = status; bind_user_name = status;

View File

@ -683,7 +683,9 @@ public:
bool xcam_buildplate_marker_detector{ false }; bool xcam_buildplate_marker_detector{ false };
int xcam_buildplate_marker_hold_count = 0; int xcam_buildplate_marker_hold_count = 0;
bool xcam_auto_recovery_step_loss{ false }; bool xcam_auto_recovery_step_loss{ false };
bool xcam_allow_prompt_sound{ false };
int xcam_auto_recovery_hold_count = 0; int xcam_auto_recovery_hold_count = 0;
int xcam_prompt_sound_hold_count = 0;
int ams_print_option_count = 0; int ams_print_option_count = 0;
//supported features //supported features
@ -804,6 +806,9 @@ public:
// set printing speed // set printing speed
int command_set_printing_speed(PrintingSpeedLevel lvl); int command_set_printing_speed(PrintingSpeedLevel lvl);
//set pormpt sound
int command_set_prompt_sound(bool prompt_sound);
// set print option // set print option
int command_set_printing_option(bool auto_recovery); int command_set_printing_option(bool auto_recovery);
@ -837,6 +842,7 @@ public:
int command_xcam_control_first_layer_inspector(bool on_off, bool print_halt); int command_xcam_control_first_layer_inspector(bool on_off, bool print_halt);
int command_xcam_control_buildplate_marker_detector(bool on_off); int command_xcam_control_buildplate_marker_detector(bool on_off);
int command_xcam_control_auto_recovery_step_loss(bool on_off); int command_xcam_control_auto_recovery_step_loss(bool on_off);
int command_xcam_control_allow_prompt_sound(bool on_off);
/* common apis */ /* common apis */
inline bool is_local() { return !dev_ip.empty(); } inline bool is_local() { return !dev_ip.empty(); }

View File

@ -55,6 +55,12 @@ PrintOptionsDialog::PrintOptionsDialog(wxWindow* parent)
} }
evt.Skip(); evt.Skip();
}); });
m_cb_sup_sound->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& evt) {
if (obj) {
obj->command_xcam_control_allow_prompt_sound(m_cb_sup_sound->GetValue());
}
evt.Skip();
});
wxGetApp().UpdateDlgDarkUI(this); wxGetApp().UpdateDlgDarkUI(this);
} }
@ -131,14 +137,23 @@ void PrintOptionsDialog::update_options(MachineObject* obj_)
m_cb_auto_recovery->Hide(); m_cb_auto_recovery->Hide();
line4->Hide(); line4->Hide();
} }
if (obj_->is_support_prompt_sound) {
text_sup_sound->Show();
m_cb_sup_sound->Show();
line5->Show();
}
else {
text_sup_sound->Hide();
m_cb_sup_sound->Hide();
line5->Hide();
}
this->Freeze(); this->Freeze();
auto test1 = obj_->xcam_first_layer_inspector;
auto test2 = obj_->xcam_buildplate_marker_detector;
auto test3 = obj_->xcam_auto_recovery_step_loss;
m_cb_first_layer->SetValue(obj_->xcam_first_layer_inspector); m_cb_first_layer->SetValue(obj_->xcam_first_layer_inspector);
m_cb_plate_mark->SetValue(obj_->xcam_buildplate_marker_detector); m_cb_plate_mark->SetValue(obj_->xcam_buildplate_marker_detector);
m_cb_auto_recovery->SetValue(obj_->xcam_auto_recovery_step_loss); m_cb_auto_recovery->SetValue(obj_->xcam_auto_recovery_step_loss);
m_cb_sup_sound->SetValue(obj_->xcam_allow_prompt_sound);
m_cb_ai_monitoring->SetValue(obj_->xcam_ai_monitoring); m_cb_ai_monitoring->SetValue(obj_->xcam_ai_monitoring);
for (auto i = AiMonitorSensitivityLevel::LOW; i < LEVELS_NUM; i = (AiMonitorSensitivityLevel) (i + 1)) { for (auto i = AiMonitorSensitivityLevel::LOW; i < LEVELS_NUM; i = (AiMonitorSensitivityLevel) (i + 1)) {
@ -256,6 +271,22 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
sizer->Add(line4, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(20)); sizer->Add(line4, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(20));
sizer->Add(0,0,0,wxTOP, FromDIP(20)); sizer->Add(0,0,0,wxTOP, FromDIP(20));
//Allow prompt sound
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_sup_sound = new CheckBox(parent);
text_sup_sound = new wxStaticText(parent, wxID_ANY, _L("Allow Prompt Sound"));
text_sup_sound->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_sup_sound, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
line_sizer->Add(text_sup_sound, 1, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
sizer->Add(0, 0, 0, wxTOP, FromDIP(15));
sizer->Add(line_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(18));
line_sizer->Add(FromDIP(5), 0, 0, 0);
line5 = new StaticLine(parent, false);
line5->SetLineColour(STATIC_BOX_LINE_COL);
sizer->Add(line5, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(20));
ai_monitoring_level_list->Connect( wxEVT_COMBOBOX, wxCommandEventHandler(PrintOptionsDialog::set_ai_monitor_sensitivity), NULL, this ); ai_monitoring_level_list->Connect( wxEVT_COMBOBOX, wxCommandEventHandler(PrintOptionsDialog::set_ai_monitor_sensitivity), NULL, this );
return sizer; return sizer;

View File

@ -26,6 +26,7 @@ protected:
CheckBox* m_cb_ai_monitoring; CheckBox* m_cb_ai_monitoring;
CheckBox* m_cb_plate_mark; CheckBox* m_cb_plate_mark;
CheckBox* m_cb_auto_recovery; CheckBox* m_cb_auto_recovery;
CheckBox* m_cb_sup_sound;
wxStaticText* text_first_layer; wxStaticText* text_first_layer;
wxStaticText* text_ai_monitoring; wxStaticText* text_ai_monitoring;
wxStaticText* text_ai_monitoring_caption; wxStaticText* text_ai_monitoring_caption;
@ -33,10 +34,12 @@ protected:
wxStaticText* text_plate_mark; wxStaticText* text_plate_mark;
wxStaticText* text_plate_mark_caption; wxStaticText* text_plate_mark_caption;
wxStaticText* text_auto_recovery; wxStaticText* text_auto_recovery;
wxStaticText* text_sup_sound;
StaticLine* line1; StaticLine* line1;
StaticLine* line2; StaticLine* line2;
StaticLine* line3; StaticLine* line3;
StaticLine* line4; StaticLine* line4;
StaticLine* line5;
wxBoxSizer* create_settings_group(wxWindow* parent); wxBoxSizer* create_settings_group(wxWindow* parent);
bool print_halt = false; bool print_halt = false;