Products > Test Equipment

Program that can log from many multimeters.

<< < (582/683) > >>

jmurray:

--- Quote from: Cavhat on October 26, 2021, 05:12:00 pm ---
--- Quote from: HKJ on October 26, 2021, 03:19:20 pm ---The "Out of memory error" is probably the reason for it running slow. My best guess is that you call some scripts recursively.
Try using #runscript without parameters, this is possible as long as you run your main script in background (#RUNSCRIPTASYNC).

--- End quote ---

None of my scripts are called recursively, but your suggestion did give me the idea to investigate potential variable scoping issues.  Sure enough, a couple of my "child" scripts implicitly used a parent script's iterator variable instead of defining their own locally scoped iterator variable.  It looks something like this:


--- Code: ---#scriptScript MyParentScript

=var i = 0;
; iterate through an array using i...
#runScript MyChildScript1
; do some other things...
#runScript MyChildScript2
#return

;-------------------------------------------------------------
#scriptScript MyChildScript1
=i = 0;
; iterate through some other array using i...

; note that I failed to actually declare "i" here using "=var i = 0;" and TC doesn't complain about it,
; so MyChildScript must be using the "i" declared in MyParentScript above and, consequently,
; this script merely redefines "i" here.
#return

;-------------------------------------------------------------
#scriptScript MyChildScript2
=i = 0;
; iterate through yet another array using i...

; note the same issue with variable scoping as in MyChildScript1
#return

--- End code ---

Once I corrected my variable scoping mistakes in a couple scripts, everything suddenly behaves properly and the whole script runs flawlessly.  Cheers!

--- End quote ---


@HKJ
Is there a way to declare and call subroutines within a script, or is saving them as external scripts the best method?

HKJ:

--- Quote from: Hydron on January 23, 2023, 07:35:44 pm ---See attached updated definition, I've called it "HP/Agilent 34401A Enhanced", added some notes (for that option only) and a lot of stuff into the Temperature setup page.

--- End quote ---

Thanks, it will be included in the next release.



--- Quote from: Hydron on January 23, 2023, 07:35:44 pm ---Finally I'm having problems with text rendering, both in general (very poor text quality on graph axes - note this is with 125% hidpi mode in windows which might not help) and specifically when using "special" characters like the Omega for Ohms and the degrees symbol for Celcius. Weirdly it seems to work for the DMM6500 device but not the 34401A, and I can't see any reason for the difference. See attached screenshot of the Chart showing both problems (the "°C" thing happens also in the current values section and popup dialogues).

--- End quote ---

TestController requires a BOM on UTF files to handle the characters correctly, I have added it.

HKJ:

--- Quote from: jmurray on January 26, 2023, 01:32:33 am ---@HKJ
Is there a way to declare and call subroutines within a script, or is saving them as external scripts the best method?

--- End quote ---

The short answer is that the script do not support declaring subroutines.
But there are many other ways to do it:
In the menu scripts you can use the heading #scriptScript header to make a hidden callable script. Check ...\Documents\TestController\Settings\ScriptLibrary.dat for examples.

You can store a script in a string and use executeEmbeddedString().
Or you can create a user defined function addFuncEmbedded() or addFuncEmbeddedGlobal()
There is a little bit of documentation here: http://lygte-info.dk/project/Calculator%20UK.html#List_vars_&_functions
Newest version of TC support triple quotes to make this easier, i.e. """ multiline text """;

Generally local variables from the calling script will be available, but it is more controlled to use parameters.

jmurray:
FYI I found a bug in the date() function.

When providing a date to be encoded, it adds two months to the date.


--- Code: ---=date(2023,02,01,16,05,00)
;; 20230401160500

--- End code ---

HKJ:

--- Quote from: jmurray on February 01, 2023, 08:03:16 am ---FYI I found a bug in the date() function.

When providing a date to be encoded, it adds two months to the date.


--- Code: ---=date(2023,02,01,16,05,00)
;; 20230401160500

--- End code ---

--- End quote ---

Thanks, it will be fixed in the next version.
As a temporary solution you can subtract 2 from the month until then.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod