Time Layer Cooling With Acceleration, as the Preview Does (#17540)

This commit is contained in:
Ian Bassi authored and GitHub committed 2026-11-15 10:47:57 -03:00
1 parent 3bfabc9831
commit 8a1cef365e
6 files changed
+438 -21

No files matched your search

+12 -3
View File
@@ -57,6 +57,7 @@
#include <math.h>
#include <map>
#include <limits>
#include <mutex>
#include <fstream>
#include <regex>
#include <set>
@@ -2770,6 +2771,14 @@ const std::vector<std::pair<GCodeProcessor::EProducer, std::string>> GCodeProces
unsigned int GCodeProcessor::s_result_id = 0;
// Results can be reset on several threads at once, as the layer cooling resets its own processor during an export.
static unsigned int next_result_id(unsigned int &last_id)
{
static std::mutex mutex;
std::lock_guard<std::mutex> lock(mutex);
return ++ last_id;
}
bool GCodeProcessor::contains_reserved_tag(const std::string& gcode, std::string& found_tag)
{
bool ret = false;
@@ -3826,7 +3835,7 @@ void GCodeProcessor::reset()
m_used_filaments.reset();
m_result.reset();
m_result.id = ++s_result_id;
m_result.id = next_result_id(s_result_id);
m_last_default_color_id = 0;
@@ -3925,7 +3934,7 @@ void GCodeProcessor::process_file(const std::string& filename, std::function<voi
// process gcode
m_result.filename = filename;
m_result.id = ++s_result_id;
m_result.id = next_result_id(s_result_id);
initialize_result_moves();
size_t parse_line_callback_cntr = 10000;
m_parser.parse_file(filename, [this, cancel_callback, &parse_line_callback_cntr](GCodeReader& reader, const GCodeReader::GCodeLine& line) {
@@ -3948,7 +3957,7 @@ void GCodeProcessor::initialize(const std::string& filename)
// process gcode
m_result.filename = filename;
m_result.id = ++s_result_id;
m_result.id = next_result_id(s_result_id);
}
void GCodeProcessor::process_buffer(const std::string &buffer)