Home AMX User Forum NetLinx Studio

how many levels are allowed per device?

Hi,

After having some issues with a module I'm writing, I could finally isolate the problem to the following netlinx code.

(****************************)

(* CONSTANTS *)
DEFINE_CONSTANT
BTN_TOGGLE = 4

(* VARIABLES *)
DEFINE_VARIABLE

DEVLEV AUDIO_SOURCE [] = {
{vdvKNX, 1},
{vdvKNX, 2},
(* {vdvKNX, 3},
{vdvKNX, 4},
{vdvKNX, 5},
{vdvKNX, 6},
{vdvKNX, 7},
{vdvKNX, 8},
{vdvKNX, 9},
{vdvKNX, 10},*)
{vdvKNX, 11},
{vdvKNX, 12},
{vdvKNX, 13},
{vdvKNX, 14},
{vdvKNX, 15},
{vdvKNX, 16},
{vdvKNX, 17},
{vdvKNX, 18},
{vdvKNX, 19},
{vdvKNX, 20}
}

(* EVENTS *)
DEFINE_EVENT

BUTTON_EVENT[ dvTP, BTN_TOGGLE]
{
RELEASE:
{
send_level AUDIO_SOURCE, 0
send_level AUDIO_SOURCE, 1
}
}

LEVEL_EVENT[AUDIO_SOURCE]
{
local_var integer idxLevel
idxLevel = get_last( AUDIO_SOURCE)
send_string 0, "'Audio source Level event - idx Level '"
}

(****************************)


Whenever I press the BTN_TOGGLE in the panel, I would expect this code to print:

(0000031307) Audio source Level event - idx [1] Level [0]
(0000031308) Audio source Level event - idx [2] Level [0]
(0000031307) Audio source Level event - idx [11] Level [0]
(0000031308) Audio source Level event - idx [12] Level [0]
(0000031307) Audio source Level event - idx [13] Level [0]
(0000031308) Audio source Level event - idx [14] Level [0]
(0000031307) Audio source Level event - idx [15] Level [0]
(0000031308) Audio source Level event - idx [16] Level [0]
(0000031308) Audio source Level event - idx [17] Level [0]
(0000031308) Audio source Level event - idx [18] Level [0]
(0000031308) Audio source Level event - idx [19] Level [0]
(0000031308) Audio source Level event - idx [20] Level [0]
(0000031308) Audio source Level event - idx [1] Level [1]
(0000031309) Audio source Level event - idx [2] Level [1]
(0000031307) Audio source Level event - idx [11] Level [1]
(0000031308) Audio source Level event - idx [12] Level [1]
(0000031307) Audio source Level event - idx [13] Level [1]
(0000031308) Audio source Level event - idx [14] Level [1]
(0000031307) Audio source Level event - idx [15] Level [1]
(0000031308) Audio source Level event - idx [16] Level [1]
(0000031308) Audio source Level event - idx [17] Level [1]
(0000031308) Audio source Level event - idx [18] Level [1]
(0000031308) Audio source Level event - idx [19] Level [1]
(0000031308) Audio source Level event - idx [20] Level [1]

(don't pay attention to the time stamp)

Instead this is the following outcome:

(0000031307) Audio source Level event - idx [1] Level [0]
(0000031308) Audio source Level event - idx [2] Level [0]
(0000031308) Audio source Level event - idx [1] Level [1]
(0000031309) Audio source Level event - idx [2] Level [1]


I have tried modifying the different levels assigned to AUDIO_SOURCE but I never get to go beyond 8 levels. It seems as if send_level would not work with levels beyond 8.

How many levels are allowed per device? Or better then, what's the highest level allowed in a specific device?

Thanks,
Jordi

Comments

  • a_riot42a_riot42 Posts: 1,624
    How many levels are allowed per device? Or better then, what's the highest level allowed in a specific device?

    I don't recall but try set_virtual_level_count and see if it helps.
    Paul
  • viningvining Posts: 4,368
    I believe virtuals are iniated with 8 levels and you need to use SVLC as Paul suggested if you want more. Levels also come in blocks of 8 if I recall so if you SVLC for 12 you'll acutally get 16.
  • Joe HebertJoe Hebert Posts: 2,159
    How many levels are allowed per device? Or better then, what's the highest level allowed in a specific device?
    Good quiz question.

    A real TP (G4) device has:
    100 ports
    4000 channels per port
    600 levels per port

    A virtual device has:
    1 port
    255 channels
    8 levels

    If you need more ports or channels or levels for a virtual device then you can use set_virtual_port_count, set_virtual_channel_count, and set_ virtual_level_count to increase the numbers.

    If you are combining real TP devices with virtual devices make sure the ports, channels, and levels of the virtual device meets the usage of the real device or funky stuff (technical term) may happen.
  • Joe HebertJoe Hebert Posts: 2,159
    As a follow up, to get the printout you are looking for add the following to your code (and uncomment the rest of the devlev array):
    DATA_EVENT[vdvKNX] {
       ONLINE: {
          SET_VIRTUAL_LEVEL_COUNT(DATA.DEVICE,20)
       }
    }
    

    You’ll notice that the very first time you press BTN_TOGGLE you will only get a 20 line printout showing a value of 1 and every subsequent push will generate a 40 line printout showing a value of 0 and then 1.

    This is because a level_event is only generated when the level value actually changes and by default the level value at bootup is 0 so the first time you do a send_level of 0 nothing will happen.
Sign In or Register to comment.