Jump to content

RGB colour matrix (8x8)


Duggle

Recommended Posts

To make it work, I (mistakenly) put led_emu_id_offset=1 if the value is 1001, as you suggested, there are no LEDs (at least I only have the first 2 LEDs of the matrix actually wired up.) 

Also no LEDs if the led_emu_id_offset is omitted.

 

I am not using buttons with these LEDs, they are purely indicators that listen to bank change.

 

I've tried setting some to Toggle or OnOnly and the result appears the same.

 

The display functions correctly until a midi key matching an EVENT_BUTTON is received and from that point onwards the particular LED only comes on when that key is down.

 

RESET_HW


DOUT_MATRIX n=1  rows=8  inverted=1  sr_dout_sel1=1  sr_dout_r1=2  sr_dout_g1=3 sr_dout_b1=4 led_emu_id_offset=1


EVENT_RECEIVER id=1 type=CC cc=16 fwd_id=SENDER:1
EVENT_SENDER   id=1 type=Meta meta=SetBank 


# Bank1
EVENT_BUTTON  id=1001  hw_id=1001  fwd_id=LED:1  bank=1  type=NoteOn key=36 chn=1  button_mode=Toggle rgb=15:0:0 value=100
EVENT_BUTTON  id=1002  hw_id=1002  fwd_id=LED:2  bank=1  type=NoteOn key=37 chn=1  button_mode=OnOnly  rgb=15:0:0 value=100

# Bank2
EVENT_BUTTON  id=1101  hw_id=1001  fwd_id=LED:1  bank=2  type=NoteOn key=36 chn=1  button_mode=OnOnly  rgb=0:15:0 value=100
EVENT_BUTTON  id=1102  hw_id=1002  fwd_id=LED:2  bank=2  type=NoteOn key=37 chn=1  button_mode=OnOnly  rgb=0:15:0 value=100

# Bank3
EVENT_BUTTON  id=1201  hw_id=1001  fwd_id=LED:1  bank=3  type=NoteOn key=36 chn=1  button_mode=OnOnly  rgb=15:15:15 value=100
EVENT_BUTTON  id=1202  hw_id=1002  fwd_id=LED:2  bank=3  type=NoteOn key=37 chn=1  button_mode=OnOnly  rgb=15:15:15 value=100


# Bank4
EVENT_BUTTON  id=1301  hw_id=1001  fwd_id=LED:1  bank=4  type=NoteOn key=36 chn=1  button_mode=OnOnly  rgb=15:4:0 value=100
EVENT_BUTTON  id=1302  hw_id=1002  fwd_id=LED:2  bank=4  type=NoteOn key=37 chn=1  button_mode=OnOnly  rgb=15:4:0 value=100

# Bank5
EVENT_BUTTON  id=1401  hw_id=1001  fwd_id=LED:1  bank=5  type=NoteOn key=36 chn=1  button_mode=OnOnly  rgb=15:4:0 value=100
EVENT_BUTTON  id=1402  hw_id=1002  fwd_id=LED:2  bank=5  type=NoteOn key=37 chn=1  button_mode=OnOnly  rgb=0:4:15 value=100

 

 

Link to comment
Share on other sites

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

Why are you taking EVENT_BUTTON and why are you taking button_mode=Toggle when only the LED function itself is desired?

 

See also the first example which demonstrates the usage with EVENT_LED: http://svnmios.midibox.org/filedetails.php?repname=svn.mios32&path=/trunk/apps/controllers/midibox_ng_v1/cfg/tests/rgb_1.ngc

 

Do you need an example with EVENT_LED and banks, or is the usage clear now?

 

Btw.: sometimes it helps to activate "set debug on" to understand the dataflow

 

Best Regards, Thorsten.

Link to comment
Share on other sites

It's working how I need now!

I'm a little concerned with pool memory, the file below allocates 6% ( there will be 64 LEDs not 8)

I'll be able to get away with 4 or fewer banks in the near term.

RESET_HW


DOUT_MATRIX n=1  rows=8  inverted=1  sr_dout_sel1=1  sr_dout_r1=2  sr_dout_g1=3 sr_dout_b1=4 led_emu_id_offset=1


