update slic3r

This commit is contained in:
QIDI TECH
2025-07-10 09:14:38 +08:00
parent e0d447172c
commit f60592f1a0
153 changed files with 6440 additions and 4276 deletions

View File

@@ -38,24 +38,27 @@ std::vector<std::string> not_support_auto_pa_cali_filaments = {
void get_default_k_n_value(const std::string &filament_id, float &k, float &n)
{
if (filament_id.compare("GFG00") == 0) {
// PETG
k = 0.04;
if (filament_id.compare("GFU01") == 0) {
/* TPU 95A */
k = 0.25;
n = 1.0;
} else if (filament_id.compare("GFB00") == 0 || filament_id.compare("GFB50") == 0) {
// ABS
k = 0.04;
} else if (filament_id.compare("GFU03") == 0) {
/* TPU 90A */
k = 0.35;
n = 1.0;
} else if (filament_id.compare("GFU01") == 0) {
// TPU
k = 0.2;
} else if (filament_id.compare("GFU04") == 0) {
/* TPU 85A */
k = 0.65;
n = 1.0;
} else if (filament_id.compare("GFB01") == 0) {
// ASA
} else if (filament_id.compare("GFG00") == 0 || filament_id.compare("GFG01") == 0 || filament_id.compare("GFG60") == 0 || filament_id.compare("GFL06") == 0 ||
filament_id.compare("GFL55") == 0 || filament_id.compare("GFG99") == 0 || filament_id.compare("GFG98") == 0 || filament_id.compare("GFG97") == 0 ||
filament_id.compare("GFG50") == 0 || filament_id.compare("GFU02") == 0 || filament_id.compare("GFU98") == 0 || filament_id.compare("GFS00") == 0 ||
filament_id.compare("GFS02") == 0) {
/* 0.04 filaments */
k = 0.04;
n = 1.0;
} else {
// PLA , other
/* other */
k = 0.02;
n = 1.0;
}
@@ -124,6 +127,8 @@ static wxString to_wstring_name(std::string name)
return _L("Hardened Steel");
} else if (name == "stainless_steel") {
return _L("Stainless Steel");
} else if (name == "tungsten_carbide") {
return _L("Tungsten Carbide");
}
return wxEmptyString;
@@ -1337,6 +1342,7 @@ bool CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &f
Print *fff_print = dynamic_cast<Print *>(print);
fff_print->set_calib_params(params);
fff_print->set_QDT_Printer(true);
//StringObjectException warning;
//auto err = print->validate(&warning);
@@ -1358,9 +1364,22 @@ bool CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &f
PlateDataPtrs plate_data_list;
partplate_list.store_to_3mf_structure(plate_data_list, true, 0);
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) {
error_message = _L("Need select printer");
return false;
}
MachineObject *obj_ = dev->get_selected_machine();
if (obj_ == nullptr) {
error_message = _L("Need select printer");
return false;
}
for (auto plate_data : plate_data_list) {
plate_data->gcode_file = temp_gcode_path;
plate_data->is_sliced_valid = true;
plate_data->printer_model_id = obj_->printer_type;
FilamentInfo& filament_info = plate_data->slice_filaments_info.front();
filament_info.type = full_config.opt_string("filament_type", 0);
}

View File

@@ -0,0 +1,81 @@
#include "CpuMemory.hpp"
#include <boost/log/trivial.hpp>
namespace Slic3r {
#ifdef _WIN32
#include <windows.h>
unsigned long long get_free_memory_win()
{
MEMORYSTATUSEX status;
status.dwLength = sizeof(status);
GlobalMemoryStatusEx(&status);
return status.ullAvailPhys;
}
#endif
#ifdef __linux__
#include <unistd.h>
#include <sys/sysinfo.h>
#elif __APPLE__
#include <mach/mach_host.h>
#include <sys/sysctl.h>
#endif
#if defined(__linux__) || defined(__APPLE__)
unsigned long long get_free_memory_unix()
{
#ifdef __linux__
struct sysinfo info;
if (sysinfo(&info) == 0) {
return info.freeram * info.mem_unit;
}
#elif __APPLE__
int mib[2] = {CTL_HW, HW_MEMSIZE};
uint64_t memsize;
size_t len = sizeof(memsize);
if (sysctl(mib, 2, &memsize, &len, NULL, 0) == 0) {
vm_size_t page_size;
mach_port_t mach_port;
mach_msg_type_number_t count;
vm_statistics64_data_t vm_stats;
mach_port = mach_host_self();
count = sizeof(vm_stats) / sizeof(natural_t);
if (host_page_size(mach_port, &page_size) == KERN_SUCCESS && host_statistics64(mach_port, HOST_VM_INFO, (host_info64_t) &vm_stats, &count) == KERN_SUCCESS) {
return (vm_stats.free_count + vm_stats.inactive_count) * page_size;
}
}
#endif
return 0;
}
#endif
unsigned long long get_free_memory()
{
#ifdef _WIN32
return get_free_memory_win();
#elif defined(__linux__) || defined(__APPLE__)
return get_free_memory_unix();
#else
return 0;
#endif
}
bool CpuMemory::cur_free_memory_less_than_specify_size_gb(int size)
{
unsigned long long free_mem = get_free_memory();
auto cur_size = free_mem / (1024.0 * 1024.0 * 1024.0);
static bool first_debug_free_memory = true;
static bool first_meet_size_gb = true;
if (first_debug_free_memory) {
first_debug_free_memory = false;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " cur_size = " << cur_size << "GB";
}
if (cur_size < size) {
if (first_meet_size_gb) {
first_meet_size_gb = false;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " cur_size = " << cur_size << "GB" << "first_meet_size_gb ";
}
return true;
}
return false;
}
} // namespace Slic3r

View File

@@ -0,0 +1,12 @@
#ifndef slic3r_CpuMemory_hpp_
#define slic3r_CpuMemory_hpp_
namespace Slic3r {
#define LOD_FREE_MEMORY_SIZE 5
class CpuMemory
{
public:
static bool cur_free_memory_less_than_specify_size_gb(int size);
};
} // namespace Slic3r
#endif

View File

@@ -365,7 +365,7 @@ void Http::priv::set_put_body(const fs::path &path)
if (!ec) {
putFile = std::make_unique<fs::ifstream>(path, std::ios_base::binary |std::ios_base::in);
::curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
::curl_easy_setopt(curl, CURLOPT_READDATA, (void *) (putFile.get()));
::curl_easy_setopt(curl, CURLOPT_READDATA, (void *) &putFile);
::curl_easy_setopt(curl, CURLOPT_INFILESIZE, filesize);
}
}
@@ -432,9 +432,6 @@ void Http::priv::http_perform()
}
CURLcode res = ::curl_easy_perform(curl);
putFile.reset();
if (res != CURLE_OK) {
if (res == CURLE_ABORTED_BY_CALLBACK) {
if (cancel) {
@@ -488,7 +485,11 @@ Http::Http(Http &&other) : p(std::move(other.p)) {}
Http::~Http()
{
assert(! p || ! p->putFile);
if (p && p->putFile)
{
p->putFile.reset();
}
if (p && p->io_thread.joinable()) {
p->io_thread.detach();
}

View File

@@ -236,6 +236,8 @@ bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Erro
// % upload_parent_path.string()
// % (upload_data.post_action == PrintHostPostUploadAction::StartPrint ? "true" : "false");
BOOST_LOG_TRIVIAL(info) << boost::format("Uploading the file to device %1%, url: %2%") % name % url;
auto http = Http::post(std::move(url));
set_auth(http);
@@ -253,13 +255,13 @@ bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Erro
//y53
progress_percentage = 0;
BOOST_LOG_TRIVIAL(info) << boost::format("Uploading the file to device %1%, url: %2%") % name % url;
http.form_add_file("file", upload_data.source_path.string(), upload_filename.string())
.on_complete([&](std::string body, unsigned status) {
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: File uploaded: HTTP %2%: %3%") % name % status % body;
BOOST_LOG_TRIVIAL(info) << boost::format("%1%: File uploaded: HTTP %2%: %3%") % name % status % body;
})
.on_error([&](std::string body, std::string error, unsigned status) {
//y40 y53
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error uploading file: %2%, HTTP %3%, body: `%4%`") % name % error % status % body;
if (progress_percentage < 0.99) {
if (status == 404)
{
@@ -469,7 +471,6 @@ bool OctoPrint::send_command_to_printer(wxString& msg, wxString commond) const
{
// printer_state: http://192.168.20.66/printer/objects/query?print_stats
const char* name = get_name();
std::string gcode = "G28";
std::string commond_str = commond.ToStdString();
std::string json_body = "{\"script\": \"" + commond_str + "\"}";
@@ -484,7 +485,7 @@ bool OctoPrint::send_command_to_printer(wxString& msg, wxString commond) const
% name % error % status % body;
})
.on_complete([&](std::string body, unsigned status) {
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: G-code sent successfully: %2%") % name % gcode;
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: G-code sent successfully: %2%") % name % json_body;
successful = true;
})
#ifdef _WIN32

View File

@@ -46,4 +46,15 @@ namespace ProfileDescrption {
const std::string PROFILE_DESCRIPTION_38 = _L("This is a water-soluble support filament, and usually it is only for the support structure and not for the model body. Printing this filament is of many requirements, and to get better printing quality, please refer to this wiki: PVA Printing Guide.");
const std::string PROFILE_DESCRIPTION_39 = _L("This is a non-water-soluble support filament, and usually it is only for the support structure and not for the model body. To get better printing quality, please refer to this wiki: Printing Tips for Support Filament and Support Function.");
const std::string PROFILE_DESCRIPTION_40 = _L("The generic presets are conservatively tuned for compatibility with a wider range of filaments. For higher printing quality and speeds, please use QIDI filaments with QIDI presets.");
const std::string PROFILE_DESCRIPTION_41 = _L("High quality profile for 0.2mm nozzle, prioritizing print quality.");
const std::string PROFILE_DESCRIPTION_42 = _L("High quality profile for 0.16mm layer height, prioritizing print quality and strength.");
const std::string PROFILE_DESCRIPTION_43 = _L("Standard profile for 0.16mm layer height, prioritizing speed.");
const std::string PROFILE_DESCRIPTION_44 = _L("High quality profile for 0.2mm layer height, prioritizing strength and print quality.");
const std::string PROFILE_DESCRIPTION_45 = _L("Standard profile for 0.4mm nozzle, prioritizing speed.");
const std::string PROFILE_DESCRIPTION_46 = _L("High quality profile for 0.6mm nozzle, prioritizing print quality and strength.");
const std::string PROFILE_DESCRIPTION_47 = _L("Strength profile for 0.6mm nozzle, prioritizing strength.");
const std::string PROFILE_DESCRIPTION_48 = _L("Standard profile for 0.6mm nozzle, prioritizing speed.");
const std::string PROFILE_DESCRIPTION_49 = _L("High quality profile for 0.8mm nozzle, prioritizing print quality.");
const std::string PROFILE_DESCRIPTION_50 = _L("Strength profile for 0.8mm nozzle, prioritizing strength.");
const std::string PROFILE_DESCRIPTION_51 = _L("Standard profile for 0.8mm nozzle, prioritizing speed.");
}

View File

@@ -97,7 +97,7 @@ namespace QDT {
#define QIDI_NETWORK_LIBRARY "qidi_networking"
#define QIDI_NETWORK_AGENT_NAME "qidi_network_agent"
#define QIDI_NETWORK_AGENT_VERSION "02.00.02.50"
#define QIDI_NETWORK_AGENT_VERSION "02.01.01.52"
//iot preset type strings
#define IOT_PRINTER_TYPE_STRING "printer"