Skip to content

Commit

Permalink
Optimize estimation mode
Browse files Browse the repository at this point in the history
Estimation mode has been split into `estimate` and `dump-moves`
commands. This allows both to run in constant memory, allowing
especially `estimate` to be used on low-resource targets like the
Raspberry Pi.

Also added a JSON output format to the `estimate` command.
  • Loading branch information
dalegaard committed Jan 14, 2022
1 parent af6e625 commit 8af5963
Show file tree
Hide file tree
Showing 6 changed files with 337 additions and 121 deletions.
22 changes: 22 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ the Klipper firmware. Currently it provides two modes:
* `estimate` mode outputs detailed statistics about a print job
* `post-process` mode can be used as a Slicer post-processing script, updating
the gcode output file with corrected time estimates.
* `dump-moves` mode dumps planning data for every move in a file

The estimation is done using an implementation of Klippers kinematics, but may
in some cases be slightly off due to rounding modes. If the timing is far
Expand Down Expand Up @@ -48,9 +49,7 @@ $ ./klipper_estimator --config_file config.json estimate ...
### `estimate` mode

Estimation mode is useful for determining statistics about a print, in order to
optimize print times. It gives a high level summary, and can optionally also
give a detailed output of every single move when using the `--dump_moves`
option.
optimize print times. It gives a high level summary.

Basic usage:
```
Expand Down Expand Up @@ -108,6 +107,11 @@ Options` under `Print Settings`:

![PrusaSlicer and SuperSlicer Post-processing scripts option](/doc/post_processing_psss.png)

### `dump-moves` mode

The `dump-moves` mode is used like `estimate` mode, but instead of providing a
summary, move planning data is dumped for every move.

## Building

`klipper_estimator` is written in Rust. Assuming a Rust toolchain is installed,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ impl OperationSequence {
}
_ => {
// Skip non-moves
if update_flush_count && delayed.is_empty() && self.flush_count == idx - 1 {
if update_flush_count && delayed.is_empty() && self.flush_count + 1 == idx {
self.flush_count = idx;
update_flush_count = false;
}
Expand Down
4 changes: 3 additions & 1 deletion tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { version = "3.0.0", features = ["derive"] }
clap = { version = "3", features = ["derive"] }
lib_klipper = { path = "../lib" }
reqwest = { version = "^0.11", default-features = false, features = ["blocking", "json", "rustls-tls"] }
serde = { version = "^1", features = ["derive"] }
Expand All @@ -17,6 +17,8 @@ deser-hjson = "^1"
once_cell = "1.8.0"
regex = "1"
lazy_static = "1"
ordered-float = { version = "2", features = ["serde"] }
term_size = "0.3"

[build-dependencies]
vergen = "^5"
Expand Down
Loading

0 comments on commit 8af5963

Please sign in to comment.