Run time error 1

Hello!

I have a problem with an error and I don’t know what this error means.
This is the error, which I get in the TESTbed:

Does anyone know what this means and how I can solve this problem?

Kind regards

Hello @lf,

As you can see in the box with the call sign, there is a problem in the library function “_elapsed()”. This could be because you use either the momentElapsed()) or “periodElapsed()” function in your project and the “interval_s” parameter is 0.

You may be using a variable here that stores the recording interval received from the server. If this variable has not been initialized or is set to 0 via the server interface, the assertion shown in the screenshot can occur.

// "aSettings.RecItv" must not be 0
momentElapsed(iLastRecord, aSettings.RecItv) 

To prevent the recording interval from being set to 0 via the server interface, the “min” attribute can be used in the Data Descriptor.

// Record interval
RecItv  u32  title="Record Interval"  units=sec  min=10  default=60

Kind regards
Microtronics Engineering

Hello @MicrotronicsEngineering ,

I am already using the “min” attribute, so unfortunately I think this is not my problem.


Is there any other reason that could cause the error?

Kind regards

Hello @lf

Using the “min” attribute only prevents a smaller value from being entered via the server interface than specified by “min”.

I think your problem is that you pass the value 0 for the second parameter of the “momentElapsed()” or “periodElapsed()” function. This means that the variable has not yet been initialized with the recording interval stored in the flash or received from the server.

To check this, you can either

  • output the value of the variable you pass to the function “momentElapsed()” or “periodElapsed()” immediately before calling the function “momentElapsed()” or “periodElapsed()” using the function “#log
// Issues the Record interval
#log("RecItv=%d", aSettings.RecItv);

// "aSettings.RecItv" must not be 0
momentElapsed(iLastRecord, aSettings.RecItv) 
  • or pass a constant to the function “momentElapsed()” or “periodElapsed()”.
momentElapsed(iLastRecord, 10) 

Kind regards
Microtronics Engineering

Hello @MicrotronicsEngineering

I am using a constant now and now it is working again.
Thanks for your help and the fast replies.

Kind regards