EVENT_RECEIVER id=1 type=CC cc=16 fwd_id=SENDER:1
EVENT_SENDER   id=1 type=Meta meta=SetBank 


# Bank1
EVENT_LED       id=1001  fwd_id=LED:1  bank=1   rgb=15:0:0 value=100
EVENT_LED       id=1002  fwd_id=LED:2  bank=1   rgb=15:0:0 value=100
EVENT_LED       id=1003  fwd_id=LED:3  bank=1   rgb=15:0:0 value=100
EVENT_LED       id=1004  fwd_id=LED:4  bank=1   rgb=15:0:0 value=100
EVENT_LED       id=1005  fwd_id=LED:5  bank=1   rgb=15:0:0 value=100
EVENT_LED       id=1006  fwd_id=LED:6  bank=1   rgb=15:0:0 value=100
EVENT_LED       id=1007  fwd_id=LED:7  bank=1   rgb=15:0:0 value=100
EVENT_LED       id=1008  fwd_id=LED:8  bank=1   rgb=15:0:0 value=100

# Bank2
EVENT_LED       id=1101  fwd_id=LED:1  bank=2   rgb=0:15:0 value=100
EVENT_LED       id=1102  fwd_id=LED:2  bank=2   rgb=0:15:0 value=100
EVENT_LED       id=1103  fwd_id=LED:3  bank=2   rgb=0:15:0 value=100
EVENT_LED       id=1104  fwd_id=LED:4  bank=2   rgb=0:15:0 value=100
EVENT_LED       id=1105  fwd_id=LED:5  bank=2   rgb=0:15:0 value=100
EVENT_LED       id=1106  fwd_id=LED:6  bank=2   rgb=0:15:0 value=100
EVENT_LED       id=1107  fwd_id=LED:7  bank=2   rgb=0:15:0 value=100
EVENT_LED       id=1108  fwd_id=LED:8  bank=2   rgb=0:15:0 value=100

# Bank3
EVENT_LED       id=1201  fwd_id=LED:1  bank=3   rgb=15:15:15 value=100
EVENT_LED       id=1202  fwd_id=LED:2  bank=3   rgb=15:15:15 value=100
EVENT_LED       id=1203  fwd_id=LED:3  bank=3   rgb=15:15:15 value=100
EVENT_LED       id=1204  fwd_id=LED:4  bank=3   rgb=15:15:15 value=100
EVENT_LED       id=1205  fwd_id=LED:5  bank=3   rgb=15:15:15 value=100
EVENT_LED       id=1206  fwd_id=LED:6  bank=3   rgb=15:15:15 value=100
EVENT_LED       id=1207  fwd_id=LED:7  bank=3   rgb=15:15:15 value=100
EVENT_LED       id=1208  fwd_id=LED:8  bank=3   rgb=15:15:15 value=100

# Bank4
EVENT_LED       id=1301  fwd_id=LED:1  bank=4   rgb=15:4:0 value=100
EVENT_LED       id=1302  fwd_id=LED:2  bank=4   rgb=15:4:0 value=100
EVENT_LED       id=1303  fwd_id=LED:3  bank=4   rgb=15:4:0 value=100
EVENT_LED       id=1304  fwd_id=LED:4  bank=4   rgb=15:4:0 value=100
EVENT_LED       id=1305  fwd_id=LED:5  bank=4   rgb=15:4:0 value=100
EVENT_LED       id=1306  fwd_id=LED:6  bank=4   rgb=15:4:0 value=100
EVENT_LED       id=1307  fwd_id=LED:7  bank=4   rgb=15:4:0 value=100
EVENT_LED       id=1308  fwd_id=LED:8  bank=4   rgb=15:4:0 value=100 

 

 

 

Link to comment
Share on other sites

Based on the fact that 4 banks of 64 EVENT_ENC consumes 69% of Event Pool Allocation

There may only be memory capacity for 3 banks including RGB LED array.

3 banks is good, more is probably better!  :happy:

 

[edit]

I've just tested 3 banks of  64*EVENT_ENC+64*EVENT_LED allocates 86%

There is also up to 32 other general buttons and 32 LEDs that need allocation.

 

Would it be easy to implement a Pagefile in SD Card to store inactive banks?

