mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 06:57:36 -06:00
ENH: support to config printer arch
Change-Id: Ib3e0cdfa10ae19c3f5543328e211bce7ff20693a Signed-off-by: Stone Li <stone.li@bambulab.com> (cherry picked from commit 24e513a89f2346e9187853cd02f8e5d73eeb8075)
This commit is contained in:
parent
957159d383
commit
3595310b09
3 changed files with 43 additions and 3 deletions
|
@ -139,6 +139,18 @@ void split_string(std::string s, std::vector<std::string>& v) {
|
|||
v.push_back(t);
|
||||
}
|
||||
|
||||
PrinterArch get_printer_arch_by_str(std::string arch_str)
|
||||
{
|
||||
if (arch_str == "i3") {
|
||||
return PrinterArch::ARCH_I3;
|
||||
}
|
||||
else if (arch_str == "core_xy") {
|
||||
return PrinterArch::ARCH_CORE_XY;
|
||||
}
|
||||
|
||||
return PrinterArch::ARCH_CORE_XY;
|
||||
}
|
||||
|
||||
void AmsTray::update_color_from_str(std::string color)
|
||||
{
|
||||
if (color.empty()) return;
|
||||
|
@ -428,6 +440,11 @@ PrinterSeries MachineObject::get_printer_series() const
|
|||
return PrinterSeries::SERIES_P1P;
|
||||
}
|
||||
|
||||
PrinterArch MachineObject::get_printer_arch() const
|
||||
{
|
||||
return DeviceManager::get_printer_arch(printer_type);
|
||||
}
|
||||
|
||||
MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string id, std::string ip)
|
||||
:dev_name(name),
|
||||
dev_id(id),
|
||||
|
@ -2426,9 +2443,9 @@ bool MachineObject::is_printing_finished()
|
|||
|
||||
bool MachineObject::is_core_xy()
|
||||
{
|
||||
if (printer_type == "N1")
|
||||
return false;
|
||||
return true;
|
||||
if (get_printer_arch() == PrinterArch::ARCH_CORE_XY)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void MachineObject::reset_update_time()
|
||||
|
@ -5094,6 +5111,21 @@ std::string DeviceManager::get_ftp_folder(std::string type_str)
|
|||
return "";
|
||||
}
|
||||
|
||||
PrinterArch DeviceManager::get_printer_arch(std::string type_str)
|
||||
{
|
||||
PrinterArch arch = PrinterArch::ARCH_CORE_XY;
|
||||
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_arch")) {
|
||||
return get_printer_arch_by_str(printer["printer_arch"].get<std::string>());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return arch;
|
||||
}
|
||||
|
||||
std::string DeviceManager::get_printer_thumbnail_img(std::string type_str)
|
||||
{
|
||||
if (DeviceManager::function_table.contains("printers")) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue