Jump to content

understanding the .ngc code


ssp
 Share

Recommended Posts

I have had to admit defeat on the NRPN's tonight and have msg'd Thorsten for some advice/help.  the latest rev is great for the negatives etc, but its the dual commands i am stuck with and working out the values for nrpn and lsb msb etc. Crazy math frying my brain.

Link to comment
Share on other sites

Just sat working on a conditional label test and something wierd is happening.

I made two files test.ngc and test.ngl with one encoder attached

in the .ngc

RESET_HW

# this command is part of a .NGC file:

ENC n=  1   sr=1 pins=0:1   type=detented3

EVENT_ENC    id=  1  type=CC  cc=16 range= 0:127 lcd_pos=1:1:1 label="^Destpanel "

in the .ngl

COND_LABEL   Destpanel
COND =0    "VCO1 FREQ"
COND =1    "VCO1 PW  "
COND =2    "VCO1 VOL "
COND =3    "VCO2 FREQ"
COND =4    "VCO2 PW  "
COND =5    "VCO2 VOL "
COND_ELSE  "--------"

 

On the 2x40 display all i get in the first line character is the "l" nothing else however, If i change ^Destpanel  to just ^Dest then it shows VCO1 FREQ on the lcd.  Why if i put the full ^destpanel am i getting the leter L instead?

 

It seems it only likes 8 characters, by removing 1 letter on each ^Destpanel to ^Destpane it works.

Is there an 8 character limit on the "Cond_Label" title name? if so can this be changed anywhere?

 

 

Edited by ssp
Link to comment
Share on other sites

2 hours ago, jjonas said:

I ran into this a while ago. From the docs for NGL:

 

I didnt see this, thanks for the heads up on this jjonas, most appreciated!!  it would be nice though as its a 2x40 and im using 8 encoders to be able to balance this out to 10 max characters per label. because you can then reduce it per your needs.

 

I wonder if this is something that Thorsten could implement ? where you can set your max characters in the .ngl file

Link to comment
Share on other sites

I think what's limited to 8 characters is the label variable (like ^destpane), not the actual string that's displayed on the LCD. In your example above you have strings that are more than 8 characters ("VCO1 FREQ" has 9 characters), and in fact you're not limited to 8 characters with the "VCO1 FREQ" style texts you want to show on the LCD. The variable length in characters (^destpane) and the string length in characters ("VCO1 frequency") are not related, so you can have short variable names and long strings for them.

Edited by jjonas
typo + clarification
Link to comment
Share on other sites

Just now, jjonas said:

I think what's limited to 8 characters is the label variable (like ^destpane), not the actual string that's displayed on the LCD. In your example above you have strings that are more than 8 characters ("VCO1 FREQ" has 9 characters), and in fact you're not limited to 8 characters with the "VCO1 FREQ" style texts you want to show on the LCD. The variable length in characters (^destpane) and the string length in characters ("VCO1 frequency") are not related, so you can have short variable names and long strings for them.

Ah got it. i will change the the label variable to a abbreviated syntax instead, i can define my own syntax list then in the .ngl file and reference that.

 

Thanks again.

Link to comment
Share on other sites

Had a little fun checking this out tonight, all working fine, I applied 8 enocders to various functions and then gave each label 10 characters on the lcd top and bottom row.

1. you define the amount of max characters by the spaces between the ".........." commas. For example if i put "VCO1 FILT " there are 9 characters and a single blank space. The next free character is 11

The spacing is then on a 40x2 display:

pos 1= 1:1:1   pos 2= 1:11:1   pos 3=1:21:1  pos 4=1:31:1
pos 5= 1:1:2   pos 6= 1:11:2   pos 7=1:21:2  pos 8=1:31:2

For the COND_LABEL  is used Dp1

so I wrote this to test

RESET_HW

# 40x2 10 character per 8 encoder test

ENC n=  1   sr=1 pins=0:1   type=detented3
EVENT_ENC    id=  1 fwd_to_lcd=1  type=CC  cc=16 range= 0:127 lcd_pos=1:1:1 label="^Dp1"
ENC n=  2   sr=1 pins=2:3   type=detented3
EVENT_ENC    id=  2 fwd_to_lcd=1  type=CC  cc=17 range= 0:127 lcd_pos=1:11:1 label="^Dp2"
ENC n=  3   sr=1 pins=4:5   type=detented3
EVENT_ENC    id=  3 fwd_to_lcd=1  type=CC  cc=18 range= 0:127 lcd_pos=1:21:1 label="^Dp3"
ENC n=  4   sr=1 pins=6:7   type=detented3
EVENT_ENC    id=  4 fwd_to_lcd=1  type=CC  cc=19 range= 0:127 lcd_pos=1:31:1 label="^Dp4"
ENC n=  5   sr=1 pins=0:1   type=detented3
EVENT_ENC    id=  5 fwd_to_lcd=1  type=CC  cc=20 range= 0:127 lcd_pos=1:1:2 label="^Dp5"
ENC n=  6   sr=1 pins=2:3   type=detented3
EVENT_ENC    id=  6 fwd_to_lcd=1  type=CC  cc=21 range= 0:127 lcd_pos=1:11:2 label="^Dp6"
ENC n=  7   sr=1 pins=4:5   type=detented3
EVENT_ENC    id=  7 fwd_to_lcd=1  type=CC  cc=22 range= 0:127 lcd_pos=1:21:2 label="^Dp7"
ENC n=  8   sr=1 pins=6:7   type=detented3
EVENT_ENC    id=  8 fwd_to_lcd=1  type=CC  cc=23 range= 0:127 lcd_pos=1:31:2 label="^Dp8"

then there were the .NGL conditional labels in thier own tables from Dp1 to Dp8, I was really pleased it all worked first time and did what I wanted it to.

Going to play with banks again tomorrow and see if how i can implement that in as well.

IMG_20200209_215940_resized_20200209_103159675.jpg

Edited by ssp
Link to comment
Share on other sites

I have been playing with banks and cond labels again today all went well.  I was pondering something though.

If i have a series of values i want to control from 3 knobs, so there are two lines of values, and 8 on each line, what i want to do to reduce the amount of encoders is have one for moving in the y direction between line 1 and line 2, then one to move in the "x" direction to step between 1 to 8 in the line, then a final encoder to change the value of the selcted cc#.

in a basic explanation (not real code!!)

Y= enc_1  if<64 line=1
Y= enc_1  if<127 line=2

X= enc_2  if<10 cc16  
X= enc_2  if<20 cc17
X= enc_2  if<30 cc18
X= enc_2  if<40 cc18

Value= enc_3 type=CC ......... this encoder would have to change its code on each movement over x&y so cc=16, cc=17,cc=18 etc.

Is it possible to do this in the .ngc?

 

5e47d6ae2894d_selmtrx.thumb.png.e56ba33d

 

Link to comment
Share on other sites

Hello

 

1 hour ago, ssp said:

If i have a series of values i want to control from 3 knobs, so there are two lines of values, and 8 on each line, what i want to do to reduce the amount of encoders is have one for moving in the y direction between line 1 and line 2, then one to move in the "x" direction to step between 1 to 8 in the line, then a final encoder to change the value of the selcted cc#.

Is it possible to do this in the .ngc?

Don't know if you can do this without a script (NGR) to handle the 8 possible two CC toggle (equivalent to Y axis in a 2x8 pattern)

You can maybe simply with toggle scan X(16,17...23,24, 31,16....) and Y (16,24,17,25....31,16...) with 2 MAP

But in a strict "user friendly" interface I personally won't use two encoder to select data in a 2x8 matrix display (for a 8x8 OK...)

A single continuous scan will be as fast for only 16 slot (assuming you can go both direction, most distant data is only at 8 encoder tick) , OR you can use the encoder button to switch X/Y scan axis

