FIX:use the gcode line command to unload the C11 printer

Change-Id: I33eec56b8c02fd605d3c0acb4e1f9d07811cea69
This commit is contained in:
tao wang 2023-02-08 14:53:10 +08:00 committed by Lane.Wei
parent a94b78d296
commit 33c22bef62
1 changed files with 16 additions and 0 deletions

View File

@ -1816,6 +1816,22 @@ int MachineObject::command_unload_filament()
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j.dump()); return this->publish_json(j.dump());
} }
else if (printer_type == "C11") {
std::string gcode = DeviceManager::load_gcode(printer_type, "ams_unload.gcode");
if (gcode.empty()) {
return -1;
}
json j;
j["print"]["command"] = "gcode_line";
j["print"]["param"] = gcode;
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
if (m_agent)
j["print"]["user_id"] = m_agent->get_user_id();
return this->publish_json(j.dump());
}
else { else {
json j; json j;
j["print"]["command"] = "unload_filament"; j["print"]["command"] = "unload_filament";