fix gcode time estimiation error (#14573)

fix gcode estimiation error
This commit is contained in:
SoftFever
2026-07-04 15:29:19 +08:00
committed by GitHub
parent b3a0c8bd40
commit dd99549d20
4 changed files with 452 additions and 14 deletions

View File

@@ -560,9 +560,24 @@ class Print;
//BBS: prepare stage time before print model, including start gcode time and mostly same with start gcode time
float prepare_time;
// Orca: extra time (e.g. a filament-change delay) that can't be attributed to a
// matching block on this pass is buffered here and retried on a later pass, so it
// is never folded into an unrelated move. On the final pass no later pass remains,
// so any still-unmatched remainder is added to the machine total (never to a move
// vertex) instead of being dropped, keeping get_time() consistent with the
// filament-change statistics. Orca-only EOF hardening; BambuStudio drops it.
using AdditionalBufferBlock = std::pair<EMoveType, float>;
using AdditionalBuffer = std::vector<AdditionalBufferBlock>;
AdditionalBuffer m_additional_time_buffer;
void reset();
void calculate_time(GCodeProcessorResult& result, PrintEstimatedStatistics::ETimeMode mode, size_t keep_last_n_blocks = 0, float additional_time = 0.0f);
// Merge adjacent buffer entries that target the same move type.
static AdditionalBuffer merge_adjacent_additional_time_blocks(const AdditionalBuffer& buffer);
// additional_time is attributed to the first block matching target_move_type
// (EMoveType::Noop matches any block, i.e. the first processed block).
void calculate_time(GCodeProcessorResult& result, PrintEstimatedStatistics::ETimeMode mode, size_t keep_last_n_blocks = 0, float additional_time = 0.0f, EMoveType target_move_type = EMoveType::Noop, bool is_final = false);
};
struct UsedFilaments // filaments per ColorChange
@@ -1115,10 +1130,10 @@ class Print;
void process_custom_gcode_time(CustomGCode::Type code);
void process_filaments(CustomGCode::Type code);
void calculate_time(GCodeProcessorResult& result, size_t keep_last_n_blocks = 0, float additional_time = 0.0f);
void calculate_time(GCodeProcessorResult& result, size_t keep_last_n_blocks = 0, float additional_time = 0.0f, EMoveType target_move_type = EMoveType::Noop, bool is_final = false);
// Simulates firmware st_synchronize() call
void simulate_st_synchronize(float additional_time = 0.0f);
void simulate_st_synchronize(float additional_time = 0.0f, EMoveType target_move_type = EMoveType::Noop);
void update_estimated_times_stats();