NEW: support calibrate option of printer

Change-Id: Iacc974d5cfec54789223f9ba298db21bea277d18
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2022-11-17 11:38:46 +08:00 committed by Lane.Wei
parent 3f4136157e
commit cb5f5a26cf
4 changed files with 22 additions and 4 deletions

View file

@ -218,7 +218,8 @@ void CalibrationDialog::on_start_calibration(wxMouseEvent &event)
Close(); Close();
} else { } else {
BOOST_LOG_TRIVIAL(info) << "on_start_calibration"; BOOST_LOG_TRIVIAL(info) << "on_start_calibration";
m_obj->command_start_calibration(); //TODO set checkbox value here
m_obj->command_start_calibration(true, true, true);
} }
} }
} }

View file

@ -1513,10 +1513,23 @@ int MachineObject::command_axis_control(std::string axis, double unit, double va
return this->publish_gcode(cmd); return this->publish_gcode(cmd);
} }
int MachineObject::command_start_calibration()
bool MachineObject::is_support_command_calibration()
{ {
if (printer_type == "BL-P001" if (printer_type == "BL-P001"
|| printer_type == "BL-P002") { || printer_type == "BL-P002") {
auto ap_ver_it = module_vers.find("rv1126");
if (ap_ver_it != module_vers.end()) {
if (ap_ver_it->second.sw_ver.compare("00.00.15.79") < 0)
return false;
}
}
return true;
}
int MachineObject::command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali)
{
if (!is_support_command_calibration()) {
// fixed gcode file // fixed gcode file
json j; json j;
j["print"]["command"] = "gcode_file"; j["print"]["command"] = "gcode_file";
@ -1527,6 +1540,9 @@ int MachineObject::command_start_calibration()
json j; json j;
j["print"]["command"] = "calibration"; j["print"]["command"] = "calibration";
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
j["print"]["option"] = (vibration ? 1 << 2 : 0)
+ (bed_leveling ? 1 << 1 : 0)
+ (xcam_cali ? 1 << 0 : 0);
return this->publish_json(j.dump()); return this->publish_json(j.dump());
} }
} }

View file

@ -614,7 +614,8 @@ public:
int command_axis_control(std::string axis, double unit = 1.0f, double value = 1.0f, int speed = 3000); int command_axis_control(std::string axis, double unit = 1.0f, double value = 1.0f, int speed = 3000);
// calibration printer // calibration printer
int command_start_calibration(); bool is_support_command_calibration();
int command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali);
int command_unload_filament(); int command_unload_filament();

View file

@ -506,7 +506,7 @@ void MonitorPanel::show_status(int status)
return; return;
last_status = status; last_status = status;
BOOST_LOG_TRIVIAL(trace) << "monitor: show_status = " << status; BOOST_LOG_TRIVIAL(info) << "monitor: show_status = " << status;
if (((status & (int) MonitorStatus::MONITOR_DISCONNECTED) != 0) || ((status & (int) MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)) { if (((status & (int) MonitorStatus::MONITOR_DISCONNECTED) != 0) || ((status & (int) MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)) {
if ((status & (int) MonitorStatus::MONITOR_DISCONNECTED_SERVER)) if ((status & (int) MonitorStatus::MONITOR_DISCONNECTED_SERVER))