From 63ac06753b248a516896c07937b315e3dab503a5 Mon Sep 17 00:00:00 2001 From: Lasse Dalegaard Date: Thu, 29 Jun 2023 00:26:14 +0200 Subject: [PATCH] Add average+top speeds in estimate output --- tool/src/cmd/estimate.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tool/src/cmd/estimate.rs b/tool/src/cmd/estimate.rs index 5f62741..17d206d 100644 --- a/tool/src/cmd/estimate.rs +++ b/tool/src/cmd/estimate.rs @@ -63,6 +63,7 @@ struct EstimationSequence { total_distance: f64, total_extrude_distance: f64, max_flow: Option, + max_speed: Option, num_moves: usize, total_z_time: f64, total_output_time: f64, @@ -150,6 +151,7 @@ impl EstimationState { seq.total_distance += m.distance; seq.total_extrude_distance += m.end.w - m.start.w; seq.num_moves += 1; + seq.max_speed = Some(seq.max_speed.unwrap_or(0.0).max(m.cruise_v)); match (m.is_extrude_move(), m.is_kinematic_move()) { (true, true) => { @@ -250,6 +252,18 @@ impl EstimateCmd { format_time(seq.total_travel_time), seq.total_travel_time ); + println!( + " Average speed: {:.3} mm/s", + seq.total_distance / seq.total_time + ); + println!( + " Top speed: {}", + if let Some(max_speed) = seq.max_speed { + format!("{:.3} mm/s", max_speed) + } else { + "-".to_string() + } + ); println!( " Average flow: {:.3} mm³/s", seq.total_extrude_distance * cross_section / seq.total_time