Home AMX User Forum NetLinx Studio
Options

HEX char, Touch Panel. Please help! )

Good day!

Please tell me how to solve the following problem.

Get a string from the device and send it to the Touch Panel using the command SEND_COMMAND Panel, "'^ TXT-101,0,', data.text"

a problem in that the characters appear in a line in a different order in HEX representation which are determined by the table

How can I make the correct display of characters on the touch panel?

Example string that I get from the device "$EE$82$20 18 $EE$82$82 01:20:33"
234.png 56.5K

Comments

  • Options
    ericmedleyericmedley Posts: 4,177
    I think I'd approach this a little differently. I mean tht actually create these graphics and make them different levels and then just send a level to the TP. I don't know if that's a font you could load to the TP or not. If not you might approach it as a set of graphics. There's a lot of ways that according mulish it. A level is one.

    The other part of you question is just simpler string parsing.
  • Options
    viningvining Posts: 4,368
    My initial instinct would be that you need similar symbols on the TP and on a button push the corresponding hex value would be sent to the device to perform a function. These don't look like feedback values but control values. What is this device your working with? Is there more info/api you could share that describes its operation?
  • Options
    I work with Stereo Reciver Rotel RCX-1500


    I have a thought, parse the string character by character. And sends the symbol on the touch panel to indicate what color it should be, what fills and what font.

    But, for some reason, it seems to me that there must be an easier way.
  • Options
    viningvining Posts: 4,368
    Ok those special character are what the device itself would display on its front panel. You don't need to mimic the front display but if you want there are several ways to go about it. If symbols occupy the same physical space on the device's display then the best way to do it is as E described by use a multi-state bargragh. Create a button and define it as a multi-state bargraph and set the number of states to amount you'll need, set the range low to 0 or 1 and the high to the number you need plus 1 if you want state 0 to be a blank or clear button. You'll have to create the graphics yourself or copy if possible and import them to your TP design and then assign the images to the state as you see fit. Then when you receive the hex string look up what level that represents via a look up table you'll have to create and then send the level to the button address.

    If the button don't display in the same physical space as other of the special characters you could just do a simple channel button with no image in the off state and the image you want for the that channel in the on state. You could also use the ^SHO command and make them invisible when they shouldn't be displayed and visible when they should be.

    I personally would just use the multi-state bargraph cuz sending levels is pretty darn easy and any button can have as many states as you feel like making and each state can have it's own text or image. If you want state 1, send level 1, state 5, send level 5, etc, etc, etc. You just gotta come up with the graphics for each state and put them into your TP design.
  • Options
    DHawthorneDHawthorne Posts: 4,584
    I wrote a module for a Rotel tuner many, many years ago that had similar issues. I did, in fact, need to parse the responses character by character. That $EE is, in effect, an escape character telling you the 3-byte sequence is a special character, so you have to look for it in your string, then break it out with the next two bytes and do a look up. I opted to created buttons as bargraphs, as vining suggests, to represent the special character. Some of them may have meanings you could just swap out for straight text, and others you might not care about. Play/stop/pause, for example, would be easy to represent on a button with a font with transport glyphs, and the letters in black boxes you could just substitute with [A], or whatever. But in either case, you have to break out the escape sequence first and figure out what they represent, and whether you care about them.
  • Options
    The problem is that special characters are appearing anywhere on the string and take any position on the screen Touch panel.
    I solved the problem in the following way:

    I know that the string can have a maximum of 80 characters (including the fact that three bytes of the special characters are converted to a single character on the screen). Therefore, the cells 80 created on the screen.

    Then parse the string according to these


    DEFINE_FUNCTION char[80] string_fn (char fString [100]){

    stack_var integer i
    stack_var integer n
    stack_var razb_stroka [80]


    for (i=3; i<=100; i++) {

    razb_stroka = "razb_stroka,type_cast(mid_string(fString,i,1))"

    n = length_string (razb_stroka)

    if (find_string (razb_stroka,"$EE,$82,$80",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$80"}
    if (find_string (razb_stroka,"$EE,$82,$82",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$82"}
    if (find_string (razb_stroka,"$EE,$82,$97",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$97"}
    if (find_string (razb_stroka,"$EE,$82,$85",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$85"}
    if (find_string (razb_stroka,"$EE,$82,$84",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$84"}
    if (find_string (razb_stroka,"$EE,$82,$92",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$92"}
    if (find_string (razb_stroka,"$EE,$82,$87",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$87"}
    if (find_string (razb_stroka,"$EE,$82,$8E",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$8E"}
    if (find_string (razb_stroka,"$EE,$82,$89",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$89"}
    if (find_string (razb_stroka,"$EE,$82,$93",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$93"}
    if (find_string (razb_stroka,"$EE,$82,$8C",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$8C"}
    if (find_string (razb_stroka,"$EE,$82,$8F",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$8F"}
    if (find_string (razb_stroka,"$EE,$82,$8A",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$8A"}
    if (find_string (razb_stroka,"$EE,$82,$8B",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$8B"}
    if (find_string (razb_stroka,"$EE,$82,$81",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$81"}
    if (find_string (razb_stroka,"$EE,$82,$83",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$83"}
    if (find_string (razb_stroka,"$EE,$82,$94",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$94"}
    if (find_string (razb_stroka,"$EE,$82,$98",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$98"}
    if (find_string (razb_stroka,"$EE,$82,$99",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$99"}
    if (find_string (razb_stroka,"$EE,$82,$9A",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$9A"}
    if (find_string (razb_stroka,"$EE,$82,$88",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$88"}
    if (find_string (razb_stroka,"$EE,$82,$95",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$95"}
    if (find_string (razb_stroka,"$EE,$82,$96",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$96"}
    if (find_string (razb_stroka,"$EE,$82,$90",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$90"}
    if (find_string (razb_stroka,"$EE,$82,$91",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$91"}
    if (find_string (razb_stroka,"$EE,$82,$8D",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$8D"}
    if (find_string (razb_stroka,"$EE,$80,$80,$EE,$80,$81,$EE,$80,$82",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-9),'END'"}


    }

    return razb_stroka

    }


    DEFINE_FUNCTION integer send_char (char fString [80]){

    stack_var integer n
    stack_var char schar


    for (n=1; n<=80; n++) {

    schar = type_cast(mid_string(fString,n,1))

    switch (schar) {

    case $80: SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
    SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,T'"

    case $82: SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F34%CF255%CTWhite'" //play
    SEND_COMMAND Panel, "'^UNI-',itoa(n),',0,0041'"
    case $97:

    case $85:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
    SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,A'"

    case $84:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
    SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,C'"

    case $92:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
    SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,F'"

    case $87:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
    SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,G'"

    case $8E:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
    SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,I'"

    case $89:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
    SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,L'"

    case $93:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
    SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,M'"

    case $8C:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
    SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,R'"

    case $8F:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
    SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,S'"

    case $8A:
    case $8B:

    case $81:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F34%CF255%CTWhite'" //pause
    SEND_COMMAND Panel, "'^UNI-',itoa(n),',0,0043'"

    case $83:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F34%CF255%CTWhite'" //stop
    SEND_COMMAND Panel, "'^UNI-',itoa(n),',0,0042'"
    case $94:
    case $98:
    case $99:
    case $9A:
    case $88:
    case $95:
    case $96:
    case $90:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF255%CTWhite'"
    SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,*'"

    case $91:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"

    case $8D:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
    SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,Z'"

    default: SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF255%CTWhite'"
    SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,',schar"




    }

    }




    }



    DATA_EVENT [dvReciv] { string: {


    if (length_string(dispalay_string) >=80 ) {

    razbor_simvol = string_fn (dispalay_string)

    send_char (razbor_simvol)


    }
    }}




    Works as it should.

    Only significant delay)
Sign In or Register to comment.