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

Add Bankable::CCAbsoluteEncoder ability Fixed #227

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

djoulz22
Copy link

Add Bankable::CCAbsoluteEncoder ability Fixed

@tttapa
Copy link
Owner

tttapa commented Jun 28, 2020

Hi, thanks for your pull request.

I'm not entirely convinced that this is the best approach, though: I believe each bank should have its own position. That's how I've implemented it on the share-encoder branch (here), so I'll probably merge that version rather than this one.

Pieter

@djoulz22
Copy link
Author

djoulz22 commented Jun 29, 2020

Hi Peter,

My code is simply copy/paste (and adapte) and must be rethink. My goal is creating a controller like that : MIDI Fighter Twister.

For example :

2 Banks,
1 SwitchSelector per Encoder (so an array of switch selecor)
Each encoder have 2 CC address, First in Bank1, second when it's own button is pushed and maintained.

Bank<2> bank = {1};

SwitchSelector selectors[] = {
  {
    bank,        // bank to manage
    11        // Digital Button pin
  },
  {
    bank,        // bank to manage
    8        // Digital Button pin
  },
  {
    bank,        // bank to manage
    5        // Digital Button pin
  },
  {
    bank,        // bank to manage
    2        // Digital Button pin
  },
};

Bankable::CCAbsoluteEncoder enc[] = {
  {
    {bank, BankType::CHANGE_ADDRESS}, // Bank configuration
    {12, 13},                       // Digital pin for encoder
    {0x10, CHANNEL_1},                // Base CC address
  },
  {
    {bank, BankType::CHANGE_ADDRESS}, // Bank configuration
    {9, 10},                       // Digital pin for encoder
    {0x12, CHANNEL_1},                // Base CC address
  },
  {
    {bank, BankType::CHANGE_ADDRESS}, // Bank configuration
    {6, 7},                       // Digital pin for encoder
    {0x14, CHANNEL_1},                // Base CC address
  },
  {
    {bank, BankType::CHANGE_ADDRESS}, // Bank configuration
    {3, 4},                       // Digital pin for encoder
    {0x16, CHANNEL_1},                // Base CC address
  },
};

Thanks for your great work !
U are the boss ;-)

PS:Sorry for my ugly English, I'm just a French ;-)

@tttapa
Copy link
Owner

tttapa commented Jun 29, 2020

I'm a bit confused by your code: All four selectors change the same bank, and all encoders use the same bank, so if you press any of the buttons, all of the encoders will change to their second address.

If I understand correctly, this would solve that:

Bank<2> banks[4] = {1, 1, 1, 1};

SwitchSelector selectors[] = {
  {
    banks[0],        // bank to manage
    11        // Digital Button pin
  },
  {
    banks[1],        // bank to manage
    8        // Digital Button pin
  },
  {
    banks[2],        // bank to manage
    5        // Digital Button pin
  },
  {
    banks[3],        // bank to manage
    2        // Digital Button pin
  },
};

Bankable::CCAbsoluteEncoder enc[] = {
  {
    {banks[0], BankType::CHANGE_ADDRESS}, // Bank configuration
    {12, 13},                       // Digital pin for encoder
    {0x10, CHANNEL_1},                // Base CC address
  },
  {
    {banks[1], BankType::CHANGE_ADDRESS}, // Bank configuration
    {9, 10},                       // Digital pin for encoder
    {0x12, CHANNEL_1},                // Base CC address
  },
  {
    {banks[2], BankType::CHANGE_ADDRESS}, // Bank configuration
    {6, 7},                       // Digital pin for encoder
    {0x14, CHANNEL_1},                // Base CC address
  },
  {
    {banks[3], BankType::CHANGE_ADDRESS}, // Bank configuration
    {3, 4},                       // Digital pin for encoder
    {0x16, CHANNEL_1},                // Base CC address
  },
};

By the way, to format blocks of code, you need triple back ticks, single back ticks are for inline code:

```cpp
// Code block
```

The cpp after the opening three back ticks specifies the programming language (C++), so you get the correct syntax highlighter.

@djoulz22
Copy link
Author

djoulz22 commented Jun 29, 2020 via email

@djoulz22
Copy link
Author

Is it possible to use CD74HC4067 with encoder?

I test it with simple button and it work but not with encoder...

Thanks in advance

@tttapa
Copy link
Owner

tttapa commented Jul 1, 2020

Is it possible to use CD74HC4067 with encoder?

No, that's not possible, see #191.

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.

None yet

3 participants