Skip to content

Commit

Permalink
Created new stub function for StandardHeater/Fan which takes Probe ar…
Browse files Browse the repository at this point in the history
…gument.

Added functions for each with defaults of T1_PROBE, T2_PROBE, T3_PROBE.
Normalize temperature values less than 100 to avoid user mistakes.
  • Loading branch information
lnevo committed Dec 24, 2014
1 parent 794eb1a commit bfc7e42
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 6 deletions.
46 changes: 40 additions & 6 deletions ReefAngel/ReefAngel.cpp
Expand Up @@ -931,18 +931,52 @@ void ReefAngelClass::MHLights(byte LightsRelay, byte OnHour, byte OnMinute, byte
StandardLights(LightsRelay, OnHour, OnMinute, OffHour, OffMinute);
}

void ReefAngelClass::StandardHeater(byte Probe, byte HeaterRelay, int LowTemp, int HighTemp)
{
if (LowTemp < 100) LowTemp *= 10; // Correct temp settings that aren't in the correct range
if (HighTemp < 100) HighTemp *= 10; // Correct temp settings that aren't in the correct range
if (Params.Temp[Probe] == 0) return; // Don't turn the heater on if the temp is reading 0
if (Params.Temp[Probe] <= LowTemp && Params.Temp[Probe] > 0) Relay.On(HeaterRelay); // If sensor 1 temperature <= LowTemp - turn on heater
if (Params.Temp[Probe] >= HighTemp) Relay.Off(HeaterRelay); // If sensor 1 temperature >= HighTemp - turn off heater
}

void ReefAngelClass::StandardHeater(byte HeaterRelay, int LowTemp, int HighTemp)
{
if (Params.Temp[TempProbe] == 0) return; // Don't turn the heater on if the temp is reading 0
if (Params.Temp[TempProbe] <= LowTemp && Params.Temp[TempProbe] > 0) Relay.On(HeaterRelay); // If sensor 1 temperature <= LowTemp - turn on heater
if (Params.Temp[TempProbe] >= HighTemp) Relay.Off(HeaterRelay); // If sensor 1 temperature >= HighTemp - turn off heater
StandardHeater(T1_PROBE, HeaterRelay, LowTemp, HighTemp);
}

void ReefAngelClass::StandardHeater2(byte HeaterRelay, int LowTemp, int HighTemp)
{
StandardHeater(T2_PROBE, HeaterRelay, LowTemp, HighTemp);
}

void ReefAngelClass::StandardHeater3(byte HeaterRelay, int LowTemp, int HighTemp)
{
StandardHeater(T3_PROBE, HeaterRelay, LowTemp, HighTemp);
}

void ReefAngelClass::StandardFan(byte Probe, byte FanRelay, int LowTemp, int HighTemp)
{
if (LowTemp < 100) LowTemp *= 10; // Correct temp settings that aren't in the correct range
if (HighTemp < 100) HighTemp *= 10; // Correct temp settings that aren't in the correct range
if (Params.Temp[Probe] == 0) return; // Don't turn the fan/chiller on if the temp is reading 0
if (Params.Temp[Probe] >= HighTemp) Relay.On(FanRelay); // If sensor 1 temperature >= HighTemp - turn on fan
if (Params.Temp[Probe] <= LowTemp) Relay.Off(FanRelay); // If sensor 1 temperature <= LowTemp - turn off fan
}

void ReefAngelClass::StandardFan(byte FanRelay, int LowTemp, int HighTemp)
{
if (Params.Temp[TempProbe] == 0) return; // Don't turn the fan/chiller on if the temp is reading 0
if (Params.Temp[TempProbe] >= HighTemp) Relay.On(FanRelay); // If sensor 1 temperature >= HighTemp - turn on fan
if (Params.Temp[TempProbe] <= LowTemp) Relay.Off(FanRelay); // If sensor 1 temperature <= LowTemp - turn off fan
StandardFan(T1_PROBE, FanRelay, LowTemp, HighTemp);
}

void ReefAngelClass::StandardFan2(byte FanRelay, int LowTemp, int HighTemp)
{
StandardFan(T2_PROBE, FanRelay, LowTemp, HighTemp);
}

void ReefAngelClass::StandardFan3(byte FanRelay, int LowTemp, int HighTemp)
{
StandardFan(T3_PROBE, FanRelay, LowTemp, HighTemp);
}

void ReefAngelClass::CO2Control(byte CO2Relay, int LowPH, int HighPH)
Expand Down
6 changes: 6 additions & 0 deletions ReefAngel/ReefAngel.h
Expand Up @@ -338,8 +338,14 @@ class ReefAngelClass

void StandardLights(byte LightsRelay, byte OnHour, byte OnMinute, byte OffHour, byte OffMinute);
void MHLights(byte LightsRelay, byte OnHour, byte OnMinute, byte OffHour, byte OffMinute, byte MHDelay);
void StandardHeater(byte Probe, byte HeaterRelay, int LowTemp, int HighTemp);
void StandardHeater(byte HeaterRelay, int LowTemp, int HighTemp);
void StandardHeater2(byte HeaterRelay, int LowTemp, int HighTemp);
void StandardHeater3(byte HeaterRelay, int LowTemp, int HighTemp);
void StandardFan(byte Probe, byte FanRelay, int LowTemp, int HighTemp);
void StandardFan(byte FanRelay, int LowTemp, int HighTemp);
void StandardFan2(byte FanRelay, int LowTemp, int HighTemp);
void StandardFan3(byte FanRelay, int LowTemp, int HighTemp);
void CO2Control(byte CO2Relay, int LowPH, int HighPH);
void CO2Control(byte CO2Relay, int LowPH, int HighPH, bool useExp);
void PHControl(byte PHControlRelay, int LowPH, int HighPH);
Expand Down
8 changes: 8 additions & 0 deletions Release_Notes.txt
@@ -1,3 +1,11 @@
Release Notes for 1.1.2
=========
Heater/Fan Updates
Added argument to specify probe for StandardHeater and StandardFan functions
New functions for defaults of probe1/2/3 (i.e. StandardHeater, StandardHeater2, StandardHeater3)
Normalize temps that are under 100 if someone uses the wrong values
i.e. StandardHeater(Port1,79,80); // We will now assume this means 790,800 by multiplying by 10

Release Notes for 1.1.1
=========
Some RANet Fixes
Expand Down

0 comments on commit bfc7e42

Please sign in to comment.