Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bar with customized width #2201

Closed

Conversation

njuFerret
Copy link

When using a bar graph as an indicator, such as for PWM's duty ratio, it can be challenging to draw the graph at a specific position and width. Modifications has been made in the source code to implement such a scenario.

@njuFerret
Copy link
Author

Forgot to add a macro to keep compatibility
#define MUIF_U8G2_U8_MIN_MAX_STEP(id, valptr, min, max, step, flags, muif) MUIF_U8G2_U8_MIN_MAX_STEP_WIDTH(id, valptr, min, max, step, max, flags, muif)

@njuFerret
Copy link
Author

the macro patch, as well as value with boundary in mui_u8g2_u8_bar_wm_mse_pf function.
bar_macro_fix.patch

@olikraus
Copy link
Owner

So the "width" argument is the total width of the bar graph.
I also think that the scale argument is kind of obsolete, because we could just multiply width with 2 or 4 instead.
All in all I more think about creating a second bar graph instead of updating the existing one.

@olikraus
Copy link
Owner

One more doubt: You have disabled the wrap around to the min value. This would be fine for the "mud" edit mode, but would be an issue with the "mse" edit mode. Instead we should have an option here instead of hard coding this. I think your PR addresses multiple problems, which should be fixed independently.

@njuFerret
Copy link
Author

njuFerret commented Jun 11, 2023

One more doubt: You have disabled the wrap around to the min value. This would be fine for the "mud" edit mode, but would be an issue with the "mse" edit mode. Instead we should have an option here instead of hard coding this. I think your PR addresses multiple problems, which should be fixed independently.

a rotary encoder was employed for user input, where mse mode isn't the candidate. therefore, the modification was not been tested. I think it's a good idea provide user some options to do that.

So the "width" argument is the total width of the bar graph. I also think that the scale argument is kind of obsolete, because we could just multiply width with 2 or 4 instead. All in all I more think about creating a second bar graph instead of updating the existing one.

ye, "max" used as total width of bar graph, was replaced by "width" argument. The "scale" arg maybe useful for large display, due to "width" defined as "uint8_t".

@olikraus
Copy link
Owner

I have recreated a new field function instead: https://github.com/olikraus/u8g2/wiki/muiref#fixed-width-bar-graph-uint8

So closing this PR without merge.

@olikraus olikraus closed this Jun 11, 2023
@njuFerret
Copy link
Author

I have recreated a new field function instead: https://github.com/olikraus/u8g2/wiki/muiref#fixed-width-bar-graph-uint8

So closing this PR without merge.

awesome!

@njuFerret njuFerret deleted the bar_with_customized_width branch June 15, 2023 01:30
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.

2 participants