mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-06 23:31:19 +00:00
* Add Missing Includes Across src/slic3r/GUI Every GUI source and header now directly includes the headers declaring what it uses, rather than relying on the precompiled header or transitive includes. Generated with clang-tidy misc-include-cleaner, plus one hand edit making CalibrationPanel.hpp self-contained. * Drop the OS-Specific Includes Added Outside Their Platform Guards GLib, GTK, D-Bus and POSIX headers are only used inside platform #if blocks, which already include them. Added unconditionally at the top of the file they broke the Windows build. * Add the clang-tidy Configuration That Generated These Includes Only misc-include-cleaner's missing-include check, with the headers it must never suggest: per-platform, internal and OS-specific ones that would break other platforms or are not meant to be included directly. * Match Windows Paths in the clang-tidy Ignore List Header paths use backslashes on Windows, so every / in a pattern is now [/\\]. The Windows SDK headers are ignored alongside the other OS-specific ones, and the list is one pattern per line. Suggested by @raistlin7447 from a Windows clang-cl run.
64 lines
1.9 KiB
C++
64 lines
1.9 KiB
C++
#include "DevAxis.h"
|
|
|
|
#include "json_diff.hpp"
|
|
#include "slic3r/GUI/DeviceManager.hpp"
|
|
#include "slic3r/Utils/NetworkAgent.hpp"
|
|
#include <string>
|
|
#include <cstdlib>
|
|
#include <cstdio>
|
|
|
|
namespace Slic3r
|
|
{
|
|
|
|
int DevAxis::Ctrl_GoHome()
|
|
{
|
|
if (m_is_support_mqtt_homing) {
|
|
json j;
|
|
j["print"]["command"] = "back_to_center";
|
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
|
return m_owner->publish_json(j);
|
|
}
|
|
|
|
// gcode command
|
|
return m_owner->is_in_printing() ? m_owner->publish_gcode("G28 X\n") : m_owner->publish_gcode("G28 \n");
|
|
}
|
|
|
|
int DevAxis::Ctrl_Axis(std::string axis, double unit, double input_val, int speed)
|
|
{
|
|
if (m_is_support_mqtt_axis_ctrl) {
|
|
int dir = input_val > 0 ? 1 : -1;
|
|
if (!IsArchCoreXY()) {
|
|
if (axis.compare("Y") == 0 || axis.compare("Z") == 0) {
|
|
dir = -dir;
|
|
}
|
|
}
|
|
json j;
|
|
j["print"]["command"] = "xyz_ctrl";
|
|
j["print"]["axis"] = axis;
|
|
j["print"]["dir"] = dir;
|
|
j["print"]["mode"] = (std::abs(input_val) >= 10) ? 1 : 0;
|
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
|
return m_owner->publish_json(j);
|
|
}
|
|
|
|
double value = input_val;
|
|
if (!IsArchCoreXY()) {
|
|
if (axis.compare("Y") == 0 || axis.compare("Z") == 0) {
|
|
value = -1.0 * input_val;
|
|
}
|
|
}
|
|
|
|
char cmd[256];
|
|
if (axis.compare("X") == 0 || axis.compare("Y") == 0 || axis.compare("Z") == 0) {
|
|
sprintf(cmd, "M211 S \nM211 X1 Y1 Z1\nM1002 push_ref_mode\nG91 \nG1 %s%0.1f F%d\nM1002 pop_ref_mode\nM211 R\n", axis.c_str(), value * unit, speed);
|
|
} else if (axis.compare("E") == 0) {
|
|
sprintf(cmd, "M83 \nG0 %s%0.1f F%d\n", axis.c_str(), value * unit, speed);
|
|
} else {
|
|
return -1;
|
|
}
|
|
|
|
// Orca: strip analytics telemetry (matches MachineObject::command_axis_control)
|
|
return m_owner->publish_gcode(cmd);
|
|
}
|
|
|
|
} // namespace Slic3r
|