Home NetLinx Studio

Strange problem - help needed...

adysadys Junior MemberPosts: 395
Hi all

I am after 2 days of debugging, and I can't find whats wrong in my program.

I have 3 simple buttons, port 20 channels 851,852,853

no matter what I do, I get them on/off

and its worked before, something happened in my system (not code changes)

I am checking the on state in TPDesign, its working.

But even with "control device" from the netlinx I cant make it work...

this mechanism is the heart of my home control (choosing Flores) and I don't know what to do... I tired to change the channels, not helping.

this is the code:


BUTTON_EVENT[tpList, FLOOR_BASE_BUTTON_LISTEN]
{

PUSH:
{

DEV Panel
Panel = tpList[get_last(tpList)]


on[Panel, FLOOR_BASE_BUTTON_LISTEN]
off[Panel, FLOOR_GROUND_BUTTON_LISTEN]
off[Panel, FLOOR_UPPER_BUTTON_LISTEN]
off[Panel, FLOOR_GARDEN_BUTTON_LISTEN]



SEND_COMMAND Panel,"'@PPN-Map House Base Listen'" // show popup

} // END OF - PUSH


}

The debugger is getting to this code!
from the same button that i am trying to turn on...

I added the code :

[Panel, FLOOR_BASE_BUTTON_LISTEN] = 1
[Panel, FLOOR_GROUND_BUTTON_LISTEN] = 1
[Panel, FLOOR_UPPER_BUTTON_LISTEN] = 1
[Panel, FLOOR_GARDEN_BUTTON_LISTEN] = 1

not helping...

I tried "panelList" instead of Panel - not helping...

the notification windows give me that:

Line 8 (20:27:23):: Input Status:Pushed [10007:20:6] - Channel 851
Line 9 (20:27:23):: Command To [10007:20:6]-[@PPN-Map House Upper Listen]
Line 10 (20:27:23):: Input Status:Released [10007:20:6] - Channel 851



and I don't get the turn on channels command...

But the popup page is changing to the appropriate page...

Whats is going on here??

I am getting crazy...


Any help will be appreciated.

Thanks

Ady.

Comments

  • Jimweir192Jimweir192 Junior Member Posts: 502
    I didn't quite follow, but have you increased your Panel Array channel count above the 256 default limit using SET_VIRTUAL_CHANNEL_COUNT

    I think that the Panel Array, tplist, would be treated as a virtual, but I could be wide of the mark here...

    Try SET_VIRTUAL_CHANNEL_COUNT (tplist,1024) in the online data event

    HTH
  • Spire_JeffSpire_Jeff Formerly Caffeinated Programmer Posts: 1,917
    Have you set the virtual level count accordingly? I'm not sure if this is the culprit, but you could verify this by dropping the channel numbers below 255 and see if it works there.

    Jeff
  • adysadys Junior Member Posts: 395
    I added it, it does not helping...

    Its for the tps, does not matter the port I am setting, right?

    SET_VIRTUAL_CHANNEL_COUNT (Panel,1024)


    very strange.

    I moved the buttons a bit to see if I am loading the page I am thinking, and now -

    some of the tps are working, some are not.

    I removed user pages, load them all, I am getting the low memory message.
    after that, loading them with smart transfer on is loading them ok, but still some of them are working and some are not... even I treat all of them the same...

    I am after 14 hours on this bug, and I don't know what to do...
  • adysadys Junior Member Posts: 395
    I undestand now, that sometimes I have this problem in the max module too.

    the browse windows list is not changing its states upon selection...

    after rebooting the controller and then the TP, its ok..

    Maybe its the same symptom to the same problem\?
  • richardhermanrichardherman not-so-junior member Posts: 255
    adys wrote:
    I have 3 simple buttons, port 20 channels 851,852,853

    no matter what I do, I get them on/off

    Hello Ady,

    I see that youre using port 20. If you're using a virtual device did you use SET_VIRTUAL_PORT_COUNT (tpList,20) ? virtual devices have default only one port.

    If this works you may thank Auser, who triggered this idea in another thread

    Regards

    Richard
  • adysadys Junior Member Posts: 395
    Hello Ady,

    I see that youre using port 20. If you're using a virtual device did you use SET_VIRTUAL_PORT_COUNT (tpList,20) ? virtual devices have default only one port.

    If this works you may thank Auser, who triggered this idea in another thread

    Regards

    Richard

    Thanks


    I don't undestand this part...

    this is not a virtual device, its a Device. Its a list of panel devices declared like this:


    // my touch panel devices
    dvTPStudyRoom = 10001:20:1
    dvTPFamilyRoom = 10002:20:2
    dvTPKitchenRoom = 10006:20:2
    dvTPGymRoom = 10003:20:3
    dvTPJaccuziRoom = 10005:20:3
    dvTPBedRoom = 10004:20:4
    dvTPSalonRoom = 10007:20:6
    dvTPEntranceRoom = 10008:20:6
    dvTPBillYardRoom = 10009:20:9
    dvTPCinemaRoom = 10010:20:10



    // Touch panel devices
    DEV tpList[TP_MAX] =
    {
    dvTPStudyRoom,
    dvTPFamilyRoom,
    dvTPKitchenRoom,
    dvTPGymRoom,
    dvTPJaccuziRoom,
    dvTPBedRoom,
    dvTPSalonRoom,
    dvTPEntranceRoom,
    dvTPBillYardRoom,
    dvTPCinemaRoom
    }


    So do I need to set the virtual device count or not?
  • viningvining X Member Posts: 4,364
    I just discovered a similar situation on my house system. I haven't done any recent firmware updates or anything but it's possible this has been an issue for a while and I just haven't noticed it until now.

    Like Adys these are normal devices and as in a previous thread it is again for HomeWorks. I guess cuz not to much else needs over 1240 channels like this code uses.

    My first thought was this or another recent thread and the need to SET_VIRTUAL_CHANNEL_COUNT but since these aren't virtuals I figured I'd try something else.

    I'm using a TP device array and a button array in my DEFINE_EVENT with a GET_LAST after the push. Buttons as high as 708 seem to work but since I don't have more button higher before the next group of higher button I don't know where the cut off is. The button in the next higher group starting at 1093 don't work. If I enable the Push message display in NS2 they display but nothing in notifications. Hmmm?

    GET_LAST? Always seemed to work before and this code is several years old and use to work so I change the button event from the original (use to work/now non working):
    BUTTON_EVENT [dvHWI_TPArray,nHWI_BTN_ARRAY]
         
         {
         PUSH:
    	  {   
    	  stack_var integer B ;
    	  stack_var integer n ;
    	  
    	   
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY)  
    	  SELECT
    	       {
    	    ACTIVE (nHWIBtn == 2):{send_string dvHWI, "'VMP',13"}
    	    ACTIVE (nHWIBtn == 3):{send_string dvHWI, "'VMR',13"}
    	    ACTIVE (nHWIBtn == 4):{send_string dvHWI, "'VMD',13"}
    	    ACTIVE (nHWIBtn == 5): // lower for phantom scene buttons  L232> LOWERDIM, [1:1:0:2:3]
    		{
    		if(sHWI_Dimmers[nHWI_ActiveRoom].nDLevel >= 1)
    		    {
    		    SELECT
    			{
    			active (nHWI_ActiveRoom >= 1 && nHWI_ActiveRoom <= 48)://H48 Dimmers (48)
    			    {
    			    send_string dvHWI, "'LOWERDIM, [1:4:1:',sHWI_Dimmers[nHWI_ActiveRoom].cDimmer,' 1',13"
    			    }
    			active (nHWI_ActiveRoom >= 49 && nHWI_ActiveRoom <= 96)://Q96 Sivoia Shades (only 32) maybe use for added MI's or H48 
    			    {
    
    to (works):
    BUTTON_EVENT [dvHWI_TPArray,0]//nHWI_BTN_ARRAY
         
         {
         PUSH:
    	  {   
    	  stack_var integer B ;
    	  stack_var integer n ;
    	  
    	   
    	  //nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) 
    	  nHWIBtn = BUTTON.INPUT.CHANNEL 
    	  SELECT
    	       {
    	    ACTIVE (nHWIBtn == 2):{send_string dvHWI, "'VMP',13"}
    	    ACTIVE (nHWIBtn == 3):{send_string dvHWI, "'VMR',13"}
    	    ACTIVE (nHWIBtn == 4):{send_string dvHWI, "'VMD',13"}
    	    ACTIVE (nHWIBtn == 5): // lower for phantom scene buttons  L232> LOWERDIM, [1:1:0:2:3]
    		{
    		if(sHWI_Dimmers[nHWI_ActiveRoom].nDLevel >= 1)
    		    {
    		    SELECT
    			{
    			active (nHWI_ActiveRoom >= 1 && nHWI_ActiveRoom <= 48)://H48 Dimmers (48)
    			    {
    			    send_string dvHWI, "'LOWERDIM, [1:4:1:',sHWI_Dimmers[nHWI_ActiveRoom].cDimmer,' 1',13"
    			    }
    			active (nHWI_ActiveRoom >= 49 && nHWI_ActiveRoom <= 96)://Q96 Sivoia Shades (only 32) maybe use for added MI's or H48 
    			    {
    			    send_string dvHWI, "'LOWERDIM, [1:4:2:',sHWI_Dimmers[nHWI_ActiveRoom].cDimmer,' 1',13"
    			    }
    

    So it appears to be something in the GET_LAST function or my button array itself, but the array looks fine all 1240 entries w/o any missing blocks or commas out of place. Is it possible the GET_LAST function was changed in a recent firmware upgrade or maybe the compiler changed in the way it compiles it?

    It appears at least in my case setting virtual counts aren't going to help cuz the system sees the pushes, it just doesn't make it through the GET_LAST.

    Hmmm!!
  • viningvining X Member Posts: 4,364
    Unless maybe GET_LAST uses the channel count as a max array count at which point it exits the loop that checks the array for matches.
  • Joe HebertJoe Hebert Junior Member Posts: 2,158
    vining wrote:
    Like Adys these are normal devices and as in a previous thread it is again for HomeWorks. I guess cuz not to much else needs over 1240 channels like this code uses.
    ...
    I'm using a TP device array and a button array in my DEFINE_EVENT with a GET_LAST after the push. Buttons as high as 708 seem to work but since I don't have more button higher before the next group of higher button I don't know where the cut off is. The button in the next higher group starting at 1093 don't work. If I enable the Push message display in NS2 they display but nothing in notifications. Hmmm?
    How many TPs are in the DEV array? There is (or at least there was) a limitation of 4000 triggers per EVENT (BUTTON, CHANNEL or LEVEL) So if there are 1240 buttons in the INTEGER array and 4 or more TPs in the DEV array, the event table limit will be exceeded.

    Given
    DEV TPs[x] = {tp1,tp2,tpx}
    INTEGER Buttons[y] = {1,2,y}
    BUTTON_EVENT[TPs,Buttons]

    x * y must be <= 4000
  • viningvining X Member Posts: 4,364
    Joe Hebert wrote:
    There is (or at least there was) a limitation of 4000 triggers per EVENT (BUTTON, CHANNEL or LEVEL)
    What constitutes a trigger? It's seem that counting every button as a trigger would impose a serious limitation to the system. 10 TPs x 401 buttons, etc. These numbers aren't to high to be expected on a regular basis. Maybe 4 x 1240 is but 10 x 401 isn't.

    To answer your question though I have 4 TPs presently which would put me over the limit. So what's the work around if this is the problem. I could leave it the way it is [dvTPArry,0] but if I recall there are hold issues or something using the 0.
  • Joe HebertJoe Hebert Junior Member Posts: 2,158
    vining wrote:
    What constitutes a trigger? It's seem that counting every button as a trigger would impose a serious limitation to the system. 10 TPs x 401 buttons, etc.
    That?s the way it?s counted. Every panel * every button counts towards the 4000 max per event.
    vining wrote:
    So what's the work around if this is the problem
    Two possible ways are to either split up the DEV array or to split up the channel array.

    So instead of doing this:
    BUTTON_EVENT[[b]dvTPs[/b],nLightButtons] {
    
       PUSH: {
    
       }
    }
    
    

    You can do this:
    BUTTON_EVENT[[b]dvTP1[/b],nLightButtons] {
    
       PUSH: {
    
       }
    }
    
    BUTTON_EVENT[[b]dvTP2[/b],nLightButtons] {
    
       PUSH: {
    
       }
    }
    
    etc.
    

    or this:
    BUTTON_EVENT[dvTPs,[b]nHalfOfTheLightButtons[/b]] {
    
       PUSH: {
    
       }
    }
    
    BUTTON_EVENT[dvTPs,[b]nTheOtherHalfOfTheLightButtons[/b]] {
    
       PUSH: {
    
       }
    }
    
    
  • DHawthorneDHawthorne Junior Member Posts: 4,584
    vining wrote: »
    Joe Hebert wrote:

    What constitutes a trigger? It's seem that counting every button as a trigger would impose a serious limitation to the system. 10 TPs x 401 buttons, etc. These numbers aren't to high to be expected on a regular basis. Maybe 4 x 1240 is but 10 x 401 isn't.

    To answer your question though I have 4 TPs presently which would put me over the limit. So what's the work around if this is the problem. I could leave it the way it is [dvTPArry,0] but if I recall there are hold issues or something using the 0.

    It's not a total limit of 4000 event triggers, it's 4000 per event table. Yes, every button counts, but it should be rare that you are putting every single button in the project in the same BUTTON_EVENT.
  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    DHawthorne wrote: »
    It's not a total limit of 4000 event triggers, it's 4000 per event table. Yes, every button counts, but it should be rare that you are putting every single button in the project in the same BUTTON_EVENT.

    So, what we're saying is something like this:
    VOLATILE Integer DEV TP_DEV[]=
    {
    10001:01:0,
    10002:01:0,
    10003:01:0,
    10004:01:0,
    10005:01:0
    }
    
    VOLATILE INTEGER TP_BUTTONS[]=
    {
    1,2,3,4,...   ...998,999,1000
    }
    
    
    
    BUTTON_EVENT[TP_DEV,TP_BUTTONS]
    {
    PUSH:
      {
      // DO SOMETHING.
      }
    }
    

    This is 5 touch panels times 1000 buttons for a grand total of 5000 possible button permutations.This is not going to work? How will its 'not working' manifest itself?
  • DHawthorneDHawthorne Junior Member Posts: 4,584
    Correct, your example will not work. Only the "lower" events will fire,the rest will simply do nothing. I'm not sure how the event tables are read into memory, but my guess would be the first four panels would work, and the last one not. However, if all you did was break up your button events so it went like so:

    BUTTON_EVENT[TP_DEV[1], TP_BUTTONS] ...
    BUTTON_EVENT[TP_DEV[2], TP_BUTTONS] ...

    It would be fine.

    I've only had this situation arise once, and it gave me fits until I figured it out ... and I only had a hunch my event table was too big. In that case, I simply broke the button array in half, and all was well. This is one of those cases where you would be well served to call a function from the event rather than putting the code in your PUSH handler. Since I've had that particular problem, I have made it a point not to have huge event arrays, and break them up by function so that I can add panels easily without blowing anything up.
  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    See, now that was my next question. Would this then work. The reason I ask, is I actaully have a couple routines that are approaching this size limit due to the sheer number of touch panels in the system.

    So, would the following work?
    VOLATILE INTEGER TP_BUTTONS[]=
    {
    1,2,3,4,...   ...998,999,1000
    }
    
    
    
    BUTTON_EVENT[10001:01:0,TP_BUTTONS]
    BUTTON_EVENT[10002:01:0,TP_BUTTONS]
    BUTTON_EVENT[10003:01:0,TP_BUTTONS]
    BUTTON_EVENT[10004:01:0,TP_BUTTONS]
    BUTTON_EVENT[10005:01:0,TP_BUTTONS]
    {
    PUSH:
      {
      // DO SOMETHING.
      }
    }
    
  • viningvining X Member Posts: 4,364
    It seemed the most appropriate thing to do was create the a button event for each TP using the exisitng button array and putting the push, hold and release into functions as Dave and Joe suggested.

    This now works fine. It seems the fourth TP just pushed me over the edge and since I haven't yet installed any more than 3 TPs on a job this hasn't been an issue.

    I'll have to keep this in mind now as this will no doubt effect many modules should I start doing larger systems which I'm hoping will eventually happen.

    Thanks Dave, Joe. You guys once again saved me from many bumps and bruises from banging my my head against the wall.
    BUTTON_EVENT [dvTP1_HWI,nHWI_BTN_ARRAY]
         
         {
         PUSH:
    	  { 
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  fnDoHWI_Push(nHWIBtn) ;	 
    	  }
         HOLD [2,REPEAT]:
    	  {
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  if (nHWIBtn == 5 || nHWIBtn == 6)
    	       {
    	       fnDoHWI_Hold(nHWIBtn) ;
    	       }
    	  }
         RELEASE:
    	  {
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  if (nHWIBtn == 5 || nHWIBtn == 6)
    	       {
    	       fnDoHWI_Release() ;
    	       }
    	  }
         }
    
    BUTTON_EVENT [dvTP2_HWI,nHWI_BTN_ARRAY]
         
         {
         PUSH:
    	  { 
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  fnDoHWI_Push(nHWIBtn) ;	 
    	  }
         HOLD [2,REPEAT]:
    	  {
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  if (nHWIBtn == 5 || nHWIBtn == 6)
    	       {
    	       fnDoHWI_Hold(nHWIBtn) ;
    	       }
    	  }
         RELEASE:
    	  {
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  if (nHWIBtn == 5 || nHWIBtn == 6)
    	       {
    	       fnDoHWI_Release() ;
    	       }
    	  }
         }  
    
    BUTTON_EVENT [dvTP3_HWI,nHWI_BTN_ARRAY]
         
         {
         PUSH:
    	  {
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  fnDoHWI_Push(nHWIBtn) ;	 
    	  }
         HOLD [2,REPEAT]:
    	  {
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  if (nHWIBtn == 5 || nHWIBtn == 6)
    	       {
    	       fnDoHWI_Hold(nHWIBtn) ;
    	       }
    	  }
         RELEASE:
    	  {
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  if (nHWIBtn == 5 || nHWIBtn == 6)
    	       {
    	       fnDoHWI_Release() ;
    	       }
    	  }
         } 
    
    BUTTON_EVENT [dvTP4_HWI,nHWI_BTN_ARRAY]
         
         {
         PUSH:
    	  {
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  fnDoHWI_Push(nHWIBtn) ;	 
    	  }
         HOLD [2,REPEAT]:
    	  {
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  if (nHWIBtn == 5 || nHWIBtn == 6)
    	       {
    	       fnDoHWI_Hold(nHWIBtn) ;
    	       }
    	  }
         RELEASE:
    	  {
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  if (nHWIBtn == 5 || nHWIBtn == 6)
    	       {
    	       fnDoHWI_Release() ;
    	       }
    	  }
         }
    
  • DHawthorneDHawthorne Junior Member Posts: 4,584
    ericmedley wrote: »
    See, now that was my next question. Would this then work. The reason I ask, is I actaully have a couple routines that are approaching this size limit due to the sheer number of touch panels in the system.

    So, would the following work?
    VOLATILE INTEGER TP_BUTTONS[]=
    {
    1,2,3,4,...   ...998,999,1000
    }
    
    
    
    BUTTON_EVENT[10001:01:0,TP_BUTTONS]
    BUTTON_EVENT[10002:01:0,TP_BUTTONS]
    BUTTON_EVENT[10003:01:0,TP_BUTTONS]
    BUTTON_EVENT[10004:01:0,TP_BUTTONS]
    BUTTON_EVENT[10005:01:0,TP_BUTTONS]
    {
    PUSH:
      {
      // DO SOMETHING.
      }
    }
    

    I haven't tried it .. I would assume that they are separate events in that case and would be OK; it's just a shortcut syntax. But I think you would have to try it and see.
  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    DHawthorne wrote: »
    I haven't tried it .. I would assume that they are separate events in that case and would be OK; it's just a shortcut syntax. But I think you would have to try it and see.


    I'm going to take a chance and say it does work. I have Lutorn HomeWorks module I wrote that will accomodate upto 200 Keypads and 25 buttons each. The button address on the touch panel determine which light button you're addressing. I use all the buttons on 1 port of the touch panels strictly for this module (port 5 for those playing the home game...)

    I quite often have 10 or more touch Modero touch panels and if I use other things like CP4As or other G3 type devices, I then map them to a viurtual device and map it to the Lutron module.

    I can have 20-30 TPs (virutal or real) all addressing the 3999 buttons at my disposal. I wirte the button_event as I've described.
    BUTTON_EVENT[DEV_TP_1_5,HWI_BUTTONS]
    BUTTON_EVENT[TP_2_5,HWI_BUTTONS]
    BUTTON_EVENT[TP_3_5,HWI_BUTTONS]
    BUTTON_EVENT[TP_4_5,HWI_BUTTONS]
    ...
    BUTTON_EVENT[vdvTP_11_5,HWI_BUTTONS]
    {
    PUSH:
      {
      // DO THE LIGHTS
      }
    }
    

    While I've never had that many keypads to deal with yet, I just tested a system and using the emulator pushed one of those top keypads. The module did fire and sent the correct command. (obviously, it was erroneous since there was no keypad really there to fire.) This worked for both the highest button numbers and the remotes address of touch panel.

    interesting...
  • viningvining X Member Posts: 4,364
    ericmedley wrote:
    I'm going to take a chance and say it does work.
    It seems to work fine. Since only one one event is actually triggered the event table is just filled with the buttons for the TP which triggered it, the program falls through the rest of the button events and executes the code when it reaches the first brace. It does shorten things up a bit and doing it this way you allows you to leave all the push, hold and release code under the events and not use functions.
    BUTTON_EVENT [dvTP1_HWI,nHWI_BTN_ARRAY]
    BUTTON_EVENT [dvTP2_HWI,nHWI_BTN_ARRAY]
    BUTTON_EVENT [dvTP3_HWI,nHWI_BTN_ARRAY]
    BUTTON_EVENT [dvTP4_HWI,nHWI_BTN_ARRAY]
         
         {
         PUSH:
    	  {
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  fnDoHWI_Push(nHWIBtn) ;	 
    	  }
         HOLD [2,REPEAT]:
    	  {
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  if (nHWIBtn == 5 || nHWIBtn == 6)
    	       {
    	       fnDoHWI_Hold(nHWIBtn) ;
    	       }
    	  }
         RELEASE:
    	  {
    	  STACK_VAR INTEGER nHWIBtn ;
    	  
    	  nHWIBtn = GET_LAST(nHWI_BTN_ARRAY) ;
    	  if (nHWIBtn == 5 || nHWIBtn == 6)
    	       {
    	       fnDoHWI_Release() ;
    	       }
    	  }
         }
    
  • viningvining X Member Posts: 4,364
    A few more questions regarding EVENT_TABLEs.

    6 touch panels
    1001 buttons for this particular device port

    System MAX of 4000 triggered events per event table.

    Events = #TPs per EVENT_TABLE * number of buttons per EVENT TABLE.
    DEFINE_CONSTANT
    
    HWI_NUM_BUTTONS		= 1001 ;
    
    DEFINE_VARIABLE
    
    VOLATILE INTEGER nHWI_BTN_ARRAY[HWI_NUM_BUTTONS] ;
    
    DEV dvHWI_TPArray [] = {dvTP_HWI_1,dvTP_HWI_2,dvTP_HWI_3,dvTP_HWI_4,dvTP_HWI_5,dvTP_HWI_6} 
    
    DEFINE_START  //initialize button array
    
         {
         STACK_VAR INTEGER i ;
         
         for( i = 1 ; i <= HWI_NUM_BUTTONS ; i ++)
    	  {
    	  nHWI_BTN_ARRAY[i] = i ;
    	  }
         SET_LENGTH_ARRAY(nHWI_BTN_ARRAY,HWI_NUM_BUTTONS) ;// not really needed
         }
    

    In this scenario the code below is probably the best way to handle this with each event table consisting of 1001 possible event triggers.
    BUTTON_EVENT[dvTP_HWI_1,nHWI_BTN_ARRAY] 
    BUTTON_EVENT[dvTP_HWI_2,nHWI_BTN_ARRAY]
    BUTTON_EVENT[dvTP_HWI_3,nHWI_BTN_ARRAY]
    BUTTON_EVENT[dvTP_HWI_4,nHWI_BTN_ARRAY]
    BUTTON_EVENT[dvTP_HWI_5,nHWI_BTN_ARRAY]
    BUTTON_EVENT[dvTP_HWI_6,nHWI_BTN_ARRAY]     
         
         {
         PUSH:
    	  {
    	  //code
    	  }
         HOLD [2,REPEAT]:
    	  {
    	  //code
    	  }
         RELEASE:
    	  {
    	  //code
    	  }
         }
    

    This won't work since we have 7 TP in the EVENT TABLE * 1001 buttons which equals 7007 possible event triggers. The 1st 3 panels will work completely, the 4th panel will work up to button 997 and the last 2 panels shouldn't work at all. Of course that might not be exactly what happens but something close. Maybe when the event table is created it gets divided equeally with all getting 666 possible triggers.
    BUTTON_EVENT[dvHWI_TPArray,nHWI_BTN_ARRAY]     
         
         {
         PUSH:
    	  {
    	  //code
    	  }
         HOLD [2,REPEAT]:
    	  {
    	  //code
    	  }
         RELEASE:
    	  {
    	  //code
    	  }
         }
    

    Now what happens if you use "0" the catch all type of event? Does the use of 0 mean the event table is created for the total possible event triggers.

    If you had 1 TP you could have 4000 event triggers and you could catch all button numbers up to 4000.

    If you had 2 TPs the system would create 2000 event triggers and you could catch all button numbers up to 2000.

    If you had 6 TPs the system would create 666 event triggers and you could catch all button numbers up to 666.

    How exactly would this work? Like I described or something else?

    Would each of these event table be maxed at 4000 and subsequently use all those resources.
    BUTTON_EVENT[dvTP_HWI_1,0] 
    BUTTON_EVENT[dvTP_HWI_2,0]
    BUTTON_EVENT[dvTP_HWI_3,0]
    BUTTON_EVENT[dvTP_HWI_4,0]
    BUTTON_EVENT[dvTP_HWI_5,0]
    BUTTON_EVENT[dvTP_HWI_6,0]     
         
         {
         PUSH:
    	  {
    	  //code
    	  }
         HOLD [2,REPEAT]:
    	  {
    	  //code
    	  }
         RELEASE:
    	  {
    	  //code
    	  }
         }
    

    Would this have similar issues as before but possibly only the 1st panel working using all 4000 events or would they each get 666 events each. Hows does it work?
    BUTTON_EVENT[dvHWI_TPArray,0]     
         
         {
         PUSH:
    	  {
    	  //code
    	  }
         HOLD [2,REPEAT]:
    	  {
    	  //code
    	  }
         RELEASE:
    	  {
    	  //code
    	  }
         }
    
Sign In or Register to comment.