Checking DTC Data for null

Discuss issues and ideas you have to configuring displays with PowerVision
cconner_aie
Posts: 93
Joined: Thu Jun 11, 2015 10:12 am

Checking DTC Data for null

Post by cconner_aie » Thu Oct 19, 2017 7:44 am

I have a function that catches new DTC's and saves them to a historic list internal to the panel and I've run into problems with the panel locking up.

I've narrowed it down to the Fault Description and Action Description fields. If I read these fields:

Code: Select all


J1939DTC dtcData;

//...

ListManagerGetItem(ListDataType.Dm1ListType, i, dtcData);

string actionDescription = "";
dtcData.ReadActionDescription(actionDescription);

string faultDescription = "";
dtcData.ReadFaultDescription(faultDescription);

// ...

CustomListData listData;
listData.WriteString(CustomListColumn.HistoricFaults_ActionDescription, actionDescription);	
listData.WriteString(CustomListColumn.HistoricFaults_FaultDescription, faultDescription);	

//...

ListManagerAddItem(ListDataType.HistoricFaults, listData);

When action description is null (if there isn't a DTC in the library), the panel will lock up. I can tell it's null because I see garbage when remotely viewing the list, it looks like the string is not terminated and I catch random bits of memory.

This has been pretty consistent with the action description, so I removed it. However I just started to see the same behavior with fault description, even when the string is empty rather than null.

It doesn't appear that I can do a simple 'if (actionDescription == null)' check with how strings are implemented. Is there a good way to check that the data in J1939DTC is filled?

I'm currently on 2.9.20040 using a PV480. We are trying to wrap this up this week and this just became a bigger issue, so if there is any advice I'd greatly appreciate it.

Thanks,
Coleby Conner
Controls Engineer, Anderson Industrial Engines
boyce
Enovation Controls Development
Enovation Controls Development
Posts: 322
Joined: Wed Sep 08, 2010 5:09 pm

Re: Checking DTC Data for null

Post by boyce » Thu Oct 19, 2017 8:17 am

I'll put a bug in the system to get more people looking at it. Can you private message a configuration to me that can reproduce the error and the information about the DTCs that cause the problem?
Boyce Schrack
Enovation Controls
cconner_aie
Posts: 93
Joined: Thu Jun 11, 2015 10:12 am

Re: Checking DTC Data for null

Post by cconner_aie » Thu Oct 19, 2017 8:19 am

Thank you Boyce, I'll try to put together a watered down example to send you.
Coleby Conner
Controls Engineer, Anderson Industrial Engines