ENH: compatible with filament unload of new firmware

Change-Id: I0b01a549929e716f0ac05176ba5dc05c360c081b
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2023-04-12 11:01:30 +08:00 committed by Lane.Wei
parent c51d9c994f
commit bc0fe0c8bc
1 changed files with 6 additions and 3 deletions

View File

@ -1892,8 +1892,8 @@ int MachineObject::command_start_calibration(bool vibration, bool bed_leveling,
int MachineObject::command_unload_filament()
{
if (printer_type == "BL-P001"
|| printer_type == "BL-P002") {
if ((printer_type == "BL-P001" || printer_type == "BL-P002")
&& !this->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY)) {
// fixed gcode file
json j;
j["print"]["command"] = "gcode_file";
@ -1901,7 +1901,10 @@ int MachineObject::command_unload_filament()
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j.dump());
}
else if (printer_type == "C11") {
else if (printer_type == "C11"
|| ((printer_type == "BL-P001" || printer_type == "BL-P002")
&& this->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY))
) {
std::string gcode = DeviceManager::load_gcode(printer_type, "ams_unload.gcode");
if (gcode.empty()) {
return -1;