ENH: add calibration and unload filament

define new command for calibration and unload filament

Change-Id: I834680740b4052d5719193a40945ca2704a3d858
Signed-off-by: Stone Li <stone.li@bambulab.com>
(cherry picked from commit c742fb5feb26938152858c44056d809fe18ce742)
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li authored and Lane.Wei committed 2022-09-02 13:16:54 +08:00
1 parent b5a21e6520
commit d54461413f
2 files changed
+29 -24

No files matched your search

+29 -12
View File
@@ -1412,22 +1412,39 @@ int MachineObject::command_axis_control(std::string axis, double unit, double va
int MachineObject::command_start_calibration()
{
// fixed gcode file
json j;
j["print"]["command"] = "gcode_file";
j["print"]["param"] = "/usr/etc/print/auto_cali_for_user.gcode";
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j.dump());
if (printer_type == "BL-P001"
|| printer_type == "BL-P002") {
// fixed gcode file
json j;
j["print"]["command"] = "gcode_file";
j["print"]["param"] = "/usr/etc/print/auto_cali_for_user.gcode";
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j.dump());
} else {
json j;
j["print"]["command"] = "calibration";
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j.dump());
}
}
int MachineObject::command_unload_filament()
{
// fixed gcode file
json j;
j["print"]["command"] = "gcode_file";
j["print"]["param"] = "/usr/etc/print/filament_unload.gcode";
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j.dump());
if (printer_type == "BL-P001"
|| printer_type == "BL-P002") {
// fixed gcode file
json j;
j["print"]["command"] = "gcode_file";
j["print"]["param"] = "/usr/etc/print/filament_unload.gcode";
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j.dump());
}
else {
json j;
j["print"]["command"] = "unload_filament";
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j.dump());
}
}