Home AMX User Forum AMX General Discussion

Events not working

I had to add some code yesterday to trigger NVR recordings of cameras based on a driveway Cartel sensor and exterior PIR motion detector which is simple enough. This was a take over system and I added My NVR code to the secondary master and then added some other code that my NVR code required to operate. As soon as I added all this code I was unable to use control device to fire off the IO's required to trigger events and check my changes. The existing code had compiler directive everywhere so I figured I deleted an #END_IF somewhere and the compiler was no longer pulling in my DEFINE_EVENTS sections. I check every freaking #IF_DEFINED and #END_IF and everyone seemed to be paired up properly so I decided to look elsewhere. One of the dependencies I had to add for my NVR code was a data_event for UIs since they were declared in the other master and I put that D_E before all other events and when I commented out its guts, re-compiled, transferred my other events worked fine. Turns out after further investigation that it was the AWAKE: and STANDBY: handlers that were breaking all my subsequent events.

This works:
DEFINE_EVENT    //DATA_EVENT   [dvUI_Arry]

DATA_EVENT   [dvUI_Arry]
     
     {
     ONLINE:
	  {
	  fnUI_Online(GET_LAST(dvUI_Arry)) ;
	  }
     OFFLINE:
	  {
	  fnUI_Offline(GET_LAST(dvUI_Arry)) ;
	  }
    // AWAKE:
//	  {
//	  fnUI_DeBug("'UI INDEX-[ ',itoa(GET_LAST(dvUI_Arry)),' ], IS AWAKE :DEBUG<',itoa(__LINE__),'>'") ;
//	  }
//     STANDBY:
//	  {
//	  fnUI_DeBug("'UI INDEX-[ ',itoa(GET_LAST(dvUI_Arry)),' ], IS IN STANDBY :DEBUG<',itoa(__LINE__),'>'") ;
//	  }
     STRING:
	  {
	  fnUI_DeBug("'UI INDEX-[ ',itoa(GET_LAST(dvUI_Arry)),' ], STRING-[ ',DATA.TEXT,' ] :DEBUG<',itoa(__LINE__),'>'") ;
	  }
     }

While this does not:
DEFINE_EVENT    //DATA_EVENT   [dvUI_Arry]

DATA_EVENT   [dvUI_Arry]
     
     {
     ONLINE:
	  {
	  fnUI_Online(GET_LAST(dvUI_Arry)) ;
	  }
     OFFLINE:
	  {
	  fnUI_Offline(GET_LAST(dvUI_Arry)) ;
	  }
     AWAKE:
	  {
	  fnUI_DeBug("'UI INDEX-[ ',itoa(GET_LAST(dvUI_Arry)),' ], IS AWAKE :DEBUG<',itoa(__LINE__),'>'") ;
	  }
     STANDBY:
	  {
	  fnUI_DeBug("'UI INDEX-[ ',itoa(GET_LAST(dvUI_Arry)),' ], IS IN STANDBY :DEBUG<',itoa(__LINE__),'>'") ;
	  }
     STRING:
	  {
	  fnUI_DeBug("'UI INDEX-[ ',itoa(GET_LAST(dvUI_Arry)),' ], STRING-[ ',DATA.TEXT,' ] :DEBUG<',itoa(__LINE__),'>'") ;
	  }
     }
Granted the AWAKE and STANDBY handlers are useless anyway and were put into my template when I thought they would eventually do something but in this an older NXC-ME master running v2.31.137 firmware I wouldn't have thought leaving these in would actually break all the events that followed.

Very much a PITA and ruined a good part of yesterday and this morning trying to figure WTF was going on but the mystery is solved so I can try and salvage my week end.

Comments

  • ericmedleyericmedley Posts: 4,177
    Whenever I find events not firing I tweak up the Duet RAM a bit and it seems to fix things. (this even if not using Duet modules). Seems to work for me every time.
  • viningvining Posts: 4,368
    ericmedley wrote: »
    Whenever I find events not firing I tweak up the Duet RAM a bit and it seems to fix things. (this even if not using Duet modules). Seems to work for me every time.
    Unfortunately this is an old NXC-ME installed around 10 years ago and it isn't running Duet Firmware.

    I did look for an updated firmware for this but I couldn't find it on the website even in the archive section. I could just be as blind as my wife says I am but I'm probably better off with out it on these old lower mem systems. I recall NI-4000 running duet firmware would not run the program at all if I set the duet mem above 4, maybe 8 but my gut says 4.

    As a matter of course on new masters I set duet mem to 18m, udp bc rate to 0, and zero config to off and things seem to work out fairly well. I'm pretty sure this old master running old firmware just didn't know what to do with the AWAKE and STANDBY handler and basically said; "no events for you" kind of like the soup nazi said to kramer.
  • AuserAuser Posts: 506
    vining wrote: »
    The existing code had compiler directive everywhere so I figured I deleted an #END_IF somewhere and the compiler was no longer pulling in my DEFINE_EVENTS sections.

    It would be worth throwing in a #WARN statement at the block you're interested in to check that the compiler is indeed including that part of the code in the compilation.
  • viningvining Posts: 4,368
    Auser wrote: »
    It would be worth throwing in a #WARN statement at the block you're interested in to check that the compiler is indeed including that part of the code in the compilation.
    Yeah, that would have been an intelligent thing to do, sure wished I thought of of that on Saturday. :)
Sign In or Register to comment.