FIX: support save remote file to storage

jira: [STUDIO-9095]
Change-Id: I675d942b52e723908a5be1861efe7917cdcc599d
This commit is contained in:
xin.zhang 2025-02-25 10:11:42 +08:00 committed by lane.wei
parent 6ec477b595
commit 5850bc8fbd
8 changed files with 83 additions and 6 deletions

View File

@ -37,6 +37,7 @@
"support_lidar_calibration": true,
"support_ai_monitoring": false,
"support_first_layer_inspect": true,
"support_save_remote_print_file_to_storage": true,
"support_chamber_temp_edit": false,
"support_extrusion_cali": false,
"support_user_preset": false

View File

@ -37,6 +37,7 @@
"support_lidar_calibration": true,
"support_ai_monitoring": false,
"support_first_layer_inspect": true,
"support_save_remote_print_file_to_storage": true,
"support_chamber_temp_edit": false,
"support_extrusion_cali": false,
"support_user_preset": false

View File

@ -47,6 +47,7 @@
"support_high_tempbed_calibration": true,
"support_ai_monitoring": true,
"support_first_layer_inspect": false,
"support_save_remote_print_file_to_storage": true,
"support_chamber_temp_edit": true,
"support_chamber_temp_edit_range": [ 20, 65 ],
"support_chamber_temp_switch_heating": 40,

View File

@ -1 +1 @@
02.00.00.03
02.00.00.04

View File

@ -3412,6 +3412,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>();
@ -5944,6 +5950,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);
@ -6542,6 +6553,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;

View File

@ -1272,12 +1272,22 @@ public:
DoorOpenCheckState get_door_open_check_state() const { return xcam_door_open_check;};
void command_set_door_open_check(DoorOpenCheckState state);
/* xcam save remove print file to local*/
bool support_save_remote_print_file_to_storage() const { return is_support_save_remote_print_file_to_storage; };
bool get_save_remote_print_file_to_storage() const { return xcam__save_remote_print_file_to_storage; };
void command_set_save_remote_print_file_to_storage(bool save);
private:
/* xcam door open check*/
bool is_support_door_open_check = false;
DoorOpenCheckState xcam_door_open_check = DoorOpenCheckState::DOOR_OPEN_CHECK_DISABLE;
time_t xcam_door_open_check_start_time = 0;
/* xcam save remove print file to local*/
bool is_support_save_remote_print_file_to_storage = false;
bool xcam__save_remote_print_file_to_storage = false;
time_t xcam__save_remote_print_file_to_storage_start_time = 0;
};
class DeviceManager

View File

@ -78,6 +78,12 @@ PrintOptionsDialog::PrintOptionsDialog(wxWindow* parent)
evt.Skip();
});
m_cb_save_remote_print_file_to_storage->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& evt)
{
if (obj) { obj->command_set_save_remote_print_file_to_storage(m_cb_save_remote_print_file_to_storage->GetValue());}
evt.Skip();
});
m_cb_plate_mark->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& evt) {
if (obj) {
obj->command_xcam_control_buildplate_marker_detector(m_cb_plate_mark->GetValue());
@ -213,6 +219,7 @@ void PrintOptionsDialog::update_options(MachineObject* obj_)
}
UpdateOptionOpenDoorCheck(obj_);
UpdateOptionSavePrintFileToStorage(obj_);
this->Freeze();
@ -240,7 +247,6 @@ void PrintOptionsDialog::UpdateOptionOpenDoorCheck(MachineObject *obj) {
if (!obj || !obj->support_door_open_check()) {
m_cb_open_door->Hide();
text_open_door->Hide();
open_door_line->Hide();
open_door_switch_board->Hide();
return;
}
@ -263,6 +269,20 @@ void PrintOptionsDialog::UpdateOptionOpenDoorCheck(MachineObject *obj) {
}
}
void PrintOptionsDialog::UpdateOptionSavePrintFileToStorage(MachineObject *obj)
{
if (obj && obj->support_save_remote_print_file_to_storage())
{
m_cb_save_remote_print_file_to_storage->SetValue(obj->get_save_remote_print_file_to_storage());
}
else
{
m_cb_save_remote_print_file_to_storage->Hide();
text_save_remote_print_file_to_storage->Hide();
text_save_remote_print_file_to_storage_explain->Hide();
}
}
wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
{
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
@ -384,9 +404,21 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
sizer->Add(open_door_switch_board, 0, wxLEFT, FromDIP(58));
line_sizer->Add(FromDIP(5), 0, 0, 0);
open_door_line = new StaticLine(parent, false);
open_door_line->SetLineColour(wxColour(255, 255, 255));
sizer->Add(open_door_line, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(20));
//Save remote file to local storage
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_save_remote_print_file_to_storage = new CheckBox(parent);
text_save_remote_print_file_to_storage = new Label(parent, _L("Store Sent Files on External Storage"));
text_save_remote_print_file_to_storage->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_save_remote_print_file_to_storage, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
line_sizer->Add(text_save_remote_print_file_to_storage, 1, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
text_save_remote_print_file_to_storage_explain = new Label(parent, _L("Save the printing files initiated from Bambu Studio, Bambu Handy and MakerWorld on External Storage"));
text_save_remote_print_file_to_storage_explain->SetFont(Label::Body_14);
text_save_remote_print_file_to_storage_explain->Wrap(300);
sizer->Add(0, 0, 0, wxTOP, FromDIP(15));
sizer->Add(line_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(18));
sizer->Add(text_save_remote_print_file_to_storage_explain, 0, wxLEFT, FromDIP(58));
line_sizer->Add(FromDIP(5), 0, 0, 0);
//Allow prompt sound
line_sizer = new wxBoxSizer(wxHORIZONTAL);

View File

@ -79,6 +79,7 @@ protected:
CheckBox* m_cb_plate_mark;
CheckBox* m_cb_auto_recovery;
CheckBox* m_cb_open_door;
CheckBox* m_cb_save_remote_print_file_to_storage;
CheckBox* m_cb_sup_sound;
CheckBox* m_cb_filament_tangle;
CheckBox* m_cb_nozzle_blob;
@ -90,6 +91,8 @@ protected:
Label* text_plate_mark_caption;
Label* text_auto_recovery;
Label* text_open_door;
Label* text_save_remote_print_file_to_storage;
Label* text_save_remote_print_file_to_storage_explain;
Label* text_sup_sound;
Label* text_filament_tangle;
Label* text_nozzle_blob;
@ -101,7 +104,6 @@ protected:
StaticLine* line5;
StaticLine* line6;
StaticLine* line7;
StaticLine* open_door_line;
SwitchBoard* open_door_switch_board;
wxBoxSizer* create_settings_group(wxWindow* parent);
@ -133,6 +135,7 @@ public:
private:
void UpdateOptionOpenDoorCheck(MachineObject *obj);
void UpdateOptionSavePrintFileToStorage(MachineObject *obj);
};
}} // namespace Slic3r::GUI