Black Screen (off)

Basic / Standard Reef Angel hardware

Posts: 58
Joined: Sun May 12, 2013 2:21 pm
PostPosted: Fri Jun 21, 2013 4:52 pm
Anyone else have any issues with the screen staying off with the new libraries? I powered the device on/off twice and reloaded the code to no avail.

Code: Select all
#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>

////// Place global variable code below here

// Needs to be global for DrawCustomGraph()
int ScreenID=1;

// Custom Menu setup
#include <avr/pgmspace.h>
prog_char menu1_label[] PROGMEM = "Water Change";
prog_char menu2_label[] PROGMEM = "Refugium Light On/Off";
prog_char menu3_label[] PROGMEM = "Skimmer On/Off";
prog_char menu4_label[] PROGMEM = "Overheat Clear";
prog_char menu5_label[] PROGMEM = "ATO Clear";

// Group the menu entries together
PROGMEM const char *menu_items[] = {
menu1_label, menu2_label, menu3_label,
menu4_label, menu5_label
};

// Define Relay Ports by Name
// Port 1 - ATO
// Port 2 - Fuge Light
// Port 3 - Actinic Light
// Port 4 - Daylight
// Port 5 - Power Head
// Port 6 - Return Pump
// Port 7 - Heater
// Port 8 - Skimmer

#define Ato                1
#define Refugium           2
#define BlueLEDs           3
#define WhiteLEDs          4
#define PowerHead          5
#define ReturnPump         6
#define Heater             7
#define Skimmer            8
////// Place global variable code above here

void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    //ReefAngel.AddStandardMenu();  // Add Standard Menu
    ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items)); // Initialize Menu
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode - turn off ATO/Power Head/Return Pump/Skimmer
    ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port6Bit | Port8;
    // Ports toggled when Lights On / Off menu entry selected - Actinic/Daylight
    ReefAngel.LightsOnPorts = Port3Bit | Port4Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit | Port7Bit;
    // 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 ); // Power head
    ReefAngel.Relay.On( Port6 ); // Return Pump
    ReefAngel.Relay.On( Port8 ); // Skimmer
    ////// Place additional initialization code below here
    ReefAngel.PHMin=576;
    ReefAngel.PHMax=839;

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.StandardLights( Port2,20,15,10,30 );
    ReefAngel.StandardLights( Port3,9,30,21,30 );
    ReefAngel.StandardLights( Port4,10,0,20,45 );
    ReefAngel.StandardHeater( Port7,755,770 );
    ReefAngel.PWM.SetDaylight( PWMParabola(12,30,18,30,0,40,0) );
    ReefAngel.PWM.SetActinic( PWMParabola(10,00,20,30,0,65,0) );
   
    ////// Place your custom code below here
    // Use one float sensor (ATOLow) for the return section and one
    // for the ATO reservoir (ATOHigh)
    ReefAngel.SingleATO(true,Port1,45,0);
    if (ReefAngel.HighATO.IsActive())
    {
      ReefAngel.Relay.Off(Port1);
    }
   
    ////// Place your custom code above here
    ReefAngel.Portal("ufgators2k");
    // This should always be the last line
    ReefAngel.ShowInterface();
}

// Custom Main Menu
// Menu Code
void MenuEntry1() {
  ReefAngel.WaterChangeModeStart();
}
void MenuEntry2() {
  // Toggle refugium light between on/auto.
  ReefAngel.Relay.Override(Refugium, ReefAngel.Relay.Status(Refugium)+1);
  ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
}
void MenuEntry3() {
  // Toggle skimmer on/off.
  ReefAngel.Relay.Toggle(Skimmer);
  ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
}
void MenuEntry4() {
  ReefAngel.OverheatClear();
  ReefAngel.DisplayMenuEntry("Clear Overheat");
}
void MenuEntry5() {
  ReefAngel.ATOClear();
  ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}

