mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-26 19:39:14 +00:00
removed changes that are out of scope
This commit is contained in:
@@ -1731,11 +1731,9 @@ int MachineObject::command_ams_user_settings(bool start_read_opt, bool tray_read
|
|||||||
|
|
||||||
int MachineObject::command_ams_calibrate(int ams_id)
|
int MachineObject::command_ams_calibrate(int ams_id)
|
||||||
{
|
{
|
||||||
if (!m_agent) return -1;
|
std::string gcode_cmd = (boost::format("M620 C%1% \n") % ams_id).str();
|
||||||
int rtn = m_agent->command_ams_calibrate(get_dev_id(), ams_id, MachineObject::m_sequence_id++, is_lan_mode_printer());
|
BOOST_LOG_TRIVIAL(trace) << "ams_debug: gcode_cmd" << gcode_cmd;
|
||||||
if (rtn == ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED || rtn == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE)
|
return this->publish_gcode(gcode_cmd);
|
||||||
show_unsupported_dlg(rtn);
|
|
||||||
return rtn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int MachineObject::command_ams_filament_settings(int ams_id, int slot_id, std::string filament_id, std::string setting_id, std::string tray_color, std::string tray_type, int nozzle_temp_min, int nozzle_temp_max)
|
int MachineObject::command_ams_filament_settings(int ams_id, int slot_id, std::string filament_id, std::string setting_id, std::string tray_color, std::string tray_type, int nozzle_temp_min, int nozzle_temp_max)
|
||||||
@@ -1773,11 +1771,9 @@ int MachineObject::command_ams_filament_settings(int ams_id, int slot_id, std::s
|
|||||||
|
|
||||||
int MachineObject::command_ams_refresh_rfid(std::string tray_id)
|
int MachineObject::command_ams_refresh_rfid(std::string tray_id)
|
||||||
{
|
{
|
||||||
if (!m_agent) return -1;
|
std::string gcode_cmd = (boost::format("M620 R%1% \n") % tray_id).str();
|
||||||
int rtn = m_agent->command_ams_refresh_rfid(get_dev_id(), tray_id, MachineObject::m_sequence_id++, is_lan_mode_printer());
|
BOOST_LOG_TRIVIAL(trace) << "ams_debug: gcode_cmd" << gcode_cmd;
|
||||||
if (rtn == ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED || rtn == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE)
|
return this->publish_gcode(gcode_cmd);
|
||||||
show_unsupported_dlg(rtn);
|
|
||||||
return rtn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int MachineObject::command_ams_refresh_rfid2(int ams_id, int slot_id)
|
int MachineObject::command_ams_refresh_rfid2(int ams_id, int slot_id)
|
||||||
@@ -1793,11 +1789,9 @@ int MachineObject::command_ams_refresh_rfid2(int ams_id, int slot_id)
|
|||||||
|
|
||||||
int MachineObject::command_ams_select_tray(std::string tray_id)
|
int MachineObject::command_ams_select_tray(std::string tray_id)
|
||||||
{
|
{
|
||||||
if (!m_agent) return -1;
|
std::string gcode_cmd = (boost::format("M620 P%1% \n") % tray_id).str();
|
||||||
int rtn = m_agent->command_ams_select_tray(get_dev_id(), tray_id, MachineObject::m_sequence_id++, is_lan_mode_printer());
|
BOOST_LOG_TRIVIAL(trace) << "ams_debug: gcode_cmd" << gcode_cmd;
|
||||||
if (rtn == ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED || rtn == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE)
|
return this->publish_gcode(gcode_cmd);
|
||||||
show_unsupported_dlg(rtn);
|
|
||||||
return rtn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int MachineObject::command_ams_control(std::string action)
|
int MachineObject::command_ams_control(std::string action)
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
#include "BBLNetworkPlugin.hpp"
|
#include "BBLNetworkPlugin.hpp"
|
||||||
#include "NetworkAgentFactory.hpp"
|
#include "NetworkAgentFactory.hpp"
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
|
||||||
#include <boost/log/trivial.hpp>
|
#include <boost/log/trivial.hpp>
|
||||||
#include <nlohmann/json.hpp>
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
@@ -22,65 +20,6 @@ void BBLPrinterAgent::set_cloud_agent(std::shared_ptr<ICloudServiceAgent> cloud)
|
|||||||
// Communication
|
// Communication
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
std::string BBLPrinterAgent::ams_refresh_rfid_gcode(const std::string& tray_id)
|
|
||||||
{
|
|
||||||
return (boost::format("M620 R%1% \n") % tray_id).str();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string BBLPrinterAgent::ams_calibrate_gcode(int ams_id)
|
|
||||||
{
|
|
||||||
return (boost::format("M620 C%1% \n") % ams_id).str();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string BBLPrinterAgent::ams_select_tray_gcode(const std::string& tray_id)
|
|
||||||
{
|
|
||||||
return (boost::format("M620 P%1% \n") % tray_id).str();
|
|
||||||
}
|
|
||||||
|
|
||||||
int BBLPrinterAgent::command_ams_refresh_rfid(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode)
|
|
||||||
{
|
|
||||||
const std::string gcode = ams_refresh_rfid_gcode(tray_id);
|
|
||||||
BOOST_LOG_TRIVIAL(trace) << "ams_debug: gcode_cmd" << gcode;
|
|
||||||
nlohmann::json j;
|
|
||||||
j["print"]["command"] = "gcode_line";
|
|
||||||
j["print"]["param"] = gcode;
|
|
||||||
j["print"]["sequence_id"] = std::to_string(sequence_id);
|
|
||||||
return publish(dev_id, j, lan_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
int BBLPrinterAgent::command_ams_calibrate(std::string dev_id, int ams_id, int sequence_id, bool lan_mode)
|
|
||||||
{
|
|
||||||
const std::string gcode = ams_calibrate_gcode(ams_id);
|
|
||||||
BOOST_LOG_TRIVIAL(trace) << "ams_debug: gcode_cmd" << gcode;
|
|
||||||
nlohmann::json j;
|
|
||||||
j["print"]["command"] = "gcode_line";
|
|
||||||
j["print"]["param"] = gcode;
|
|
||||||
j["print"]["sequence_id"] = std::to_string(sequence_id);
|
|
||||||
return publish(dev_id, j, lan_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
int BBLPrinterAgent::command_ams_select_tray(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode)
|
|
||||||
{
|
|
||||||
const std::string gcode = ams_select_tray_gcode(tray_id);
|
|
||||||
BOOST_LOG_TRIVIAL(trace) << "ams_debug: gcode_cmd" << gcode;
|
|
||||||
nlohmann::json j;
|
|
||||||
j["print"]["command"] = "gcode_line";
|
|
||||||
j["print"]["param"] = gcode;
|
|
||||||
j["print"]["sequence_id"] = std::to_string(sequence_id);
|
|
||||||
return publish(dev_id, j, lan_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
int BBLPrinterAgent::publish(const std::string& dev_id, const nlohmann::json& j, bool lan_mode)
|
|
||||||
{
|
|
||||||
const int rtn = lan_mode ? send_message_to_printer(dev_id, j.dump(), 0, 0) : send_message(dev_id, j.dump(), 0, 0);
|
|
||||||
if (rtn == 0) {
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "publish_json: " << j.dump() << " code: " << rtn;
|
|
||||||
} else {
|
|
||||||
BOOST_LOG_TRIVIAL(error) << "publish_json: " << j.dump() << " code: " << rtn;
|
|
||||||
}
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
int BBLPrinterAgent::send_message(std::string dev_id, std::string json_str, int qos, int flag)
|
int BBLPrinterAgent::send_message(std::string dev_id, std::string json_str, int qos, int flag)
|
||||||
{
|
{
|
||||||
auto& plugin = BBLNetworkPlugin::instance();
|
auto& plugin = BBLNetworkPlugin::instance();
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "ICloudServiceAgent.hpp"
|
#include "ICloudServiceAgent.hpp"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <nlohmann/json.hpp>
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
@@ -29,12 +28,6 @@ public:
|
|||||||
|
|
||||||
// Communication
|
// Communication
|
||||||
int send_message(std::string dev_id, std::string json_str, int qos, int flag) override;
|
int send_message(std::string dev_id, std::string json_str, int qos, int flag) override;
|
||||||
static std::string ams_refresh_rfid_gcode(const std::string& tray_id);
|
|
||||||
static std::string ams_calibrate_gcode(int ams_id);
|
|
||||||
static std::string ams_select_tray_gcode(const std::string& tray_id);
|
|
||||||
int command_ams_refresh_rfid(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode) override;
|
|
||||||
int command_ams_calibrate(std::string dev_id, int ams_id, int sequence_id, bool lan_mode) override;
|
|
||||||
int command_ams_select_tray(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode) override;
|
|
||||||
int connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl) override;
|
int connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl) override;
|
||||||
int disconnect_printer() override;
|
int disconnect_printer() override;
|
||||||
int send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag) override;
|
int send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag) override;
|
||||||
@@ -92,9 +85,6 @@ public:
|
|||||||
FilamentSyncMode get_filament_sync_mode() const override;
|
FilamentSyncMode get_filament_sync_mode() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// why: the lan/cloud DECISION stays machine-side; keep this mechanical branch in sync with publish_json.
|
|
||||||
int publish(const std::string& dev_id, const nlohmann::json& j, bool lan_mode);
|
|
||||||
|
|
||||||
std::shared_ptr<ICloudServiceAgent> m_cloud_agent;
|
std::shared_ptr<ICloudServiceAgent> m_cloud_agent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -84,16 +84,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual int send_message(std::string dev_id, std::string json_str, int qos, int flag) = 0;
|
virtual int send_message(std::string dev_id, std::string json_str, int qos, int flag) = 0;
|
||||||
|
|
||||||
// why: gcode is firmware dialect, not a waist concept - commands whose body is Bambu-dialect
|
|
||||||
// gcode live on the agent that speaks it; the default is an honest refusal that MachineObject's
|
|
||||||
// publish funnel turns into a dialog.
|
|
||||||
virtual int command_ams_refresh_rfid(std::string, std::string, int, bool)
|
|
||||||
{ return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; }
|
|
||||||
virtual int command_ams_calibrate(std::string, int, int, bool)
|
|
||||||
{ return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; }
|
|
||||||
virtual int command_ams_select_tray(std::string, std::string, int, bool)
|
|
||||||
{ return ORCA_NETWORK_ERR_CMD_NOT_SUPPORTED; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Establish a direct LAN connection to a printer.
|
* Establish a direct LAN connection to a printer.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -767,27 +767,6 @@ int NetworkAgent::send_message(std::string dev_id, std::string json_str, int qos
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int NetworkAgent::command_ams_refresh_rfid(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode)
|
|
||||||
{
|
|
||||||
if (m_printer_agent)
|
|
||||||
return m_printer_agent->command_ams_refresh_rfid(dev_id, tray_id, sequence_id, lan_mode);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int NetworkAgent::command_ams_calibrate(std::string dev_id, int ams_id, int sequence_id, bool lan_mode)
|
|
||||||
{
|
|
||||||
if (m_printer_agent)
|
|
||||||
return m_printer_agent->command_ams_calibrate(dev_id, ams_id, sequence_id, lan_mode);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int NetworkAgent::command_ams_select_tray(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode)
|
|
||||||
{
|
|
||||||
if (m_printer_agent)
|
|
||||||
return m_printer_agent->command_ams_select_tray(dev_id, tray_id, sequence_id, lan_mode);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int NetworkAgent::connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl)
|
int NetworkAgent::connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl)
|
||||||
{
|
{
|
||||||
if (m_printer_agent)
|
if (m_printer_agent)
|
||||||
|
|||||||
@@ -142,9 +142,6 @@ public:
|
|||||||
int set_on_local_message_fn(OnMessageFn fn);
|
int set_on_local_message_fn(OnMessageFn fn);
|
||||||
int set_server_callback(OnServerErrFn fn);
|
int set_server_callback(OnServerErrFn fn);
|
||||||
int send_message(std::string dev_id, std::string json_str, int qos, int flag);
|
int send_message(std::string dev_id, std::string json_str, int qos, int flag);
|
||||||
int command_ams_refresh_rfid(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode);
|
|
||||||
int command_ams_calibrate(std::string dev_id, int ams_id, int sequence_id, bool lan_mode);
|
|
||||||
int command_ams_select_tray(std::string dev_id, std::string tray_id, int sequence_id, bool lan_mode);
|
|
||||||
int connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl);
|
int connect_printer(std::string dev_id, std::string dev_ip, std::string username, std::string password, bool use_ssl);
|
||||||
int disconnect_printer();
|
int disconnect_printer();
|
||||||
int send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag);
|
int send_message_to_printer(std::string dev_id, std::string json_str, int qos, int flag);
|
||||||
|
|||||||
Reference in New Issue
Block a user