I have a strange problem with displaying some data that changes. I have 3 pieces of data on the screen - x, y, z, where x = y/z. I am using "fire on change" on both y and z to update the calculation of x. The variable y is received over CAN, z is changed via button push on the display. Everything works fine until I reset the variable y to zero. This is done via button push on the display, which sends a CAN message to a controller that resets the variable. Once this variable is reset, the value x is frozen on the screen and will not change if y or z or both change. However, if I change screens and then come back the value is changed and works normally again.
I tried to remedy this by programming a delay after resetting the variable followed by recalculating x, UIApp Showview, and Screen Show /Page with no success.
Any help would be greatly appreciated.
Phil
problem updating on-screen data
- drphil69
- Posts: 139
- Joined: Wed Mar 02, 2011 5:59 pm
- drphil69
- Posts: 139
- Joined: Wed Mar 02, 2011 5:59 pm
Re: problem updating on-screen data
Sorry, I made a mistake in the above post. I set the variable Z to zero... are there any divide by zero issues that could be causing this? I will try incorporating a check to ensure that if z = 0 then x = 0 and the calculation is avoided... (key word is "try")
thanks,
Phil
thanks,
Phil
- bmcrae
- Enovation Controls Development
- Posts: 75
- Joined: Thu Sep 09, 2010 11:20 am
Re: problem updating on-screen data
I believe you have found a bug. I am entering a bug to be tracked and possibly fixed in version 2.3.
Basically what I have found is if z is ever zero, all calculations of x stop, even if z is later set to something other than 0 later. You can prevent this by not calculating x when z=0, but if you attempt to divide by 0 the calculation will not update.
Attached is a simple test configuration using j1939 engine speed as the j1939 data. There is a fire on change event tied to the j1939 data which calculates x = engine speed / z. I have keys that change the value of z from 0 to 1 to 2. If I initialize z to 0, all is broken. If I start out at 1 it works. If z is ever 0, all stops.
Brian McRae
SW Test Lead
FW Murphy
Basically what I have found is if z is ever zero, all calculations of x stop, even if z is later set to something other than 0 later. You can prevent this by not calculating x when z=0, but if you attempt to divide by 0 the calculation will not update.
Attached is a simple test configuration using j1939 engine speed as the j1939 data. There is a fire on change event tied to the j1939 data which calculates x = engine speed / z. I have keys that change the value of z from 0 to 1 to 2. If I initialize z to 0, all is broken. If I start out at 1 it works. If z is ever 0, all stops.
Brian McRae
SW Test Lead
FW Murphy
- drphil69
- Posts: 139
- Joined: Wed Mar 02, 2011 5:59 pm
Re: problem updating on-screen data
Thanks Brian. The work around I choose was to make a dummy variable such that if z = 0, then Dummy = 1000000000, which rounds x to zero (at least on the screen) after rounding.
Phil
Phil