Fix: Modify the method of obtaining the first_layer_time.

Jira: None

Change-Id: I0ef83d8f47f9d7b235b88caaa8b895367729f3e9
(cherry picked from commit 1de8d5c0d3bb6742219963bd7297286a937e0ed5)
This commit is contained in:
weizhen.xie 2025-09-29 10:02:05 +08:00 committed by Noisyfox
parent 9f7ff97be6
commit c93d345d2a
4 changed files with 4 additions and 9 deletions

View file

@ -1987,7 +1987,6 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
if(is_BBL_Printer())
result->label_object_enabled = m_enable_exclude_object;
result->initial_layer_time = m_initial_layer_time;
// Write the profiler measurements to file
PROFILE_UPDATE();
PROFILE_OUTPUT(debug_out_path("gcode-export-profile.txt").c_str());
@ -3430,11 +3429,6 @@ void GCode::process_layers(
else
tbb::parallel_pipeline(12, generator & cooling & fan_mover & pa_processor_filter & output);
for (auto& layer_res : layers_results) {
if (layer_res.layer_id == 0)
m_initial_layer_time = layer_res.layer_time;
}
}
// Process all layers of a single object instance (sequential mode) with a parallel pipeline:

View file

@ -618,8 +618,6 @@ private:
std::vector<const PrintObject*> m_printed_objects;
float m_initial_layer_time;
// Processor
GCodeProcessor m_processor;

View file

@ -2524,11 +2524,13 @@ void GCodeProcessor::finalize(bool post_process)
auto it = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [](const std::pair<ExtrusionRole, float>& item) { return erCustom == item.first; });
auto prepare_time = (it != time_mode.roles_times.end()) ? it->second : 0.0f;
std::vector<float>& layer_times = m_result.print_statistics.modes[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)].layers_times;
m_result.initial_layer_time = layer_times.size() > 0 ? std::max(float(0.0), layer_times[0] - prepare_time) : 0;
//update times for results
for (size_t i = 0; i < m_result.moves.size(); i++) {
//field layer_duration contains the layer id for the move in which the layer_duration has to be set.
size_t layer_id = size_t(m_result.moves[i].layer_duration);
std::vector<float>& layer_times = m_result.print_statistics.modes[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)].layers_times;
if (layer_times.size() > layer_id - 1 && layer_id > 0)
m_result.moves[i].layer_duration = layer_id == 1 ? std::max(0.f,layer_times[layer_id - 1] - prepare_time) : layer_times[layer_id - 1];
else

View file

@ -301,6 +301,7 @@ class Print;
filament_printable_reuslt = other.filament_printable_reuslt;
layer_filaments = other.layer_filaments;
filament_change_count_map = other.filament_change_count_map;
initial_layer_time = other.initial_layer_time;
#if ENABLE_GCODE_VIEWER_STATISTICS
time = other.time;
#endif