Jump to content

Lit a LED in MMv2?


novski
 Share

Recommended Posts

HI

i wold like to test a "case" by lighting up a LED when it reaches that line.

I'm running a MMv2 App where the LED are lit by received messages from the program.

what i need is the value to light up LED 1 on DOUT SR1. But i can't find out how this piece of code works! I'm looking at it since hours!

/////////////////////////////////////////////////////////////////////////////

// This function is called from MM_MIDI_Received in mm_midi.c when

// a LED status message has been received

/////////////////////////////////////////////////////////////////////////////

const char mm_id_map_0a[8] = { ID_BANK, ID_GROUP, ID_RECRDY_x_FUNCTA, ID_FUNCTA_LED, ID_WRITE_x_FUNCTB, ID_FUNCTB_LED, ID_OTHER_x_FUNCTC, ID_FUNCTC_LED };

const char mm_id_map_0b[8] = { ID_FX_BYPASS_x_EFFECT1, ID_EFFECT1_LED, ID_SEND_MUTE_x_EFFECT2, ID_EFFECT2_LED, ID_PRE_POST_x_EFFECT3, ID_EFFECT3_LED, ID_SELECT_x_EFFECT4, ID_EFFECT4_LED };


void MM_DIO_LEDHandler(unsigned char led_id_l, unsigned char led_id_h)

{

  unsigned char mm_id;

  unsigned char ix = led_id_l & 0x07;


  // map LSB/MSB to MIDIbox MM ID

  if( led_id_h <= 0x07 ) {

    mm_id = ((led_id_l << 3) & 0x38) | led_id_h;

  } else if( led_id_h == 0x08 ) {

    mm_id = ix | 0x30;

  } else if( led_id_h == 0x09 ) {

    mm_id = ix | 0x38;

  } else if( led_id_h == 0x0a ) {

    mm_id = mm_id_map_0a[ix];

  } else if( led_id_h == 0x0b ) {

    mm_id = mm_id_map_0b[ix];

  }


  // set LED status (bit #6 set: LED on)

  MM_DIO_LEDSet(mm_id, led_id_l & (1 << 6 )); 

Please please help!

thanks!

Link to comment
Share on other sites

Ok i give up. Im trying to reverse engineer the MMv2 LEDs for my SAC Application since 9 hours now and can't explain whats going on in there.

first and biggest Quesiton is: what a Array is this?

unsigned char led_status[256/8];

Iff anybody has a explanation about Aarays with 2 values in the "[ ]" please let me know.

What i acualy need to do, is light up the LEDs on SR1-3. - but in a special way.

I have a Host that operates in different menus. Those are entered by turning the JogWeel rotary. I managed to choose the right menu by Button in a stable way already. (it clicks 14detents back and for menu 3 - 3 detends forwards... and works! :queen: )

Now the real hard quest is to light the lights on pressing a button. Because the Motormixer has just 8 Rotarys and 8 Buttons it switches pretty often between the different menus and often uses the same Buttons to do different things... (there are just 8 Hardware Buttons on the MM..) I have 24 Buttons assigned and those have to map to the right 24 LEDs.

so the actual Question is: How can i make the Received Midi String assign The LED of ID_SELECT_CHN1 witch is located on SR2 Pin0.

i know thats a difficult question. And I'm really thankful for Help.

best regards

novski

for interested people:

link to demo software of SAC. don't forget to choose the Motormix Midi template!

post-10711-0-28396000-1343061118_thumb.j

post-10711-0-89692200-1343061145_thumb.j

post-10711-0-40412700-1343061158_thumb.j

post-10711-0-34917200-1343061172_thumb.j

Midibox_mm_v2_SACspecial.zip

Edited by novski
Link to comment
Share on other sites

first and biggest Quesiton is: what a Array is this?

unsigned char led_status[256/8];
Iff anybody has a explanation about Aarays with 2 values in the "[ ]" please let me know.
The MM application stores the received LED status events in an array. Up to 256 LEDs are supported, some of them (128..256) are used by internal features such as the "general purpose controller" mode. Storing the LED status in an array is required, since we want to switch between these modes (means: button/LEDs will change their purpose) without requesting the DAW for sending the original LED status again when switching back to a different mode (e.g. because the DAW doesn't support such a function). Why is the array size divided by 8: because this saves some memory. A byte can store 8 bits, the led status for each LED is 1 bit (on or off), accordingly we don't need to allocate 256 bytes, if the same information could also be stored in 32 bytes. This is already "advanced programming" (required due to limited resources of the PIC), and this might have confused you. In general: if you need more customization, but find my method to complicated, just remove the code and start from scratch - it's sometimes faster than going through the legacy stuff...
so the actual Question is: How can i make the Received Midi String assign The LED of ID_SELECT_CHN1 witch is located on SR2 Pin0.
You probably already know that the free configurable MM function->LED/button map is located in mm_dio_table.c It assigns the functions to all SRs in a continuous list. Currently following functions are assigned to the second shift register (SR2?)

// 2nd shift register
// button LED
ID_SOLO_CHN1, ID_SOLO_CHN1,
ID_SOLO_CHN2, ID_SOLO_CHN2,
ID_SOLO_CHN3, ID_SOLO_CHN3,
ID_SOLO_CHN4, ID_SOLO_CHN4,
ID_SOLO_CHN5, ID_SOLO_CHN5,
ID_SOLO_CHN6, ID_SOLO_CHN6,
ID_SOLO_CHN7, ID_SOLO_CHN7,
ID_SOLO_CHN8, ID_SOLO_CHN8,
[/code] But ID_SELECT_* functions are assigned to the 4th shift register:
[code]
// 4th shift register
// button LED
ID_SELECT_CHN1, ID_SELECT_CHN1,
ID_SELECT_CHN2, ID_SELECT_CHN2,
ID_SELECT_CHN3, ID_SELECT_CHN3,
ID_SELECT_CHN4, ID_SELECT_CHN4,
ID_SELECT_CHN5, ID_SELECT_CHN5,
ID_SELECT_CHN6, ID_SELECT_CHN6,
ID_SELECT_CHN7, ID_SELECT_CHN7,
ID_SELECT_CHN8, ID_SELECT_CHN8,
You have to reorder the assignments to adapt them for your needs. In addition you are asking to assign ID_SELECT_CHN1 to the D0 output pin, but DOUTs are counted from D7 (the "first LED" is D7) (this also related to following question which is probably the reason why you are asking this: ) This simply means, that you have to mirror the LED assignments this way:

// button LED
ID_SELECT_CHN1, ID_SELECT_CHN8,
ID_SELECT_CHN2, ID_SELECT_CHN7,
ID_SELECT_CHN3, ID_SELECT_CHN6,
ID_SELECT_CHN4, ID_SELECT_CHN5,
ID_SELECT_CHN5, ID_SELECT_CHN4,
ID_SELECT_CHN6, ID_SELECT_CHN3,
ID_SELECT_CHN7, ID_SELECT_CHN2,
ID_SELECT_CHN8, ID_SELECT_CHN1,
[/code]

Best Regards, Thorsten.

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...
 Share

×
×
  • Create New...