Please Help new sketch using Library ver 16

Related to the development libraries, released by Curt Binder
Post Reply
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Please Help new sketch using Library ver 16

Post by divingdon »

Help Please...

Below is the current errors that I am receiving when I try to build this sketch using Lib ver 16 and Arudino software 22.

This sketch is a combination of a sketch generator by Ragen and the PWM commands and relay labels from my old sketch that was created using Lib ver 14. I just kept adding until the sketch would not compile any further and here is where I'm stuck. I did compile and load this sketch before I added the WiFi feature, and it did load and even turned on my PWM channels but the Controller has a blank display which is soild white.

After I get this sketch working I planned to move on to Client 2.2 upgrade


libraries\ReefAngel\ReefAngel.cpp: In member function ' void ReefAngelClass::InitMenus()':
libraries\ReefAngel\ReefAngel.cpp:1287: error: expected initializer before '}' token
libraries\ReefAngel\ReefAngel.cpp:1464: error: 'CurrentRelayState' was not declared in this scope
libraries\ReefAngel\ReefAngel.cpp:1501: error: 'CurrentRelayState' was not declared in this scope

// Autogenerated file by RAGen (v1.0.4.92), (08/24/2011 17:30)
// Memory_082411_1730.pde
//
// This file sets the default values to the Internal Memory
//

/* The following features are enabled for this PDE File:
#define DirectTempSensor
#define wifi
#define StandardLightSetup
#define Simple_menu
*/

#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <DS1307RTC.h>
#include <Time.h>
#include <OneWire.h>
#include <Phillips6610LCDInv.h>
#include <avr/pgmspace.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <Wire.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>

Phillips6610LCDInv e;


/*
----------------------------------------------------------------------------------------------------------------------------------------------------------
Give labels to your PWM channels
----------------------------------------------------------------------------------------------------------------------------------------------------------
*/
#define WhitePWM1 0
#define BluePWM1 1
#define WhitePWM2 2
#define BluePWM2 3
#define WhitePWM3 4
#define BluePWM3 5

byte PWMChannel[]={
0,0,0,0,0,0};

// Labels for the web banner
#include <avr/pgmspace.h>
prog_char id_label[] PROGMEM = "divingdon";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "Room";
prog_char probe3_label[] PROGMEM = "LED's";
prog_char relay1_label[] PROGMEM = "Sump";
prog_char relay2_label[] PROGMEM = "Ca%20Reactor";
prog_char relay3_label[] PROGMEM = "Skimmer";
prog_char relay4_label[] PROGMEM = "Chiller";
prog_char relay5_label[] PROGMEM = "Heater";
prog_char relay6_label[] PROGMEM = "Heater";
prog_char relay7_label[] PROGMEM = "PWM%20Supply";
prog_char relay8_label[] PROGMEM = "Red%20LED's";
PROGMEM const char *webbanner_items[] = {
id_label, probe1_label, probe2_label, probe3_label, relay1_label, relay2_label,
relay3_label, relay4_label, relay5_label, relay6_label, relay7_label, relay8_label};




void setup()
{
e.lcd_init();
e.lcd_clear(COLOR_WHITE,0,0,132,132);
e.lcd_BacklightOn();

InternalMemory.MHOnHour_write(8);
InternalMemory.MHOnMinute_write(0);
InternalMemory.MHOffHour_write(15);
InternalMemory.MHOffMinute_write(0);
InternalMemory.MHDelay_write(5);
InternalMemory.StdLightsOnHour_write(8);
InternalMemory.StdLightsOnMinute_write(0);
InternalMemory.StdLightsOffHour_write(15);
InternalMemory.StdLightsOffMinute_write(0);
InternalMemory.DP1OnHour_write(20);
InternalMemory.DP1OnMinute_write(0);
InternalMemory.DP2OnHour_write(22);
InternalMemory.DP2OnMinute_write(30);
InternalMemory.DP1Timer_write(10);
InternalMemory.DP2Timer_write(10);
InternalMemory.DP1RepeatInterval_write(60);
InternalMemory.DP2RepeatInterval_write(60);
InternalMemory.ATOTimeout_write(60);
InternalMemory.ATOHighTimeout_write(60);
InternalMemory.ATOHourInterval_write(0);
InternalMemory.ATOHighHourInterval_write(0);
InternalMemory.FeedingTimer_write(900);
InternalMemory.LCDTimer_write(600);
InternalMemory.LEDPWMActinic_write(50);
InternalMemory.LEDPWMDaylight_write(50);
InternalMemory.WM1Timer_write(200);
InternalMemory.WM2Timer_write(354);
InternalMemory.HeaterTempOn_write(780);
InternalMemory.HeaterTempOff_write(791);
InternalMemory.ChillerTempOn_write(810);
InternalMemory.ChillerTempOff_write(785);
InternalMemory.OverheatTemp_write(1500);
InternalMemory.PHMax_write(840);
InternalMemory.PHMin_write(550);
}

void loop()
{
// ReefAngel.ShowInterface();

// display the values
char buf[128];
sprintf(buf, "MH %2d:%02d-%2d:%02d,%d", InternalMemory.MHOnHour_read(), InternalMemory.MHOnMinute_read(),
InternalMemory.MHOffHour_read(), InternalMemory.MHOffMinute_read(),
InternalMemory.MHDelay_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW, buf);
sprintf(buf, "Std %2d:%02d-%2d:%02d", InternalMemory.StdLightsOnHour_read(), InternalMemory.StdLightsOnMinute_read(),
InternalMemory.StdLightsOffHour_read(), InternalMemory.StdLightsOffMinute_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, buf);
sprintf(buf, "LED A: %d%% D: %d%%", InternalMemory.LEDPWMActinic_read(), InternalMemory.LEDPWMDaylight_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*3, buf);
sprintf(buf, "WM1: %ds", InternalMemory.WM1Timer_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*4, buf);
sprintf(buf, "WM2: %ds", InternalMemory.WM2Timer_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, buf);
sprintf(buf, "F: %ds", InternalMemory.FeedingTimer_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*6, buf);
sprintf(buf, "S: %ds", InternalMemory.LCDTimer_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*7, buf);
sprintf(buf, "H On: %d -> %d", InternalMemory.HeaterTempOn_read(), InternalMemory.HeaterTempOff_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*9, buf);
sprintf(buf, "C On: %d -> %d", InternalMemory.ChillerTempOn_read(), InternalMemory.ChillerTempOff_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*10, buf);
sprintf(buf, "PH %d - %d", InternalMemory.PHMax_read(), InternalMemory.PHMin_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*11, buf);

delay(10000);
e.lcd_clear(COLOR_WHITE,0,0,132,132);

sprintf(buf, "OH: %dF", InternalMemory.OverheatTemp_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW, buf);
sprintf(buf, "ATO L: %ds (%dh)", InternalMemory.ATOTimeout_read(), InternalMemory.ATOHourInterval_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, buf);
sprintf(buf, "ATO H: %ds (%dh)", InternalMemory.ATOHighTimeout_read(), InternalMemory.ATOHighHourInterval_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*3, buf);

sprintf(buf, "DP1: %2d:%02d", InternalMemory.DP1OnHour_read(), InternalMemory.DP1OnMinute_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, buf);
sprintf(buf, " %ds", InternalMemory.DP1Timer_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*6, buf);
sprintf(buf, "DP2: %2d:%02d", InternalMemory.DP2OnHour_read(), InternalMemory.DP2OnMinute_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*7, buf);
sprintf(buf, " %ds", InternalMemory.DP2Timer_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*8, buf);

delay(10000);
e.lcd_clear(COLOR_WHITE,0,0,132,132);


// Setup relay 7 to turn on at 06:00aM and off at 10:15AM
ReefAngel.StandardLights(7,06,0,22,15);
ReefAngel.Relay.Write(); //Writes the value of RelayData to the RelayBox

// Setup relay 8 to turn on at 18:00PM and off at 00:00AM
ReefAngel.StandardLights(8,18,0,00,00);
ReefAngel.Relay.Write(); //Writes the value of RelayData to the RelayBox



//This section calculates the slope
PWMChannel[WhitePWM1]=2.55*PWMSlope(06,45,21,00,0,30,60,PWMChannel[WhitePWM1]); // calculate slope for 0 to 50% starting at 12:30pm with duration of 60min, then from 50% to 0 from 17:00pm with duration of 60min
PWMChannel[BluePWM1]=2.55*PWMSlope(06,45,21,15,0,35,60,PWMChannel[BluePWM1]);
PWMChannel[WhitePWM2]=2.55*PWMSlope(06,46,21,00,0,30,60,PWMChannel[WhitePWM2]);
PWMChannel[BluePWM2]=2.55*PWMSlope(06,46,22,15,0,35,60,PWMChannel[BluePWM2]);
PWMChannel[WhitePWM3]=2.55*PWMSlope(06,47,21,00,0,30,60,PWMChannel[WhitePWM3]);
PWMChannel[BluePWM3]=2.55*PWMSlope(06,47,21,15,0,35,60, PWMChannel[BluePWM3]);

// this section sends the data to the PWM expansion module
PWMExpansion(WhitePWM1,PWMChannel[WhitePWM1]);
PWMExpansion(BluePWM1,PWMChannel[BluePWM1]);
PWMExpansion(WhitePWM2,PWMChannel[WhitePWM2]);
PWMExpansion(BluePWM2,PWMChannel[BluePWM2]);
PWMExpansion(WhitePWM3,PWMChannel[WhitePWM3]);
PWMExpansion(BluePWM3,PWMChannel[BluePWM3]);
}
void PWMExpansion(byte cmd, byte data)
{
Wire.beginTransmission(2); // transmit to device #2
Wire.send('$'); // sends $
Wire.send('$'); // sends $
Wire.send('$'); // sends $
Wire.send(cmd); // sends a value
Wire.send(data); // sends 255
Wire.endTransmission(); // stop transmitting}
}
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Please Help new sketch using Library ver 16