Only two encoder, data and value

Best

Zam

Link to comment
Share on other sites

2 hours ago, Zam said:

Hello

 

Don't know if you can do this without a script (NGR) to handle the 8 possible two CC toggle (equivalent to Y axis in a 2x8 pattern)

You can maybe simply with toggle scan X(16,17...23,24, 31,16....) and Y (16,24,17,25....31,16...) with 2 MAP

But in a strict "user friendly" interface I personally won't use two encoder to select data in a 2x8 matrix display (for a 8x8 OK...)

A single continuous scan will be as fast for only 16 slot (assuming you can go both direction, most distant data is only at 8 encoder tick) , OR you can use the encoder button to switch X/Y scan axis

Only two encoder, data and value

Best

Zam

it is actually 5 rows of 8 but i used 2 rows as an example before i start trying this. I am just curious if it is possible, I will have a play this evening and see where i get to.

I know that in thorstens blofeld files that there is the meta , bank and cond label used. i could alter this slightly but its the #cc as well.

will see what happens tonight

 

Link to comment
Share on other sites

  • 2 months later...

been busy with work and other things or a while so I havent been in to update things.

Today i had a play around with some new controller code, took a while to think about it and get it running, had to pick through some of my info i wrote down. All sorted in the end and i got things running.. the builds are progressing slowly these days because of lockdown here in the uk. But its giving me time to carry on learning new sections of code.

Link to comment
Share on other sites

  • 3 months later...

question:

if i have 16 buttons as selectors for each 3 digit 7 segment led, and one encoder for value.  is it possible so if i press button 1 the encoder is mapped to the button one cc~ and value range selection and the led, then if i press button 2 it then changes for that and if i press 3 it changes for that?

so the encoder becomes active for the toggle button you press. This would save me from having an encoder for each 3 digit and function.

Is it possible to have an encoder function defined in a map?

Thanks

Link to comment
Share on other sites

Hi,

 

I'm not sure i undesrtood your question well but it seems to me that you need to use the bank function. for example:

 

EVENT_ENC id= 1 hw_id= 1 bank= 1 type= CC chn= 1 cc= 0 range= 0:127 fwd_to_lcd=1 lcd_pos=1:1:1 label= "%3d"
EVENT_ENC id= 2 hw_id= 1 bank= 2 type= CC chn= 1 cc= 1 range= 0:127 fwd_to_lcd=1 lcd_pos=1:1:1 label= "%3d"
EVENT_ENC id= 3 hw_id= 1 bank= 3 type= CC chn= 1 cc= 2 range= 0:127 fwd_to_lcd=1 lcd_pos=1:1:1 label= "%3d"

EVENT_BUTTON id= 4   fwd_id= LED:4   type= Meta meta= SetBankOfHwId:1 range=1:1 button_mode= OnOnly   # "Bank 1"
EVENT_BUTTON id= 5   fwd_id= LED:5   type= Meta meta= SetBankOfHwId:1 range=2:2 button_mode= OnOnly   # "Bank 2"
EVENT_BUTTON id= 6   fwd_id= LED:6   type= Meta meta= SetBankOfHwId:1 range=3:3 button_mode= OnOnly   # "Bank 3"

In this example, when you press a button, it activates the corresponding EVENT_ENC and deactivates the others.

 

Is it what you're looking for?

Cheers,

 

Thomas

  • Like 1
Link to comment
Share on other sites

27 minutes ago, totoRaymond said:

Hi,

 

I'm not sure i undesrtood your question well but it seems to me that you need to use the bank function. for example:

 


EVENT_ENC id= 1 hw_id= 1 bank= 1 type= CC chn= 1 cc= 0 range= 0:127 fwd_to_lcd=1 lcd_pos=1:1:1 label= "%3d"
EVENT_ENC id= 2 hw_id= 1 bank= 2 type= CC chn= 1 cc= 1 range= 0:127 fwd_to_lcd=1 lcd_pos=1:1:1 label= "%3d"
EVENT_ENC id= 3 hw_id= 1 bank= 3 type= CC chn= 1 cc= 2 range= 0:127 fwd_to_lcd=1 lcd_pos=1:1:1 label= "%3d"

