Null structure pointer in feedback statement in timeline brings NX-3200 to its knees

I ended spending way too much time chasing this one around. I had a controller go bad. It started dropping offline constantly. When I replaced it, the code just crawled on the new controller. I swear it acted like the processor was running at just a couple ticks a second. Turned out not to be the hardware, I tried another one and got the same result; turned out not to be any of 3 different versions of firmware; turned out not to have anything to do with RMS version vs. firmware version. It turned out I have a feedback timeline referencing a "masterroom" variable which is null until the first time you've selected a specific room on the master panel. Fresh code upload to a new controller doesn't have that variable set, and the processor just chokes on it. It shows up in the logs as an error, but it's not clear from that just how much it drags the controller. In the end, I just iffed out those 5 feedback statements to not evaluate unless theres a value, and Shazaam! Code took off like a champ.


  • HARMAN_icraigieHARMAN_icraigie Technical Trainer II, Harman Professional University Posts: 404

    Always best practice to validate any variable referenced as an index into an array - not only that is has a value as but also that it does not exceed the bounds of that array.

  • richardhermanrichardherman not-so-junior member Posts: 136

    @[email protected]: Example code? I'm curious.

  • TonyAngeloTonyAngelo Code Monkey Posts: 315

    Not exactly the issue, but still somewhat on point (and one of my favs)

  • fogled@mizzou[email protected] h4x354x0r Posts: 512

    Here's the most basic clipping of code that provokes the problem:

    dvtp_master = 10001:25:0 //MASTER CONTROL

    long feedbacktime[1] = {300} //Time for feedback (Define_Program replacement) loop

    structure roomdata {
    char name[20]
    integer status
    integer occsensor
    integer helpbtns[30]
    char user[30]
    devics d[12] //sub-structure
    inputs i[8] //sub-structure
    audiodata a[2] //sub-structure
    deviceip n[1] //sub-structure

    persistent integer masterroom

    data_event[dvmaster] { //master init
    online: {
    //what here?

    timeline_create(99,feedbacktime,1,timeline_absolute,timeline_repeat) // Creates main room control & buffer processing timeline


    timeline_event[99] { //Primary Feedback Timeline

    //Master Panel Feedback

    [dvtp_master,200] = (rm[masterroom].status==1) //
    [dvtp_master,201] = (rm[masterroom].d[1].ipconnect==1) //
    [dvtp_master,202] = (rm[masterroom].occsensor==1) //
    [dvtp_master,204] = (rm[masterroom].d[4].ipconnect==1) //
    [dvtp_master,206] = (rm[masterroom].d[6].ipconnect==1) //
    [dvtp_master,208] = (rm[masterroom].d[8].ipconnect==1) //
    [dvtp_master,211] = (rm[masterroom].d[11].ipconnect==1) //
    [dvtp_master,212] = (rm[masterroom].d[12].ipconnect==1) //

    All I have to do to get rid of the problem is this:
    if(masterroom) { [dvtp_master,200] = (rm[masterroom].status==1) // [dvtp_master,201] = (rm[masterroom].d[1].ipconnect==1) // [dvtp_master,202] = (rm[masterroom].occsensor==1) // [dvtp_master,204] = (rm[masterroom].d[4].ipconnect==1) // [dvtp_master,206] = (rm[masterroom].d[6].ipconnect==1) // [dvtp_master,208] = (rm[masterroom].d[8].ipconnect==1) // [dvtp_master,211] = (rm[masterroom].d[11].ipconnect==1) // [dvtp_master,212] = (rm[masterroom].d[12].ipconnect==1) // }
    Like I said, I spent way too much time chasing this one around. If I had just declared an initial value in the define variable statement, this never would have happened. If I had (insert any number of other typical programming habits), this wouldn't have happened. I didn't test defining zero as default instead of null to see if there was any difference between the two.

  • fogled@mizzou[email protected] h4x354x0r Posts: 512

    Sorry I obviously don't have any clue what I'm doing trying to post code on this new forum. I just put my stuff inside the Code ticks from the Paragraph drop-down. What came back out is utterly bizarre.

Sign In or Register to comment.