mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-29 02:40:33 -07:00
ENH: support mqtt control
jira: [STUDIO-12442] Change-Id: I51e43692c692c910e94d4e67349a70377b057d1c (cherry picked from commit 5c4c3c7f953a980aebfaed5120a65e81ba79b56f)
This commit is contained in:
parent
fb2ecdc6d9
commit
2d23db7890
2 changed files with 25 additions and 0 deletions
|
|
@ -2140,6 +2140,15 @@ int MachineObject::command_stop_buzzer()
|
|||
|
||||
int MachineObject::command_set_bed(int temp)
|
||||
{
|
||||
if (m_support_mqtt_bet_ctrl)
|
||||
{
|
||||
json j;
|
||||
j["print"]["command"] = "set_bed_temp";
|
||||
j["print"]["temp"] = temp;
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
|
||||
std::string gcode_str = (boost::format("M140 S%1%\n") % temp).str();
|
||||
return this->publish_gcode(gcode_str);
|
||||
}
|
||||
|
|
@ -2522,6 +2531,17 @@ int MachineObject::command_ams_air_print_detect(bool air_print_detect)
|
|||
|
||||
int MachineObject::command_axis_control(std::string axis, double unit, double input_val, int speed)
|
||||
{
|
||||
if (m_support_mqtt_axis_control)
|
||||
{
|
||||
json j;
|
||||
j["print"]["command"] = "xyz_ctrl";
|
||||
j["print"]["axis"] = axis;
|
||||
j["print"]["dir"] = input_val > 0 ? 1 : -1;
|
||||
j["print"]["mode"] = (std::abs(input_val) >= 10) ? 1 : 0;
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
|
||||
double value = input_val;
|
||||
if (!is_core_xy()) {
|
||||
if ( axis.compare("Y") == 0
|
||||
|
|
@ -6265,6 +6285,8 @@ void MachineObject::parse_new_info(json print)
|
|||
is_support_internal_timelapse = get_flag_bits(fun, 28);
|
||||
is_support_command_homing = get_flag_bits(fun, 32);
|
||||
is_support_brtc = get_flag_bits(fun, 31);
|
||||
m_support_mqtt_axis_control = get_flag_bits(fun, 38);
|
||||
m_support_mqtt_bet_ctrl = get_flag_bits(fun, 39);
|
||||
}
|
||||
|
||||
/*aux*/
|
||||
|
|
|
|||
|
|
@ -1205,7 +1205,9 @@ public:
|
|||
int command_stop_buzzer();
|
||||
|
||||
/* temp*/
|
||||
bool m_support_mqtt_bet_ctrl = false;
|
||||
int command_set_bed(int temp);
|
||||
|
||||
int command_set_nozzle(int temp);
|
||||
int command_set_nozzle_new(int nozzle_id, int temp);
|
||||
int command_set_chamber(int temp);
|
||||
|
|
@ -1245,6 +1247,7 @@ public:
|
|||
int command_nozzle_blob_detect(bool nozzle_blob_detect);
|
||||
|
||||
// axis string is X, Y, Z, E
|
||||
bool m_support_mqtt_axis_control = false;
|
||||
int command_axis_control(std::string axis, double unit = 1.0f, double input_val = 1.0f, int speed = 3000);
|
||||
|
||||
int command_extruder_control(int nozzle_id, double val);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue