If it still doesnt work then I'll need to see your whole code because you may have a delay somewhere that would cause that code not to get hit each second...
It may also be why your pump is logging extra seconds if you have something taking too much time in your code.
If thats the case we can change the logic to just do it when the hour and minute are at 5pm and 9pm.
kirkwood wrote:I loaded the new code and it did not go into feeding mode at 21:00
Well I reloaded the old code at 945 because I wasn't 100% sure the cable was fully connected to the RA the previous time I tried to upload. Anyway the feeding mode ran at 2200 which I thought meant it was going to run every hour. However it did NOT run at 2300 or 0000. So that's a good thing. I will see how it continues to play out before I try the new code.
I still can't get the feeding mode to run properly. I just loaded in the simplified code that eliminated all the math and the feeding mode did not run at 9pm. Here is my full code.
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port5Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port6Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 825 );
// Ports that are always on
ReefAngel.Relay.On( Port5 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.MHLights( Port1,16,0,23,0,5 );
ReefAngel.MHLights( Port2,17,0,21,30,10 );
ReefAngel.DosingPumpRepeat( Port3,0,120,292 );
ReefAngel.DosingPumpRepeat( Port4,60,120,340 );
ReefAngel.StandardHeater( Port6,775,805 );
ReefAngel.StandardATO( Port7,900 );
////// Place your custom code below here
//Start Feeding Mode at 17:00 and 21:00
if ( (now()%61200==0) || (now()%75600==0) ) {
ReefAngel.FeedingModeStart();
}
for (int i=0;i< numPumps;i++) {
if (ReefAngel.Relay.Status(pump)) {
if (!pumpStatus) {
pumpTimer=now()-pumpTimer; // Pump was off, timer is now a time
pumpStatus=true;
}
} else {
if (pumpStatus) {
pumpTimer=now()-pumpTimer; // Pump was on, timer is now a timer
pumpStatus=false;
// Normalize and assign to CustomVar for reporting on the portal
ReefAngel.CustomVar[portalMinutes]=pumpTimer[i]/60; // Number of Minutes
ReefAngel.CustomVar[portalSeconds[i]]=pumpTimer[i]%60; // Number of Seconds
}
}
}
if (now()%SECS_PER_DAY==SECS_PER_DAY-1) pumpTimer[0]=0; // Clear timer for DPump1
if (now()%SECS_PER_DAY==SECS_PER_DAY-1) pumpTimer[1]=0; // Clear timer for DPump2
if (bitRead(ReefAngel.Relay.RelayMaskOn, 6)==1) { // ATO relay was forced on
atoDisabled=true; // don't want to change the variable names yet.. but you may want to to make it clearer..
}
if (atoDisabled && (bitRead(ReefAngel.Relay.RelayMaskOn, 6)==0)) { // ATO override has been cleared
pumpTimer[2]=0; // Clear timer for ATOPort
atoDisabled=false;
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "kirkwood" );
ReefAngel.ShowInterface();
}
Well... I guess the math is wrong
It took me a good 5 minutes and a few scratches in my head saying WTF is going on??? LOL
We need to actually do module of 24hrs and check the remainder for the hours you want...
So, here it is:
Sweet I will try the new code tomorrow. I've got a trip coming up soon so I'm trying to have everything set up just right before I go. With the RA this will be the first true stress free vacation.