Troubleshooting Custom Module

gregrgregr Junior MemberPosts: 54
OK, my foray into modules is not going well.

I am trying to troubleshoot problems, and have already found that unless you pass variables into the module from the main code, you cannot watch them in debug.

So I should be able to do a SEND_STRING 0 from inside the module (inside the data_event for the virtual device) to test what is firing and what is not, right? No go. Neither diagnostics nor Telnet sees the message. Tech support confirms I should be able to.

Next I try turning on a channel on the virtual device from the module. Also cannot see the channel change status.

I know the modules are getting the commands, because I have those turned on for the virtual devices in Diagnostics, and they show up, and also in the case of one module that works, the real device fires.

Hope it's something simple!

Thanks in advance,

Greg

Comments

  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,166
    Can you post some code, specifically your module(s) declarations and the header of the module? Also, perhaps the place where you write a string to 0.

    I watch stuff in modules all the time in debug.
  • gregrgregr Junior Member Posts: 54
    I'll try, if I can figure out how to insert code:

    Here is the declaration from Main Code:
    DEFINE_START
    
    (***********************************************************)
    (*                    MODULES GO BELOW                     *)
    (***********************************************************)
    
    DEFINE_MODULE 'Sanyo Projector' Instance1(dvProjector,vdvProjector,dvKP)
    DEFINE_MODULE 'AMX Radia' Instance1(dvLights,vdvLights,dvKP)
    DEFINE_MODULE 'Alcorn-Mcbride' Instance1(dvDVM,vdvDVM,dvKP)
    
    (***********************************************************)
    (*                THE EVENTS GO BELOW                      *)
    (***********************************************************)
    DEFINE_EVENT
    

    This is the part of the module where I'm trying to send messages back to the master. (This module seems to work, but I'm using it as a troubleshooting test for my other module which does not.)
    DATA_EVENT[vdvProjector]//VIRTUAL DEVICE
    {
        COMMAND:
        {
    	    SELECT 
    	    {
    		ACTIVE (FIND_STRING(DATA.TEXT,'POWER ON',1)):
    		    {
    		    CALL 'SendStringProjector'("'C00',$0D,$0A")
    		    sTimesArray[1]=500//1/2 SEC
    		    TIMELINE_CREATE(TLONBLINK,sTimesArray,1,TIMELINE_ABSOLUTE,TIMELINE_REPEAT)//TO CREATE IMMEDIATE BLINK
    		    sTimesArray[1] = 2000//FIRST SEQUENCE HAPPENS AT 2 SECONDS
    		    TIMELINE_CREATE(TLPOLL,sTimesArray,1,TIMELINE_ABSOLUTE,TIMELINE_REPEAT)//RUN POLLING TIMELINE WITH PARAMETERS
    		    }
    		ACTIVE (FIND_STRING(DATA.TEXT,'POWER OFF',1)):
    		    {    ON[vdvProjector,1] SEND_STRING 0,'DATA.TXT'
    		    CALL 'SendStringProjector'("'C01',$0D,$0A")
    		    sTimesArray[1]=500//1/2 SEC
    		    TIMELINE_CREATE(TLOFFBLINK,sTimesArray,1,TIMELINE_ABSOLUTE,TIMELINE_REPEAT)//TO CREATE IMMEDIATE BLINK
    		    sTimesArray[1] = 2000
    		    TIMELINE_CREATE(TLPOLL,sTimesArray,1,TIMELINE_ABSOLUTE,TIMELINE_REPEAT)
    		    }
    
    

    I am both turning a feedback channel on and doing a send string in the second "ACTIVE" statement. Neither seems to work, although the projector is getting the command contained immediately after. I don't get it.

    Eric, do I understand you to say that you watch module variables in debug?

    I have attached entire files if that helps.

    Thanks much!

    Greg
  • gregrgregr Junior Member Posts: 54
    OK, the mystery deepens-It started working for no apparent reason! I ate lunch, came back to it, and just for kicks, added a CHANNEL_EVENT in the main code to trap the feedback statement in the module, and all of a sudden I started getting CHANNEL notifications, the SEND_STRINGS to the Master, the malfunctioning module started working, everything just as you would expect.

    The only thing I can think of is that the non-working module was missing the ONLINE_EVENT for the real device which allows the ONLINE variable to become true, forcing a repeating IP socket connection attempt. I then added it, but got the same symptoms until just now. Could the Master have become unresponsive in some way because of the repeated connection attempts, and stayed partially locked up for more than 2 hours?

    Or maybe the process of eating lunch...Come to think of it, I did have to skip breakfast this morning...

    Thanks for the offer of help, Eric.

    Greg
  • SamkAMXSamkAMX Junior Member Posts: 29
    send string 0, "'sending this', variable"

    even if "variable" is not populated "sending this" will always show up in diagnostics
    if an event triggers it - push, online event, string event etc

    sometimes buffer overflows(kind of like your temp internet files in web browser) and you may have to disable diagnostics or notifications, close window then reanable and you'll see them again
  • yuriyuri Junior Member Posts: 861
    is it possible to define multiple modules with the same instance id?
  • DHawthorneDHawthorne Junior Member Posts: 4,584
    yuri wrote: »
    is it possible to define multiple modules with the same instance id?

    Well, it's possible, though I surely wouldn't recommend it. When a module is loading into the running code, each instance has it's variables and routines ID's with the instance name so the running program can tell one from the other. None of this is visible, to either you or to debug, it's all internal to the running code. So, with the same instance ID, you are basically going to have two modules doing exactly the same thing at the same time with the same data. I'm surprised the compiler allows it at all, though I imagine if you really tried, you could write one in such a way that it didn't barf.
  • gregrgregr Junior Member Posts: 54
    yuri, I think that since the modules are different, they can use the same instance #.
Sign In or Register to comment.