rszimm / sprinklers_pi

Sprinkling System Control Program for the Raspberry Pi
GNU General Public License v2.0
310 stars 100 forks source link

Expanding zone support to 31 #9

Open BillSobel opened 10 years ago

BillSobel commented 10 years ago

Is adding support for 31 zones at direct as updating the define for NUM_ZONES, or is their other work to be done? I'm looking at ordering the raspberry pi version with 3 expansion boards and wanted to ask if I could utilize all of them (or offer to help if work is needed to support more than the 15 zones supported today)

Best, Bill

rszimm commented 10 years ago

Bill, increasing NUM_ZONES gets you about 50% of the way there. Unfortunately the next 50% is much more difficult. Specifically the settings are stored in a binary file that is only 2k large. This is because this exact same code can be compiled to target the Arduino/AVR platform where the settings are stored in EEPROM and the size is only 2k. Increasing NUM_ZONES beyond 16 will result in a lot of settings overwriting one another.

At some point I have on my to-do list a change that will move the settings from an EEPROM file to a more text oriented settings file that I could store in the filesystem, but that work is still a ways away. Anyway, if you wanted to start digging into this I believe that almost all the work would be contained in the settings.cpp and .h files.

BillSobel commented 10 years ago

I looked over the code, I think I see what needed to be done. Would you be opposed to (for now) extending the EEPROM class to 4k (since it appears to only be instantiated on the Pi) and having an #ifdef in the settings that adjusted some of the offsets if the zone count was > 15? I think in that case it might be a pretty easy change until you tackle the config file rewrite. If you are ok with that I'd be happy to branch and propose the changes back either late this month or early Jan (I'm leaving for India in about 12 hours and back for Christmas so no coding on home projects until then).

rszimm commented 10 years ago

That sounds good to me. If you wanted to take a swipe at it, go ahead. I'll probably add something to the makefile such that the standard build still creates a 15/16 zone support, but with a switch you'll get 31/32 zone support, but the two settings files would be incompatible.