Jump to content

understanding the .ngc code


ssp
 Share

Recommended Posts

Is it possible to change the font size when using the ssd1306 oled's? Is this set in mios studio while the stf32m is in bootloader mode.

when entering the , set lcd_type  etc?

UPDATE: I found the section i needed in the NG usermanual.

 

GLCDs can output different fonts which are selected with the ampersant (&) character:

  • &&: outputs the & character
  • &<font>: selects a font for graphical LCDs:
    • &n: selects the "normal" 6x8 font
    • &i: selects the inverted 6x8 font
    • &s: selects the "small" 4x8 font
    • &t: selects the "tiny" 4x8 font
    • &b: selects the "big" 24x16 font
    • &k: selects "knob icons", a 24x32 font. Values can be output with %B
    • &h: selects a meter with horizontal orientation, a 32x8 font. Values can be output with %B
    • &v: selects a meter with vertical orientation, a 8x32 font. Values can be output with %B

And finally it's also possible to change the output LCD and position within a label:

  • @(<lcd>:<X>:<Y>): changes to the given lcd, X and Y position.

Example:

lcd_pos=1:1:1  label="Enc%3i&k@(1:1:2)%B&n@(1:18:1)%3d"

No, this is not an encrypted message, because the processing rules are well documented! ;-) - it will output "ENC" + the ID number. Then it will select the "knob" icon, jump to position X=1 Y=2 and output the knob icon based on the EVENT value. Thereafter it will select the normal font, jump to position X=18 Y=1 and output the MIDI value in decimal format.

 

 

all is good

 

 

Edited by ssp
Link to comment
Share on other sites

  • 2 weeks later...

been busy working on various projects, finally got time to print the enclosure for one of them this weekend. Designed in solidworks and printed in Carbon/Nylon.

I have 5 alps motorised faders to fit and a few buttons, leds and pots to go on a pcb i am milling next week.

There are insert faceplates to do yet on the fader face and the upper face.

All is looking good though so far and the cade is working as well, I am also making a small dout x2 pcb as well as i only need 9 leds, i am using a TSSOP16 74hc595 and a smt resistor network to reduce the size for the space i need in the enclosure.

Using jlcpcb in china for a couple of different boards as they are far too expensive to be made in the uk.

 

 

1.jpg

2.jpg

3.jpg

4.jpg

Link to comment
Share on other sites

  • 11 months later...

Question, i have 8 oleds hooked upto the st core, the first 7 work fine but the 8th keeps corrupting, it will not display the text correctly.

the lcd number in the mios setting is for 8 only, i just erased the st board and re uploaded mios and the mb ng software, all is good but 8 is still garbled, i used other oleds i have here incase it was faulty, moved it around and i also got my two spare st boards and programmed them also. Still the same barled text on number 8 only, any ideas? 

 

The pcb is clean and soldered correctly no bridges or any issues.

 

Update: Problem solved, needed more voltage so moved the j15_S from 3v3 to 5v

 

 

 

pic.jpg

Edited by ssp
Link to comment
Share on other sites

I am looking at the banks and other functions today.

I am sure I have seen this discussed somewhere ( having a forum search to find it)

can you have multiple control parameters on a fader, potentiometer or encoder from a button press

So if you want one fader to control ADSR features.

on its 1st function its cc16 assigned to the amplitude

press a button and then

its second function is cc17 assigned to decay

press again

third function is cc18 assigned to sustain..

and so on

Would this be a combination of mapping and radio buttons? I am playing around with the code today seeing if i can make a happy accident.

 

I am currently reading the enc_banks on teh git hub

https://github.com/midibox/mios32/blob/master/apps/controllers/midibox_ng_v1/cfg/tests/encbanks.ngc

 

Tx

Edited by ssp
Link to comment
Share on other sites

Hi,

 

About your LCDs, i was going to advise to check your voltages, too much of a voltage drop on a long run can give weird behaviours, especially on proto boards.

But anyway, you figured that out.

 

