Home AMX User Forum NetLinx Studio
Options

text feedback to panels using levels

Hi

I'm sure having read somewhere in this forum about a neat way to provide text feedback to touch panels using levels or address codes or something similar. The idea was to enter several texts on the panel (using TP4 or by programm) and assigning them to level values. One then simply needs to send a new level vlaue to the the panel to show the respective text. Since level values are managed by netlinx itself (meaning they won't be sent if they didn't change) I found this a very effictive way to provide textual feedback to the user. However, I wasn't able to find the thread again. Am I dreaming here?

Thanks for your guidance,
Patrick

Comments

  • Options
    viningvining Posts: 4,368
    wengerp wrote: »
    Hi

    I'm sure having read somewhere in this forum about a neat way to provide text feedback to touch panels using levels or address codes or something similar. The idea was to enter several texts on the panel (using TP4 or by programm) and assigning them to level values. One then simply needs to send a new level vlaue to the the panel to show the respective text. Since level values are managed by netlinx itself (meaning they won't be sent if they didn't change) I found this a very effictive way to provide textual feedback to the user. However, I wasn't able to find the thread again. Am I dreaming here?

    Thanks for your guidance,
    Patrick
    I do it all the time. Make a button a multi-state bar graph with as many states as you need, set the range low to 1 and high to the number of states. In tpd4 add the static text per state level. You can also send the state's text via code but then you'd have to ensure to do that after every TP reboot which means using a custom event to determine when a TP has been rebooted. If there's only a handful of states then enter it in the TP manually but if there's dozens then via code might be worth a try.

    You can also use ^GHH and ^GHL (I think those are the commands) to set the bargraph hi-lo range if doing this via code and then set the text per state from an array.

    I personally think using multi- states BGs when text is static although multiple possibilties is the proper way to go.
  • Options
    vining wrote: »
    ...you'd have to ensure to do that after every TP reboot which means using a custom event to determine when a TP has been rebooted.

    What custom event do you use to determine if a panel has been rebooted?
  • Options
    viningvining Posts: 4,368
    On the UIs I have a nearly invisble button with the letter "R" (no quotes) on it, port 1. Off State is red, on state is green, not that it matters to anyone but me. Later the text is set to "I" (no quotes) once port 1 is initialized and I have an array for all other ports used so I can init ports as when or how I need.
    Constant
    UI_DETERMINE_BOOT_BTN = 100; //any number of your choosing for both channel and VT, make different if you want.
    CUSTOM_EVENTID_BTNTXT = 1001;
    
    Variable
    PERSISTENT CHAR    nUI_BootInitArry[UI_HIGHEST_PORT_USED][NUM_UIs_IN_SYSTEM];
    
    Functions
    DEFINE_FUNCTION fnUI_SetBootInitArry(INTEGER iUI_Indx, CHAR iValue)
    
         {
         STACK_VAR INTEGER i;
        
         for(i = 1; i <= UI_HIGHEST_PORT_USED; i++)
    	  {
    	  nUI_BootInitArry[i][iUI_Indx] = iValue;
    	  fnUI_DeBug("'CUSTOM_EVENT: UI INDEX-[ ',itoa(iUI_Indx),' ], DEV PORT-[ ',itoa(i),' ], SET VALUE-[ ',itoa(iValue),' ] :DEBUG<',__LINE__,'>'");
    	  }
         }
    
    DEFINE_FUNCTION fnUI_RunBootInitTasks(INTEGER iUI_Indx)
    
         {
         //stuff I do for port 1 main code stuff.  Other port channels I do stuff if and when a user goes on those pages unless it makes sense to do right away, usually doesn't.
         }
    

    When a UI comes online:
    SEND_COMMAND dvUI_Arry[iUI_Indx],"'?TXT-',itoa(UI_DETERMINE_BOOT_BTN),',1'";
    

    My custom event:
    DEFINE_EVENT    //CUSTOM_EVENT [dvUI_Arry,UI_DETERMINE_BOOT_BTN,CUSTOM_EVENT_ID_BTN_TXT] //UI REBOOT/FILE RE-LOAD CHECK
    
    CUSTOM_EVENT [dvUI_Arry,UI_DETERMINE_BOOT_BTN,CUSTOM_EVENTID_BTNTXT]
    
         {
         STACK_VAR INTEGER nUI_Indx;
         LOCAL_VAR INTEGER nCheckOnce[NUM_UIs_IN_SYSTEM];
         
         nUI_Indx = GET_LAST(dvUI_Arry);
         if(CUSTOM.TEXT == 'R')//RELOADED OR REBOOTED
    	  {
    	  OFF[dvUI_Arry[nUI_Indx],UI_DETERMINE_BOOT_BTN];
    	  fnUI_DeBug("'CUSTOM_EVENT: UI INDEX-[ ',itoa(nUI_Indx),' ], RX BTN TEXT-[ ',CUSTOM.TEXT,' ] :DEBUG<',itoa(__LINE__),'>'");
    	  	 
    	  fnUI_DeBug("'CUSTOM_EVENT: UI INDEX-[ ',itoa(nUI_Indx),' ], SENDING CMD, SET BTN TEXT TO "I" :DEBUG<',itoa(__LINE__),'>'");
    	  SEND_COMMAND dvUI_Arry[nUI_Indx],"'^TXT-',itoa(UI_DETERMINE_BOOT_BTN),',0,I'";//both for FB
    	  
    	  fnUI_DeBug("'CUSTOM_EVENT: UI INDEX-[ ',itoa(nUI_Indx),' ], SETTING UI_BOOT ARRAY AND RUNNING BOOT TASKS :DEBUG<',itoa(__LINE__),'>'");
    	  fnUI_SetBootInitArry(nUI_Indx,UI_REBOOTED);//set the entire array to "rebooted"
    	  fnUI_RunBootInitTasks(nUI_Indx);//only immediate main page events related to main or dev port 1
    	  
    	  if(!nCheckOnce[nUI_Indx])//JUST IN CASE "I" ISN'T WRITTEN TO THE BUTTON, WE DON'T WANT A LOOP CREATED
    	       {
    	       nCheckOnce[nUI_Indx] = 1;
    	       fnUI_DeBug("'CUSTOM_EVENT: UI INDEX-[ ',itoa(nUI_Indx),' ], CONFIRMING BTN TEXT SET TO "I" :DEBUG<',itoa(__LINE__),'>'");
    	       SEND_COMMAND dvUI_Arry[nUI_Indx],"'?TXT-',itoa(UI_DETERMINE_BOOT_BTN),',1'";
    	       }
    	  else
    	       {
    	       fnUI_DeBug("'CUSTOM_EVENT ERR: UI INDEX-[ ',itoa(nUI_Indx),' ], ALREADY ATTEMPTED TO SET BTN TEXT TO "I" :DEBUG<',itoa(__LINE__),'>'");
    	       }
    	  }
         else if(CUSTOM.TEXT == 'I')//INITALIZED
    	  {
    	  nCheckOnce[nUI_Indx] = 0;
    	  ON[dvUI_Arry[nUI_Indx],UI_DETERMINE_BOOT_BTN];
    	  //don't set to UI_INITIALIZED here.  needs to be done by UI dev when actually initialized
    	  fnUI_DeBug("'CUSTOM_EVENT: UI INDEX-[ ',itoa(nUI_Indx),' ], RX BTN TEXT-[ ',CUSTOM.TEXT,' ] :DEBUG<',itoa(__LINE__),'>'");
    	  fnUI_DeBug("'CUSTOM_EVENT: UI INDEX-[ ',itoa(nUI_Indx),' ], REBOOT / INIT BTN HAS BEEN SET TO "I" :DEBUG<',itoa(__LINE__),'>'");
    	  fnUI_DeBug("'CUSTOM_EVENT: UI INDEX-[ ',itoa(nUI_Indx),' ], INDIVIDUAL DEVs STILL NEED TO BE INITIALIZED :DEBUG<',itoa(__LINE__),'>'");
    	  }
         else//HMMM?
    	  {
    	  nCheckOnce[nUI_Indx] = 0;
    	  fnUI_DeBug("'CUSTOM_EVENT: UI INDEX-[ ',itoa(nUI_Indx),' ], RX BTN TEXT-[ ',CUSTOM.TEXT,' ] :DEBUG<',itoa(__LINE__),'>'");
    	  fnUI_DeBug("'CUSTOM_EVENT: UI INDEX-[ ',itoa(nUI_Indx),' ], UNEXPECTED RETURNED VALUE, WHY? :DEBUG<',itoa(__LINE__),'>'");
    	  fnUI_DeBug("'CUSTOM_EVENT: UI INDEX-[ ',itoa(nUI_Indx),' ], ASSUMING FILE RE-LOADED OR PANEL REBOOTED, DEVs NEEDS RE-INIT :DEBUG<',itoa(__LINE__),'>'");
    	  fnUI_SetBootInitArry(nUI_Indx,UI_REBOOTED);//set the entire array to "rebooted" since something is up.
    	  }
         }
    
  • Options
    vining wrote: »
    I do it all the time. Make a button a multi-state bar graph with as many states as you need, set the range low to 1 and high to the number of states. In tpd4 add the static text per state level. You can also send the state's text via code but then you'd have to ensure to do that after every TP reboot which means using a custom event to determine when a TP has been rebooted. If there's only a handful of states then enter it in the TP manually but if there's dozens then via code might be worth a try.

    You can also use ^GHH and ^GHL (I think those are the commands) to set the bargraph hi-lo range if doing this via code and then set the text per state from an array.

    I personally think using multi- states BGs when text is static although multiple possibilties is the proper way to go.

    Sorry for the late response (holiday).

    That's exactly the information I was looking for. Thanks a lot for sharing.

    Patrick
  • Options
    vining wrote: »
    On the UIs I have a nearly invisble button with the letter "R" (no quotes) on it, port 1. Off State is red, on state is green, not that it matters to anyone but me. Later the text is set to "I" (no quotes) once port 1 is initialized and I have an array for all other ports used so I can init ports as when or how I need.

    Gotcha. I thought you meant there was some Custom Event that would notify you when a panel reboots in place of an Online event.
Sign In or Register to comment.