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

@ -1350,6 +1350,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);
}
@ -1920,6 +1926,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;
@ -2279,6 +2294,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;