// Custom Main Screen
void DrawCustomMain() {
  //const int NumScreens=2;
  //static boolean drawGraph=true;
 
  // Main Header
  ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 28, 2,"Kopman's Reef");
  ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 128, 11);

  // Param Header
  DrawParams(5,14);
 
  //switch (ScreenID) {
  //  case 0:
  //  {
  //    if (drawGraph) { ReefAngel.LCD.DrawGraph(5,40); drawGraph=false; }
  //    break;
  //  }
  //  case 1: { DrawStatus(5,40); break; }
  //}
  DrawStatus(5,40);
  ReefAngel.LCD.DrawDate(4,122);
  // Draw Relays
  DrawRelays(12,94);
 
 
  /*(if (ReefAngel.Joystick.IsLeft()) {
    ReefAngel.ClearScreen(DefaultBGColor);
    ScreenID--; drawGraph=true;
  }
  if (ReefAngel.Joystick.IsRight()) {
    ReefAngel.ClearScreen(DefaultBGColor);
    ScreenID++; drawGraph=true;
  }
  if (ScreenID<0) ScreenID=NumScreens-1;
  if (ScreenID>=NumScreens) ScreenID=0;
  */
}

void DrawCustomGraph() {
//  if (ScreenID==0)
//    ReefAngel.LCD.DrawGraph(5, 40);
}

void DrawParams(int x, int y) {
  char buf[16];

  ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+5,y,"Temp:");
  ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+80, y, "PH:");
  // Temp and PH
  y+=2;
  ConvertNumToString(buf, ReefAngel.Params.Temp[T2_PROBE], 10);
  ReefAngel.LCD.DrawText(T2TempColor, DefaultBGColor, x+45, y, buf);
  y+=6;
  ConvertNumToString(buf, ReefAngel.Params.Temp[T1_PROBE], 10);
  ReefAngel.LCD.DrawLargeText(T1TempColor, DefaultBGColor, x+5, y, buf, Num8x16);
  ConvertNumToString(buf, ReefAngel.Params.PH, 100);
  ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+80, y, buf, Num8x16);
  y+=5;
  ConvertNumToString(buf, ReefAngel.Params.Temp[T3_PROBE], 10);
  ReefAngel.LCD.DrawText(T3TempColor, DefaultBGColor, x+45, y, buf);
}

void DrawStatus(int x, int y) {
  int t=x;
  ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,30,y,"ATO Status");
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,15,y+10,"Resv",Font8x16);
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,85,y+10,"Sump",Font8x16);
 
  if (ReefAngel.HighATO.IsActive()) { // ATO reservoir is empty
    ReefAngel.LCD.FillCircle(55,y+15,5,COLOR_RED);
  } else {
    ReefAngel.LCD.FillCircle(55,y+15,5,COLOR_GREEN);
  }
 
  if (ReefAngel.LowATO.IsActive()) { // Return pump water level is low
    ReefAngel.LCD.FillCircle(70,y+15,5,COLOR_RED);
  } else {
    ReefAngel.LCD.FillCircle(70,y+15,5,COLOR_GREEN);
  }
  y+=25;
  ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,15,y,"Heater Status");
  if (ReefAngel.Relay.Status(Heater) == 1) {
    ReefAngel.LCD.FillCircle(105,y+2,5,COLOR_GREEN);
  } else {
    ReefAngel.LCD.FillCircle(105,y+2,5,COLOR_RED);
  }
  // Display Water level
  //ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,x,y,"AT0 Level:"); x+=65;
  //ReefAngel.LCD.DrawSingleMonitor(ReefAngel.WaterLevel.GetLevel(),DPColor,x,y,1);
  //x+=5*(intlength(ReefAngel.WaterLevel.GetLevel())+1);
  //ReefAngel.LCD.DrawText(DPColor, DefaultBGColor, x, y, "%");
  //y+=12; x=t;
}

void DrawRelays(int x, int y) {
  // Draw Relays
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(x, y, TempRelay);
}
Image

Return to Standard

Who is online

Users browsing this forum: No registered users and 1 guest