EVENT_BUTTON id= 4   fwd_id= LED:4   type= Meta meta= SetBankOfHwId:1 range=1:1 button_mode= OnOnly   # "Bank 1"
EVENT_BUTTON id= 5   fwd_id= LED:5   type= Meta meta= SetBankOfHwId:1 range=2:2 button_mode= OnOnly   # "Bank 2"
EVENT_BUTTON id= 6   fwd_id= LED:6   type= Meta meta= SetBankOfHwId:1 range=3:3 button_mode= OnOnly   # "Bank 3"

In this example, when you press a button, it activates the corresponding EVENT_ENC and deactivates the others.

 

Is it what you're looking for?

Cheers,

 

Thomas

Thanks Thomas, yes a slight variation of that.

I have my test setup on the table ready to try a few things out tomorrow. hopefully it will work!!

Link to comment
Share on other sites

  • 2 weeks later...
  • 5 weeks later...
On 20/08/2020 at 0:08 AM, totoRaymond said:

Hi,

 

I'm not sure i undesrtood your question well but it seems to me that you need to use the bank function. for example:

 


EVENT_ENC id= 1 hw_id= 1 bank= 1 type= CC chn= 1 cc= 0 range= 0:127 fwd_to_lcd=1 lcd_pos=1:1:1 label= "%3d"
EVENT_ENC id= 2 hw_id= 1 bank= 2 type= CC chn= 1 cc= 1 range= 0:127 fwd_to_lcd=1 lcd_pos=1:1:1 label= "%3d"
EVENT_ENC id= 3 hw_id= 1 bank= 3 type= CC chn= 1 cc= 2 range= 0:127 fwd_to_lcd=1 lcd_pos=1:1:1 label= "%3d"

EVENT_BUTTON id= 4   fwd_id= LED:4   type= Meta meta= SetBankOfHwId:1 range=1:1 button_mode= OnOnly   # "Bank 1"
EVENT_BUTTON id= 5   fwd_id= LED:5   type= Meta meta= SetBankOfHwId:1 range=2:2 button_mode= OnOnly   # "Bank 2"
EVENT_BUTTON id= 6   fwd_id= LED:6   type= Meta meta= SetBankOfHwId:1 range=3:3 button_mode= OnOnly   # "Bank 3"

In this example, when you press a button, it activates the corresponding EVENT_ENC and deactivates the others.

 

Is it what you're looking for?

Cheers,

 

Thomas

On 20/08/2020 at 0:08 AM, totoRaymond said:

Hi,

 

I'm not sure i undesrtood your question well but it seems to me that you need to use the bank function. for example:

 


EVENT_ENC id= 1 hw_id= 1 bank= 1 type= CC chn= 1 cc= 0 range= 0:127 fwd_to_lcd=1 lcd_pos=1:1:1 label= "%3d"
EVENT_ENC id= 2 hw_id= 1 bank= 2 type= CC chn= 1 cc= 1 range= 0:127 fwd_to_lcd=1 lcd_pos=1:1:1 label= "%3d"
EVENT_ENC id= 3 hw_id= 1 bank= 3 type= CC chn= 1 cc= 2 range= 0:127 fwd_to_lcd=1 lcd_pos=1:1:1 label= "%3d"

EVENT_BUTTON id= 4   fwd_id= LED:4   type= Meta meta= SetBankOfHwId:1 range=1:1 button_mode= OnOnly   # "Bank 1"
EVENT_BUTTON id= 5   fwd_id= LED:5   type= Meta meta= SetBankOfHwId:1 range=2:2 button_mode= OnOnly   # "Bank 2"
EVENT_BUTTON id= 6   fwd_id= LED:6   type= Meta meta= SetBankOfHwId:1 range=3:3 button_mode= OnOnly   # "Bank 3"

