NEW: add config file to store functional compatibility
Change-Id: I9831cef9d57642fe7709eef87e74a64e21857e18
This commit is contained in:
parent
b510e94e06
commit
3b9801f147
|
@ -73,11 +73,11 @@ AuFile::AuFile(wxWindow *parent, fs::path file_path, wxString file_name, Auxilia
|
||||||
}
|
}
|
||||||
|
|
||||||
image->Rescale(size.x, size.y);
|
image->Rescale(size.x, size.y);
|
||||||
m_file_bitmap = wxBitmap(*image);
|
m_file_bitmap.bmp() = wxBitmap(*image);
|
||||||
} else {
|
} else {
|
||||||
m_bitmap_excel = create_scaled_bitmap("placeholder_excel", nullptr, 168);
|
m_bitmap_excel = ScalableBitmap(this, "placeholder_excel", 168);
|
||||||
m_bitmap_pdf = create_scaled_bitmap("placeholder_pdf", nullptr, 168);
|
m_bitmap_pdf = ScalableBitmap(this, "placeholder_pdf", 168);
|
||||||
m_bitmap_txt = create_scaled_bitmap("placeholder_txt", nullptr, 168);
|
m_bitmap_txt = ScalableBitmap(this, "placeholder_txt", 168);
|
||||||
|
|
||||||
if (m_type == OTHERS) {m_file_bitmap = m_bitmap_txt;}
|
if (m_type == OTHERS) {m_file_bitmap = m_bitmap_txt;}
|
||||||
if (m_type == BILL_OF_MATERIALS) {
|
if (m_type == BILL_OF_MATERIALS) {
|
||||||
|
@ -210,7 +210,7 @@ void AuFile::PaintBackground(wxDC &dc)
|
||||||
dc.SetPen(AUFILE_GREY200);
|
dc.SetPen(AUFILE_GREY200);
|
||||||
dc.SetBrush(AUFILE_GREY200);
|
dc.SetBrush(AUFILE_GREY200);
|
||||||
dc.DrawRoundedRectangle(0, 0, size.x, size.y, AUFILE_ROUNDING);
|
dc.DrawRoundedRectangle(0, 0, size.x, size.y, AUFILE_ROUNDING);
|
||||||
dc.DrawBitmap(m_file_bitmap, (size.x - m_file_bitmap.GetSize().x) / 2, (size.y - m_file_bitmap.GetSize().y) / 2);
|
dc.DrawBitmap(m_file_bitmap.bmp(), (size.x - m_file_bitmap.GetBmpWidth()) / 2, (size.y - m_file_bitmap.GetBmpHeight()) / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ void AuFile::on_input_enter(wxCommandEvent &evt)
|
||||||
|
|
||||||
|
|
||||||
wxString new_fullname_path = dir.wstring() + "/" + new_fullname;
|
wxString new_fullname_path = dir.wstring() + "/" + new_fullname;
|
||||||
fs::path new_dir_path(new_fullname_path);
|
fs::path new_dir_path(new_fullname_path.c_str());
|
||||||
|
|
||||||
|
|
||||||
if (fs::exists(new_dir_path)) existing = true;
|
if (fs::exists(new_dir_path)) existing = true;
|
||||||
|
@ -540,11 +540,11 @@ void AuFile::msw_rescale()
|
||||||
}
|
}
|
||||||
|
|
||||||
image->Rescale(size.x, size.y);
|
image->Rescale(size.x, size.y);
|
||||||
m_file_bitmap = wxBitmap(*image);
|
m_file_bitmap.bmp() = wxBitmap(*image);
|
||||||
} else {
|
} else {
|
||||||
m_bitmap_excel = create_scaled_bitmap("placeholder_excel", nullptr, 168);
|
m_bitmap_excel = ScalableBitmap(this, "placeholder_excel", 168);
|
||||||
m_bitmap_pdf = create_scaled_bitmap("placeholder_pdf", nullptr, 168);
|
m_bitmap_pdf = ScalableBitmap(this, "placeholder_pdf", 168);
|
||||||
m_bitmap_txt = create_scaled_bitmap("placeholder_txt", nullptr, 168);
|
m_bitmap_txt = ScalableBitmap(this, "placeholder_txt", 168);
|
||||||
|
|
||||||
if (m_type == OTHERS) { m_file_bitmap = m_bitmap_txt; }
|
if (m_type == OTHERS) { m_file_bitmap = m_bitmap_txt; }
|
||||||
if (m_type == BILL_OF_MATERIALS) { m_file_bitmap = m_bitmap_excel; }
|
if (m_type == BILL_OF_MATERIALS) { m_file_bitmap = m_bitmap_excel; }
|
||||||
|
|
|
@ -91,14 +91,14 @@ public:
|
||||||
wxString cover_text_left;
|
wxString cover_text_left;
|
||||||
wxString cover_text_right;
|
wxString cover_text_right;
|
||||||
wxString cover_text_cover;
|
wxString cover_text_cover;
|
||||||
wxBitmap m_file_bitmap;
|
ScalableBitmap m_file_bitmap;
|
||||||
ScalableBitmap m_file_cover;
|
ScalableBitmap m_file_cover;
|
||||||
ScalableBitmap m_file_edit_mask;
|
ScalableBitmap m_file_edit_mask;
|
||||||
ScalableBitmap m_file_delete;
|
ScalableBitmap m_file_delete;
|
||||||
|
|
||||||
wxBitmap m_bitmap_excel;
|
ScalableBitmap m_bitmap_excel;
|
||||||
wxBitmap m_bitmap_pdf;
|
ScalableBitmap m_bitmap_pdf;
|
||||||
wxBitmap m_bitmap_txt;
|
ScalableBitmap m_bitmap_txt;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AuFile(wxWindow *parent, fs::path file_path, wxString file_name, AuxiliaryFolderType type, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
AuFile(wxWindow *parent, fs::path file_path, wxString file_name, AuxiliaryFolderType type, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "MsgDialog.hpp"
|
#include "MsgDialog.hpp"
|
||||||
#include "Plater.hpp"
|
#include "Plater.hpp"
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
#include "nlohmann/json.hpp"
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
|
@ -21,7 +20,6 @@
|
||||||
#include <boost/uuid/uuid_generators.hpp>
|
#include <boost/uuid/uuid_generators.hpp>
|
||||||
#include <boost/uuid/uuid_io.hpp>
|
#include <boost/uuid/uuid_io.hpp>
|
||||||
|
|
||||||
using namespace nlohmann;
|
|
||||||
|
|
||||||
namespace pt = boost::property_tree;
|
namespace pt = boost::property_tree;
|
||||||
|
|
||||||
|
@ -259,63 +257,34 @@ wxString HMSItem::get_hms_msg_level_str(HMSMessageLevel level)
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINTER_TYPE MachineObject::parse_printer_type(std::string type_str)
|
std::string MachineObject::parse_printer_type(std::string type_str)
|
||||||
{
|
{
|
||||||
if (type_str.compare("3DPrinter-P1") == 0) {
|
if (type_str.compare("3DPrinter-X1") == 0) {
|
||||||
return PRINTER_TYPE::PRINTER_3DPrinter_P1;
|
return "BL-P002";
|
||||||
} else if (type_str.compare("3DPrinter-X1") == 0) {
|
|
||||||
return PRINTER_TYPE::PRINTER_3DPrinter_X1;
|
|
||||||
} else if (type_str.compare("3DPrinter-X1-Carbon") == 0) {
|
} else if (type_str.compare("3DPrinter-X1-Carbon") == 0) {
|
||||||
return PRINTER_TYPE::PRINTER_3DPrinter_X1_Carbon;
|
return "BL-P001";
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(trace) << "unknown printer type: " << type_str;
|
|
||||||
return PRINTER_TYPE::PRINTER_3DPrinter_UKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRINTER_TYPE MachineObject::parse_iot_printer_type(std::string type_str)
|
|
||||||
{
|
|
||||||
if (type_str.compare("BL-P003") == 0) {
|
|
||||||
return PRINTER_TYPE::PRINTER_3DPrinter_P1;
|
|
||||||
} else if (type_str.compare("BL-P002") == 0) {
|
|
||||||
return PRINTER_TYPE::PRINTER_3DPrinter_X1;
|
|
||||||
} else if (type_str.compare("BL-P001") == 0) {
|
} else if (type_str.compare("BL-P001") == 0) {
|
||||||
return PRINTER_TYPE::PRINTER_3DPrinter_X1_Carbon;
|
return type_str;
|
||||||
}
|
} else if (type_str.compare("BL-P003") == 0) {
|
||||||
|
return type_str;
|
||||||
BOOST_LOG_TRIVIAL(trace) << "unknown printer type: " << type_str;
|
|
||||||
return PRINTER_TYPE::PRINTER_3DPrinter_UKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRINTER_TYPE MachineObject::parse_preset_printer_type(std::string type_str)
|
|
||||||
{
|
|
||||||
return parse_iot_printer_type(type_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string MachineObject::get_preset_printer_model_name(PRINTER_TYPE printer_type)
|
|
||||||
{
|
|
||||||
if (printer_type == PRINTER_TYPE::PRINTER_3DPrinter_P1) {
|
|
||||||
return "Bambu Lab P1";
|
|
||||||
} else if (printer_type == PRINTER_TYPE::PRINTER_3DPrinter_X1) {
|
|
||||||
return "Bambu Lab X1";
|
|
||||||
} else if (printer_type == PRINTER_TYPE::PRINTER_3DPrinter_X1_Carbon) {
|
|
||||||
return "Bambu Lab X1 Carbon";
|
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return DeviceManager::parse_printer_type(type_str);
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string MachineObject::get_preset_printer_model_name(std::string printer_type)
|
||||||
|
{
|
||||||
|
return DeviceManager::get_printer_display_name(printer_type);
|
||||||
|
}
|
||||||
|
|
||||||
wxString MachineObject::get_printer_type_display_str()
|
wxString MachineObject::get_printer_type_display_str()
|
||||||
{
|
{
|
||||||
if (printer_type == PRINTER_TYPE::PRINTER_3DPrinter_P1)
|
std::string display_name = get_preset_printer_model_name(printer_type);
|
||||||
return "Bambu Lab P1";
|
if (!display_name.empty())
|
||||||
else if (printer_type == PRINTER_TYPE::PRINTER_3DPrinter_X1)
|
return display_name;
|
||||||
return "Bambu Lab X1";
|
else
|
||||||
else if (printer_type == PRINTER_TYPE::PRINTER_3DPrinter_X1_Carbon)
|
return _L("Unknown");
|
||||||
return "Bambu Lab X1 Carbon";
|
|
||||||
return _L("Unknown");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MachineObject::set_access_code(std::string code)
|
void MachineObject::set_access_code(std::string code)
|
||||||
|
@ -335,17 +304,6 @@ bool MachineObject::is_lan_mode_printer()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MachineObject::get_printer_type_string()
|
|
||||||
{
|
|
||||||
if (printer_type == PRINTER_TYPE::PRINTER_3DPrinter_P1)
|
|
||||||
return "3DPrinter-P1";
|
|
||||||
else if (printer_type == PRINTER_TYPE::PRINTER_3DPrinter_X1)
|
|
||||||
return "3DPrinter-X1";
|
|
||||||
else if (printer_type == PRINTER_TYPE::PRINTER_3DPrinter_X1_Carbon)
|
|
||||||
return "3DPrinter-X1-Carbon";
|
|
||||||
return "3DPrinter";
|
|
||||||
}
|
|
||||||
|
|
||||||
MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string id, std::string ip)
|
MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string id, std::string ip)
|
||||||
:dev_name(name),
|
:dev_name(name),
|
||||||
dev_id(id),
|
dev_id(id),
|
||||||
|
@ -1695,6 +1653,40 @@ bool MachineObject::is_info_ready()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MachineObject::is_function_supported(PrinterFunction func)
|
||||||
|
{
|
||||||
|
std::string func_name;
|
||||||
|
switch (func) {
|
||||||
|
case FUNC_MONITORING:
|
||||||
|
func_name = "FUNC_MONITORING";
|
||||||
|
break;
|
||||||
|
case FUNC_TIMELAPSE:
|
||||||
|
func_name = "FUNC_TIMELAPSE";
|
||||||
|
break;
|
||||||
|
case FUNC_RECORDING:
|
||||||
|
func_name = "FUNC_RECORDING";
|
||||||
|
break;
|
||||||
|
case FUNC_FIRSTLAYER_INSPECT:
|
||||||
|
func_name = "FUNC_FIRSTLAYER_INSPECT";
|
||||||
|
break;
|
||||||
|
case FUNC_SPAGHETTI:
|
||||||
|
func_name = "FUNC_SPAGHETTI";
|
||||||
|
break;
|
||||||
|
case FUNC_FLOW_CALIBRATION:
|
||||||
|
func_name = "FUNC_FLOW_CALIBRATION";
|
||||||
|
break;
|
||||||
|
case FUNC_AUTO_LEVELING:
|
||||||
|
func_name = "FUNC_AUTO_LEVELING";
|
||||||
|
break;
|
||||||
|
case FUNC_CHAMBER_TEMP:
|
||||||
|
func_name = "FUNC_CHAMBER_TEMP";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return DeviceManager::is_function_supported(printer_type, func_name);
|
||||||
|
}
|
||||||
|
|
||||||
int MachineObject::publish_json(std::string json_str, int qos)
|
int MachineObject::publish_json(std::string json_str, int qos)
|
||||||
{
|
{
|
||||||
if (is_lan_mode_printer()) {
|
if (is_lan_mode_printer()) {
|
||||||
|
@ -3058,7 +3050,7 @@ void DeviceManager::parse_user_print_info(std::string body)
|
||||||
if (!elem["dev_online"].is_null())
|
if (!elem["dev_online"].is_null())
|
||||||
obj->m_is_online = elem["dev_online"].get<bool>();
|
obj->m_is_online = elem["dev_online"].get<bool>();
|
||||||
if (elem.contains("dev_model_name") && !elem["dev_model_name"].is_null())
|
if (elem.contains("dev_model_name") && !elem["dev_model_name"].is_null())
|
||||||
obj->printer_type = MachineObject::parse_iot_printer_type(elem["dev_model_name"].get<std::string>());
|
obj->printer_type = elem["dev_model_name"].get<std::string>();
|
||||||
if (!elem["task_status"].is_null())
|
if (!elem["task_status"].is_null())
|
||||||
obj->iot_print_status = elem["task_status"].get<std::string>();
|
obj->iot_print_status = elem["task_status"].get<std::string>();
|
||||||
if (elem.contains("dev_product_name") && !elem["dev_product_name"].is_null())
|
if (elem.contains("dev_product_name") && !elem["dev_product_name"].is_null())
|
||||||
|
@ -3137,4 +3129,67 @@ void DeviceManager::load_last_machine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json DeviceManager::function_table = json::object();
|
||||||
|
|
||||||
|
std::string DeviceManager::parse_printer_type(std::string type_str)
|
||||||
|
{
|
||||||
|
if (DeviceManager::function_table.contains("printers")) {
|
||||||
|
for (auto printer : DeviceManager::function_table["printers"]) {
|
||||||
|
if (printer.contains("model_id") && printer["model_id"].get<std::string>() == type_str) {
|
||||||
|
if (printer.contains("printer_type")) {
|
||||||
|
return printer["printer_type"].get<std::string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string DeviceManager::get_printer_display_name(std::string type_str)
|
||||||
|
{
|
||||||
|
if (DeviceManager::function_table.contains("printers")) {
|
||||||
|
for (auto printer : DeviceManager::function_table["printers"]) {
|
||||||
|
if (printer.contains("model_id") && printer["model_id"].get<std::string>() == type_str) {
|
||||||
|
if (printer.contains("display_name")) {
|
||||||
|
return printer["display_name"].get<std::string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceManager::is_function_supported(std::string type_str, std::string function_name)
|
||||||
|
{
|
||||||
|
if (DeviceManager::function_table.contains("printers")) {
|
||||||
|
for (auto printer : DeviceManager::function_table["printers"]) {
|
||||||
|
if (printer.contains("model_id") && printer["model_id"].get<std::string>() == type_str) {
|
||||||
|
if (printer.contains("func")) {
|
||||||
|
if (printer["func"].contains(function_name))
|
||||||
|
return printer["func"][function_name].get<bool>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceManager::load_functional_config(std::string config_file)
|
||||||
|
{
|
||||||
|
std::ifstream json_file(config_file.c_str());
|
||||||
|
try {
|
||||||
|
if (json_file.is_open()) {
|
||||||
|
json_file >> DeviceManager::function_table;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "load functional config failed, file = " << config_file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(...) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "load functional config failed, file = " << config_file;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
#include "nlohmann/json.hpp"
|
||||||
#include "libslic3r/ProjectTask.hpp"
|
#include "libslic3r/ProjectTask.hpp"
|
||||||
#include "slic3r/Utils/json_diff.hpp"
|
#include "slic3r/Utils/json_diff.hpp"
|
||||||
#include "slic3r/Utils/NetworkAgent.hpp"
|
#include "slic3r/Utils/NetworkAgent.hpp"
|
||||||
|
@ -32,17 +33,10 @@ inline int correct_filament_temperature(int filament_temp)
|
||||||
|
|
||||||
wxString get_stage_string(int stage);
|
wxString get_stage_string(int stage);
|
||||||
|
|
||||||
|
using namespace nlohmann;
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
enum PRINTER_TYPE {
|
|
||||||
PRINTER_3DPrinter_UKNOWN,
|
|
||||||
PRINTER_3DPrinter_NONE,
|
|
||||||
PRINTER_3DPrinter_X1_Carbon, // BL-P001
|
|
||||||
PRINTER_3DPrinter_X1, // BL-P002
|
|
||||||
PRINTER_3DPrinter_P1, // BL-P003
|
|
||||||
};
|
|
||||||
|
|
||||||
enum PRINTING_STAGE {
|
enum PRINTING_STAGE {
|
||||||
PRINTING_STAGE_PRINTING = 0,
|
PRINTING_STAGE_PRINTING = 0,
|
||||||
PRINTING_STAGE_BED_LEVELING,
|
PRINTING_STAGE_BED_LEVELING,
|
||||||
|
@ -62,6 +56,18 @@ enum PRINTING_STAGE {
|
||||||
PRINTING_STAGE_COUNT
|
PRINTING_STAGE_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum PrinterFunction {
|
||||||
|
FUNC_MONITORING = 0,
|
||||||
|
FUNC_TIMELAPSE,
|
||||||
|
FUNC_RECORDING,
|
||||||
|
FUNC_FIRSTLAYER_INSPECT,
|
||||||
|
FUNC_SPAGHETTI,
|
||||||
|
FUNC_FLOW_CALIBRATION,
|
||||||
|
FUNC_AUTO_LEVELING,
|
||||||
|
FUNC_CHAMBER_TEMP,
|
||||||
|
FUNC_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
enum PrintingSpeedLevel {
|
enum PrintingSpeedLevel {
|
||||||
SPEED_LEVEL_INVALID = 0,
|
SPEED_LEVEL_INVALID = 0,
|
||||||
|
@ -301,10 +307,8 @@ public:
|
||||||
|
|
||||||
/* static members and functions */
|
/* static members and functions */
|
||||||
static inline int m_sequence_id = 20000;
|
static inline int m_sequence_id = 20000;
|
||||||
static PRINTER_TYPE parse_printer_type(std::string type_str);
|
static std::string parse_printer_type(std::string type_str);
|
||||||
static PRINTER_TYPE parse_iot_printer_type(std::string type_str);
|
static std::string get_preset_printer_model_name(std::string printer_type);
|
||||||
static PRINTER_TYPE parse_preset_printer_type(std::string type_str);
|
|
||||||
static std::string get_preset_printer_model_name(PRINTER_TYPE printer_type);
|
|
||||||
static bool is_bbl_filament(std::string tag_uid);
|
static bool is_bbl_filament(std::string tag_uid);
|
||||||
|
|
||||||
typedef std::function<void()> UploadedFn;
|
typedef std::function<void()> UploadedFn;
|
||||||
|
@ -322,8 +326,8 @@ public:
|
||||||
bool has_access_right() { return !access_code.empty(); }
|
bool has_access_right() { return !access_code.empty(); }
|
||||||
void set_access_code(std::string code);
|
void set_access_code(std::string code);
|
||||||
bool is_lan_mode_printer();
|
bool is_lan_mode_printer();
|
||||||
PRINTER_TYPE printer_type = PRINTER_3DPrinter_UKNOWN;
|
//PRINTER_TYPE printer_type = PRINTER_3DPrinter_UKNOWN;
|
||||||
std::string get_printer_type_string();
|
std::string printer_type; /* model_id */
|
||||||
wxString get_printer_type_display_str();
|
wxString get_printer_type_display_str();
|
||||||
|
|
||||||
std::string product_name; // set by iot service, get /user/print
|
std::string product_name; // set by iot service, get /user/print
|
||||||
|
@ -574,6 +578,7 @@ public:
|
||||||
void set_online_state(bool on_off);
|
void set_online_state(bool on_off);
|
||||||
bool is_online() { return m_is_online; }
|
bool is_online() { return m_is_online; }
|
||||||
bool is_info_ready();
|
bool is_info_ready();
|
||||||
|
bool is_function_supported(PrinterFunction func);
|
||||||
|
|
||||||
|
|
||||||
/* Msg for display MsgFn */
|
/* Msg for display MsgFn */
|
||||||
|
@ -636,6 +641,13 @@ public:
|
||||||
// get alive machine
|
// get alive machine
|
||||||
std::map<std::string, MachineObject*> get_local_machine_list();
|
std::map<std::string, MachineObject*> get_local_machine_list();
|
||||||
void load_last_machine();
|
void load_last_machine();
|
||||||
|
|
||||||
|
static json function_table;
|
||||||
|
static std::string parse_printer_type(std::string type_str);
|
||||||
|
static std::string get_printer_display_name(std::string type_str);
|
||||||
|
static bool is_function_supported(std::string type_str, std::string function_name);
|
||||||
|
|
||||||
|
static bool load_functional_config(std::string config_file);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
|
@ -1092,6 +1092,9 @@ void GUI_App::post_init()
|
||||||
if (hms_query)
|
if (hms_query)
|
||||||
hms_query->check_hms_info();
|
hms_query->check_hms_info();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
std::string functional_config_file = Slic3r::resources_dir() + "/config.json";
|
||||||
|
DeviceManager::load_functional_config(encode_path(functional_config_file.c_str()));
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "finished post_init";
|
BOOST_LOG_TRIVIAL(info) << "finished post_init";
|
||||||
//BBS: remove the single instance currently
|
//BBS: remove the single instance currently
|
||||||
|
|
|
@ -75,6 +75,26 @@ void PrintOptionsDialog::update_spaghetti()
|
||||||
void PrintOptionsDialog::update_options(MachineObject *obj_)
|
void PrintOptionsDialog::update_options(MachineObject *obj_)
|
||||||
{
|
{
|
||||||
if (!obj_) return;
|
if (!obj_) return;
|
||||||
|
if (obj_->is_function_supported(PrinterFunction::FUNC_FIRSTLAYER_INSPECT)) {
|
||||||
|
text_first_layer->Show();
|
||||||
|
m_cb_first_layer->Show();
|
||||||
|
} else {
|
||||||
|
text_first_layer->Hide();
|
||||||
|
m_cb_first_layer->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj_->is_function_supported(PrinterFunction::FUNC_SPAGHETTI)) {
|
||||||
|
text_spaghetti->Show();
|
||||||
|
m_cb_spaghetti->Show();
|
||||||
|
m_cb_spaghetti_print_halt->Show();
|
||||||
|
text_spaghetti_print_halt->Show();
|
||||||
|
}else {
|
||||||
|
text_spaghetti->Hide();
|
||||||
|
m_cb_spaghetti->Hide();
|
||||||
|
m_cb_spaghetti_print_halt->Hide();
|
||||||
|
text_spaghetti_print_halt->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
this->Freeze();
|
this->Freeze();
|
||||||
m_cb_spaghetti->SetValue(obj_->xcam_spaghetti_detector);
|
m_cb_spaghetti->SetValue(obj_->xcam_spaghetti_detector);
|
||||||
m_cb_spaghetti_print_halt->SetValue(obj_->xcam_spaghetti_print_halt);
|
m_cb_spaghetti_print_halt->SetValue(obj_->xcam_spaghetti_print_halt);
|
||||||
|
@ -88,7 +108,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
|
||||||
auto sizer = new wxBoxSizer(wxVERTICAL);
|
auto sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
auto line_sizer = new wxBoxSizer(wxHORIZONTAL);
|
auto line_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
m_cb_spaghetti = new CheckBox(parent);
|
m_cb_spaghetti = new CheckBox(parent);
|
||||||
auto text_spaghetti = new wxStaticText(parent, wxID_ANY, _L("Spaghetti Detection"));
|
text_spaghetti = new wxStaticText(parent, wxID_ANY, _L("Spaghetti Detection"));
|
||||||
text_spaghetti->SetFont(Label::Body_14);
|
text_spaghetti->SetFont(Label::Body_14);
|
||||||
line_sizer->Add(FromDIP(5), 0, 0, 0);
|
line_sizer->Add(FromDIP(5), 0, 0, 0);
|
||||||
line_sizer->Add(m_cb_spaghetti, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
line_sizer->Add(m_cb_spaghetti, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||||
|
@ -112,7 +132,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
|
||||||
|
|
||||||
line_sizer = new wxBoxSizer(wxHORIZONTAL);
|
line_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
m_cb_first_layer = new CheckBox(parent);
|
m_cb_first_layer = new CheckBox(parent);
|
||||||
auto text_first_layer = new wxStaticText(parent, wxID_ANY, _L("First Layer Inspection"));
|
text_first_layer = new wxStaticText(parent, wxID_ANY, _L("First Layer Inspection"));
|
||||||
text_first_layer->SetFont(Label::Body_14);
|
text_first_layer->SetFont(Label::Body_14);
|
||||||
line_sizer->Add(FromDIP(5), 0, 0, 0);
|
line_sizer->Add(FromDIP(5), 0, 0, 0);
|
||||||
line_sizer->Add(m_cb_first_layer, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
line_sizer->Add(m_cb_first_layer, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||||
|
|
|
@ -24,6 +24,8 @@ protected:
|
||||||
CheckBox* m_cb_first_layer;
|
CheckBox* m_cb_first_layer;
|
||||||
CheckBox* m_cb_spaghetti;
|
CheckBox* m_cb_spaghetti;
|
||||||
CheckBox* m_cb_spaghetti_print_halt;
|
CheckBox* m_cb_spaghetti_print_halt;
|
||||||
|
wxStaticText* text_first_layer;
|
||||||
|
wxStaticText* text_spaghetti;
|
||||||
wxStaticText* text_spaghetti_print_halt;
|
wxStaticText* text_spaghetti_print_halt;
|
||||||
wxBoxSizer* create_settings_group(wxWindow* parent);
|
wxBoxSizer* create_settings_group(wxWindow* parent);
|
||||||
|
|
||||||
|
|
|
@ -1043,26 +1043,18 @@ wxWindow *SelectMachineDialog::create_item_checkbox(wxString title, wxWindow *pa
|
||||||
return checkbox;
|
return checkbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectMachineDialog::update_select_layout(PRINTER_TYPE type)
|
void SelectMachineDialog::update_select_layout(MachineObject *obj)
|
||||||
{
|
{
|
||||||
if (type == PRINTER_TYPE::PRINTER_3DPrinter_UKNOWN) {
|
if (obj && obj->is_function_supported(PrinterFunction::FUNC_FLOW_CALIBRATION)) {
|
||||||
select_bed->Show();
|
|
||||||
select_flow->Show();
|
select_flow->Show();
|
||||||
} else if (type == PRINTER_TYPE::PRINTER_3DPrinter_X1) {
|
|
||||||
select_bed->Show();
|
|
||||||
select_flow->Show();
|
|
||||||
} else if (type == PRINTER_TYPE::PRINTER_3DPrinter_X1_Carbon) {
|
|
||||||
select_bed->Show();
|
|
||||||
select_flow->Show();
|
|
||||||
} else if (type == PRINTER_TYPE::PRINTER_3DPrinter_P1) {
|
|
||||||
select_bed->Show();
|
|
||||||
select_flow->Show(false);
|
|
||||||
} else if (type == PRINTER_TYPE::PRINTER_3DPrinter_NONE) {
|
|
||||||
select_bed->Hide();
|
|
||||||
select_flow->Hide();
|
|
||||||
} else {
|
} else {
|
||||||
|
select_flow->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj && obj->is_function_supported(PrinterFunction::FUNC_AUTO_LEVELING)) {
|
||||||
select_bed->Show();
|
select_bed->Show();
|
||||||
select_flow->Show();
|
} else {
|
||||||
|
select_bed->Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
Fit();
|
Fit();
|
||||||
|
@ -1753,7 +1745,7 @@ void SelectMachineDialog::update_user_printer()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_printer_last_select = "";
|
m_printer_last_select = "";
|
||||||
update_select_layout(PRINTER_TYPE::PRINTER_3DPrinter_NONE);
|
update_select_layout(nullptr);
|
||||||
m_comboBox_printer->SetTextLabel("");
|
m_comboBox_printer->SetTextLabel("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1798,7 +1790,7 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
|
||||||
if (obj) {
|
if (obj) {
|
||||||
obj->command_get_version();
|
obj->command_get_version();
|
||||||
dev->set_selected_machine(m_printer_last_select);
|
dev->set_selected_machine(m_printer_last_select);
|
||||||
update_select_layout(obj->printer_type);
|
update_select_layout(obj);
|
||||||
} else {
|
} else {
|
||||||
BOOST_LOG_TRIVIAL(error) << "on_selection_changed dev_id not found";
|
BOOST_LOG_TRIVIAL(error) << "on_selection_changed dev_id not found";
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -328,7 +328,7 @@ public:
|
||||||
~SelectMachineDialog();
|
~SelectMachineDialog();
|
||||||
|
|
||||||
wxWindow *create_item_checkbox(wxString title, wxWindow *parent, wxString tooltip, std::string param);
|
wxWindow *create_item_checkbox(wxString title, wxWindow *parent, wxString tooltip, std::string param);
|
||||||
void update_select_layout(PRINTER_TYPE type);
|
void update_select_layout(MachineObject *obj);
|
||||||
void prepare_mode();
|
void prepare_mode();
|
||||||
void sending_mode();
|
void sending_mode();
|
||||||
void finish_mode();
|
void finish_mode();
|
||||||
|
|
|
@ -1313,14 +1313,41 @@ void StatusPanel::update(MachineObject *obj)
|
||||||
}
|
}
|
||||||
calibration_dlg->update_cali(obj);
|
calibration_dlg->update_cali(obj);
|
||||||
|
|
||||||
if (print_options_dlg == nullptr) {
|
|
||||||
print_options_dlg = new PrintOptionsDialog(this);
|
if (obj->is_function_supported(PrinterFunction::FUNC_FIRSTLAYER_INSPECT)
|
||||||
print_options_dlg->update_machine_obj(obj);
|
|| obj->is_function_supported(PrinterFunction::FUNC_SPAGHETTI)) {
|
||||||
|
m_options_btn->Show();
|
||||||
|
if (print_options_dlg == nullptr) {
|
||||||
|
print_options_dlg = new PrintOptionsDialog(this);
|
||||||
|
print_options_dlg->update_machine_obj(obj);
|
||||||
|
} else {
|
||||||
|
print_options_dlg->update_machine_obj(obj);
|
||||||
|
}
|
||||||
|
print_options_dlg->update_options(obj);
|
||||||
} else {
|
} else {
|
||||||
print_options_dlg->update_machine_obj(obj);
|
m_options_btn->Hide();
|
||||||
}
|
}
|
||||||
print_options_dlg->update_options(obj);
|
|
||||||
|
if (obj->is_function_supported(PrinterFunction::FUNC_TIMELAPSE)) {
|
||||||
|
m_timelapse_button->Show();
|
||||||
|
} else {
|
||||||
|
m_timelapse_button->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj->is_function_supported(PrinterFunction::FUNC_RECORDING)) {
|
||||||
|
m_recording_button->Show();
|
||||||
|
} else {
|
||||||
|
m_recording_button->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj->is_function_supported(PrinterFunction::FUNC_CHAMBER_TEMP)) {
|
||||||
|
m_tempCtrl_frame->Enable();
|
||||||
|
} else {
|
||||||
|
m_tempCtrl_frame->SetLabel(TEMP_BLANK_STR);
|
||||||
|
m_tempCtrl_frame->GetTextCtrl()->SetLabel(TEMP_BLANK_STR);
|
||||||
|
m_tempCtrl_frame->Disable();
|
||||||
|
}
|
||||||
|
|
||||||
update_error_message();
|
update_error_message();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2362,6 +2389,11 @@ void StatusPanel::set_default()
|
||||||
m_show_ams_group = false;
|
m_show_ams_group = false;
|
||||||
reset_printing_values();
|
reset_printing_values();
|
||||||
|
|
||||||
|
m_timelapse_button->Show();
|
||||||
|
m_recording_button->Show();
|
||||||
|
m_tempCtrl_frame->Show();
|
||||||
|
m_options_btn->Show();
|
||||||
|
|
||||||
reset_temp_misc_control();
|
reset_temp_misc_control();
|
||||||
m_ams_control->Hide();
|
m_ams_control->Hide();
|
||||||
m_ams_control_box->Hide();
|
m_ams_control_box->Hide();
|
||||||
|
|
Loading…
Reference in New Issue