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 77594f1aba7db2948dd9b8627d74f37ff8dbf07a)
This commit is contained in:
hu.wang 2023-08-15 16:05:13 +08:00 committed by Lane.Wei
parent 3992c14ad6
commit b7b875a62a
6 changed files with 88 additions and 8 deletions

View File

@ -15,7 +15,8 @@
"FUNC_PRINT_WITHOUT_SD": false,
"FUNC_ALTER_RESOLUTION": false,
"FUNC_PRINT_ALL": false,
"FUNC_EXTRUSION_CALI": true
"FUNC_EXTRUSION_CALI": true,
"FUNC_PROMPT_SOUND": false
},
"camera_resolution": [ "720p" ],
"bed_temperature_limit": 100,
@ -39,7 +40,8 @@
"FUNC_VIRTUAL_CAMERA": false,
"FUNC_PRINT_WITHOUT_SD": false,
"FUNC_ALTER_RESOLUTION": false,
"FUNC_PRINT_ALL": false
"FUNC_PRINT_ALL": false,
"FUNC_PROMPT_SOUND": false
},
"camera_resolution": [ "720p" ],
"bed_temperature_limit": 100,
@ -81,7 +83,8 @@
"func": {
"FUNC_CHAMBER_TEMP": false,
"FUNC_VIRTUAL_TYAY": true,
"FUNC_EXTRUSION_CALI": false
"FUNC_EXTRUSION_CALI": false,
"FUNC_PROMPT_SOUND": false
},
"model_id": "BL-P002",
"compatible_machine": [ "BL-P001", "C11", "C12"],
@ -95,7 +98,8 @@
"FUNC_CHAMBER_TEMP": false,
"FUNC_VIRTUAL_TYAY": true,
"FUNC_EXTRUSION_CALI": false,
"FUNC_LOCAL_TUNNEL": false
"FUNC_LOCAL_TUNNEL": false,
"FUNC_PROMPT_SOUND": false
},
"model_id": "BL-P001",
"compatible_machine": [ "BL-P002", "C11", "C12"],

View File

@ -0,0 +1,10 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_13676_18539)">
<path d="M10.5 0C10.225 0 10 0.225 10 0.5C10 0.775 10.225 1 10.5 1H14.2937L6.64687 8.64688C6.45312 8.84063 6.45312 9.15937 6.64687 9.35312C6.84062 9.54688 7.15938 9.54688 7.35313 9.35312L15 1.70625V5.5C15 5.775 15.225 6 15.5 6C15.775 6 16 5.775 16 5.5V0.5C16 0.225 15.775 0 15.5 0H10.5ZM2 2C0.896875 2 0 2.89687 0 4V14C0 15.1031 0.896875 16 2 16H12C13.1031 16 14 15.1031 14 14V9.5C14 9.225 13.775 9 13.5 9C13.225 9 13 9.225 13 9.5V14C13 14.5531 12.5531 15 12 15H2C1.44687 15 1 14.5531 1 14V4C1 3.44688 1.44687 3 2 3H6.5C6.775 3 7 2.775 7 2.5C7 2.225 6.775 2 6.5 2H2Z" fill="#00AE42"/>
</g>
<defs>
<clipPath id="clip0_13676_18539">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 838 B

View File

@ -1347,6 +1347,12 @@ void MachineObject::parse_status(int flag)
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);
}
@ -1996,6 +2002,15 @@ int MachineObject::command_set_printing_option(bool auto_recovery)
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)
{
json j;
@ -2368,6 +2383,13 @@ int MachineObject::command_xcam_control_auto_recovery_step_loss(bool 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)
{
bind_user_name = status;
@ -2624,7 +2646,10 @@ bool MachineObject::is_function_supported(PrinterFunction func)
func_name = "FUNC_CAMERA_VIDEO";
break;
case FUNC_MEDIA_FILE:
func_name = "FUNC_MEDIA_FILE";
func_name = "FUNC_MEDIA_FILE";
break;
case FUNC_PROMPT_SOUND:
func_name = "FUNC_PROMPT_SOUND";
break;
case FUNC_REMOTE_TUNNEL:
parse_version_func();

View File

@ -107,6 +107,7 @@ enum PrinterFunction {
FUNC_CHAMBER_FAN,
FUNC_AUX_FAN,
FUNC_EXTRUSION_CALI,
FUNC_PROMPT_SOUND,
FUNC_VIRTUAL_TYAY,
FUNC_PRINT_ALL,
FUNC_FILAMENT_BACKUP,
@ -720,7 +721,9 @@ public:
int xcam_buildplate_marker_hold_count = 0;
bool xcam_support_recovery_step_loss { true };
bool xcam_auto_recovery_step_loss{ false };
bool xcam_allow_prompt_sound{ false };
int xcam_auto_recovery_hold_count = 0;
int xcam_prompt_sound_hold_count = 0;
int ams_print_option_count = 0;
/*not support U2*/
@ -816,6 +819,9 @@ public:
// set printing speed
int command_set_printing_speed(PrintingSpeedLevel lvl);
//set pormpt sound
int command_set_prompt_sound(bool prompt_sound);
// set print option
int command_set_printing_option(bool auto_recovery);
@ -849,6 +855,7 @@ public:
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_auto_recovery_step_loss(bool on_off);
int command_xcam_control_allow_prompt_sound(bool on_off);
/* common apis */
inline bool is_local() { return !dev_ip.empty(); }

View File

@ -55,6 +55,12 @@ PrintOptionsDialog::PrintOptionsDialog(wxWindow* parent)
}
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);
}
@ -131,14 +137,23 @@ void PrintOptionsDialog::update_options(MachineObject* obj_)
m_cb_auto_recovery->Hide();
line4->Hide();
}
if (obj_->is_function_supported(PrinterFunction::FUNC_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();
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_plate_mark->SetValue(obj_->xcam_buildplate_marker_detector);
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);
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(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 );
return sizer;

View File

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