My system includes the dual dosing pump on 2 relays plus 2 pumps running as wavemakers. My sketch includes the following:
Code: Select all
// run wavemakers during the day
if (hour() > 10 && hour() < 23)
{
ReefAngel.Wavemaker1(WAVEMAKER1);
ReefAngel.Wavemaker2(WAVEMAKER2);
}
else
{
ReefAngel.Relay.Off(WAVEMAKER1);
ReefAngel.Relay.Off(WAVEMAKER2);
}
// run dosing pumps at night
if (hour() < 10)
{
ReefAngel.DosingPumpRepeat1(ALK_DOSER);
ReefAngel.DosingPumpRepeat2(CALC_DOSER);
}
else
{
ReefAngel.Relay.Off(ALK_DOSER);
ReefAngel.Relay.Off(CALC_DOSER);
}
I looked at the source code for the Dosing Pumps and the Wavemakers and found the following:
1. Dosing Pump 1 uses the same timer as Wavemaker 1.
2. The Dosing pump code leaves the timer untriggered when it is done running.
3. The Wavemaker code leaves the timer triggered when it is done running.
4. The wavemaker code uses a static variable to control it's initialization, so it only ever initializes the timer once.
I am really glad that I didn't try to have the wavemakers and the dosing pumps run at the same time, the interference could have caused a severe overdose of my tank. As it is, I am just losing the use of the wavemakers.
It seems to me like the wavemaker function should be rewritten to not use timers. I don't see any reason for them to. Couldn't the wavemaker function be rewritten as follows:
Code: Select all
void ReefAngelClass::Wavemaker1(byte WMRelay)
{
if ((now() / InternalMemory.WM1Timer_read()) & 0x01);
Relay.On (WMRelay);
else
Relay.Off (WMRelay);
}