Level Event Problem
zerodev
Posts: 10
After searching the forums and coming up empty, I thought I'd give this a try.
I've built a module that handles volume controls, and I am using Level Events to handle feedback. Here is my code:
MODULE:
select
{
active (FIND_STRING(cResponse, "'Vol'", 1)):
{
nVolumeFB = atoi(cResponse)
SEND_LEVEL vdvDev, PROGRAM_VOLUME_FB, nVolumeFB
}
}
PROGRAM:
LEVEL_EVENT [sDevice[2].vdvDevice, PROGRAM_VOLUME_FB]
{
SEND_LEVEL dvPanels1, Level.Input.Level, Level.Value
}
I have had no issues in the past doing this sort of thing, but all of a sudden this does not work. I am seeing the level change coming from the module, but for whatever godforsaken reason, it's not making it into the LEVEL_EVENT in the program (and I have quadruple-checked that I have the correct variables/constants in the event). I just upgraded firmware to no avail, and I'm about to tear my hair out. Ideas?
I've built a module that handles volume controls, and I am using Level Events to handle feedback. Here is my code:
MODULE:
select
{
active (FIND_STRING(cResponse, "'Vol'", 1)):
{
nVolumeFB = atoi(cResponse)
SEND_LEVEL vdvDev, PROGRAM_VOLUME_FB, nVolumeFB
}
}
PROGRAM:
LEVEL_EVENT [sDevice[2].vdvDevice, PROGRAM_VOLUME_FB]
{
SEND_LEVEL dvPanels1, Level.Input.Level, Level.Value
}
I have had no issues in the past doing this sort of thing, but all of a sudden this does not work. I am seeing the level change coming from the module, but for whatever godforsaken reason, it's not making it into the LEVEL_EVENT in the program (and I have quadruple-checked that I have the correct variables/constants in the event). I just upgraded firmware to no avail, and I'm about to tear my hair out. Ideas?
0
Comments
It you go back to levels above 8 you'll need to set the virtual level count as mentioned before. My memory is a little off and maybe virtuals are only initiated with 1 level. I think it's 8 but right now I really can't remember so just use the set_virtual_level_count anyway and see if that helps. I know in the past I've had to use that on real devices too for both levels and channels and it is a good practice to just do it cuz you never now when another firmware release will break it again.
There are ways to get around this. One would be to save the level value to a variable and when the touch panel comes online, you can update it with the stored value. Another thing you can do is to send the level.value-1, then send the actual level value. But, it seems like you are seeing a level change on one side.
My new line of thinking is the sDevice[2].vdvDevice in the level event. Is the value of this variable set in the define_start section? If it is, I think you might need to look at the rebuild_event() command.
Jeff
FYI, I get around the re-triggering issue by resetting the level if it's been triggered. That way there's always fresh feedback if the level gets triggered with the same value as before. Wouldn't think that would be an issue with this particular problem, but I might be wrong.
I did figure out a way around this by defining my touch panels in the module and just sending a level event directly to the bargraph from within the module. This works just fine, but it's not the way the rest of my program functions and I would love to get it all on the same page.
Thanks for the help!
That's my current recollection of virtuals and how I'm currently treat them until I'm notified to the contrary. If I had time I'd almost like to run some tests to confirm my thinking but I don't.