-->
Page 1 of 1

Are chained gosubs broken?

PostPosted: Sun Jan 24, 2016 2:35 pm
by catthetrout
Been messing on the esp for a couple of cold days this weekend and while working on the big project came across strangeness.

Notice the delay and no crash, just goes away for 40 odd seconds and finishes. Never executes any subroutine either. Maybe it is my device and/or some corruption can someone please verify this behavior.

-------- Code ------------------
[main]
print "in main"
print time()
gosub sub1
print "Main Done"
print time()
end

[sub1]
print "in sub 1"
gosub 2
return

[sub2]
print "in sub 2"
return

-------- Output ----------------

in main
Sun Jan 24 19:27:47 2016
Main Done
Sun Jan 24 19:28:32 2016
Done...

Re: Are chained gosubs broken?

PostPosted: Sun Jan 24, 2016 3:29 pm
by Mmiscool
just took a quick glance at your code

Found a problem right away. You need to use the whole branch label when telling it to goub.

Code: Select all[main]
print "in main"
print time()
gosub [sub1]
print "Main Done"
print time()
end

[sub1]
print "in sub 1"
gosub [sub2]
return

[sub2]
print "in sub 2"
return


My output after running the code above.
Code: Select allin main
Sun Jan 24 20:28:36 2016
in sub 1
in sub 2
Main Done
Sun Jan 24 20:28:37 2016
Done...

Re: Are chained gosubs broken?

PostPosted: Sun Jan 24, 2016 4:38 pm
by Mmiscool
I just uploaded a new build that will give an error msg when a branch is not found in the goto or gosub commands.

Hopefully this will be helpful in debugging these kind of things in the future.