Sync bargraphs on multible panels

bia@jdm.dk[email protected] Junior MemberPosts: 20
Hi guys

I have a seies of bargraphs running, to control floorheat valves.

All my touch panels on the project are grouped as ALLTP:

DEV ALLTP[] = {TP1,TP2,TP3,TP4}


This is my code for one of the bargraphs:

LEVEL_EVENT[ALLTP,1] // READ THE LEVEL OF THE BARGRAPH
{
BARGRAPH1 = LEVEL.VALUE // STORE THE LEVEL OF THE BARGRAPH

SEND_LEVEL VAO,1,BARGRAPH1 // UPDATE THE PASSIVE BARGRAPH(1)
}


How do I sync the level on all touch panels - when I change the value on one of them ?

Comments

  • ericmedleyericmedley Senior Member - 3709 Posts Posts: 4,157
    Here's how I would approach it.

    Firstly, when whatever device is sending you feedback on the heat level does so, store that in a non-volatile varialbe. Then, send out that value to all TPs whenever it changes, whenever a TP accesses the page/popup showing these values or whenever a TP comes online after being offline.

    I personally don't bother updating feedback on panels that are not actively showing something. For example, I update all lighting feedback on a panel when the user selects the lighting mode button. I can then sneak in the feedback for individual ones just prior to them looking at a zone. It happens so fast they don't ever see blank or falses values anyway.

    The idea of syncing the fader values is not actually done at the panel level. It happens at the device feedback level.
  • undrtkrundrtkr Junior Member Posts: 35
    DEFINE_CONNECT_LEVEL

    I programmed a 9 room system over the summer. 9 small conference rooms and a main panel in the lobby that can control and monitor all 9 rooms. The first device must be a virtual then all the panels you want to use for that device follow. This allows you to just update the level of the virtual which will then automatically update to the panels tied to that virtual. Worked like a champ.

    Example:
    DEFINE_CONNECT_LEVEL(vdvVol,1,dvPnl1,1,dvPnl2,1,dvPnl3,1)
  • DHawthorneDHawthorne Junior Member Posts: 4,584
    There are three ways to do this I can think of off the top of my head. One is to combine them all in a virtual, and send your feedback to the virtual. I personally don't like that method much because it seems like a waste; you got to dedicate an entire port to it. I only like to do that if a device needs it in the first place. Another way is to put the panels in an array, and send your update to the array. That allows you to use the port for other things, but still sends it out to all of them. The third is make a FOR loop, and send it to each panel in the loop as needed. I generally prefer that method, as it allows me to test if the panel is displaying the page before sending it out. You can also more easily force updates to individual panels because they aren't linked together in any way.

    But situation often determines the method. Just figure out what your choices are and pick the best one for the situation.
  • TurnipTruckTurnipTruck Junior Member Posts: 1,485
    undrtkr wrote: »
    DEFINE_CONNECT_LEVEL
    Example:
    DEFINE_CONNECT_LEVEL(vdvVol,1,dvPnl1,1,dvPnl2,1,dvPnl3,1)

    I would not used any of the connecting or combining functions. I have had strange results with them, especially when devices fall offline. Much of this is left over from the Axcess days.

    When a piece of hardware's level changes, send it to all panels (or those on a certain page)

    When a panel comes online (or flips to a certain page) send it fresh levels
  • viningvining X Member Posts: 4,348
    Here's an example of what I do for level which is vuirtually the same for channels and VT too.

    If I want to send to a specific panel I pass this function the index position of that panel otherwise I send it a constant called "UI_UPDATE_ACTIVE" which equals zero. I have two integer arrays that I use to determine which UI's to send to if I'm going to update all active "on page" UI's.

    The first array tracks when a UI goes on and off page. If on page I sent the UI index position to the instance of the device I'm now on page with and then I use an array to hold the UI type which I determine by it's device id when the UI's port 1 comes online. The UI type is just so I can route levels, channels, VT to devices that use them while skipping devices that don't. This changes per controlled device and therefore it is set up specifically for each controlled device for what feedback the UI's need or don't need.

    When a UI comes on page I send this function its UI index from another function that loops through all the levels that are needed to bring that panel up to date and when I recevie a level form the device I'm controlling I send the function "0" or the constant "UI_UPDATE_ACTIVE" which sets the parameters for the "for loop" and then will update all "on page" UI's for that device instance. Often there's only one instance of a module running.
    DEFINE_FUNCTION fnAVR_DoSend_LVL(INTEGER iUI_Indx,INTEGER iLVL_CHNL,INTEGER iLVL_Value,INTEGER iAVR_Indx) 
         
         {
         STACK_VAR INTEGER n ;
         STACK_VAR INTEGER nUICount ; 
         STACK_VAR INTEGER nLoopStart ; 
         
         if(iUI_Indx)
    	  {
    	  nUICount = iUI_Indx ;
    	  nLoopStart = iUI_Indx ;
    	  }
         else
    	  {
    	  nUICount = NUM_UIs_IN_SYSTEM ;
    	  nLoopStart = 1 ;
    	  }
    	  
         fnDeBug_AVRs("'fnFB_DoSend_LVL: Running FB! :DEBUG <',ITOA(__LINE__),'>'",iAVR_Indx) ;
         
         for(n = nLoopStart ; n <= nUICount ; n++)
              {
    	  if(nUI_AVRActiveArry[n] == iAVR_Indx)//means it on this dev is active on page for this tuner slot
    	       {
    	       SWITCH(nUI_TypeArry[n])
    		    {
    		    CASE UI_TYPE_G4:
    		    CASE UI_TYPE_R4:
    		    CASE UI_TYPE_G3:
    		    CASE UI_TYPE_MIO_DMS:
    		    CASE UI_TYPE_iPHONE:
    		    CASE UI_TYPE_iTOUCH:
    		    CASE UI_TYPE_iPAD:
    			 {
    			 SEND_LEVEL dvAVR_UIArry[n],iLVL_CHNL,iLVL_Value ;
    			 }
    		    CASE UI_TYPE_METKP:
    		    CASE UI_TYPE_UNKNOWN:
    		    CASE UI_TYPE_VIRTUAL:
    			 {
    			 //DO NOTHING
    			 }
    		    }
    	       }
    	  }
      
         RETURN ;
         }
    
Sign In or Register to comment.