Post by binder »

Your sketch you loaded does nothing but write the internal memory values and then sets the PWM expansion values. Oh and I just now saw that it has some functions in it. You have taken the top includes from a regular PDE file mixed with the Internal Memory programming PDE file and added in the PWM expansion stuff.

So the controller will just display the internal memory values on the screen for 10 seconds and wipe it clean and repeat. You won't be able to do anything else with it....you don't even call the ShowInterface to draw anything.

My suggestion is to get rid of this PDE file and generate a new one from the PDE tab inside ragen. Then get that working first before moving on to client suite. You do not need to use the Internal Memory tab inside ragen because you have already stored your internal memory by using this sketch.

curt
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: Please Help new sketch using Library ver 16

Post by divingdon »

Thanks that seemed to work but now with only Wifi, Standardlights and Simple_Menu defined the sketch is to large and I didnt and in the PWMSlope commands yet. Any suggestions
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Please Help new sketch using Library ver 16

Post by binder »

divingdon wrote:Thanks that seemed to work but now with only Wifi, Standardlights and Simple_Menu defined the sketch is to large and I didnt and in the PWMSlope commands yet. Any suggestions
If you are planning on using the Client Suite (you have wifi enabled), I would suggest using the simplified menu.

Add this to your ReefAngel_Features.h:

Code: Select all

#define SIMPLE_MENU
Then, along the same line, I would suggest removing the Date & Time Setup. So comment out this line:

Code: Select all

//#define DateTimeSetup
I showed what the commented out line is. You could just as easily have deleted the line too.

Doing these changes will save a lot of space. The date & time setup requires a lot of space to enable. Also, the menu system I created uses a lot of space as well. If you have the WIFI enabled, everything you could change/update via the menu system can be updated via the WIFI interface either manually or with the Client Suite.

Now, if you want to update a web banner (which it looks like you do based on the initial PDE), you can have the Client Suite update it for you or you can have the controller update it. If you have the controller update it, you won't be able to use the Client Suite and you won't be able to connect to the controller's internal web page to view your controller status. You will be able to connect to it, but you can have problems because the controller will be updating (or trying to update) the values every 180 seconds (or whatever the value is you specified). That can lead to some problems if you attempt any communication over the WIFI channel.

I would suggest if you wanted to make use of any of the monitoring apps (Client Suite, Windows Gadget, etc), that you do not have the controller update the web banner.

So give those suggestions a try that I mentioned above and see how it works for you.

curt
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: Please Help new sketch using Library ver 16

Post by divingdon »

This line //#define DateTimeSetup is not in the ReefAngel_Feaures.h file. Where can I find it?
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Please Help new sketch using Library ver 16

Post by binder »

divingdon wrote:This line //#define DateTimeSetup is not in the ReefAngel_Feaures.h file. Where can I find it?
if that line or this line:

Code: Select all

#define DateTimeSetup
is not in there, then don't worry about it. It means that it's not enabled which is what we want.

curt
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: Please Help new sketch using Library ver 16

Post by divingdon »

Client is up and running on the WiFi

Thanks for everything
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Please Help new sketch using Library ver 16

Post by binder »

divingdon wrote:Client is up and running on the WiFi

Thanks for everything
Awesome. Glad you got things working properly. :)

curt
Post Reply