FIX: support save remote file to storage

jira: [STUDIO-9095]
Change-Id: I675d942b52e723908a5be1861efe7917cdcc599d
(cherry picked from commit 5850bc8fbd0dd6e757e48e54275c1788e15ff93e)
This commit is contained in:
xin.zhang
2025-02-25 10:11:42 +08:00
committed by Noisyfox
parent 8ccd7b0cc6
commit 0099823501
7 changed files with 82 additions and 6 deletions

View File

@@ -3366,6 +3366,12 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
}
}
if (jj.contains("support_save_remote_print_file_to_storage")) {
if (jj["support_save_remote_print_file_to_storage"].is_boolean()) {
is_support_save_remote_print_file_to_storage = jj["support_save_remote_print_file_to_storage"].get<bool>();
}
}
if (jj.contains("support_ai_monitoring")) {
if (jj["support_ai_monitoring"].is_boolean()) {
is_support_ai_monitoring = jj["support_ai_monitoring"].get<bool>();
@@ -5936,6 +5942,11 @@ void MachineObject::parse_new_info(json print)
ams_auto_switch_filament_flag = get_flag_bits(cfg, 18);
}
if (time(nullptr) - xcam__save_remote_print_file_to_storage_start_time > HOLD_TIME_MAX)
{
xcam__save_remote_print_file_to_storage = get_flag_bits(cfg, 19);
}
if (time(nullptr) - xcam_door_open_check_start_time > HOLD_TIME_MAX)
{
xcam_door_open_check = (DoorOpenCheckState) get_flag_bits(cfg, 20, 2);
@@ -6547,6 +6558,24 @@ void MachineObject::command_set_door_open_check(DoorOpenCheckState state)
}
}
void MachineObject::command_set_save_remote_print_file_to_storage(bool save)
{
if (get_save_remote_print_file_to_storage() != save)
{
json j;
j["system"]["command"] = "print_cache_set";
j["system"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
j["system"]["config"] = save ? true : false;
if (publish_json(j.dump()) == 0)
{
xcam__save_remote_print_file_to_storage = save;
xcam__save_remote_print_file_to_storage_start_time = time(nullptr);
}
}
}
bool DeviceManager::EnableMultiMachine = false;
bool DeviceManager::key_field_only = false;