Too Big?

I have been working on re-writing my code (for my pool controller I am working on). I am trying to make it more “object-oriented.” To help myself, I grabbed the source for squirrel and built the command line interpreter (sq) which has really helped my work through the kinks of my squirrel knowledge (and most of my code). I have even created “imp” classes as stand-in when I run locally to better test my code locally. This has helped me find a lot of bugs, and sq is a lot more helpful on errors, then the imp server log (they say the same thing, but sq prints out line numbers, and all the variables on the stack,etc).

Anyways, I have been working on my re-write for a bit (well, my free time is next to none, so it has taken me a few days, 10-60 minutes at a time). Anyways, I finally went to upload it today, and I get no log output, and the lights on the IMP lead me to believe that it is just continuously rebooting. My code is 14KB on disk (without the IMP bootstrap code), but including comments, whitespaces, etc. If I am really running out of space, would there be any better indication?

Again, this could be some dumb mistake, but it (generally) runs ok on my machine with sq (the UART is fed with data from a file, and everything else (inputs/outputs) are just stubbed out).

Nevermind… I put a imp.sleep(0.1) after all my server.log() and I can see I have a loop or something going on…Sorry for the noise…

Any large memory allocations the code is performing? I’ll email you to continue the debug of this, but since release-5, which you’re running, you shouldn’t have code size issues.

Phew :slight_smile:

btw server.error() will log and flush to the server (vs buffering until the next event process, which is what server.log() does). Useful tip.

Very useful. Thanks! I got it up and running now and I am going to slowly put back what I took out to do it. I think it was my subclass of OutputPort (to save a small amount of history of what set was called on), I have 8 OutputPorts (is there a limit)?

There’s no limit to the number of any class, apart from memory. OutputPorts are not memory-heavy unless your derived class does something memory hungry though.

Developing code using “sq” on the PC is a good technique, but you do need to keep in mind the one or two differences.

Peter

Hugo, my derived class was storing the last 6 values (numbers), so not very large.

Peter, I didn’t see that part on the differences, but they all sound reasonable. I do use the file i/o stuff to simulate the UART, but none of that stuff is uploaded to the IMPs, of course.

It has really helped get me up and running much faster, however. Almost temped to write a real debugger, with stepping, variable views, etc, but who has time for these sort of things:-)

BTW, this all works now. Hugo had told me that my card wasn’t on Release-5 as it should have been, so it is possible that was it.