slo Posted January 13, 2023 Report Share Posted January 13, 2023 Noob here trying to come up with a scheme to display past values alongside current active values from an encoder. The code below demonstrates the problem I'm having. Setting encoder 1 in bank 2 and then switching back between banks produces the desired result, but in bank 1 it looks like the past value is getting over written so encoder 1 bank 1 is not displayed. Using a SSD 1306 display. Below is the .ngc ,ngr .ngl I need a better scheme or hints to the path forward. Thanks. RESET_HW LCD "%C@(9:1:1)GLCD Test" #increments/decrements the bank EVENT_ENC id=65 hw_id= 65 type=Meta meta=SetBank range=1:2 meta=RunSection:1 #This is a dummy LED without assigned hardware (hw_id=2000 not used anywhere else) and without MIDI event. #the purpose of this EVENT item is to print the bank whenever the LCD is refreshed EVENT_LED id=2000 fwd_to_lcd=1 lcd_pos=9:17:1 label="Bank%q" ###Bank 1 EVENT_ENC id=1 hw_id=1 bank= 1 fwd_id=LED_MATRIX:1 LED_MATRIX_PATTERN n= 1 range= 16:122 type= cc chn=1 cc= 20 lcd_pos=1:1:2 label="&bOSC1 Ran@(1:6:6)&b^range " EVENT_ENC id=2 hw_id=2 bank= 1 fwd_id=LED_MATRIX:2 LED_MATRIX_PATTERN n= 1 range= 0:127 type= cc chn=1 cc= 21 lcd_pos=1:1:2 label="&bLFO Rate@(1:6:6)&b ^volume" ###Bank 2 EVENT_ENC id=17 hw_id=1 bank= 2 fwd_id=LED_MATRIX:1 LED_MATRIX_PATTERN n= 1 range= 16:122 type= cc chn=1 cc= 32 lcd_pos=1:1:2 label="&bOSC2 Ran@(1:6:6)&b^range " ###Inactive encoders bank 2 EVENT_ENC id=4001 hw_id=2 bank= 2 fwd_id=LED_MATRIX:2 LED_MATRIX_PATTERN n= 4 value= 64 ###print past values EVENT_LED id=1001 bank= 1 fwd_to_lcd=1 lcd_pos=1:1:6 label="&b^range " EVENT_LED id=1002 bank= 1 fwd_to_lcd=1 lcd_pos=1:1:6 label="&b^volume" EVENT_LED id=1017 bank= 2 fwd_to_lcd=1 lcd_pos=1:1:6 label="&b^range " # encoder hardware configuration ENC n= 1 sr= 1 pins=0:1 type=non_detented ENC n= 2 sr= 1 pins=2:3 type=non_detented ENC n= 65 sr= 6 pins=0:1 type=non_detented # LEDring configuration # NOTE: with ULN2803 based transistor arrays we've to invert the selection lines! # -> inverted=1 # if you don't use these arrays, please set inverted=0 DOUT_MATRIX n= 1 rows=16 inverted=1 sr_dout_sel1= 1 sr_dout_sel2= 2 sr_dout_r1= 3 sr_dout_r2= 4 sr_dout_g1= 0 sr_dout_g2= 0 sr_dout_b1= 0 sr_dout_b2= 0 # modified ledring patterns for 16 LEDs # LED_MATRIX_PATTERNs LED_MATRIX_PATTERN n= 1 pos= 0 pattern=1000000000000000 LED_MATRIX_PATTERN n= 1 pos= 1 pattern=1100000000000000 LED_MATRIX_PATTERN n= 1 pos= 2 pattern=1110000000000000 LED_MATRIX_PATTERN n= 1 pos= 3 pattern=1111000000000000 LED_MATRIX_PATTERN n= 1 pos= 4 pattern=1111100000000000 LED_MATRIX_PATTERN n= 1 pos= 5 pattern=1111110000000000 LED_MATRIX_PATTERN n= 1 pos= 6 pattern=1111111000000000 LED_MATRIX_PATTERN n= 1 pos= 7 pattern=1111111100000000 LED_MATRIX_PATTERN n= 1 pos= M pattern=1111111110000000 LED_MATRIX_PATTERN n= 1 pos= 8 pattern=1111111110000000 LED_MATRIX_PATTERN n= 1 pos= 9 pattern=1111111111000000 LED_MATRIX_PATTERN n= 1 pos=10 pattern=1111111111100000 LED_MATRIX_PATTERN n= 1 pos=11 pattern=1111111111110000 LED_MATRIX_PATTERN n= 1 pos=12 pattern=1111111111111000 LED_MATRIX_PATTERN n= 1 pos=13 pattern=1111111111111100 LED_MATRIX_PATTERN n= 1 pos=14 pattern=1111111111111110 LED_MATRIX_PATTERN n= 1 pos=15 pattern=1111111111111111 LED_MATRIX_PATTERN n= 4 pos= 0 pattern=0111110000000000 LED_MATRIX_PATTERN n= 4 pos= 1 pattern=0111110000000000 LED_MATRIX_PATTERN n= 4 pos= 2 pattern=0111110000000000 LED_MATRIX_PATTERN n= 4 pos= 3 pattern=0111110000000000 LED_MATRIX_PATTERN n= 4 pos= 4 pattern=0000000000000000 LED_MATRIX_PATTERN n= 4 pos= 5 pattern=0000000000000000 LED_MATRIX_PATTERN n= 4 pos= 6 pattern=0000000000000000 LED_MATRIX_PATTERN n= 4 pos= 7 pattern=0000000000000000 LED_MATRIX_PATTERN n= 4 pos= M pattern=0000000000000000 LED_MATRIX_PATTERN n= 4 pos= 8 pattern=0000000000000000 LED_MATRIX_PATTERN n= 4 pos= 9 pattern=0000000000000000 LED_MATRIX_PATTERN n= 4 pos=10 pattern=0000000000000000 LED_MATRIX_PATTERN n= 4 pos=11 pattern=0000000000000000 LED_MATRIX_PATTERN n= 4 pos=12 pattern=0000000000111110 LED_MATRIX_PATTERN n= 4 pos=13 pattern=0000000000111110 LED_MATRIX_PATTERN n= 4 pos=14 pattern=0000000000111110 LED_MATRIX_PATTERN n= 4 pos=15 pattern=0000000000111110 ################################################## ###Note that ^section == 0 is called after boot### #### Section 0 #### if ^section == 0 log "running section0" #initialize all banks to 1 log "call bank 1 for all parameters" set ^bank 1 exec_meta RunSection:1 exit endif ##################################### ### Store encoder values bank 1 ### if ^bank == 1 LOG "First Bank" set LED:1001 ENC:1 set LED:1002 ENC:2 ##################################### ### Store encoder values bank 2 ### elsif ^bank == 2 LOG "Second Bank" set LED:1017 ENC:1 endif exit COND_LABEL range COND <30 "Lo " COND <50 "32'" COND <75 "16'" COND <100 "8'" COND <110 "4'" COND <122 "2'" COND_ELSE "2'" COND_LABEL volume COND <5 "0 " COND <10 "1 " COND <21 "2 " COND <43 "3 " COND <50 "4 " COND <64 "5 " COND <75 "6 " COND <85 "7 " COND <106 "8 " COND <112 "9 " COND <127 "10" COND_ELSE "10" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.