Edited by Duggle
Link to comment
Share on other sites

No, a page file can't be used, most informations have to be directly available in RAM (e.g. so that banked items can receive MIDI values regardless if they are selected or not).

 

But I'm planning to compress the stored events (values which haven't been changed don't need to be stored).

This will reduce the memory consumption by more than 50%

 

Btw.: you are currently using two different ids (1001 upwards and 1 upwards) for LEDs - this isn't required.

Just start led_emu_id_offset with 1001

 

Best Regards, Thorsten.

Link to comment
Share on other sites

The "compression" is now part of V1.020 - up to 16 bytes can be saved per item.

 

In your .NGC file you can save even more bytes by moving the encoder labels to the .NGL file!

You could address them with "^e1" ... "^e64" - this will dramatically reduce the memory consumption. :smile:

 

Best Regards, Thorsten.

Link to comment
Share on other sites

  • 3 weeks later...
 

Btw.: you are currently using two different ids (1001 upwards and 1 upwards) for LEDs - this isn't required.

Just start led_emu_id_offset with 1001

 

I must confess, I don't understand yet.

I have built the full 8x8 RGB matrix. (actually only the first 4 rows of 8 LEDs are loaded - supply delay...)

The only way I can get it to work right is with

 

DOUT_MATRIX n=1  rows=8  inverted=1  sr_dout_sel1=1  sr_dout_r1=2  sr_dout_g1=3 sr_dout_b1=4 led_emu_id_offset=1 
EVENT_LED id=1001 fwd_id=LED:1 bank=1 rgb=15:0:0 value=100
EVENT_LED id=1002 fwd_id=LED:2 bank=1 rgb=15:3:0 value=100
EVENT_LED id=1003 fwd_id=LED:3 bank=1 rgb=15:7:0 value=100
#etc counting upwards until
EVENT_LED id=1032 fwd_id=LED:32 bank=1 rgb=15:7:0 value=100

It doesn't seem to matter if they all have id=1001

Now, If I have led_emu_id_offset=1001 (and the id=nnn with nnn counting up from 1001)

I am not uniquely addressing rows, values are folded over such that all 4 rows show the same pattern of colours. 

 

Bearing in mind, the aim is that these LEDs don't respond to MIDI events as such, they simply each change to a unique state based on the currently selected bank...

 

I'd like to ask about the 32 standard LEDs that are wired to a DOUTx4 module that comes after RGB DOUTx4 module in the SRIO chain. 

I've tried to address them with EVENT_BUTTON fwd_id=LED:65 (counting up) seemingly without luck. Am I on the right track?

 

The next devices on the SRIO chain are 4 x Fairlightiii 2x8 encoder pcb's. I think the configuration of these will be straight forward if I put the correct SR number assignments for the encoders and DOUT_MATRIX's ?

Edited by Duggle
Link to comment
Share on other sites

What I meant was, that you could also write:

 

DOUT_MATRIX n=1  rows=8  inverted=1  sr_dout_sel1=1  sr_dout_r1=2  sr_dout_g1=3 sr_dout_b1=4 led_emu_id_offset=1001
EVENT_LED id=1001 hw_id=1001 bank=1 rgb=15:0:0 value=100
EVENT_LED id=1002 hw_id=1002 bank=1 rgb=15:3:0 value=100
EVENT_LED id=1003 hw_id=1003 bank=1 rgb=15:7:0 value=100

# And then for LEDs in the second bank:

EVENT_LED id=1101 hw_id=1001 bank=2 rgb=0:15:0 value=100
EVENT_LED id=1102 hw_id=1002 bank=2 rgb=3:15:0 value=100
EVENT_LED id=1103 hw_id=1003 bank=2 rgb=7:15:0 value=100

# this maps LED functions to the "LED hardware" which is assigned to hw_id=1001.. via led_emu_id_offset=1001

 

(the hw_id assignments for the first three EVENT_LED statements are only mentioned for demonstration purposes - actually they could also be omitted, because if hw_id is not specified, the hw_id is automatically set to the id value)

 

 

 

I've tried to address them with EVENT_BUTTON fwd_id=LED:65 (counting up) seemingly without luck. Am I on the right track?

 

