Method running into the next one.
I have this sporadic issue where one method sometimes runs into the method directly below it . The method 'DisplayTemplate' is called frequently and on a few occasions (quite rare but still shouldnt be happening) it will 'overshoot' and print out the method below it on my LCD screen,(Usually just the first line or so). The Startupscreen1 method is only ever called at startup .
Any ideas what might cause this or had similar issues?
I thought it may be from a lack of allocated stack space for the cog in which its running and I recently upped it to 128 longs but it still occured.
Any ideas what might cause this or had similar issues?
I thought it may be from a lack of allocated stack space for the cog in which its running and I recently upped it to 128 longs but it still occured.
PUB DisplayTemplate(Mode,MSG)|a,b
{{Templete used to display Current Status of ProGen}}
case Mode
0: ' Non Promotional Product
lcd.move(1,1)
lcd.str(string(" NON PROMO PRODUCT "))
'b := strsize(@printerproduct)
if lcdstrlength <19
lcd.move((10-lcdstrlength/2),3)
lcd.str(@printerproduct)
else
lcd.move(2,3)
repeat a from 0 to 17
lcd.char(printerproduct.byte[a])
1: ' Promotional Product
if lcdOneShot == 0 'This is to prevent junk sometimes being displayed when changing over messages
Pause(500)
lcd.clear
lcdOneShot:=1
debug.str(string(13,"Lcd Oneshot executed!!!"))
lcd.move(1,1)
b := lcdstrlength
lcd.str(string("Batch:"))
if b <15
lcd.move(21 - b,1)
lcd.str(@printerproduct)
else
repeat a from 0 to 13
lcd.char(printerproduct.byte[a])
lcd.move(1,2)
lcd.str(string("Balance:"))
lcd.move(9,2)
case (NoOfCodes-CurCodeNo)
0..9: lcd.str(string(" "))
10..99: lcd.str(string(" "))
100..999: lcd.str(string(" "))
1000..9999: lcd.str(string(" "))
10000..99999: lcd.str(string(" "))
100000..999999: lcd.str(string(" "))
1000000..9999999: lcd.str(string(" "))
10000000..99999999: lcd.str(string(" "))
100000000..99999999: lcd.str(string(" "))
lcd.dec(NoOfCodes-CurCodeNo)
a:=10-CharsPerCode/2
if a//2 == 0
a++
lcd.move(a,3)
lcd.str(@thecode)
lcd.move(1,4)
case LcdAlertCount
0:
if MSG <> 0
lcd.str(MSG)
else
lcd.str(string(" "))
1: lcd.str(string(" "))
LcdAlertCount++
if LcdAlertCount>1
LcdAlertCount:=0
PUB StartUpScreen1
{{When ProGen is switched on this screen appears followed by Startupscreen2,3 and 4}}
lcd.clear
lcd.move(6,1)
lcd.str(string("ProGen 125"))
lcd.move(1,2)
lcd.str(string(" UNIQUE CODE FEEDER"))
lcd.move(1,3)
lcd.str(@KernalVerNo)
lcd.move(1,4)
lcd.str(@VersionNo)

Comments
PUB GetInterfaceVersion(locPointer)|a ,LocRx repeat a from 0 to strsize(@Version) byte[locPointer++] := Version.byte[a] [color="red"]locpointer.byte[a]:=0[/color]The loop copies the version string including terminator (0..length). I believe the red line is intended to place said terminator but effectively writes a zero byte somewhere on the stack (locpointer.byte[idx] accesses memory starting at @locpointer, IOW relative to the method's parameter location). I'm not saying that this is the reason for the odd behaviour you're seeing but it's definitely fishy.I was testing it with this stackLength object recommended in the propellor manual, and i found that if i ran it on my lcdhander it was returning a stack length of 32 longs but if i used 32 longs it would cause issues