About your second question, there are multiple ways of achieving this. What is it you really want? One single button to cycle through a number of banks?

You can use meta= CycleBank for that. i didn't use it myself, so you might want to make some tests.

 

But basically, you have multiple events, with unique ids, but same hw_id, and unique bank#.

you button should be set to event= Meta meta= CycleBank mode= OnOnly i guess

 

This should get you started. but be aware that this will cycle the bank for ALL parameters with bank ids available.

 

Thomas

Link to comment
Share on other sites

38 minutes ago, totoRaymond said:

Hi,

 

About your LCDs, i was going to advise to check your voltages, too much of a voltage drop on a long run can give weird behaviours, especially on proto boards.

But anyway, you figured that out.

 

About your second question, there are multiple ways of achieving this. What is it you really want? One single button to cycle through a number of banks?

You can use meta= CycleBank for that. i didn't use it myself, so you might want to make some tests.

 

But basically, you have multiple events, with unique ids, but same hw_id, and unique bank#.

you button should be set to event= Meta meta= CycleBank mode= OnOnly i guess

 

This should get you started. but be aware that this will cycle the bank for ALL parameters with bank ids available.

 

Thomas

yes this is what is in the git hub, i am thinking of two buttons, -bank and +bank, i am still reading things and writing bits down to work on this week

 

Thanks for the info Thomas @totoRaymond

Link to comment
Share on other sites

Hi again,

 

If you're thinking about 2 buttons, then there is the "meta= IncBank" and "meta= DecBank"  options. having the effect of increasing bank and decreasing bank respectively.

 

AND (i just checked the manual), you can also specify the hw_id on which you want to change bank with "meta= IncBankOfHwId" and "meta= DecBankOfHwId" options.

advantage being:  i doesn't change ALL parameters banks but only the specified ones (you can specify any number of hw_id)

 

Hope this helps.

 

Thomas

 

Edited by totoRaymond
Link to comment
Share on other sites

  • 2 weeks later...

Question:

I want to test the bank code i have written, I am going to assign in to a fader connected to j5a on the stfm core.

Would i use the EVENT_AIN function for this?

I just want to connect a fader directly to j5a, so how would i implement this rather than using an ainser8 or ainser64?

 

thanks

Link to comment
Share on other sites

Hi ssp,

 

I never used it but yes, it seems that if you connect a fader or pot to J5A, you need to use AIN statement first to describe the physical thing.

 

then use EVENT_AIN to describe the behavior of said event.

If you'll use bank on that parameter, you need to use different "id" for each bank but they should all refer to the same "hw_id"

 

I hope it's clear enough, sometimes i find it difficult to explain such things in human language. (plus english is not my mother tongue)

 

Cheers,

 

Thomas

Edited by totoRaymond
Link to comment
Share on other sites

13 minutes ago, totoRaymond said:

Hi ssp,

 

I never used it but yes, it seems that if you connect a fader or pot to J5A, you need to use AIN statement first to describe the physical thing.

 

then use EVENT_AIN to describe the behavior of said event.

If you'll use bank on that parameter, you need to use different "id" for each bank but they should all refer to the same "hw_id"

 

I hope it's clear enough, sometimes i find it difficult to explain such things in human language. (plus english is not my mother tongue)

 

Cheers,

 

Thomas

Yes i understand the "bank" setup and hw id's, it was just finding an example of setting up the fader on j5a as the only other time i have used it is with an ainser64 and i dont need one of those right now.  sat going through the ngc info again to see whats what, there is so much missing info wise that was never added along with the solution to having multiple ssd1306 but it still refers to j28 on the lpc pcb and nothing for the stfm pcbs. it would be good to get some of these updated as others have had to edit mios rather than configuring the ngc which is easier for users.

Link to comment
Share on other sites

7 minutes ago, ssp said:

