I've just uploaded my code to a new controller (after loading the initial memory settings) and I'm getting 0 for my Temp 1 and Error for my Temp 2 and Temp 3 readings. This is the same code that I have been using on the other units, so I don't think it's the code, unless something changed in the recent libraries. Could something be wrong with the unit?
Here is the code:
Code: Select all
//
// This version updated for v1.0.3 or later
/*
The following features are enabled for this File:
#define DisplayImages
#define OverheatSetup
#define DateTimeSetup
#define VersionMenu
#define DirectTempSensor
#define DisplayLEDPWM
#define wifi
#define SaveRelayState
#define WDT
#define PWMEXPANSION
#define CUSTOM_MAIN
#define COLORS_PDE
#define SALINITYEXPANSION
#define RFEXPANSION
#define FONT_8x8
#define FONT_8x16
Ports assignment:
Port1 - Fuge Light
Port2 - Avast ATO
Port3 - Heater(s)
Port4 - Kalk Reactor
Port5 - Avast Schwabble
Port6 - Closed Loop Pump
Port7 - Skimmer
Port8 - Return Pump
*/
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>
//*********************************************************************************************************************************
//--------------------------------------------------- Start of Global Variables ---------------------------------------------------
// Globals Needed for RF Mode on Custom Menu
byte vtmode;
byte vtspeed;
// Globals Needed for Params on Custom Main
byte x,y;
char text[10];
int v;
// Globals Needed for RF Mode on Custom Main
byte vtechmode;
byte vtechspeed;
boolean bFeeding=false;
//------------------------------------------------------ End of Global Variables --------------------------------------------------
//----------------------------------------------------------- Custom Menu ---------------------------------------------------------
#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Feeding";
prog_char menu1_label[] PROGMEM = "Water Change Pause";
prog_char menu2_label[] PROGMEM = "Vortech Mode";
prog_char menu3_label[] PROGMEM = "Vortech Speed";
prog_char menu4_label[] PROGMEM = "Lights On";
prog_char menu5_label[] PROGMEM = "Lights Off";
prog_char menu6_label[] PROGMEM = "Overheat Clear";
prog_char menu7_label[] PROGMEM = "PH Calibration";
prog_char menu8_label[] PROGMEM = "Salinity Calibration";
PROGMEM const char *menu_items[] = {
menu0_label, menu1_label, menu2_label,
menu3_label, menu4_label, menu5_label,
menu6_label, menu7_label, menu8_label
};
void MenuEntry1()
{
ReefAngel.FeedingModeStart();
}
void MenuEntry2()
{
ReefAngel.WaterChangeModeStart();
}
void MenuEntry3()
{
vtmode++;
vtechmode++;
if (vtmode>6)
{
vtmode=0;
vtechmode=0;
}
InternalMemory.RFMode_write(vtmode); // Set the Internal Memory Setting for RF Mode
ReefAngel.RF.SetMode(vtmode, InternalMemory.RFSpeed_read(), InternalMemory.RFDuration_read());
ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
}
void MenuEntry4()
{
vtspeed+=10;
vtechspeed+=10;
if (vtspeed>100)
{
vtspeed=0;
vtechspeed=0;
}
InternalMemory.RFSpeed_write(vtspeed); // Set the Internal Memory Setting for RF Speed
ReefAngel.RF.SetMode(InternalMemory.RFMode_read(), vtspeed, InternalMemory.RFDuration_read());
ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
}
void MenuEntry5()
{
ReefAngel.Relay.RelayMaskOn = ReefAngel.LightsOnPorts;
ReefAngel.Relay.Write();
ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
}
void MenuEntry6()
{
ReefAngel.Relay.RelayMaskOn = 0;
ReefAngel.Relay.Write();
ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
}
void MenuEntry7()
{
ReefAngel.OverheatClear();
ReefAngel.DisplayMenuEntry("Clear Overheat");
}
void MenuEntry8()
{
ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry9()
{
ReefAngel.SetupCalibrateSalinity();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
//--------------------------------------------------------- End Custom Menu -------------------------------------------------------
//*********************************************************************************************************************************
//*********************************************************************************************************************************
//---------------------------------------------Custom Main for PWM Expansion Module------------------------------------------------
void DrawCustomMain()
{
//Top Banner
ReefAngel.LCD.DrawLargeText(COLOR_BLACK, 255, 9, 3, "WISEGUYS' REEF", Font8x16);
ReefAngel.LCD.Clear(DefaultFGColor,3,21,126,21);
// Display T1 Header Text
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,255,10,25,"Tank");
char text[7];
// Display the T1 Temp Value
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE, 255, 4, 35, text, Font8x16);
// Display the Salinity Header Text
ReefAngel.LCD.DrawText(COLOR_CRIMSON,255,55,25,"Sal.");
// Display the Salinity Value
ConvertNumToString(text, ReefAngel.Params.Salinity, 10);
ReefAngel.LCD.DrawLargeText(COLOR_CRIMSON, 255, 57, 35, text, Font8x16);
// Display pH Header Text
ReefAngel.LCD.DrawText(COLOR_INDIGO,255,105,25,"pH");
// Display pH Value
ConvertNumToString(text, ReefAngel.Params.PH, 100);
ReefAngel.LCD.DrawLargeText(COLOR_INDIGO, 255, 94, 35, text, Font8x16);
//Display Alternate Temp Parameters
ReefAngel.LCD.DrawText(0,255,8,54,"Sump");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T2_PROBE], COLOR_CORNFLOWERBLUE, 36, 54, 10);
ReefAngel.LCD.DrawText(0,255,72,54,"Hood");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T3_PROBE], COLOR_CORNFLOWERBLUE, 100, 54, 10);
// Display EcoSmart Mode Value & Speed %
ReefAngel.LCD.Clear(DefaultFGColor,3,65,126,65);
ReefAngel.LCD.DrawLargeText(COLOR_BLACK, 255, 17, 69, "Ecotech Mode");
ConvertNumToString(text, vtechspeed, 1);
if (vtechmode == 0)
{
ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,255,1,80,"Constant - ", Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,255,97,80,text, Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,255,121,80,"%", Font8x16);
}
else if(vtechmode == 1)
{
ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,1,80,"Lagoon - ", Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,97,80,text, Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,121,80,"%", Font8x16);
}
else if (vtechmode == 2)
{
ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,1,80,"Reef Crest -", Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,97,80,text, Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,121,80,"%", Font8x16);
}
else if (vtechmode == 3)
{
ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,255,1,80,"Short Pulse-", Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,255,97,80,text, Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,255,121,80,"%", Font8x16);
}
else if (vtechmode == 4)
{
ReefAngel.LCD.DrawLargeText(COLOR_PINK,255,1,80,"Long Pulse -", Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_PINK,255,97,80,text, Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_PINK,255,121,80,"%", Font8x16);
}
else if (vtechmode == 5)
{
ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,1,80,"Nutrient TM-", Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,97,80,text, Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,121,80,"%", Font8x16);
}
else if (vtechmode == 6)
{
ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,1,80,"Tidal Swell-", Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,97,80,text, Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,121,80,"%", Font8x16);
}
else if (vtechmode == 9)
{
ReefAngel.LCD.DrawLargeText(COLOR_BLACK,255,1,80,"Night - ", Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_BLACK,255,97,80,text, Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_BLACK,255,121,80,"%", Font8x16);
}
// Display Main Relay Box
ReefAngel.LCD.Clear(DefaultFGColor,3,99,126,99);
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(13, 102, TempRelay);
//Draw Date & Time
ReefAngel.LCD.Clear(DefaultFGColor,3,116,126,116);
ReefAngel.LCD.DrawDate(6, 119);
}
void DrawCustomGraph() // Not Used
{
}
//------------------------------------------------------ End Custom Main ----------------------------------------------------------
//*********************************************************************************************************************************
//-------------------------------------------------------- Begin Setup ------------------------------------------------------------
void setup()
{
ReefAngel.Init(); //Initialize controller
ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items)); //Intialize Custom Menu
vtmode=InternalMemory.RFMode_read();
vtspeed=InternalMemory.RFSpeed_read();
vtechmode=InternalMemory.RFMode_read();
vtechspeed=InternalMemory.RFSpeed_read();
ReefAngel.FeedingModePorts = Port2Bit | Port7Bit | Port6Bit; // Turn off Skimmer, ATO and Close Loop when feeding mode is activated
ReefAngel.WaterChangePorts = Port2Bit | Port7Bit | Port8Bit; // Turn off Return Pump, Skimmer & ATO when water change mode is actived
ReefAngel.OverheatShutoffPorts = Port1Bit | Port3Bit;
ReefAngel.LightsOnPorts = Port1Bit;
ReefAngel.TempProbe = T2_PROBE; // Use T1 probe as temperature and overheat functions
ReefAngel.OverheatProbe = T2_PROBE;
InternalMemory.OverheatTemp_write( 850 ); // Set the Overheat temperature setting
// Ports that are always on
ReefAngel.Relay.On(Port8);
ReefAngel.Relay.On(Port6);
}
//---------------------------------------------------------- End Setup ------------------------------------------------------------
//*********************************************************************************************************************************
//--------------------------------------------------------- Begin Loop ------------------------------------------------------------
void loop()
{
// Specific functions
ReefAngel.Relay.DelayedOn(Port7, 2); // Turn on Port 7 (Skimmer) with 2 minute delay
ReefAngel.Relay.DelayedOn(Port2, 10); // Turn on Port 2 (Avast ATO) with 10 minute delay
ReefAngel.StandardLights(Port1,21,0,9,00); //Fuge Light on at night
ReefAngel.StandardHeater(Port3,770,790); // Standard Heater Using Internal Memory
ReefAngel.DosingPumpRepeat(Port5,0,360,60); //Turn Schwabble on for 1 minute every 4 hours
ReefAngel.DosingPumpRepeat(Port4,0,30,30); // Turn Kalk stirer on for 30 seconds every half hour
// Fan Speed Functions
signed int HoodFanSpeed;
HoodFanSpeed=map(ReefAngel.Params.Temp[3],750,1000,25,100); // Calculate Hood Fan speed
HoodFanSpeed=constrain(HoodFanSpeed,0,100);
ReefAngel.PWM.SetChannel(0,HoodFanSpeed);
signed int SumpFanSpeed;
SumpFanSpeed=map(ReefAngel.Params.Temp[1],750,850,25,100); // Calculate Sump Fan speed
SumpFanSpeed=constrain(SumpFanSpeed,0,100);
ReefAngel.PWM.SetChannel(1,SumpFanSpeed);
/*
------------------------------------------------ Start Time-of-Day Based Functions ----------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ These are the mode numbers for the RF Expansion Module for reference ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define Constant 0
#define Random1 1 // Lagoonal
#define Random2 2 // Reef Crest
#define ShortWave 3
#define LongWave 4
#define Smart_NTM 5 // Nutrient Transport Mode
#define Smart_TSM 6 // Tidal Swell Mode
#define Feeding_Start 7
#define Feeding_Stop 8
#define Night 9
#define Slave_Start 97
#define Slave_Stop 98
#define None 99
RF Mode = http://YOURIPADDRESS:2000/mb855,X
RF Speed = http://YOURIPADDRESS:2000/mb856,X
RF Duration = http://YOURIPADDRESS:2000/mb857,X
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
//-------------------------------------------------------- Start RF Smart Nutrient Mode After Feeding ---------------------------
if (hour() >=9 && hour() < 21)
{
if (vtechmode == 9)
{
ReefAngel.RF.UseMemory=true;
vtechmode = InternalMemory.RFMode_read();
vtechspeed = InternalMemory.RFSpeed_read();
}
if (ReefAngel.DisplayedMenu==FEEDING_MODE) bFeeding=true;
if (ReefAngel.DisplayedMenu==DEFAULT_MENU && bFeeding)
{
bFeeding=false;
ReefAngel.Timer[1].SetInterval(600); // Timer for 10min
ReefAngel.Timer[1].Start();
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Smart_NTM,100,6);
vtechmode = 5;
vtechspeed = 100;
}
if (ReefAngel.DisplayedMenu==DEFAULT_MENU && ReefAngel.Timer[1].IsTriggered())
{
ReefAngel.RF.UseMemory=true;
vtechmode = InternalMemory.RFMode_read();
vtechspeed = InternalMemory.RFSpeed_read();
}
}
else
{
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Night,15,0);
vtechmode = 9;
vtechspeed = 15;
}
//---------------------------------------------------------- End RF Smart Nutrient Mode After Feeding -----------------------------
ReefAngel.Portal("mvwise");
ReefAngel.ShowInterface();
}
//--------------------------------------------------------------- End Loop --------------------------------------------------------
//*********************************************************************************************************************************