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

[ui] button_group: public state-bitfields and some refactor #864

Merged
merged 2 commits into from
May 21, 2022

Conversation

TomSaw
Copy link
Contributor

@TomSaw TomSaw commented May 18, 2022

Key intent here is to declare the state bitfields (pressed, released, repeated) public, so i can pass them around for remote interpretation.

By the chance, i gave some service: It's more compact and should be easier to read.
Interface is 100% like before except the state-getters returning bool, not T now - Guess that was a mistake.

Further Ideas but with API change:

  • Type N-Buttons as template argument template<std::size_t N> improves generics: you can easily take the N from your enum ButtonIdentifier.
enum ButtonIdentifier {
  BUTTON1,
  BUTTON2,
  N
};
  • move Button-data State pressed, State released and State repeated into external struct like it's for modernized modm:driver:**. So it's even easier to pass the states around and follows the convention.

@TomSaw TomSaw force-pushed the fix/refactor-button-group branch 2 times, most recently from b7f226c to f6bc7f5 Compare May 18, 2022 09:56
@TomSaw TomSaw changed the title [ui] button_group: public state-bitfields and litttle refactorisation [ui] button_group: public state-bitfields and litttle refactorisatio May 18, 2022
@TomSaw TomSaw changed the title [ui] button_group: public state-bitfields and litttle refactorisatio [ui] button_group: public state-bitfields and some refactor May 18, 2022
@TomSaw TomSaw force-pushed the fix/refactor-button-group branch 2 times, most recently from 6549d04 to 5946a62 Compare May 18, 2022 10:03
Copy link
Member

@salkinium salkinium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine!

src/modm/ui/button_group.hpp Outdated Show resolved Hide resolved
@salkinium salkinium added this to the 2022q2 milestone May 18, 2022
@TomSaw TomSaw force-pushed the fix/refactor-button-group branch from 5946a62 to 095217b Compare May 19, 2022 07:35
@TomSaw
Copy link
Contributor Author

TomSaw commented May 19, 2022

Done. Have moved the whole docs into button.md

@TomSaw TomSaw force-pushed the fix/refactor-button-group branch 3 times, most recently from 7e2b6e5 to 9c379fc Compare May 19, 2022 07:54
src/modm/ui/button.md Outdated Show resolved Hide resolved
src/modm/ui/button.md Outdated Show resolved Hide resolved
@salkinium
Copy link
Member

Also something with the update() method broke the unit tests…

@TomSaw TomSaw force-pushed the fix/refactor-button-group branch 2 times, most recently from c77fdd1 to 7dbceb2 Compare May 19, 2022 09:30
@TomSaw
Copy link
Contributor Author

TomSaw commented May 19, 2022

I've moved internal members completely into private scope. Only the ButtonGroup::State types kept being public.

test/config/hosted.xml Outdated Show resolved Hide resolved
@TomSaw TomSaw force-pushed the fix/refactor-button-group branch from 7dbceb2 to 55d5911 Compare May 20, 2022 12:22
Copy link
Member

@salkinium salkinium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@salkinium salkinium merged commit 55d5911 into modm-io:develop May 21, 2022
@TomSaw TomSaw deleted the fix/refactor-button-group branch May 21, 2022 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants