Home AMX User Forum NetLinx Studio
Options

What am I doing wrong?

  FOR(x=1; x <= NUM_ROOMS_ON_SEL[nTP_INDEX]; x++)
   { 
     SELECT
      {
	ACTIVE(nDISPLAYED_ROOMS[nTP_INDEX][x] > 0 AND nDISPLAYED_ROOMS[nTP_INDEX][x] <= NUMBER_OF_ROOMS):
	  {
	    IF(uROOM[nDISPLAYED_ROOMS[nTP_INDEX][x]].nROOM_ICON)
	      SEND_COMMAND dvTP_SYS[nTP_INDEX],"'^BMF-',ITOA(ROOM_SELECT_BTN[x]),
							      ',1,%SW1,%I',uROOM[nDISPLAYED_ROOMS[nTP_INDEX][x]].nROOM_ICON,
					      '%T',uROOM[nDISPLAYED_ROOMS[nTP_INDEX][x]].sNAME"
	    ELSE
	      SEND_COMMAND dvTP_SYS[nTP_INDEX],"'^BMF-',ITOA(ROOM_SELECT_BTN[x]),		
					      ',1,%SW1,%I<0>,%T',uROOM[nDISPLAYED_ROOMS[nTP_INDEX][x]].sNAME"
	      
	    SEND_STRING 0,"'^BMF-',ITOA(ROOM_SELECT_BTN[x]),
                                       ',1,%SW1,%I',uROOM[nDISPLAYED_ROOMS[nTP_INDEX][x]].nROOM_ICON,
					      '%T',uROOM[nDISPLAYED_ROOMS[nTP_INDEX][x]].sNAME"
	    SEND_COMMAND dvTP_SYS[nTP_INDEX],"'^BMF-',ITOA(ROOM_SELECT_BTN[x]),		
					      ',',ITOA(NUMBER_STATES_ROOM_BTN),		 
					      ',%SW1,%I<0>,%T',uROOM[nDISPLAYED_ROOMS[nTP_INDEX][x]].sNAME"
	  }



Ok, the problem I am encountering is that the above code works, but the ^BMF command isn't operating how I think it should. The SEND_STRING Command is how I originally had it, but when I did it this way, the text never got changed on the touchpanel if the nROOM_ICON variable had a 0 value. Here is an example of what was sent to the master:
Line     48 :: ^BMF-5,1,%SW1,%I - 04:33:31
Line     49 :: ^BMF-6,1,%SW1,%IK%TMJA - 04:33:31

Notice how line 48 ends after %I and line 49 actually has the complete instruction. I found that in order to get a clear icon command to go, I had to use the <0> format. From what I am reading tho, I should be able to choose between enclosing ASCII in < > or passing the decimal value like %I',##,'. Can anyone point out what I am missing?


P.S.
In my code, the .nROOM_ICON is right next to the variable, the forum is formating it funky like )

Thanks,

Comments

  • Options
    What am I doing wrong?

    Jeff,

    My reading of the G4 Panel Programming Manual for the ^BMF command is that the only way it will work is the 2nd way in your example. Although the documentation is a little confusing, the <> brackets in the documentation are there to indicate to the programmer that the %I specifier takes an argument which is either an icon specification in the range 1-9900 or a value of 0 to clear the icon. The <> brackets would not be part of the actual SEND_COMMAND to the touchpanel device.

    If you look at the specification for the ^BMF command in general:
    ^BMF-<variable text address range>,<data>
    

    this would seem to imply the use of <> for specifying the variable text field and to enclose the data but we know this is not the case. The documentation uses the <> brackets as field delimeters for descriptive purposes. While there may be some commands that actually use the <> brackets, I can't say that I have used one.

    What is a little more puzzling to me in your example is that my documentation specifies the %I command as follows:
    %I,<icon 1-9900, 0-clear>
    

    which I generally interpret to mean that the ',' comma is required as part of the specification and is not there for documentation purposes. However, you indicated that the command is working without the comma so perhaps this is empirical evidence that the documenation is incorrect or that the command works with or without the comma.
  • Options
    Re: What am I doing wrong?
    Originally posted by Spire_Jeff
    [code]

    Notice how line 48 ends after %I and line 49 actually has the complete instruction. I found that in order to get a clear icon command to go, I had to use the <0> format. From what I am reading tho, I should be able to choose between enclosing ASCII in < > or passing the decimal value like %I',##,'. Can anyone point out what I am missing?


    Thanks,

    Is this a test?

    Don't use ASCII < > symbols anywhere in the string expression.
    Those symbols represent an optional parameter and are not needed.

    You can use " '%I',0 " or " '%10' " but not " '%I<0>' "

    Check Software History for the touch panel Send_Command detail.

    Nice use of structures BTW.
  • Options
    Spire_JeffSpire_Jeff Posts: 1,917
    not a test, just a lack of sleep.... I'm not really sure where I got the <0> from, but I coulda swore I tried it out a couple different ways and sticking <> in there made something work..... but then again that was after quite a few hours of coding and I was probably hallucinating. I find that when something doesn't work in the real world, hallucinations brought on by lack of sleep can work miracles.

    Ok, I am directly controlling the touchpanel using studio at the moment and here are my findings so far:

    "'^BMF-5,1,%SW1%I0,%TTest'" - Clears the ICON and sets text

    "'^BMF-5,1,%SW1%I75%TTest1'" - Sets the ICON properly and sets text correctly

    "'^BMF-5,1,%SW1%I0%TTest2'" - Does not clear ICON, but does change it to something other than 75 and does set the text

    "'^BMF-5,1,%SW1%I<0>%TTest3'" - Clears the icon and sets the text properly (See, I thought it worked)

    "'^BMF-5,1,%SW1%I<75>%TTest4'" - Does not set the ICON but does set the text

    "'^BMF-5,1,%SW1%I',75,'%TTest5'" - Sets the ICON and the text.

    "'^BMF-5,1,%SW1%I',0,'%TTest6'" - Clears the ICON, but does not set the text

    "'^BMF-5,1,%SW1%I75,%TTest7'" - Sets the ICON and the text properly

    "'^BMF-5,1,%SW1%I',0,',%TTest8'" - Clears the ICON, but does not set the text

    "'^BMF-5,1,%SW1%I',75,',%TTest9'" - Does not set the ICON, but does set the text.


    Ok, what does all this mean? Well, I found one format up there the works correctly with both case (setting and clearing) so I can change my code to reflect that and remove a couple of unnecessary conditionals. Other than that, it means that sometimes even the wrong way can be somewhat functional??? ;)

    Oh, seperating the %SW1 and the %I with a comma didn't seem to change anything.

    Let me know if there is still something I am missing because I still think it works different than the documentation. I am sure it's probably a comma hiding in the wrong place or some other punctuation missing or something like that.

    Thanks for all of the help.

    Jeff
  • Options
    Spire_JeffSpire_Jeff Posts: 1,917
    Almost forgot....

    Thanks for the compliment on my use of structures. It's always nice to hear good things.

    Thanks,

    Jeff
  • Options
    Originally posted by Spire_Jeff

    Let me know if there is still something I am missing because I still think it works different than the documentation. I am sure it's probably a comma hiding in the wrong place or some other punctuation missing or something like that.

    Jeff

    Try this version at let me know what happens. I don't have time to test it. Leave out the number after the %I. This would be like having no text after the %T to clear text.

    " '^BMF-5,1,%SW1%I%TTest10' "

    or with commas separating each data section

    " '^BMF-5,1,%SW1,%I,%TTest11' "

    I looked at software history again and noticed that there are commas separating each data field. Does your modified version of test 1 shown below also work?

    " '^BMF-5,1,%SW1,%I75,%TTest1 '"


    Try including the zero and commas as well to clear the icon

    " '^BMF-5,1,%SW1,%I0,%TTest12' "

    Be careful that a 0 (zero) is not an O (oh.) I do this sometimes when tired.

    Brian
  • Options
    Spire_JeffSpire_Jeff Posts: 1,917
    I'll try that when I get back to the office today. I was also thinking on my drive home last night that even tho it is clearing the icon, it may be doing it by setting the icon number to a slot that has nothing in it. ie it is using the decimal value of <0> and setting it to something like slot 300 or something.

    I'll also double check the 0 vs O thing. Good news is that using the above test, I figured out that doing the ITOA on the value and using "'....%I',ITOA(value),',%TText'" works for everything. I also tried with and without commas between everything and it didn't seem to make a difference if there was a comma between the %SW1 and the %I, but it did make a difference if I left out the comma between %I and %T.

    Jeff
  • Options
    Spire_JeffSpire_Jeff Posts: 1,917
    " '^BMF-5,1,%SW1%I%TTest10' " - Works properly


    " '^BMF-5,1,%SW1,%I,%TTest11' " - Displays some Icon (I'm guessing Ascii value of a COMMA)


    " '^BMF-5,1,%SW1,%I75,%TTest1 '" - Works properly

    " '^BMF-5,1,%SW1,%I0,%TTest12' " - Works properly


    I also checked and didn't find any O's trying to be 0's

    Jeff
  • Options
    Originally posted by Spire_Jeff
    " '^BMF-5,1,%SW1%I%TTest10' " - Works properly


    " '^BMF-5,1,%SW1,%I,%TTest11' " - Displays some Icon (I'm guessing Ascii value of a COMMA)


    " '^BMF-5,1,%SW1,%I75,%TTest1 '" - Works properly

    " '^BMF-5,1,%SW1,%I0,%TTest12' " - Works properly


    I also checked and didn't find any O's trying to be 0's

    Jeff

    Sounds good, hopefully you got this one licked. It is interesting that you don't need the comma between data fields. It must be used only for clarity. The % symbol is the real delimiter.

    I use an NetLinx editor font called Fixedsys that puts a slash through the zero; no more mistakes.
  • Options
    Spire_JeffSpire_Jeff Posts: 1,917
    Yes, I did resolve my issues. Thanks for the help. Although, I still think the documentation needs to be double checked. I think that one of the following should function according to the documentation.

    "'^BMF-5,1,%SW1,%I',0,'%TTest6'" - Clears the ICON, but does not set the text

    "'^BMF-5,1,%SW1,%I',0,',%TTest8'" - Clears the ICON, but does not set the text

    Documentation:
    '%I',<icon 1-9900, 0-clear> Set Icon
    '%I<icon 01-9900, 0-clear>' Set Icon

    And as best I can recall, the above is the way I first tried to do this hoping to avoid the ITOA() conversion.

    But, I suppose that is just my ego speaking ;)

    Jeff
Sign In or Register to comment.