Yes i understand the "bank" setup and hw id's, it was just finding an example of setting up the fader on j5a as the only other time i have used it is with an ainser64 and i dont need one of those right now.  sat going through the ngc info again to see whats what, there is so much missing info wise that was never added along with the solution to having multiple ssd1306 but it still refers to j28 on the lpc pcb and nothing for the stfm pcbs. it would be good to get some of these updated as others have had to edit mios rather than configuring the ngc which is easier for users.

I feel what you say.

Documentation on the midibox NG is sometimes wonky (some description are wrong case wise, I've lost nights chasing case sensitive statements) but the software is so good....

 

I'd like to be able to correct things on the documentation sometimes.... or just add comments so people after resolve same problems faster.

 

still, MidiBox is an awesome project. It deserves to be supported by a lot more people. I'd like to become part of the team though i don't feel worthy of it.

 

Cheers,

Thomas

 

Link to comment
Share on other sites

16 minutes ago, totoRaymond said:

I feel what you say.

Documentation on the midibox NG is sometimes wonky (some description are wrong case wise, I've lost nights chasing case sensitive statements) but the software is so good....

 

I'd like to be able to correct things on the documentation sometimes.... or just add comments so people after resolve same problems faster.

 

still, MidiBox is an awesome project. It deserves to be supported by a lot more people. I'd like to become part of the team though i don't feel worthy of it.

 

Cheers,

Thomas

 

yes the ngc format is so much easier to go through than the old assembly!! but i got to grips with that in the end.

I am trying to get to grips with everything then apply it in the thread in a more simplistic way for those coming in new and also it helps me visualise things better.

 

I just got the fader working on the core once it was written it was simple

# AIN hardware
AIN enable_mask=10000000  ( I am assuming that the 8 digits refer to the 8 pins on J5a/b and for an active pin you put a 1 in place?


# EVENTs
EVENT_AIN id= 1 type=CC chn= 1 cc= 16 range= 0:127

It works but i get double figures in mios studio when i move the fader

such as

 Chn# 1  CC# 16 = 22
 Chn# 1  CC# 16 = 22
 Chn# 1  CC# 16 = 23
 Chn# 1  CC# 16 = 23

Is this a bit resolution that i need to add into the ngc code to prevent the doubling up on the fader movement into mios studio?

Thanks

 

I need some zzz now so will test the code tomorrow

Link to comment
Share on other sites

4 minutes ago, totoRaymond said:

that's strange.

can you send your complete .ngc file?

and have you turned debug_mode  on?

also what is the status of your router?

I had weird behavior related to these in the past.

the code is basic

 

this is the mios studio input: it replicates the fader movement

[8548.313] b0 10 03   Chn# 1  CC# 16 = 3
[8548.313] b0 10 03   Chn# 1  CC# 16 = 3
[8548.315] b0 10 02   Chn# 1  CC# 16 = 2
[8548.315] b0 10 02   Chn# 1  CC# 16 = 2
[8548.315] b0 10 02   Chn# 1  CC# 16 = 2
[8548.333] b0 10 00   Chn# 1  CC# 16 = 0
[8548.333] b0 10 00   Chn# 1  CC# 16 = 0
[8548.333] b0 10 00   Chn# 1  CC# 16 = 0

Link to comment
Share on other sites

13 minutes ago, totoRaymond said:

that's strange.

can you send your complete .ngc file?

and have you turned debug_mode  on?

also what is the status of your router?

I had weird behavior related to these in the past.

so using this just to tect the fader

RESET_HW

# AIN hardware
AIN enable_mask=1000

# EVENTs
EVENT_AIN id=1 type=CC chn=1 cc=16 range=0:127

 

i get this in the input window of miosstudio it jitters around while using the fader

[9150.059] b0 10 56   Chn# 1  CC# 16 = 86
[9150.062] b0 10 57   Chn# 1  CC# 16 = 87
[9150.069] b0 10 5a   Chn# 1  CC# 16 = 90
[9150.071] b0 10 5b   Chn# 1  CC# 16 = 91
[9150.076] b0 10 58   Chn# 1  CC# 16 = 88
[9150.077] b0 10 5e   Chn# 1  CC# 16 = 94
[9150.078] b0 10 5c   Chn# 1  CC# 16 = 92
[9150.080] b0 10 5e   Chn# 1  CC# 16 = 94
[9150.081] b0 10 5c   Chn# 1  CC# 16 = 92
[9150.082] b0 10 5e   Chn# 1  CC# 16 = 94
[9150.083] b0 10 5d   Chn# 1  CC# 16 = 93
[9150.084] b0 10 5f   Chn# 1  CC# 16 = 95
[9150.085] b0 10 61   Chn# 1  CC# 16 = 97
[9150.086] b0 10 5e   Chn# 1  CC# 16 = 94
[9150.089] b0 10 60   Chn# 1  CC# 16 = 96
[9150.092] b0 10 61   Chn# 1  CC# 16 = 97
[9150.093] b0 10 62   Chn# 1  CC# 16 = 98
[9150.097] b0 10 65   Chn# 1  CC# 16 = 101
[9150.098] b0 10 67   Chn# 1  CC# 16 = 103
[9150.099] b0 10 63   Chn# 1  CC# 16 = 99
[9150.103] b0 10 66   Chn# 1  CC# 16 = 102
[9150.104] b0 10 64   Chn# 1  CC# 16 = 100
[9150.106] b0 10 66   Chn# 1  CC# 16 = 102
[9150.110] b0 10 67   Chn# 1  CC# 16 = 103
[9150.113] b0 10 68   Chn# 1  CC# 16 = 104
[9150.117] b0 10 67   Chn# 1  CC# 16 = 103
[9150.118] b0 10 6b   Chn# 1  CC# 16 = 107
[9150.119] b0 10 69   Chn# 1  CC# 16 = 105
[9150.122] b0 10 68   Chn# 1  CC# 16 = 104
[9150.123] b0 10 6a   Chn# 1  CC# 16 = 106
[9150.124] b0 10 6c   Chn# 1  CC# 16 = 108
[9150.126] b0 10 6b   Chn# 1  CC# 16 = 107
[9150.129] b0 10 6d   Chn# 1  CC# 16 = 109
[9150.130] b0 10 6c   Chn# 1  CC# 16 = 108
[9150.137] b0 10 6e   Chn# 1  CC# 16 = 110
[9150.138] b0 10 6d   Chn# 1  CC# 16 = 109
[9150.142] b0 10 6e   Chn# 1  CC# 16 = 110
[9150.146] b0 10 70   Chn# 1  CC# 16 = 112
[9150.148] b0 10 72   Chn# 1  CC# 16 = 114
[9150.149] b0 10 6f   Chn# 1  CC# 16 = 111
[9150.153] b0 10 70   Chn# 1  CC# 16 = 112
[9150.158] b0 10 71   Chn# 1  CC# 16 = 113
[9150.162] b0 10 72   Chn# 1  CC# 16 = 114
[9150.163] b0 10 74   Chn# 1  CC# 16 = 116
[9150.166] b0 10 76   Chn# 1  CC# 16 = 118
[9150.167] b0 10 74   Chn# 1  CC# 16 = 116
[9150.168] b0 10 73   Chn# 1  CC# 16 = 115
[9150.169] b0 10 74   Chn# 1  CC# 16 = 116
[9150.173] b0 10 75   Chn# 1  CC# 16 = 117
[9150.178] b0 10 76   Chn# 1  CC# 16 = 118
[9150.184] b0 10 74   Chn# 1  CC# 16 = 116
[9150.185] b0 10 77   Chn# 1  CC# 16 = 119
[9150.191] b0 10 78   Chn# 1  CC# 16 = 120
[9150.193] b0 10 7a   Chn# 1  CC# 16 = 122
[9150.203] b0 10 7b   Chn# 1  CC# 16 = 123
[9150.207] b0 10 7c   Chn# 1  CC# 16 = 124
[9150.214] b0 10 7d   Chn# 1  CC# 16 = 125
[9150.217] b0 10 7e   Chn# 1  CC# 16 = 126

 

Link to comment
Share on other sites

Got it all running, used 3 buttons and two displays and a single fader, the code works really nicely and I got to grips with it finally, this is good as I will need multiple functions to map rather than have too fit individual parts everywhere!

Code:

RESET_HW

LCD "%C@(1:1:1)Bank Test"

# Controlled from buttons

# select Bank1 directly
EVENT_BUTTON id=1 type=Meta meta=SetBank button_mode=OnOnly range=1:1

# For testing purposes: decrement bank
EVENT_BUTTON id=2 type=Meta meta=DecBank button_mode=OnOnly

# For testing purposes: increment bank
EVENT_BUTTON id=3 type=Meta meta=IncBank button_mode=OnOnly

# For testing purposes: cycle bank
EVENT_BUTTON id=4 type=Meta meta=CycleBank button_mode=OnOnly

# Bank 1
EVENT_AINSER id=1 hw_id =1 bank=1 fwd_to_lcd=1 type=CC chn=1 cc=16 range=0:127 offset=0 lcd_pos=2:1:1 label="FDR1 #%3i %3d@(2:1:2)%B"

#Bank 2
EVENT_AINSER id=1 hw_id =1 bank=2 fwd_to_lcd=1 type=CC chn=1 cc=17 range=0:127 offset=0 lcd_pos=2:1:1 label="FDR2 #%3i %3d@(2:1:2)%B"


# AIN hardware
AIN enable_mask=00000000


# AINSER hardware
AINSER n=1   enabled=1  muxed=1  cs=0  num_pins=1  resolution=7bit
AINSER n=2   enabled=0  muxed=1  cs=1  num_pins=0  resolution=7bit

# EVENTs
#EVENT_AINSER id= 1 type=CC chn= 1 cc= 16 range= 0:127 offset= 0 ports=1000100000001000 lcd_pos=2:1:1 label="^std_ain"

Link to comment
Share on other sites

Question

using the code above i edited to add banked leds.

from this:

# Bank 1
EVENT_AINSER id=1 hw_id =1 bank=1 fwd_to_lcd=1 type=CC chn=1 cc=16 range=0:127 offset=0 lcd_pos=2:1:1 label="FDR1 #%3i %3d@(2:1:2)%B"

#Bank 2
EVENT_AINSER id=1 hw_id =1 bank=2 fwd_to_lcd=1 type=CC chn=1 cc=17 range=0:127 offset=0 lcd_pos=2:1:1 label="FDR2 #%3i %3d@(2:1:2)%B"

 

To this:

# Bank 1
EVENT_AINSER id=1 hw_id =1 bank=1 fwd_to_lcd=1 fwd_id=LED:1 fwd_to type=CC chn=1 cc=16 range=0:127 offset=0 lcd_pos=2:1:1 label="FDR1 #%3i %3d@(2:1:2)%B"

#Bank 2
EVENT_AINSER id=1 hw_id =1 bank=2 fwd_to_lcd=1 fwd_id=LED:2 type=CC chn=1 cc=17 range=0:127 offset=0 lcd_pos=2:1:1 label="FDR2 #%3i %3d@(2:1:2)%B"

However this just lit the led when the fader was moved and remained on when the bank was changed and then the other led came on and stayed on, not what i wanted.

What i want is that when you press the bank buttons if you are on bank 1 then the led for bank one i9s lit, when you press the increment button to goto bank 2 led 1 goes out and led 2 for bank 2 come on press increment again and bank 3 led comes on and 2 goes out.

how would i go about this?

would i define an EVENT_LED id=1 and add functions to that or would i use a map?

 

Thanks

Link to comment
Share on other sites

there isn't any real info on how I can do this,

I have the bank code written and working yet don't seem to be able to assign a single led to a bank to show its active and then turn off when another bank is selected and that bank's led comes on.

I have tried multiple versions of adapted code and do not seem to be getting anywhere.

Searching the forum is hard work as it keeps erroring and not completing the search.

I am going to try something in the .NGR script but even so I don't think that is the answer.

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