Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
srnet Senior Member Joined: 08/08/2014 Location: United KingdomPosts: 164
Posted: 10:09pm 24 Mar 2015
Copy link to clipboard
Print this post
I was trying out my GPS Distance and Calculation routines for the LoRa tracker receiver. The program would run for a few minutes and go a bit haywire, it was in fact running out of memory.
The problem turns out to be an error on my part;
FUNCTION CONVERTLAT(LLAT$) as FLOAT
DIM LOCAL FLOAT LGPSDeg, LGPSMins, Ltemp
DIM LOCAL is not highlighted as an error, but causes 3 new variables to be assigned every time it runs.
EXPLICIT mode does pick it up, in that the variables in the incorrect DIM are not created as LOCAL so an error is reported.
Could catch you out, eventually, in an infrequently used routine.
Using MMII 4.6b
Edited by srnet 2015-03-26$50SAT is Silent but probably still working. For information on LoRa visit http://www.loratracker.uk/
PicFan Senior Member Joined: 18/03/2014 Location: AustriaPosts: 133
Posted: 05:40am 26 Mar 2015
Copy link to clipboard
Print this post
I think, the correct Syntax is:
LOCAL DIM AS FLOAT var1, var2, varX
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1576
Posted: 06:23am 26 Mar 2015
Copy link to clipboard
Print this post
Hi
please try
LOCAL FLOAT var1, var2, varX
without DIM!
edit: LOCAL replaces DIM in a SUB. LOCAL means "DIM" locally.
Local variables "live" (exist in the memory) until the program exits the SUB.
Generally you should use DIM only in the main program.
DIM variables are globally available.
Regards
MichaelEdited by twofingers 2015-03-27causality ≠ correlation ≠ coincidence
srnet Senior Member Joined: 08/08/2014 Location: United KingdomPosts: 164
Posted: 06:56am 26 Mar 2015
Copy link to clipboard
Print this post
I fixed it as soon as I spotted in in the code.
Point was that the interpreter does not pick it up, but instead your program may crash days or weeks after it started.
$50SAT is Silent but probably still working. For information on LoRa visit http://www.loratracker.uk/