Could you please check if this also fails if led_emu_id_offset is set to a much higher value, e.g. 1001 as proposed?

 

 

 

The next devices on the SRIO chain are 4 x Fairlightiii 2x8 encoder pcb's. I think the configuration of these will be straight forward if I put the correct SR number assignments for the encoders and DOUT_MATRIX's ?

 

yes

 

Best Regards, Thorsten.

Link to comment
Share on other sites

Thanks Thorsten, it's getting a little clearer.

 

The RGB LEDs are working perfectly with the following script, but no sign of action on the next DOUT SR in the chain, I'm looking for something on D7.

DOUT_MATRIX n=1  rows=8  inverted=1  sr_dout_sel1=1  sr_dout_r1=2  sr_dout_g1=3 sr_dout_b1=4 led_emu_id_offset=1001


EVENT_RECEIVER id=1 type=CC cc=16 fwd_id=SENDER:1
EVENT_SENDER   id=1 type=Meta meta=SetBank 

EVENT_BUTTON   fwd_id=LED:65 type=NoteOn key=36 value=100

# Bank1
#1st row
EVENT_LED id=1001  bank=1 rgb=15:0:0 value=100
EVENT_LED id=1002  bank=1 rgb=15:3:0 value=100
EVENT_LED id=1003  bank=1 rgb=15:7:0 value=100
EVENT_LED id=1004  bank=1 rgb=15:15:0 value=100
EVENT_LED id=1005  bank=1 rgb=7:15:0 value=100
EVENT_LED id=1006  bank=1 rgb=3:15:0 value=100
EVENT_LED id=1007  bank=1 rgb=3:15:3 value=100
EVENT_LED id=1008  bank=1 rgb=0:15:0 value=100
#2nd row
EVENT_LED id=1009   bank=1 rgb=0:0:15 value=100

# Bank2
EVENT_LED id=1001  bank=2 rgb=15:15:15 value=100
EVENT_LED id=1002  bank=2 rgb=15:15:15 value=100
EVENT_LED id=1003  bank=2 rgb=15:15:15 value=100
EVENT_LED id=1004  bank=2 rgb=15:15:15 value=100
EVENT_LED id=1005  bank=2 rgb=15:15:15 value=100
EVENT_LED id=1006  bank=2 rgb=15:15:15 value=100
EVENT_LED id=1007  bank=2 rgb=15:15:15 value=100
EVENT_LED id=1008  bank=2 rgb=15:15:15 value=100

EVENT_LED id=1009   bank=2 rgb=15:15:15 value=100

 

 

Link to comment
Share on other sites

O.K, getting clearer, still!

 

EVENT_BUTTON id=1  fwd_id=LED:33 type=NoteOn key=36 value=100

 

works because there are 32 SR DOUT bits before the first standard LED.

 

Perhaps the documentation should explain the counting logic to make it clearer (or perhaps I missed it).

Link to comment
Share on other sites

I'm not sure, TK, because the particular issue is hit when dealing with combinations of display elements: LED Matrix followed by standard LEDs. Otherwise I might have suggested a note where "fwd_id" is explained but this would only complicate that section.

I can only suggest a paragraph in the examples somewhere, explaining that the LED indexing is done by DOUT pins and not LED Matrix Elements which is what I (wrongly) predicted.

Link to comment
Share on other sites

Well, you've used the led_emu_id_offset wrongly anyhow.

