Skip to content

Conversation

@usbalbin
Copy link
Owner

@usbalbin usbalbin commented Aug 1, 2025

Solves #8

Adds settings. Just like Metrics, Settings are detected by probe-plotter-tools, however instead of being plotted the program adds sliders(see top right corner). When the sliders are changed, the value is sent to the MCU

fn init(...) {
    // make_setting!(VAR_NAME: Type = default, min_value..=max_value, step_size)
    let mut duty = make_setting!(DUTY: u16 = 10, 10..=90, 10).unwrap();

    // duty is constrained to 10..=90% and is set in increments of 10

    let pwm = setup_some_pwm_thing();
}

fn update(...) {
    pwm.set_duty(duty.get()); // Get the latest value as set by probe-plotter-tools
}

Other example from README.md:

image

Note This PR changes the expression syntax for the make_metric macro. Do not use x to refer to the value, instead use the assigned name like so:

let mut sawtooth = make_metric!(SAWTOOTH: i32 = 42, "(SAWTOOTH / 10) % 100").unwrap();

@usbalbin usbalbin force-pushed the settings branch 2 times, most recently from 2f8967f to 0502884 Compare August 1, 2025 19:28
@usbalbin usbalbin marked this pull request as ready for review August 1, 2025 22:44
@usbalbin
Copy link
Owner Author

usbalbin commented Aug 1, 2025

@AdinAck Any thoughts on the settings feature?

@AdinAck
Copy link

AdinAck commented Aug 2, 2025

@AdinAck Any thoughts on the settings feature?

Oh nice, I didn't even know rerun had that!

@usbalbin
Copy link
Owner Author

usbalbin commented Aug 2, 2025

@AdinAck Any thoughts on the settings feature?

Oh nice, I didn't even know rerun had that!

It does not. But since rerun is built using egui it was quite simple to just add a panel for the settings

@usbalbin usbalbin merged commit 7cfbf7f into main Aug 2, 2025
4 checks passed
@usbalbin usbalbin deleted the settings branch August 2, 2025 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants