mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 22:54:08 -06:00
NEW: add ams retry and ams wiki guide
Change-Id: Ic589eeab1472a4625a5f1cbe98b56901c3e655ee Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
066a4d70c9
commit
508f814bbc
4 changed files with 34 additions and 7 deletions
|
@ -1372,6 +1372,19 @@ int MachineObject::command_ams_select_tray(std::string tray_id)
|
||||||
return this->publish_gcode(gcode_cmd);
|
return this->publish_gcode(gcode_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MachineObject::command_ams_control(std::string action)
|
||||||
|
{
|
||||||
|
//valid actions
|
||||||
|
if (action == "resume" || action == "reset" || action == "pause") {
|
||||||
|
json j;
|
||||||
|
j["print"]["command"] = "ams_control";
|
||||||
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
|
j["print"]["param"] = action;
|
||||||
|
return this->publish_json(j.dump());
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int MachineObject::command_set_chamber_light(LIGHT_EFFECT effect, int on_time, int off_time, int loops, int interval)
|
int MachineObject::command_set_chamber_light(LIGHT_EFFECT effect, int on_time, int off_time, int loops, int interval)
|
||||||
{
|
{
|
||||||
|
|
|
@ -564,6 +564,7 @@ public:
|
||||||
int command_ams_filament_settings(int ams_id, int tray_id, std::string setting_id, std::string tray_color, std::string tray_type, int nozzle_temp_min, int nozzle_temp_max);
|
int command_ams_filament_settings(int ams_id, int tray_id, std::string setting_id, std::string tray_color, std::string tray_type, int nozzle_temp_min, int nozzle_temp_max);
|
||||||
int command_ams_select_tray(std::string tray_id);
|
int command_ams_select_tray(std::string tray_id);
|
||||||
int command_ams_refresh_rfid(std::string tray_id);
|
int command_ams_refresh_rfid(std::string tray_id);
|
||||||
|
int command_ams_control(std::string action);
|
||||||
int command_set_chamber_light(LIGHT_EFFECT effect, int on_time = 500, int off_time = 500, int loops = 1, int interval = 1000);
|
int command_set_chamber_light(LIGHT_EFFECT effect, int on_time = 500, int off_time = 500, int loops = 1, int interval = 1000);
|
||||||
int command_set_work_light(LIGHT_EFFECT effect, int on_time = 500, int off_time = 500, int loops = 1, int interval = 1000);
|
int command_set_work_light(LIGHT_EFFECT effect, int on_time = 500, int off_time = 500, int loops = 1, int interval = 1000);
|
||||||
|
|
||||||
|
|
|
@ -2114,11 +2114,17 @@ void StatusPanel::on_set_nozzle_temp()
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusPanel::on_ams_load(SimpleEvent &event)
|
void StatusPanel::on_ams_load(SimpleEvent &event)
|
||||||
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "on_ams_load";
|
||||||
|
on_ams_load_curr();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatusPanel::on_ams_load_curr()
|
||||||
{
|
{
|
||||||
if (obj) {
|
if (obj) {
|
||||||
std::string curr_ams_id = m_ams_control->GetCurentAms();
|
std::string curr_ams_id = m_ams_control->GetCurentAms();
|
||||||
std::string curr_can_id = m_ams_control->GetCurrentCan(curr_ams_id);
|
std::string curr_can_id = m_ams_control->GetCurrentCan(curr_ams_id);
|
||||||
std::map<std::string, Ams *>::iterator it = obj->amsList.find(curr_ams_id);
|
std::map<std::string, Ams*>::iterator it = obj->amsList.find(curr_ams_id);
|
||||||
if (it == obj->amsList.end()) {
|
if (it == obj->amsList.end()) {
|
||||||
BOOST_LOG_TRIVIAL(trace) << "ams: find " << curr_ams_id << " failed";
|
BOOST_LOG_TRIVIAL(trace) << "ams: find " << curr_ams_id << " failed";
|
||||||
return;
|
return;
|
||||||
|
@ -2129,8 +2135,8 @@ void StatusPanel::on_ams_load(SimpleEvent &event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AmsTray *curr_tray = obj->get_curr_tray();
|
AmsTray* curr_tray = obj->get_curr_tray();
|
||||||
AmsTray *targ_tray = obj->get_ams_tray(curr_ams_id, curr_can_id);
|
AmsTray* targ_tray = obj->get_ams_tray(curr_ams_id, curr_can_id);
|
||||||
if (curr_tray && targ_tray) {
|
if (curr_tray && targ_tray) {
|
||||||
int old_temp = -1;
|
int old_temp = -1;
|
||||||
int new_temp = -1;
|
int new_temp = -1;
|
||||||
|
@ -2139,12 +2145,14 @@ void StatusPanel::on_ams_load(SimpleEvent &event)
|
||||||
old_temp = (atoi(curr_tray->nozzle_temp_min.c_str()) + atoi(curr_tray->nozzle_temp_max.c_str())) / 2;
|
old_temp = (atoi(curr_tray->nozzle_temp_min.c_str()) + atoi(curr_tray->nozzle_temp_max.c_str())) / 2;
|
||||||
if (!targ_tray->nozzle_temp_max.empty() && !targ_tray->nozzle_temp_min.empty())
|
if (!targ_tray->nozzle_temp_max.empty() && !targ_tray->nozzle_temp_min.empty())
|
||||||
new_temp = (atoi(targ_tray->nozzle_temp_min.c_str()) + atoi(targ_tray->nozzle_temp_max.c_str())) / 2;
|
new_temp = (atoi(targ_tray->nozzle_temp_min.c_str()) + atoi(targ_tray->nozzle_temp_max.c_str())) / 2;
|
||||||
} catch (...) {
|
}
|
||||||
|
catch (...) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
int tray_index = atoi(curr_ams_id.c_str()) * 4 + atoi(tray_it->second->id.c_str());
|
int tray_index = atoi(curr_ams_id.c_str()) * 4 + atoi(tray_it->second->id.c_str());
|
||||||
obj->command_ams_switch(tray_index, old_temp, new_temp);
|
obj->command_ams_switch(tray_index, old_temp, new_temp);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
int tray_index = atoi(curr_ams_id.c_str()) * 4 + atoi(tray_it->second->id.c_str());
|
int tray_index = atoi(curr_ams_id.c_str()) * 4 + atoi(tray_it->second->id.c_str());
|
||||||
obj->command_ams_switch(tray_index, -1, -1);
|
obj->command_ams_switch(tray_index, -1, -1);
|
||||||
}
|
}
|
||||||
|
@ -2270,12 +2278,16 @@ void StatusPanel::on_ams_selected(wxCommandEvent &event)
|
||||||
|
|
||||||
void StatusPanel::on_ams_guide(wxCommandEvent& event)
|
void StatusPanel::on_ams_guide(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
;// todo
|
wxString ams_wiki_url = "https://wiki.bambulab.com/en/software/bambu-studio/use-ams-on-bambu-studio";
|
||||||
|
wxLaunchDefaultBrowser(ams_wiki_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusPanel::on_ams_retry(wxCommandEvent& event)
|
void StatusPanel::on_ams_retry(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
;// todo
|
BOOST_LOG_TRIVIAL(info) << "on_ams_retry";
|
||||||
|
if (obj) {
|
||||||
|
obj->command_ams_control("resume");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusPanel::on_bed_temp_kill_focus(wxFocusEvent &event)
|
void StatusPanel::on_bed_temp_kill_focus(wxFocusEvent &event)
|
||||||
|
|
|
@ -301,6 +301,7 @@ protected:
|
||||||
|
|
||||||
/* extruder apis */
|
/* extruder apis */
|
||||||
void on_ams_load(SimpleEvent &event);
|
void on_ams_load(SimpleEvent &event);
|
||||||
|
void on_ams_load_curr();
|
||||||
void on_ams_unload(SimpleEvent &event);
|
void on_ams_unload(SimpleEvent &event);
|
||||||
void on_ams_setting_click(SimpleEvent &event);
|
void on_ams_setting_click(SimpleEvent &event);
|
||||||
void on_filament_edit(wxCommandEvent &event);
|
void on_filament_edit(wxCommandEvent &event);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue