NEW:Add buried points for printing and machine control

Change-Id: I4ba4786fc1d343e497717a012d6e18aee22324e1
This commit is contained in:
Kunlong Ma 2023-07-19 10:26:59 +08:00 committed by Lane.Wei
parent 83e76b6b58
commit be21570964
2 changed files with 105 additions and 0 deletions

View file

@ -1620,12 +1620,29 @@ int MachineObject::command_go_home()
int MachineObject::command_control_fan(FanType fan_type, bool on_off)
{
std::string gcode = (boost::format("M106 P%1% S%2% \n") % (int)fan_type % (on_off ? 255 : 0)).str();
try {
json j;
j["fan_control"] = "fan_control";
NetworkAgent* agent = GUI::wxGetApp().getAgent();
if (agent) agent->track_event("printer_control", j.dump());
}
catch (...) {}
return this->publish_gcode(gcode);
}
int MachineObject::command_control_fan_val(FanType fan_type, int val)
{
std::string gcode = (boost::format("M106 P%1% S%2% \n") % (int)fan_type % (val)).str();
try {
json j;
j["fan_control"] = "fan_control_val";
NetworkAgent* agent = GUI::wxGetApp().getAgent();
if (agent) agent->track_event("printer_control", j.dump());
}
catch (...) {}
return this->publish_gcode(gcode);
}
@ -1663,12 +1680,29 @@ int MachineObject::command_task_resume()
int MachineObject::command_set_bed(int temp)
{
std::string gcode_str = (boost::format("M140 S%1%\n") % temp).str();
try {
json j;
j["temp_control"] = "bed_temp";
NetworkAgent* agent = GUI::wxGetApp().getAgent();
if (agent) agent->track_event("printer_control", j.dump());
}
catch (...) {}
return this->publish_gcode(gcode_str);
}
int MachineObject::command_set_nozzle(int temp)
{
std::string gcode_str = (boost::format("M104 S%1%\n") % temp).str();
try {
json j;
j["temp_control"] = "nozzle_temp";
NetworkAgent* agent = GUI::wxGetApp().getAgent();
if (agent) agent->track_event("printer_control", j.dump());
}
catch (...) {}
return this->publish_gcode(gcode_str);
}
@ -1931,6 +1965,16 @@ int MachineObject::command_axis_control(std::string axis, double unit, double va
else {
return -1;
}
try {
json j;
j["axis_control"] = axis;
NetworkAgent* agent = GUI::wxGetApp().getAgent();
if (agent) agent->track_event("printer_control", j.dump());
}
catch (...) {}
return this->publish_gcode(cmd);
}