Keeze

[Newbie] Rotary encoder confusion

7 posts in this topic

Hello,

Just started with Midibox. First, I want to build a controller for controlling various CC parameters in my VST's. Got the first kits from Smashtv an soldered everything together.

Burned the bootloader to the CORE_STM32F4 Module and loaded the Midibox NG app.

Connected a DIN and a small LED display to the CORE_STM32F4 Module.

 

First test: print "Hello World" to LCD ...works...
Second test: Connect a button ...works...
Now it is time to connect a Rotary encoder...
All seems to work.

With the following small program:

RESET_HW
LCD "%CEncoder Values"
# Hardware configuration
ENC n=1 sr= 1 pins=0:1 type=detented1
# Events
EVENT_ENC id=1 fwd_to_lcd=1 type=CC chn= 1 cc= 16 range=0:127 lcd_pos=1:1:1 label="^std_enc"

I get the folowing output in the debug-screen:

[1934162.881] MBNG_ENC_NotifyChange(1, 1)
[1934162.882] [EVENT] id=ENC:1 hw_id=ENC:1 bank=0 fwd_id=DISABLED:0 type=CC value=1 label=^std_enc
[1934163.305] MBNG_ENC_NotifyChange(1, -1)
[1934163.305] [EVENT] id=ENC:1 hw_id=ENC:1 bank=0 fwd_id=DISABLED:0 type=CC value=1 label=^std_enc
[1934163.466] MBNG_ENC_NotifyChange(1, -1)
[1934163.466] [EVENT] id=ENC:1 hw_id=ENC:1 bank=0 fwd_id=DISABLED:0 type=CC value=0 label=^std_enc
[1934163.650] MBNG_ENC_NotifyChange(1, -1)
[1934163.651] [EVENT] id=ENC:1 hw_id=ENC:1 bank=0 fwd_id=DISABLED:0 type=CC value=0 label=^std_enc

The LCD outputs only a 0 or a 1. What am I doing wrong that the value does not increment or decrement? When I slide the CC16 slider in the virtual keyboard, the LCD takes over the correct value. And as soon as i touch the encoder the values flip back to 1 or 0.

When I set the range to a map the values on the LCD show the values from the map correct and increment en decrement correctly.

I hope that someone can shed some light on this subject... ;)

Cheers,
Kees

Edited by Keeze

Share this post


Link to post
Share on other sites

Hi Keeze

I don't see a fwd_id in your config and the output seams to Disable it somehow. I don't know if that is the problem, but maybe you can add a fwd_id to test.

RESET_HW
LCD "%CEncoder Values"
# Hardware configuration
ENC n=1 sr= 1 pins=0:1 type=detented1
# Events
EVENT_ENC id=1 fwd_id=881 fwd_to_lcd=1 type=CC chn= 1 cc= 16 range=0:127 lcd_pos=1:1:1 label="^std_enc"

fwd_id can be anything you don't already use... this sample = 881

Regards, Novski

Share this post


Link to post
Share on other sites

Hello Novski,

Tnx for your reply!
I added the suggested fwd_id, but than the program stucks saying:

[11261.264] AUTOLOAD 'ENC'
[11261.264] [MBNG_FILE_C:6] ERROR: invalid fwd_id controller name in EVENT_ENC ... fwd_id=123
[11261.264] [MBNG_FILE_C] Event Pool Number of Items: 0
[11261.264] [MBNG_FILE_C] Event Pool Allocation: 12 of 65536 bytes (0%)
[11261.275] Patch 'ENC' loaded from SD Card!
[11261.278] [MBNG_FILE_R] /ENC.NGR (optional run script) not found

Cheers,
Kees

Share this post


Link to post
Share on other sites

I could be completely wrong (I am not a C-coder), but in lines 233 - 247 of mbng_enc.c I find:

     s32 value = item.value;
     if( item.min <= item.max ) {
       value = event_incrementer;
       if( value < item.min )
         value = item.min;
       else if( value > item.max )
         value = item.max;
     } else {
       // reversed range
       value = event_incrementer;
       if( value < item.max )
         value = item.max;
       else if( value > item.min )
         value = item.min;
     }

so value is replaced by event_incrementer and not added? Or am I completely wrong...

value = event_incrementer; vs value += event_incrementer;

...

Digging further..

Kees

Share this post


Link to post
Share on other sites

Good find, thanks for the information! :)

This bug came in with the changes for interpolation maps.

It's fixed in this pre-release: http://www.ucapps.de/mios32/midibox_ng_v1_035_pre2.zip

Could you please check if it works at your side? Then I will publish the "final v1.035" at my webpage

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

Hi Thorsten,

I confirm that this issue is solved! All works great, a big thanks from Holland! :-)

Keep up the good work!
Cheers,

Kees

Share this post


Link to post
Share on other sites

Great! :)

V1.035 is now officially released.

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now