xap.Timer issues with LCD Applet

Hi All,

Im scripting an Applet to use with my 20x4 LCD, all is working well so far except i appear to have a timer issue

the script will happily run for 5 - 10 minutes or so and then appears to just stop - occasionally the HAH becomes unresponsive - memory leak??

im not stopping or the deleting the timer at anypoint as yet, its scripted in a way that i want the timer to continuly run... perhaps this is the issue

Member for

14 years 5 months

mark_baldwin

13 years 10 months ago

This is why I started the 20x4 display, I knew someone else would get interested too :)

I'm liking what you are trying to do. If you want I'll try it out myself and see what I find.

Member for

14 years 5 months

mark_baldwin

13 years 10 months ago

Hi Andrew

I've edited it for my system, ironed out a couple of bugs and it's been working fine now for a couple of hours.

Well done on the coding, I'm sure Brett will pull it to bits but hey ho, we can only try to follow the LUA Jedi master, we can never become one with him ;)

There were a couple of typos in the code that would have only thrown up an error every now and then depending on your system.

Here is my version

Attachments

Member for

13 years 11 months

AndrewJ

13 years 10 months ago

Hi Mark,

thanks for the comments, Brett is indeed the true master of lua prehaps he will be along to optimise both our efforts ;)

Strangely enough i cannot get your code to run up at all, it just sits at the ip address and doesnt attempt to run...(same behavior once i have changed the jeenode to my 1wire code)

i have compared our codes and can see you have modified filter2 with the jeenode code, change the function name accordingly and set the currentcost channel from * to 1

spaced out a few of the functions, tided up some spacing etc

I just tided up my version and still have the same issue, timer stops after a couple of minutes, im assuming its quiting at the CatchCurrentCost section as it never gets far enough to display the watts

thanks

Andrew

Member for

14 years 5 months

mark_baldwin

13 years 10 months ago

The bit that made it crash fo me was this bit

function catchCurrentCost()
  Value3 = xap.getValue("input.state","text")
  Line3 = Value3..Unit3..string.rep(fill, (lcdcols - string.len(Value3) - string.len(unit3)))
end

Member for

14 years 5 months

mark_baldwin

13 years 10 months ago

I changed it to this

function catchCurrentCost()
  Value3 = "Electric live - "..xap.getValue("input.state","text")
  Line3 = Value3..Unit3..string.rep(fill, (lcdcols - string.len(Value3) - string.len(Unit3)))
end

Spot the difference :)

Member for

13 years 11 months

AndrewJ

13 years 10 months ago

Other than adding the prefix for the Wattage i cant see any other difference? puzzled

im guessing its related to setting a text var "Value3" to a numeric value (Wattage) without prefixing with text first as the other values all start with A-Z as pulled from the ini i.e "Sensor 1"

just added a prefix and all is well :)

p.s i was going to add a prefix section in V2 :)

next up - to add text scrolling next and maybe a status line for RF / Relay commands

Member for

14 years 5 months

mark_baldwin

13 years 10 months ago

string.len(unit3)))

string.len(Unit3)))

LUA is fussy sometimes about capitalisation

Member for

13 years 11 months

AndrewJ

13 years 10 months ago

I wouldnt have spotted that in a million years :)

even had the other half staring at it for 10 minutes

LUA is extremely fussy in general!!

Andrew