Skip to content

Commit

Permalink
Upgrade to defmt-decoder v0.4.0 (#2809)
Browse files Browse the repository at this point in the history
Co-authored-by: Jonathan Pallant <jonathan.pallant@ferrous-systems.com>
  • Loading branch information
Urhengulas and jonathanpallant authored Nov 28, 2024
1 parent 0d8b011 commit 849498d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 16 deletions.
29 changes: 24 additions & 5 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions changelog/changed-defmt-decoder-v0.4.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Upgrade `defmt-decoder` to `v0.4.0`
4 changes: 1 addition & 3 deletions probe-rs-tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ capstone = "0.12"
cargo_metadata = "0.19"
clap = { version = "4", features = ["derive", "env"] }
colored = "2"
defmt-decoder = { version = "=0.3.11", features = [
"unstable",
] } # pinned because "unstable" has potential for breaking changes
defmt-decoder = "0.4"
directories = "5"
dunce = "1"
figment = { version = "0.10", features = ["toml", "json", "yaml", "env"] }
Expand Down
4 changes: 3 additions & 1 deletion probe-rs-tools/src/bin/probe-rs/cmd/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ pub struct SharedOptions {
#[clap(flatten)]
pub(crate) format_options: FormatOptions,

/// The default format string to use for decoding defmt logs.
/// The format string to use when printing defmt encoded log messages from the target.
///
/// See https://defmt.ferrous-systems.com/custom-log-output
#[clap(long)]
pub(crate) log_format: Option<String>,

Expand Down
17 changes: 10 additions & 7 deletions probe-rs-tools/src/bin/probe-rs/util/rtt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,17 @@ impl RttActiveUpChannel {
};

// Format options:
// 1. Custom format for the channel
// 2. Default with optional timestamp and location
let format = if let Some(format) = channel_config.log_format.as_deref() {
FormatterFormat::Custom(format)
} else {
FormatterFormat::Default {
// 1. Oneline format with optional location
// 2. Custom format for the channel
// 3. Default with optional location
let format = match channel_config.log_format.as_deref() {
Some("oneline") => FormatterFormat::OneLine {
with_location: channel_config.show_location,
}
},
Some(format) => FormatterFormat::Custom(format),
None => FormatterFormat::Default {
with_location: channel_config.show_location,
},
};

ChannelDataFormat::Defmt {
Expand Down

0 comments on commit 849498d

Please sign in to comment.