In this example, when you press a button, it activates the corresponding EVENT_ENC and deactivates the others.

 

Is it what you're looking for?

Cheers,

 

Thomas

Just to let you know I applied a variation of this example today, and it worked first time!!!  i had to take the fwd to led aout for now as i only have the dout matrix running, but the selection for each 3 digit display from a button and a single encoder works.

Link to comment
Share on other sites

i had another idea on this,

instead of having 16 buttons to select each 3 digit display...... is it possible to use an encoder with push switch instead of all the buttons?  give each button a range value so its not just changing per indent step.

using the buttons it works fine and has been tested. it also forwards to an Led to show its the active one

Is it possible to replace the buttons with an encoder instead? or could I use a pot and set the values ranges per display?

display 1: range 1-10

display 2: range 11-20

display 3: range 21-30

In effect it becomes a selection menu then press the encoder or pot knob down to select the display thats chosen, you then use the second encoder to change the value from -99 to 99.

I am trying to find an example on the forum to use as a template to modify to try this out.

If anyone has any pointers please let me know.

Link to comment
Share on other sites

Ok this is working fine now i can use an encoder to select up and down over 3 displays.

but I cant figure out how to have a single button replace the need for the three test buttons here:

EVENT_BUTTON id= 4   type=Meta meta=SetBankOfHwId:1  range=1:1 button_mode= OnOnly   # "Bank 1"
EVENT_BUTTON id= 5   type=Meta meta=SetBankOfHwId:1  range=2:2 button_mode= OnOnly   # "Bank 2"
EVENT_BUTTON id= 6   type=Meta meta=SetBankOfHwId:1  range=3:3 button_mode= OnOnly   # "Bank 3"

What would be better is not to have a button and when the selection encoder ( encoder id 5) is turned to the relevent item from say "bank 1" to  "bank 3" that it automatically allows me to use ENC_id=1 hw_id=1 to change the value of bank 3.

 

Or would this require a single button instead?

Im pleased i got it to sweep up and down the banks, its just the methid of selection now. I have looked over the forum for inspiration but not found anything yet.

 

any pointers gratefully accepted!

Edited by ssp
editing code
Link to comment
Share on other sites

slight issue.

I have managed to hook up the individual leds tonight and check the code, its all working however using this:
EVENT_BUTTON id= 4   fwd_id= LED:4   type= Meta meta= SetBankOfHwId:1 range=1:1 button_mode= OnOnly   # "Bank 1"

is fine, and the led it forwards to lights up, however when you press the next button:
EVENT_BUTTON id= 5   fwd_id= LED:5   type= Meta meta= SetBankOfHwId:1 range=2:2 button_mode= OnOnly   # "Bank 2"

led 5 lights up but led 4  also stays lit, what would i use to turn off the previous led?

in the past i used radio groups and maps leds.

Update: its working, just added the radio group...  i knew what it was just having a brain fart

EVENT_BUTTON id= 4  fwd_id= LED:17 type=Meta meta=SetBankOfHwId:1  range=1:1 button_mode= OnOnly radio_group=1

Edited by ssp
BRAIN FART!!!
Link to comment
Share on other sites

i had another go at trying to get the encoder to switch between each function as the buttons would however when the encoder changed to another function it didnt enable that as if i had pressed the button "on"

i can go back and fore the 3 displays and then press each button to activate the corresponding value to change with the other encoder

would i use a "soft" button or an event sender so that when i turn the selection encoder from its first point "lfo mod" to its second point "lfo res" and when it is on the second automatically put it in a "button on" state so i can then use the second encoder to change the value?

I am going to have a play around, I can't find anything like this talked about on the forum so I thought I would ask.

Thanks for any help. hopefully i can figure it out!

 

Could i use a meta event to send the button on?   ie: meta=SendEvent:button_mode ononly

 

Edited by ssp
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...