Home AMX User Forum NetLinx Studio

Netlinx_send_level

Hi Guys,

Finally making progress with my home system. Taught myself the basics.

Have serial control from touch panel wayheyy. Struggling with the send_ level I want it to increase and decrease my volume meter in increments of say 5 units. I can get the meter to snap to a set level but not nudge by a set value as with other control systems.

Any tips ?

Comments

  • Math - track what the current level, is +/- in the send level to the panel. Although I would suggest a better route might be to set the level as Display only and then synchronize the panel level with the device level that you are controlling. Does require discrete raise/lower buttons that then can be used to "nudge" the level at the device.

  • Depending on how you want to do this, you can send the level from the panel itself and use a LEVEL_EVENT in programming to send it to your device.
    If you make buttons for 'volume up' and 'volume down' on the touchpanel, in the properties of these buttons you can set the 'level control type' to 'relative' and the 'level control value' to what you want, +5 for the 'up' button and -5 for the 'down' button, for instance. If you also make a bargraph (display only) which displays the same level that will show the current level.

    I usually don't change the 'standard' AMX level (0..255) to something else, but you can do that. I prefer to use some math, like below.

    the bVolumeUp en bVolumeDown var's are used because when the panel goes 'offline', the levels get reset to zero. Doing it this way makes sure it won't send level changes to your device unless you actually push a button.

    The programming would look something like this: (for an AMX DVX)

    DEFINE_VARIABLE
    //volume
    DEVLEV dlMainVolume  = {dvTP,1}   //main volume
    
    PERSISTENT INTEGER nMainVolume              //holds mainvolume level
    VOLATILE  SINTEGER sMainVolume              //holds mainvolume converted to dvx xpoint level
    VOLATILE   INTEGER bVolumeUp                //true when volume up button is pushed
    VOLATILE   INTEGER bVolumeDown              //true when volume down button is pushed
    
    LEVEL_EVENT [dlMainVolume] //volume
    {
        IF (bVolumeUp OR bVolumeDown) //only if button is pushed
        {
        //volume max:0; min:-100
        nMainVolume = LEVEL.VALUE //store 'amx' level (0..255)
        sMainvolume = ((LEVEL.VALUE * 100) / 255) - 100 //calculate level for dvx
        SEND_COMMAND dvDVXAudioOut1,"FORMAT('XPOINT-%d',sMainVolume),',1,',ITOA(LS_OUT)"
        }
    }
    
    BUTTON_EVENT [dvTP,nMainVolumeButtons]
    {
        PUSH:
        {
        SWITCH (GET_LAST(nMainVolumeButtons))
        {
            CASE 1: //volume up
            {
            TO[bVolumeUp]
            }
            CASE 2: //volume down
            {
            TO[bVolumeDown]
            }
        }
        }
    }
    

    As part of the routine that executes when the touch panel comes online, the level that is stored on the controller (in nMainVolume) gets send to the bargraph display:

    DATA_EVENT [dvTP]
    {
        ONLINE:
        {
        WAIT 15
        {
            SEND_LEVEL dlMainVolume, nMainVolume //send volume level to panel
            SEND_COMMAND dvTP,'ADBEEP' //confirm online status
        }
        }
    }
    

    If you use something like this in your feedback for the volumebuttons:

    [dvTP,41] = bVolumeUp   AND nMainVolume < 255   //volume up
    [dvTP,42] = bVolumeDown AND nMainVolume > 0     //volume down
    

    The buttons will display the 'on' state as long as the are pushed, until the level reaches max (or min)

  • Amazing Cheers, I will try your method 1st Richard. Weekend project ha

Sign In or Register to comment.