I was hoping you guys could help me figure out how to attach custom variables so I can view these rates in the portal.
Thanks!
My current code
Code: Select all
#define Actinic 1
#define T5A 2
#define T5B 3
#define MH 4
#define Autofeeder 5
#define Blank2 6
#define FastFlush 7
#define ReverseOsmosis 8
#include <Salinity.h>
#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 <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <ReefAngel.h>
byte IOIn[7];
byte IOIn1[7];
int Flow0;
int Flow1;
int Flow2;
int Flow01;
int Flow11;
int Flow21;
char text[12];
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 122);
pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
char text[10];
ConvertNumToString(text, ReefAngel.Params.Salinity, 10);
strcat(text," ");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,93,"Salinity:");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,75,93,text);
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 103, TempRelay);
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,4,4,"CBN:");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,4,15,"GFO:");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,4,26,"BIO:");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,42,4,"GPH");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,42,15,"GPH");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,42,26,"GPH");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,4,37,"DSP:");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,4,48,"BTA:");
//ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,4,59,"CAL:");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,42,37,"GPH");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,42,48,"GPH");
//ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,42,59,"GPH");
ConvertNumToString(text, Flow0, 1);
strcat(text,"");
ReefAngel.LCD.DrawText(0, 255, 29, 4, text);
ConvertNumToString(text, Flow1, 1);
strcat(text,"");
ReefAngel.LCD.DrawText(0, 255, 29, 15, text);
ConvertNumToString(text, Flow2, 1);
strcat(text,"");
ReefAngel.LCD.DrawText(0, 255, 29, 26, text);
GetFlow1();
ConvertNumToString(text, Flow01, 1);
strcat(text,"");
ReefAngel.LCD.DrawText(0, 255, 29, 37, text);
ConvertNumToString(text, Flow11, 1);
strcat(text,"");
ReefAngel.LCD.DrawText(0, 255, 29, 48, text);
//ConvertNumToString(text, Flow21, 1);
//strcat(text,"");
//ReefAngel.LCD.DrawText(0, 255, 29, 59, text);
}
void DrawCustomGraph()
{
//ReefAngel.LCD.DrawGraph(5, 5);
}
void setup()
{
ReefAngel.Init(); //Initialize controller
ReefAngel.FeedingModePorts = B00000000;
ReefAngel.WaterChangePorts = B00000000;
ReefAngel.OverheatShutoffPorts = B00000000;
ReefAngel.LightsOnPorts = B00000111;
}
void loop()
{
ReefAngel.StandardLights(Actinic,11,0,24,0); //Actinic schedule 11:00am - 12:00am
ReefAngel.StandardLights(T5A,11,30,22,15); //Blue Plus 1 schedule 11:30am - 11:15pm
ReefAngel.StandardLights(T5B,11,45,22,30); //Blue Plus 2 schedule 11:45am - 11:30pm
ReefAngel.MHLights(MH,12,30,21,15,15); //Metal Halide schedule 12:30pm - 9:15pm with 15min cool down
ReefAngel.StandardLights(FastFlush,9,45,9,55); //RO Fast Flush schedule 9:45am - 9:55pm
ReefAngel.StandardLights(ReverseOsmosis,9,45,13,0); //RO Fast Flush schedule 9:45am - 1:00pm
ReefAngel.PWM.SetActinic(MoonPhase());
GetFlow();
GetFlow1();
ReefAngel.Portal("tkeracer619");
ReefAngel.ShowInterface();
}
void GetFlow()
{
Wire.requestFrom(9,7);
if(Wire.available())
{
for (int a=0;a<8;a++)
IOIn[a]=Wire.read();
}
Flow0=(IOIn[1]<<8)+IOIn[2];
Flow1=(IOIn[3]<<8)+IOIn[4];
Flow2=(IOIn[5]<<8)+IOIn[6];
}
void GetFlow1()
{
Wire.requestFrom(10,7);
if(Wire.available())
{
for (int a=0;a<8;a++)
IOIn1[a]=Wire.read();
}
Flow01=(IOIn1[1]<<8)+IOIn1[2];
Flow11=(IOIn1[3]<<8)+IOIn1[4];
Flow21=(IOIn1[5]<<8)+IOIn1[6];
}