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

Support chaining multiple UI control creation in LRemote #108

Open
pablosun opened this issue Oct 9, 2018 · 1 comment
Open

Support chaining multiple UI control creation in LRemote #108

pablosun opened this issue Oct 9, 2018 · 1 comment
Assignees

Comments

@pablosun
Copy link
Contributor

pablosun commented Oct 9, 2018

It would be more convenient if we can pass LRemote UI controls in to an {} constructor or array initializers to chain creations together.

@pablosun pablosun self-assigned this Oct 9, 2018
@pablosun pablosun added this to the BLE and LRemote Enhancement milestone Oct 9, 2018
@SmallpTsai
Copy link

Possible implementation

void LRemote_addControls(std::vector<LRemoteUIControl *> lists) {
  for (auto control : lists) {
    LRemote.addControl(*control);
  }
}

Sample usage

  LRemote_addControls({
    &buttonForward, &buttonBackward,
    &buttonTL, &buttonTR,
    &buttonSL, &buttonSR,
    &buttonRun, &buttonClimb,
    &buttonRotateX, &buttonRotateY, &buttonRotateZ,
    &buttonTwist,
  });

detail usage can be found at:
https://github.com/SmallpTsai/hexapod-v2-7697/blob/master/software/hexapod7697/src/normal_mode.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants