Level bar graphs are not working

Dear All,
I'm trying to update the level bar graphs on some older NXD-500i's without success. These levels are come from a Precis Autoptach ( audio switcher ) and I keep the volumes on a float array Volumes[] for all outputs.
When debugging, I can see the "Volumes[]" values while they change from the range of -70 to 10.
So the data_event capture works perfect. The only thing I should finally do is sending the value to the panel bar graph.
A part of the code :

dvTP1 = 10021:2:20 //port2
dvTP2 = 10051:2:50
dvTP3 = 10052:2:50
dvTP4 = 10061:2:60
dvTP5 = 10062:2:60

volatile float Volumes[32] //32 audio outputs
volatile dvTPs[] = { dvTP1,dvTP2,dvTP3,dvTP4,dvTP5 }

data_event[dvPrecis]
{
string:
{
stack_var char nString[100]
stack_var char nStr1[100]
stack_var char nStr2[100]
stack_var char nStr3[100]
stack_var float nLevel
stack_var integer nOutput

     nString = data.text

//**Volume Feedback ** example 'CL0O8VA-300T' output 8 at level -30db

 if ( find_string(nString,'CL',1) and find_string(nString,'VA',1) and find_string(nString,'T',1) )
   {
     nStr3 = remove_string(nString,'T',1)
     remove_string(nStr3,'O',1)
     nStr1  = remove_string(nStr3,'VA',1)
     nStr2  = nStr3

     nLevel = atof(nStr2)   
     nOutput = atoi(nStr1)
     Volumes[nOutput] = nLevel/10    /from, -70 to 10 

     send_level dvTPs,  nOutput, Volumes[nOutput]
    }   //volume feedback

}
}

For some reason, the bar graph level is going at the full position ( 100% ) regardless the value is sent (any value) and keeps staying there.
Again, the values taken from the data_event ( feedback ), are correct...!

Below you can see some notifications from N2S after a volume up command has been sent. You can see the
"Value= No Conversion for Double Precision" message. What does this mean exactly ?
In my code debugging, the Volumes[8] = -28

Line 1 2019-06-01 (16:19:18):: Input Status:Pushed [10021:2:20] - Channel 100 //volume UP
Line 2 2019-06-01 (16:19:18):: String To [5001:1:10]-[CL0O8VA-280T]
Line 3 2019-06-01 (16:19:18):: String From [5001:1:10]-[CL0O8VA-280T]
Line 4 2019-06-01 (16:19:18):: Level Value To [10021:2:20] - Level 8 Value= No Conversion for Double Precision
Line 5 2019-06-01 (16:19:18):: Level Value To [10051:2:50] - Level 8 Value= No Conversion for Double Precision
Line 6 2019-06-01 (16:19:18):: Level Value To [10052:2:50] - Level 8 Value= No Conversion for Double Precision
Line 7 2019-06-01 (16:19:18):: Level Value To [10061:2:60] - Level 8 Value= No Conversion for Double Precision
Line 8 2019-06-01 (16:19:18):: Level Value To [10062:2:60] - Level 8 Value= No Conversion for Double Precision

P.S> When sending a value - for e.g. "-28" - from the N2S "Emulate a Device", the bar graphs are working perfect !!

Any ideas please ?

Thanks,
George

Comments

  • richardhermanrichardherman not-so-junior member Posts: 228

    Why are the level values stored in a float? I have no experience with the Precis, but from your code snippet it seems you get -700 to 100 back from the device, so a sinteger would be enough.

    And when you send '-28' from 'emulate a device', do you also select float as the level type? If not, that could be the reason it works there.

  • viningvining X Member Posts: 4,353

    In my code it looks like I store the received value in a sinteger

    fnAP_FB_SendLVL(UI_UPDATE_ACTIVE,LVL_VOL_BAR_G,TYPE_CAST(((sAP_Zone[nLastOutPut].Volume / 10) + 70) * 1.25))

    I use a bar graph with a range of 0-100.

  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,159

    It's probably just a matter of taste. Since in many cases we need to make some changes in the ways AMX does level ranges to how the device, as usual there are a couple ways to make this happen.
    1) is to force the level range in the TP file; changing the given range of the fader from the drfault 0-255 ($0-$FF) to whatever the device range is. Then when you send the raw fader values they line up nicely.
    2) (how I tend to do it) is to do the math in code so the range being sent to the touch panel ends up being 0-255.

    I tend to do the latter for the reason that I find that when I or someone later makes a new panel file or changes things the code continues to work more-or-less out of the box. In fact, In most things I try to write in such a way that if the box is changed or reset to factory values, it will still work. (when possible)

    Also, I take great pleasure in being able to run into my old Algebra teacher and saying, "I really do use this stuff every day."

  • George KrietsepisGeorge Krietsepis Member Posts: 169

    Hi All,
    thanks for your replies and suggestions...Answering your questions:
    1. I used float instead of sinteger because I needed the values being on negative decimal format
    2. When sending a negative value from "emulate a device", the bar graph works fine

    Finally, i made it work by removing the division of the value by 10 ( Volumes[nOutput] = nLevel/10 ). I just left it as it is ( Volumes[nOutput] = nLevel ) and changed the bar graphs range from -700 to 100.

    George

Sign In or Register to comment.