diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 894835a69..7251ce9d1 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -4605,6 +4605,10 @@ void DeviceManager::on_machine_alive(std::string json_str) if (j.contains("sec_link")) { sec_link = j["sec_link"].get(); } + std::string connection_name = ""; + if (j.contains("connection_name")) { + connection_name = j["connection_name"].get(); + } MachineObject* obj; @@ -4623,7 +4627,9 @@ void DeviceManager::on_machine_alive(std::string json_str) // update properties /* ip changed */ obj = it->second; - if (obj->dev_ip.compare(dev_ip) != 0 && !obj->dev_ip.empty()) { + if (obj->dev_ip.compare(dev_ip) != 0 && !obj->dev_ip.empty() + && obj->dev_connection_name.compare(connection_name) != 0 + ) { BOOST_LOG_TRIVIAL(info) << "MachineObject IP changed from " << obj->dev_ip << " to " << dev_ip; obj->dev_ip = dev_ip; /* ip changed reconnect mqtt */ @@ -4655,6 +4661,7 @@ void DeviceManager::on_machine_alive(std::string json_str) obj->dev_connection_type = connect_type; obj->bind_state = bind_state; obj->bind_sec_link = sec_link; + obj->dev_connection_name = connection_name; //load access code AppConfig* config = Slic3r::GUI::wxGetApp().app_config; diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index ea83222b1..2f5ed5227 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -391,6 +391,7 @@ public: float nozzle_diameter { 0.0f }; std::string dev_connection_type; /* lan | cloud */ std::string connection_type() { return dev_connection_type; } + std::string dev_connection_name; /* lan | eth */ void set_dev_ip(std::string ip) {dev_ip = ip;} std::string get_ftp_folder(); bool has_access_right() { return !get_access_code().empty(); }