Skip to content

Commit a93b16d

Browse files
committed
Update example
1 parent 453eef3 commit a93b16d

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,23 @@ A set of tools to plot values from the target to graph in rerun with minimal per
1010
#![no_main]
1111

1212
use cortex_m_rt::entry;
13+
14+
use defmt_rtt as _;
15+
use panic_halt as _;
1316
use probe_plotter::{make_metric, make_setting};
1417

1518
#[entry]
1619
fn main() -> ! {
20+
defmt::println!("Running...");
1721
let mut sawtooth = make_metric!(SAWTOOTH: i32 = 42, "(SAWTOOTH / 10) % 100").unwrap();
22+
defmt::println!("sawtooth initialized to: {}", sawtooth.get());
1823
let mut sine = make_metric!(SINE: i32 = 42, "100 * sin(2 * pi * SINE / 4000)").unwrap();
1924

2025
let mut setting_roundtrip =
2126
make_metric!(SETTING_ROUNDTRIP: i8 = 0, "SETTING_ROUNDTRIP").unwrap();
2227

2328
// Allow values -1..=7, step by 2, so {-1, 1, 3, 5, 7}
24-
let mut setting = make_setting!(SETTING: i8 = 42, -1..=7, 2).unwrap();
29+
let mut setting = make_setting!(SETTING: i8 = 5, -1..=7, 2).unwrap();
2530

2631
loop {
2732
for i in 0..i32::MAX {
@@ -32,7 +37,6 @@ fn main() -> ! {
3237
}
3338
}
3439
}
35-
3640
```
3741

3842
The formulas seen in the `make_metric` macro invocation are computed by the host and will thus have zero impact on the targets performance. The `set` method on the metrics object is simply a volatile store which is quite cheap. The host will then read that value using the debug probe at regular intervals and update the graph on any changes.
@@ -54,8 +58,8 @@ cd examples/simple
5458
cargo run # Let it flash and then cancel (Ctrl+C) to let the target continue running in the background while giving up access to the probe
5559
5660
cd ../probe-plotter-tools
57-
cargo run ../examples/simple/target/thumbv7em-none-eabihf/debug/simple stm32g474retx
58-
# Rerun will open with a graph showing all created metrics objects
61+
cargo run --bin custom-viewer ../examples/simple/target/thumbv7em-none-eabihf/debug/simple stm32g474retx
62+
# Rerun will open with a graph showing all created metrics objects and a panel with settings at the right hand side
5963
```
6064

61-
<img width="2050" height="1166" alt="image" src="https://github.com/user-attachments/assets/dcdced90-9130-449f-ae0e-22a92a3dd409" />
65+
<img width="2880" height="1920" alt="image" src="https://github.com/user-attachments/assets/8cf4055f-e85b-4c43-8184-7bee24955829" />

examples/simple/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ use probe_plotter::{make_metric, make_setting};
1111
fn main() -> ! {
1212
defmt::println!("Running...");
1313
let mut sawtooth = make_metric!(SAWTOOTH: i32 = 42, "(SAWTOOTH / 10) % 100").unwrap();
14-
defmt::println!("foo initialized to: {}", sawtooth.get());
14+
defmt::println!("sawtooth initialized to: {}", sawtooth.get());
1515
let mut sine = make_metric!(SINE: i32 = 42, "100 * sin(2 * pi * SINE / 4000)").unwrap();
1616

1717
let mut setting_roundtrip =
1818
make_metric!(SETTING_ROUNDTRIP: i8 = 0, "SETTING_ROUNDTRIP").unwrap();
1919

2020
// Allow values -1..=7, step by 2, so {-1, 1, 3, 5, 7}
21-
let mut setting = make_setting!(SETTING: i8 = 42, -1..=7, 2).unwrap();
21+
let mut setting = make_setting!(SETTING: i8 = 5, -1..=7, 2).unwrap();
2222

2323
loop {
2424
for i in 0..i32::MAX {

0 commit comments

Comments
 (0)