OK, done. Actually fairly simple but thought I would document in detail here for those looking for the same thing later.
1. Create a new CustomMemVars.h file which is included into Globals.h. This contains the memory locations for the on hour and minute and off hour and minute for each relay. I put these starting at 110-113 for Relay 1, 120-123 for Relay
2 and so on. The first few lines look like
Code: Select all
#define PortTimerStart 110
#define Port1TimerOnHour PortTimerStart
#define Port1TimerOnMin PortTimerStart+1
#define Port1TimerOffHour PortTimerStart+2
#define Port1TimerOffMin PortTimerStart+3
#define Port2TimerOnHour PortTimerStart+10
#define Port2TimerOnMin PortTimerStart+11
#define Port2TimerOffHour PortTimerStart+12
create new functions within InternalEEprom.cpp that read and write to each of these memory locations. Here are a couple of examples. Just pass the relay id for reads and the relay id and a value for writes. For the other memory locations the other functions add 1, 2 and 3 to the calculated memory position respectively.
Code: Select all
uint8_t InternalEEPROMClass::PortTimerOnHour_read(const uint8_t relayid)
{
return read((PortTimerStart+(10*(relayid-1))));
}
void InternalEEPROMClass::PortTimerOnHour_write(const uint8_t relayid, const uint8_t value)
{
write(PortTimerStart+(10*(relayid-1)), value);
}
3. Protoype the above funcitons in InternalEEPROM.h
4. Edit InitialInternalMemory.ino which is in the examples to set the values you would like. This step is optional since you can use the android app after the fact to edit the values directly. but e.g.
Code: Select all
// set initial values for relay on off schedule as needed
// Port 4 is the skimmer
InternalMemory.PortTimerOnHour_write(4, 7);
InternalMemory.PortTimerOnMin_write(4, 0);
InternalMemory.PortTimerOffHour_write(4, 19);
InternalMemory.PortTimerOffMin_write(4, 0);
5. Edit your sketch to use the StandardLights function to pull the time values in like:
Code: Select all
////// Place your custom code below here
ReefAngel.StandardLights( Port4, InternalMemory.PortTimerOnHour_read(Port4), InternalMemory.PortTimerOnMin_read(Port4), InternalMemory.PortTimerOffHour_read(Port4), InternalMemory.PortTimerOffMin_read(Port4));
ReefAngel.StandardLights( Port5, InternalMemory.PortTimerOnHour_read(Port5), InternalMemory.PortTimerOnMin_read(Port5), InternalMemory.PortTimerOffHour_read(Port5), InternalMemory.PortTimerOffMin_read(Port5));
ReefAngel.StandardLights( Port7, InternalMemory.PortTimerOnHour_read(Port7), InternalMemory.PortTimerOnMin_read(Port7), InternalMemory.PortTimerOffHour_read(Port7), InternalMemory.PortTimerOffMin_read(Port7));
////// Place your custom code above here
6. Either:
Compile and upload the InitialInstallMemory.ino sketch to setup internal memory then compile and upload the actual sketch
OR
I found it easier to run the wizard and just leave the ports off that i wanted to have use the new timers. That way I got a sketch file that was almost what I needed. I then did the first wizard upload which sets the internal memory values (for everything but your new locations) but rather than doing the second upload of the actual compiled sketch from the wizard I compiled a new sketch with the the lines from step 5 swapped in and uploaded that. If you do it this way your internal memory should get set up with all the values you want for most of the parameters and you will just need to go in and manually write the values for your new timer memory locations via the android app.
This is probably not the most robust or elegant way to do this and some or all of these changes may disappear with library updates. What can I say, old scientific computing habits of just doing whatever gets the job done are hard to break! On the other hand its not that many lines of code to copy and paste back into the needed files.