@HKJ, I've run into some strangeness with respect to variables, variable initialization, and loops / script loading. Something is simply not acting the way it should (and is documented.)
AFAIK, if I initialize a variable like so:
=var foo=50
or
=globalvar bar=0.25
Whether in a script or program, every time that code is encountered, the value should be reset to the stated value. Correct?
Here are strange things I am seeing, with global variables:
* The first time it's encountered in a script, yes it is initialized properly
BUT... sometimes, or in some cases repeatably, it's not working that way when the same line is later encountered.
A. Settings variables* I have some settings that are pre-initialized in global vars (eg testCurrent = 0.25)
* I use #popupnumber to let the user modify for that run (eg changing it to 0.05 )
* ISSUE: If I: abort the run, edit the file, load+run the file (which still contains the original preset), and click Run...
* when the popup shows, it shows the value that the user last entered??!!
B. Big Loop* My current big project has a big loop (a more in-depth battery tester. Repeatedly checks iR, drains N Ah, and repeats until drained)
* At the start of the loop there are a bunch of initialized global variables (global b/c they are needed in runScript() scripts)
* ISSUE: in a number of cases, the variables are NOT re-initializing for the next go-round!
* My attempted workaround, not sure if fully working yet due to C below: I am simply defining globalvar xyz; outside the loop, then assigning a value inside the loop. That seems to work better -- but should not be needed, correct?
C. SIMPLY CONFUSING* This one I've not yet diagnosed. I am wondering if your newer debug flags might help me dig in deeper.
* AND, this used to be working without issues

Not sure what I changed...
outside of any loop, during prelim setup, I've got (simplified a bit):
#calc
...
runScript("""# local long string that turns on logging, turns on load device, sets current, does an N second delay""");
printLog(""+timestamp()+": Done stabilizing");
if ( readVoltage(load)<termVoltage )
printLog("in test a");
whyTestStopped="Low Input Voltage: "+readVoltage(load);
printLog("in test b");
printLog("pre-Loop: TEST ABORT Before starting; Input Voltage too low. "+whyTestStopped);
printLog("in test c");
setOn(load,0);
printLog("in test d");
return;
printLog("in test e");
endif;
printLog("after test");What I get:
* runScript all works
* I get the Done Stabilizing printLog
* Then, with logging still active, load still on -- "Abort" goes gray so presumably the script stopped.
Yet there's no exception or any other message in the debug log (other than ongoing log comm's until I stop it)
Any ideas most welcome.
I don't know how to debug this further.
(BTW is there a way to NOT log all device I/O while in debug? it's 99.9% distraction for what I'm doing now...)