OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) sprinklers_pi – An alternative sprinkler control program Re: Re: sprinklers_pi – An alternative sprinkler control program

#24932

rszimm
Participant

By all means, go ahead and take what you want!

Be a bit careful with that relative path thing. The path cstring (sPage) is pretty darn short in length (only 30 bytes), which is why I chose an absolute path right off the root FS (i.e. /web). As you surmised, the memcpy protects the memory outside the cstring, so make sure if you change the memcpy length, you also change the cstring length. From your post I think you just pulled off the forward slash and changed the 5 to a 4 in the memcpy. That should be totally fine…

BTW (tech speak here…): There are a bunch of these little optimizations in there. This is because it’s designed to run inside the small address space of the Atmel Arduino platform. They only give you 4k of RAM over there. That’s right, 4096 bytes of RAM! It’s hard to implement a web server and a FAT file system retrieval library, as well as a NTP time keeping library and a TFTP server all in 4k of RAM (not to mention the actual sprinkler code) That means that there are tons of little size optimizations and limitations to keep the stack size from growing (I don’t use any heap in this application). If I didn’t want to cross-develop here there are a LOT of things I would have done differently.