In order to improve the understanding, I added following note to the description of led_emu_id_offset (http://www.ucapps.de/midibox_ng_manual_ngc.html):

 

In order to avoid conflicts with LEDs which are directly connected to DOUT pins (and which are accessed with LED:1 .. LED:256), it's recommended specify emulated ids outside this range, e.g. led_emu_id_offset=1001.

 

Best Regards, Thorsten.

Link to comment
Share on other sites

Well, you've used the led_emu_id_offset wrongly anyhow.

Do you mean before when I had led_emu_id_offset=1?

The additional description that you have since added, helps.

I might have expected LED:1 to work instead it's LED:33 to address the first standard LED in my set up. I'm not sure there is any indication of this (or rather the logic behind this) in the manual.

Link to comment
Share on other sites

Do you mean before when I had led_emu_id_offset=1?

 

yes - in all of my demo .NGC files I used a much higher offset value. After reading the documentation I realized, that I haven't mentioned why I did this...

 

 

 

I might have expected LED:1 to work instead it's LED:33 to address the first standard LED in my set up. I'm not sure there is any indication of this (or rather the logic behind this) in the manual.

 

I think that the logic should be clear meanwhile.

LED:1..256 address the DOUT pins

 

With led_emu_id_offset it's possible to emulate LED functions with a LED matrix. If you set the offset to <=256, it will shadow DOUT pins functions, which is normally not desired.

 

I hope that this forum works as enhanced documentation for such very special setups if somebody comes across the same problem.

 

Best Regards, Thorsten.

Link to comment
Share on other sites

  • 1 month later...

Hi Duggle,

unfortunately i get a "non valid image" error when i click on your matrix schematic from the first post.

Would you please post it again?

Thanks a lot!

Best regards

Marxon

Edited by Marxon
Link to comment
Share on other sites

  • 1 year later...

Hi folks - I have a 4x4 LED/button matrix setup for drum pads. Here's what I'm looking to set up (but can't)...

  1. All RGB LED's are a different color, always on but dimmed to lowest intensity
  2. When the respective button is pressed (or note received), the LED brightness changes to full intensity

I've tried a lot of different configs, and I can get the led's to stay dimmed until a button press, but... the color doesn't change. All the LED's stay red. The config below is what I have now:

 

RESET_HW

LCD "%C@(1:1:1)v1.0"

DebounceCtr 255

### SR ###

DIN_MATRIX  n=1  rows=4  inverted=0  sr_dout_sel1=1  sr_din1=1                                button_emu_id_offset=1001
DOUT_MATRIX n=1  rows=4  inverted=0  sr_dout_sel1=1  sr_dout_r1=3  sr_dout_g1=4  sr_dout_b1=5 led_emu_id_offset=1001

### Buttons ###

# LED's

EVENT_LED     id= 1001  hw_id=1001  bank=1  range=map1   dimmed=1  fwd_to_lcd=1  lcd_pos=1:20:1    label="^std_led"
EVENT_LED     id= 1002  hw_id=1002  bank=1  range=map1   dimmed=1  fwd_to_lcd=1  lcd_pos=1:20:1    label="^std_led"
EVENT_LED     id= 1003  hw_id=1003  bank=1  range=map1   dimmed=1  fwd_to_lcd=1  lcd_pos=1:20:1    label="^std_led"
EVENT_LED     id= 1004  hw_id=1004  bank=1  range=map1   dimmed=1  fwd_to_lcd=1  lcd_pos=1:20:1    label="^std_led"

# Bank 1

EVENT_BUTTON  id=1001  hw_id=1001  bank=1  fwd_id=LED:1001  fwd_to_lcd=1  type=NoteOn key=36 chn=1  rgb=15:0:0    lcd_pos=1:33:2   label="%3i %N@(1:1:2)%B"
EVENT_BUTTON  id=1002  hw_id=1002  bank=1  fwd_id=LED:1002  fwd_to_lcd=1  type=NoteOn key=37 chn=1  rgb=15:2:0    lcd_pos=1:33:2   label="%3i %N@(1:2:2)%B"
EVENT_BUTTON  id=1003  hw_id=1003  bank=1  fwd_id=LED:1003  fwd_to_lcd=1  type=NoteOn key=38 chn=1  rgb=15:8:0    lcd_pos=1:33:2   label="%3i %N@(1:3:2)%B"
EVENT_BUTTON  id=1004  hw_id=1004  bank=1  fwd_id=LED:1004  fwd_to_lcd=1  type=NoteOn key=39 chn=1  rgb=12:12:0   lcd_pos=1:33:2   label="%3i %N@(1:4:2)%B"

MAP1  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15

What am I doing wrong, or is there a better way to do this?

Link to comment
Share on other sites

Hi,

you have set the first DOUT shift register in your DOUT matrix and your DIN matrix.

 

Hey! I was triggering both off the same DOUT which has worked fine otherwise. I tried using a different SR just in case, but no difference... :(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...