RF Expansion Module
Re: RF Expansion Module
Found the problem.
It had missing includes on the PDE file.
I uploaded a corrected version.
Please go ahead and download it again.
It had missing includes on the PDE file.
I uploaded a corrected version.
Please go ahead and download it again.
Roberto.
Re: RF Expansion Module
That did it. As always you never cease to amaze me on how quick you respond!
So if after I "Press the joystick to finalize your pump setup" the vortech goes white, but the module keeps flashing blue and green do I have to try to sync them again?
So if after I "Press the joystick to finalize your pump setup" the vortech goes white, but the module keeps flashing blue and green do I have to try to sync them again?
-
- Posts: 149
- Joined: Tue Nov 01, 2011 11:05 am
Re: RF Expansion Module
When you did it did you clear your vortech memory first? Also - in yoru setup() define the mode you want to use constantly, then if you want something to change it create an if/else statement in loop
Also white = sync, orange = antisync, blue = back of tank
other times vortech is solid white in feed at 0%. Night mode is breathing white @ 50% of internal memory speed
Also white = sync, orange = antisync, blue = back of tank
other times vortech is solid white in feed at 0%. Night mode is breathing white @ 50% of internal memory speed
Last edited by Deckoz2302 on Thu Dec 29, 2011 5:43 pm, edited 1 time in total.
Re: RF Expansion Module
Yup, cleared the memory settings first. I have defined in my setup(). The Vortech went white like it paired fine, the module just kept flashing blue and green, instead of going solid green.
Code: Select all
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Smart_NTM,120,6);
-
- Posts: 149
- Joined: Tue Nov 01, 2011 11:05 am
Re: RF Expansion Module
In setup - don't use
because you are declaring the internal memory value
also - if your trying to do nutrient transport module will turn purple
green = constant speed
Code: Select all
ReefAngel.RF.UseMemory=false;
also - if your trying to do nutrient transport module will turn purple
green = constant speed
Re: RF Expansion Module
Same issue so I reset the vortech again, uploaded the VortechSetup.PDE again, after I hit the joystick to finalize the settings, the vortech turns white, but the RF Module continues to blink blue and green instead of going to a solid green
Only thing in Setup is ReefAngel.RF.SetMode(Smart_NTM,120,6);
I've commented out everything else I had in my loop and custom menu. Here's a copy if anyone is interested.
Only thing in Setup is ReefAngel.RF.SetMode(Smart_NTM,120,6);
I've commented out everything else I had in my loop and custom menu. Here's a copy if anyone is interested.
Code: Select all
// Autogenerated file by RAGen (v1.0.4.92), (10/15/2011 12:40)
// RA_101511_1240.pde
//
// This version designed for v0.8.5 Beta 12 or later
// *********************************************************
// MANY THANKS TO BOTH ROBERTO AND CURT FOR ALL THEIR HELP!*
// *********************************************************
/* The following features are enabled for this PDE File:
#define DisplayLEDPWM
#define wifi
#define VersionMenu
#define CUSTOM_MAIN
#define NUMBERS_8x16
#define COLORS_PDE
#define CUSTOM_MENU
#define CUSTOM_MENU_ENTRIES 6
#define RFEXPANSION
*/
#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>
#include <ReefAngel_Colors.h>
#include <ReefAngel_CustomColors.h>
#include <avr/pgmspace.h>
#include <ReefAngel_RF.h>
#define Sump 1
#define DosingPump2 2
#define Refugium 3
#define Daylight 4
#define Actinic 5
#define Skimmer 6
#define Heater 7
#define DosingPump1 8
//Cloud & Lightning effects
byte ActinicPWMValue=0;
byte DaylightPWMValue=0;
boolean ForceCloud=false;
// Create the menu entries
prog_char menu1_label[] PROGMEM = "Feeding";
prog_char menu2_label[] PROGMEM = "Water Change";
prog_char menu3_label[] PROGMEM = "Force Cloud";
prog_char menu4_label[] PROGMEM = "Force Storm";
prog_char menu5_label[] PROGMEM = "Overheat Clear";
prog_char menu6_label[] PROGMEM = "PH Calibration";
prog_char menu7_label[] PROGMEM = "Version";
// Group the menu entries together
PROGMEM const char *menu_items[] = {
menu1_label, menu2_label, menu3_label,
menu4_label, menu5_label, menu6_label, menu7_label
};
// Menu Item actions
void MenuEntry1()
{
ReefAngel.FeedingModeStart();
}
void MenuEntry2()
{
ReefAngel.WaterChangeModeStart();
}
void MenuEntry3()
{
ForceCloud=true;
ReefAngel.DisplayedMenu=RETURN_MAIN_MODE;
}
void MenuEntry4()
{
ForceCloud=true;
//ReefAngel.RF.UseMemory=false; // Sets variable so default memory modes for RF Module are not used
//ReefAngel.RF.SetMode(10,150,0); // Sets Storm mode (10) on Vortech pumps at 150/255 speed, and 0 duration since not applicable to this mode.
ReefAngel.DisplayedMenu=RETURN_MAIN_MODE;
}
void MenuEntry5()
{
ReefAngel.OverheatClear();
ReefAngel.DisplayMenuEntry("Clear Overheat");
}
void MenuEntry6()
{
ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry7()
{
ReefAngel.DisplayVersion();
}
// Custom Main Screen
void DrawCustomMain()
{
ReefAngel.LCD.DrawText(COLOR_WHITE, COLOR_CORNFLOWERBLUE, 0, 0, " "); //Top Banner
ReefAngel.LCD.DrawText(COLOR_WHITE, COLOR_CORNFLOWERBLUE, 0, 2, " BioCube 14 Nano Reef "); //Top Banner
ReefAngel.LCD.DrawDate(6, 123);
pingSerial();
// Display Temp Text
ReefAngel.LCD.DrawText(0,255,12,12,"Temp");
// Display the T1 temp value 10,22
char text[7];
ConvertNumToString(text, ReefAngel.Params.Temp1, 10);
ReefAngel.LCD.Clear(255, 0, 22, 50, 36);
ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE, 255, 10, 22, text, Num8x16);
pingSerial();
// Display pH Text
ReefAngel.LCD.DrawText(0,255,100,12,"pH");
// Display pH Value
ConvertNumToString(text, ReefAngel.Params.PH, 100);
ReefAngel.LCD.Clear(255, 90, 22, 98, 36);
ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE, 255, 90, 22, text, Num8x16);
pingSerial();
// Display Actinic Percentage Text
ReefAngel.LCD.DrawText(0,255,8,40,"Actinic %");
// Display the Actinic PWM channel value at 90,40
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(),COLOR_CORNFLOWERBLUE, 90, 40, 1);
// Display Daylight Percentage Text
ReefAngel.LCD.DrawText(0,255,8,50,"Daylight %");
// Display the Daylight PWM channel value at 90,50
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(),COLOR_CORNFLOWERBLUE, 90, 50, 1);
// Display T2 Temp Text
ReefAngel.LCD.DrawText(0,255,8,60,"Canopy Temp");
// Display the T2 temperature value at 90,60
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp2, COLOR_CORNFLOWERBLUE, 90, 60, 10);
// Display T3 Temp Text
ReefAngel.LCD.DrawText(0,255,8,70,"Ambient Temp");
// Display the T3 temperature at 90,70
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp3, COLOR_CORNFLOWERBLUE, 90, 70, 10);
// Display Vortech MP10ew Mode Text at 90, 80
ReefAngel.LCD.DrawText(0,255,8,80,"EcoSmart Mode");
// Display EcoSmart Mode Value
//ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,255,90,80,"Storm");
//ConvertNumToString(text, InternalMemory.RFMode_read(), 1);
//ReefAngel.LCD.Clear(255, 90, 80, 98, 90);
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE, 255, 90, 80, InternalMemory.RFMode_read());
//pingSerial();
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(13, 97, TempRelay);
}
void DrawCustomGraph()
{
// ReefAngel.LCD.DrawGraph(5,7);
}
void setup()
{
ReefAngel.Init(); //Initialize controller
ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items)); //For Custom Menu
ReefAngel.FeedingModePorts = B00100001; //Ports 6 & 1 turn off
ReefAngel.WaterChangePorts = B00100001; //Ports 6 & 1 turn off
ReefAngel.OverheatShutoffPorts = B00011000; //Ports 4 & 5 turn off
ReefAngel.LightsOnPorts = B00011000; //Ports 4 & 5 turn on
// ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Smart_NTM,120,6);
// Ports that are always on
ReefAngel.Relay.On(Port1);
}
void loop()
{
ReefAngel.ShowInterface();
// Delay Skimmer port 5 minutes whenever turned on
// From Curt - THANKS CURT!
ReefAngel.Relay.DelayedOn(Port6, 5);
//Heater
ReefAngel.StandardHeater(Heater,775,780); // Setup Heater to turn on at 77.5F and off at 78.0F
//Lighting schedule
ReefAngel.MHLights(Daylight,9,0,17,0,0); //Daylight schedule 9:00am - 5:00pm with 0min cool down
ReefAngel.StandardLights(Actinic,7,0,19,0); //Actinic schedule 7:00am - 7:00pm
ReefAngel.StandardLights(Refugium,19,0,7,0); //Refugium schedule 7:00pm - 7:00am
// Dosing pumps (OLD DOSING METHOD OF PUMP ONE ON THE HOUR, THEN PUMP2 5 MIN LATER - to use when tank is more mature
//From Roberto - THANKS ROBERTO!
/* if (ReefAngel.DisplayedMenu==255 && minute()==0 && second()<1) //Alk Doser - Only works if Main screen is showing
ReefAngel.Relay.On(DosingPump1); //Turn Alk Doser on
else
ReefAngel.Relay.Off(DosingPump1); //Turn Alk Doser off
if (ReefAngel.DisplayedMenu==255 && minute()==5 && second()<1) //CA Doser - Only works if Main screen is showing
ReefAngel.Relay.On(DosingPump2); //Turn CA Doser on
else
ReefAngel.Relay.Off(DosingPump2); //Turn CA Doser off
*/
// Dosing pumps
// From Roberto - THANKS ROBERTO!
if (ReefAngel.DisplayedMenu==255 && hour()%2==0 && minute()==0 && second()<1) // 1 sec dosing on even hours
ReefAngel.Relay.On(DosingPump1); //Turn DosingPump1 Doser on
else
ReefAngel.Relay.Off(DosingPump1); //Turn DosingPump1 Doser off
if (ReefAngel.DisplayedMenu==255 && hour()%2==1 && minute()==0 && second()<1) // 1 sec dosing on odd hours
ReefAngel.Relay.On(DosingPump2); //Turn DosingPump2 Doser on
else
ReefAngel.Relay.Off(DosingPump2); //Turn DosingPump2 Doser off
// Cloud & Lightning effects - Calculate your regular sunrise/sunset PWM value
// From Roberto - THANKS ROBERTO!
// byte PWMSlope(byte startHour, byte startMinute, byte endHour, byte endMinute, byte startPWM, byte endPWM, byte Duration, byte oldValue)
if (hour()>=19 || hour()<7)
{
ReefAngel.PWM.SetActinic(MoonPhase()); //Moon phase schedule between 7:00pm - 7:00am
//ReefAngel.RF.UseMemory=false; // Sets variable so default memory modes for RF Module are not used
//ReefAngel.RF.SetMode(Smart_NTM,10,5); // Sets Night mode on Vortech pumps
}
else
{
ActinicPWMValue=PWMSlope(7,00,19,0,0,35,60,ActinicPWMValue); //Actinic turn on at 7am, off at 10am, and ramp up 0% to 50% PWM in 60 minutes
//ActinicPWMValue=PWMSlope(16,00,19,0,0,50,60,ActinicPWMValue); //Actinic turn on at 4pm, off at 7pm, and ramp up 0% to 50% PWM in 60 minutes
ReefAngel.PWM.SetActinic(ActinicPWMValue);
//ReefAngel.RF.UseMemory=false; // Sets variable so default memory modes for RF Module are not used
//ReefAngel.RF.SetMode(Smart_NTM,106,10); // Sets Day mode on Vortech pumps
}
DaylightPWMValue=PWMSlope(9,00,17,0,0,75,60,DaylightPWMValue); //Daylight turn on at 9am, off at 5pm, and ramp up 0% to 50% PWM in 60 minutes
CheckCloud();
ReefAngel.PWM.SetDaylight(DaylightPWMValue);
}
//*********************************************************************************************************************************
// Random Cloud/Thunderstorm effects function
// From Roberto - THANKS ROBERTO!
void CheckCloud()
{
// ------------------------------------------------------------
// Change the values below to customize your cloud/storm effect
// Frequency in days based on the day of the month - number 2 means every 2 days, for example (day 2,4,6 etc)
// For testing purposes, you can use 1 and cause the cloud to occur everyday
#define Clouds_Every_X_Days 1
// Percentage chance of a cloud happening today
// For testing purposes, you can use 100 and cause the cloud to have 100% chance of happening
#define Cloud_Chance_per_Day 100
// Minimum number of minutes for cloud duration. Don't use max duration of less than 6
#define Min_Cloud_Duration 7
// Maximum number of minutes for the cloud duration. Don't use max duration of more than 255
#define Max_Cloud_Duration 15
// Minimum number of clouds that can happen per day
#define Min_Clouds_per_Day 3
// Maximum number of clouds that can happen per day
#define Max_Clouds_per_Day 6
// Only start the cloud effect after this setting
// In this example, start could after 11:30am
#define Start_Cloud_After NumMins(11,30)
// Always end the cloud effect before this setting
// In this example, end could before 4:30pm
#define End_Cloud_Before NumMins(16,30)
// Percentage chance of a lightning happen for every cloud
// For testing purposes, you can use 100 and cause the lightning to have 100% chance of happening
#define Lightning_Change_per_Cloud 25
// Note: Make sure to choose correct values that will work within your PWMSLope settings.
// For example, in our case, we could have a max of 5 clouds per day and they could last for 50 minutes.
// Which could mean 250 minutes of clouds. We need to make sure the PWMSlope can accomodate 250 minutes of effects or unforseen result could happen.
// Also, make sure that you can fit double those minutes between Start_Cloud_After and End_Cloud_Before.
// In our example, we have 510 minutes between Start_Cloud_After and End_Cloud_Before, so double the 250 minutes (or 500 minutes) can fit in that 510 minutes window.
// It's a tight fit, but it did.
//#define printdebug // Uncomment this for debug print on Serial Monitor window
#define forcecloudcalculation // Uncomment this to force the cloud calculation to happen in the boot process.
// Change the values above to customize your cloud/storm effect
// ------------------------------------------------------------
// Do not change anything below here
static byte cloudchance=255;
static byte cloudduration=0;
static int cloudstart=0;
static byte numclouds=0;
static byte lightningchance=0;
static byte cloudindex=0;
static byte lightningstatus=0;
static int LastNumMins=0;
// Every day at midnight, we check for chance of cloud happening today
if (hour()==0 && minute()==0 && second()==0) cloudchance=255;
#ifdef forcecloudcalculation
if (cloudchance==255)
#else
if (hour()==0 && minute()==0 && second()==1 && cloudchance==255)
#endif
{
//Pick a random number between 0 and 99
cloudchance=random(100);
// if picked number is greater than Cloud_Chance_per_Day, we will not have clouds today
if (cloudchance>Cloud_Chance_per_Day) cloudchance=0;
// Check if today is day for clouds.
if ((day()%Clouds_Every_X_Days)!=0) cloudchance=0;
// If we have cloud today
if (cloudchance)
{
// pick a random number for number of clouds between Min_Clouds_per_Day and Max_Clouds_per_Day
numclouds=random(Min_Clouds_per_Day,Max_Clouds_per_Day);
// pick the time that the first cloud will start
// the range is calculated between Start_Cloud_After and the even distribuition of clouds on this day.
cloudstart=random(Start_Cloud_After,Start_Cloud_After+((End_Cloud_Before-Start_Cloud_After)/(numclouds*2)));
// pick a random number for the cloud duration of first cloud.
cloudduration=random(Min_Cloud_Duration,Max_Cloud_Duration);
//Pick a random number between 0 and 99
lightningchance=random(100);
// if picked number is greater than Lightning_Change_per_Cloud, we will not have lightning today
if (lightningchance>Lightning_Change_per_Cloud) lightningchance=0;
}
}
//When custom menu Force cloud is selected
if (ForceCloud)
{
ForceCloud=false;
cloudchance=1;
cloudduration=10;
lightningchance=1;
cloudstart=NumMins(hour(),minute())+1;
}
// Now that we have all the parameters for the cloud, let's create the effect
if (cloudchance)
{
//is it time for cloud yet?
if (NumMins(hour(),minute())>=cloudstart && NumMins(hour(),minute())<(cloudstart+cloudduration))
{
DaylightPWMValue=ReversePWMSlope(cloudstart,cloudstart+cloudduration,DaylightPWMValue,0,180);
if (lightningchance && (NumMins(hour(),minute())==(cloudstart+(cloudduration/2))) && second()<5)
{
if (random(100)<20) lightningstatus=1;
else lightningstatus=0;
if (lightningstatus)
{
DaylightPWMValue=100;
ActinicPWMValue=100;
}
else
{
DaylightPWMValue=0;
ActinicPWMValue=0;
}
delay(1);
}
}
if (NumMins(hour(),minute())>(cloudstart+cloudduration))
{
cloudindex++;
if (cloudindex < numclouds)
{
cloudstart=random(Start_Cloud_After+(((End_Cloud_Before-Start_Cloud_After)/(numclouds*2))*cloudindex*2),(Start_Cloud_After+(((End_Cloud_Before-Start_Cloud_After)/(numclouds*2))*cloudindex*2))+((End_Cloud_Before-Start_Cloud_After)/(numclouds*2)));
// pick a random number for the cloud duration of first cloud.
cloudduration=random(Min_Cloud_Duration,Max_Cloud_Duration);
//Pick a random number between 0 and 99
lightningchance=random(100);
// if picked number is greater than Lightning_Change_per_Cloud, we will not have lightning today
if (lightningchance>Lightning_Change_per_Cloud) lightningchance=0;
}
}
}
if (LastNumMins!=NumMins(hour(),minute()))
{
LastNumMins=NumMins(hour(),minute());
ReefAngel.LCD.Clear(255,0,113,132,121);
ReefAngel.LCD.DrawText(0,255,12,113,"C");
ReefAngel.LCD.DrawText(0,255,18,113,"00:00");
ReefAngel.LCD.DrawText(0,255,52,113,"L");
ReefAngel.LCD.DrawText(0,255,58,113,"00:00");
ReefAngel.LCD.DrawText(0,255,93,113,"DUR");
if (cloudchance && (NumMins(hour(),minute())<cloudstart))
{
int x=0;
if ((cloudstart/60)>=10) x=18;
else x=24;
ReefAngel.LCD.DrawText(0,255,x,113,(cloudstart/60));
if ((cloudstart%60)>=10) x=36;
else x=42;
ReefAngel.LCD.DrawText(0,255,x,113,(cloudstart%60));
}
ReefAngel.LCD.DrawText(0,255,114,113,cloudduration);
if (lightningchance)
{
int x=0;
if (((cloudstart+(cloudduration/2))/60)>=10) x=88;
else x=94;
ReefAngel.LCD.DrawText(0,255,x,113,((cloudstart+(cloudduration/2))/60));
if (((cloudstart+(cloudduration/2))%60)>=10) x=109;
else x=112;
ReefAngel.LCD.DrawText(0,255,x,113,((cloudstart+(cloudduration/2))%60));
}
}
}
byte ReversePWMSlope(long cstart,long cend,byte PWMStart,byte PWMEnd, byte clength)
{
long n=elapsedSecsToday(now());
cstart*=60;
cend*=60;
if (n<cstart) return PWMStart;
if (n>=cstart && n<=(cstart+clength)) return map(n,cstart,cstart+clength,PWMStart,PWMEnd);
if (n>(cstart+clength) && n<(cend-clength)) return PWMEnd;
if (n>=(cend-clength) && n<=cend) return map(n,cend-clength,cend,PWMEnd,PWMStart);
if (n>cend) return PWMStart;
//End Cloud & Lighting
}
-
- Posts: 149
- Joined: Tue Nov 01, 2011 11:05 am
Re: RF Expansion Module
I feel as though you need to declare something in your loop somewhere - perfect placeis in your moonphase if statement.... try adding lines similar to this and see if it changes anything >.<
if ( hour() <= 6 || hour () >= 19 ) // Moonlights on from 7PM to 7AM
{
ReefAngel.PWM.SetActinic(MoonPhase());
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Night,15,0);
}
else
{
ReefAngel.PWM.SetActinic(0);
ReefAngel.RF.UseMemory=true;
}
if ( hour() <= 6 || hour () >= 19 ) // Moonlights on from 7PM to 7AM
{
ReefAngel.PWM.SetActinic(MoonPhase());
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Night,15,0);
}
else
{
ReefAngel.PWM.SetActinic(0);
ReefAngel.RF.UseMemory=true;
}
Re: RF Expansion Module
No change. Does your RF Module constantly blink blue and green? The manual says it should go solid green after a successful sync, so I'm wondering if it's even sending RF commands to the Vortech.
Re: RF Expansion Module
OK unplugged everything, let is sit for about 30 secs and plugged it all back in. Now the vortech is breathing white, so must be in night mode. The RF Module is breathing white too. <shrug> works for me!
Re: RF Expansion Module
I'll double check, but I think after you described what you experienced, I may have forgotten something on the vortechsetup.pde file.
I have always used a controller with internal memory already initialized, so that's why it would turn green (constant mode), because it was what I had already set on my internal memory.
I think what happened in here was that your internal memory has an unknown value.
I can't remember if you have wifi. If you do, would you please browse to http://youripaddress:2000/mb855 and let me know what you see on the browser?
I have always used a controller with internal memory already initialized, so that's why it would turn green (constant mode), because it was what I had already set on my internal memory.
I think what happened in here was that your internal memory has an unknown value.
I can't remember if you have wifi. If you do, would you please browse to http://youripaddress:2000/mb855 and let me know what you see on the browser?
Roberto.
-
- Posts: 149
- Joined: Tue Nov 01, 2011 11:05 am
Re: RF Expansion Module
I used the first vortechsetup.pde that rimai posted and just declared random2,155,0 in setup. other then that i have the code posted above and a code to set vortech in ntm for 30 min after feed mode and all worked fine....if its breathing white its in night mode...wait til morning see what it does.
Re: RF Expansion Module
Sorry no wifi, I connect via USB. I didn't set an internal memory value manually, I just added ReefAngel.RF.SetMode(Smart_NTM,120,6); to my setup() like Deckoz2302 suggested. I looked in the Reef Angel Client a couple days ago to see if I could set it in there before I got the module, but didn't see anywhere I could set the internal memory settings outside of what's in the Memory tab.
Re: RF Expansion Module
I think it's all good now. I'll be feeding my Poseidon complex during my lunch break tomorrow for sure Thanks for the help!Deckoz2302 wrote:I used the first vortechsetup.pde that rimai posted and just declared random2,155,0 in setup. other then that i have the code posted above and a code to set vortech in ntm for 30 min after feed mode and all worked fine....if its breathing white its in night mode...wait til morning see what it does.
Re: RF Expansion Module
Ok, so here is what I'd like you to do.
Shut the Client Listener service if you have it running.
On Arduino IDE, open Serial Monitor and make sure it is set to 57600 baud.
Type: GET /mb855
After you type this, make sure you hit at least one time the space in your keyboard, then hit enter.
It should give you something on the screen.
Paste it her, please
Shut the Client Listener service if you have it running.
On Arduino IDE, open Serial Monitor and make sure it is set to 57600 baud.
Type: GET /mb855
After you type this, make sure you hit at least one time the space in your keyboard, then hit enter.
It should give you something on the screen.
Paste it her, please
Roberto.
Re: RF Expansion Module
It says:
HTTP/1.1 200 OK
Server: ReefAngel
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Connection: close
Content-Type: text/xml
Content-Length: 118
<M855>255</M855>
Which is the same thing InternalMemory.RFMode_read() is returning. I was going to bug you later about if it should return a number or a string, like Storm, Night, etc
HTTP/1.1 200 OK
Server: ReefAngel
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Connection: close
Content-Type: text/xml
Content-Length: 118
<M855>255</M855>
Which is the same thing InternalMemory.RFMode_read() is returning. I was going to bug you later about if it should return a number or a string, like Storm, Night, etc
Re: RF Expansion Module
Just as I was thinking.
I'll change the setup code to initialize the memory.
Thank you so much for finding the bug.
Now, to fix your memory, you can simply type: GET /mb855,0
Same thing. Make sure you get space before hitting enter.
This will place 0 on the internal memory, which is constant. If you want to use a different value, just use the equivalent number of the mode you wish to be the default mode.
I'll change the setup code to initialize the memory.
Thank you so much for finding the bug.
Now, to fix your memory, you can simply type: GET /mb855,0
Same thing. Make sure you get space before hitting enter.
This will place 0 on the internal memory, which is constant. If you want to use a different value, just use the equivalent number of the mode you wish to be the default mode.
Roberto.
Re: RF Expansion Module
Oh, make sure to place values on 856 and 857 too.
855- mode
856- speed
857- duration
855- mode
856- speed
857- duration
Roberto.
Re: RF Expansion Module
All 3 internal memory areas set. Thanks again.
-
- Posts: 149
- Joined: Tue Nov 01, 2011 11:05 am
Re: RF Expansion Module
Hmmm, I noticed the same thing as stu except my mode value is 4 whether or not the other modes are switched due to if statements. I believe each time we reference the mode value in our code we could write something like this in our custom main
If (InternalMemory.RFmode_read() == 4) ReefAngel.LCD.DrawText(COLOR_YELLOW,DefaultBGColor,8,y+13,"Reef Crest:");
Else (InternalMemory.RFmode_read() == 8)ReefAngel.LCD.DrawText(COLOR_VIOLET,DefaultBGColor,8,y+13,"Nutrient Transport");// not sure of actual numbers for each mode gotta look at global.h
But the problem is when we say use memory false in our code the setmode doesn't rewrite internal memory value so it probably won't work. if we made a global value though. Like byte vtechmode; above setup and then in our if statement for moonphase or feeding or what have you. Add this line
if ( hour() <= 6 || hour () >= 20 )
{
ReefAngel.PWM.SetActinic(MoonPhase());
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Night,10,0);
vtechmode = 11//not sure of night number
}
else { ReefAngel.PWM.SetActinic(0);
Vtechmode = InternalMemory.RFmode_read();
}
If (vtechmode == 11) reefangel draw text ect ect we would have to have this if statement in custom main otherwise if it is in loop it will show up on every screen - which is why we should create a global byte and set change the value in loop() and intialize its value in setup() with vtechmode = internalmem.....
Then in our custom write it like
If (InternalMemory.RFmode_read() == 4) ReefAngel.LCD.DrawText(COLOR_YELLOW,DefaultBGColor,8,y+13,"Reef Crest:");
Else (InternalMemory.RFmode_read() == 8)ReefAngel.LCD.DrawText(COLOR_VIOLET,DefaultBGColor,8,y+13,"Nutrient Transport");// not sure of actual numbers for each mode gotta look at global.h
But the problem is when we say use memory false in our code the setmode doesn't rewrite internal memory value so it probably won't work. if we made a global value though. Like byte vtechmode; above setup and then in our if statement for moonphase or feeding or what have you. Add this line
if ( hour() <= 6 || hour () >= 20 )
{
ReefAngel.PWM.SetActinic(MoonPhase());
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Night,10,0);
vtechmode = 11//not sure of night number
}
else { ReefAngel.PWM.SetActinic(0);
Vtechmode = InternalMemory.RFmode_read();
}
If (vtechmode == 11) reefangel draw text ect ect we would have to have this if statement in custom main otherwise if it is in loop it will show up on every screen - which is why we should create a global byte and set change the value in loop() and intialize its value in setup() with vtechmode = internalmem.....
Then in our custom write it like
-
- Posts: 149
- Joined: Tue Nov 01, 2011 11:05 am
Re: RF Expansion Module
When I get home today rimai I may add to your vortechsetup pde and upload it for you, so that once slaves are set menu pops up to select default mode, speed % and pulse duration.
Gotta look at the code to figure out how you do a scroll select like tempuratures on the preloaded pde(like how you select water/lights/room)
Mode would have to be simple string array? And use the number of the position to set value
Speed would be internalmemory rfspeed write = abs((percent * 0.01) * 255)
Duration would just be 0-255 selection
Gotta look at the code to figure out how you do a scroll select like tempuratures on the preloaded pde(like how you select water/lights/room)
Mode would have to be simple string array? And use the number of the position to set value
Speed would be internalmemory rfspeed write = abs((percent * 0.01) * 255)
Duration would just be 0-255 selection
Re: RF Expansion Module
I wanted to tweak my internal memory settings this morning when my lights came on. I changed the values for 856 and 857, but nothing happened. I uploaded my PDE to reset the software, but nothing happened. That's when I went looking for a software reset function and posted this http://forum.reefangel.com/viewtopic.php?f=12&t=526. I didn't want to have to unplug the controller while I was testing.StuGotz wrote:All 3 internal memory areas set. Thanks again.
I unplugged the relay box for 10 secs and when it came back up the vortech changed to the new settings. I changed the memory values again, but this time the Vortech changed immediately without a hard reset.
-
- Posts: 149
- Joined: Tue Nov 01, 2011 11:05 am
Re: RF Expansion Module
Did you understand my code idea for displaying the mode on main stu?
Put this above setup
Place this in setup
In your loop for moonlight or feeding or where your if/else statement is put this in if
Place this in else
Creatr a function
Put this above setup
Code: Select all
byte vtechmode;
void vtechstr(byte);
Code: Select all
vtechmode = InternalMemory.RFmode_Read();
Code: Select all
vtechmode = 5; //replace 5 with the numerical value of the mode
Code: Select all
vtechmode = InternamMemory.RFmode_read();
Code: Select all
void vtechstr(byte modenum) {
char modestr;
if (modenum= 0) modestr = "Constant"; // do this for each number of modes
Last edited by Deckoz2302 on Fri Dec 30, 2011 8:42 am, edited 1 time in total.
-
- Posts: 149
- Joined: Tue Nov 01, 2011 11:05 am
Re: RF Expansion Module
then at the end of the function return modestr;
Then call it in custom main with
ReefAngel.LCD.DrawText(#,#,#,#,vtechstr(vtechmode));
Let me know if it works, ii will try when I get home
Also last post in if statement it has to be double ==....post is to long to edit on phone...bleh android
And I think we need to use str not char
Then call it in custom main with
ReefAngel.LCD.DrawText(#,#,#,#,vtechstr(vtechmode));
Let me know if it works, ii will try when I get home
Also last post in if statement it has to be double ==....post is to long to edit on phone...bleh android
And I think we need to use str not char
Re: RF Expansion Module
There is no need to reboot the controller for the memory settings to take effect.
It will always use memory settings to pick up the mode.
If you add no SetMode() on your loop, it will use memory settings.
I think the confusion is when you use SetMode() without UseMemory=false.
You must use UseMemory=false to be able to use SetMode() properly or the controller may get confused and won't know which mode to use.
By looking at th previous code, you had this:
You need to have this:
If you don't add anything to your code, you should still be able to change modes by changing the internal memory.
Changing internal memory is slightly harder now, because we are in the process of revamping all apps (Client, Status, iPhone and Android), but they will all eventually offer that capability in the near future and it should be just open your prefered application and change modes.
Give this a shot and see if it works.
It will always use memory settings to pick up the mode.
If you add no SetMode() on your loop, it will use memory settings.
I think the confusion is when you use SetMode() without UseMemory=false.
You must use UseMemory=false to be able to use SetMode() properly or the controller may get confused and won't know which mode to use.
By looking at th previous code, you had this:
Code: Select all
// ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Smart_NTM,120,6);
Code: Select all
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Smart_NTM,120,6);
Changing internal memory is slightly harder now, because we are in the process of revamping all apps (Client, Status, iPhone and Android), but they will all eventually offer that capability in the near future and it should be just open your prefered application and change modes.
Give this a shot and see if it works.
Roberto.
Re: RF Expansion Module
I had to unplug the unit yesterday for it to sync up for the 1st time, and again this morning for the changes I made to 2 memory location for speed and duration. After I unplugged the unit this morning I was able to update the memory locations one more time and the change occured immediately without any reboots, soft or hard. I'm not sure what is causing it to lock up like that, requiring a hard reset.rimai wrote:There is no need to reboot the controller for the memory settings to take effect.
The PDE I posted earlier was updated after I posted it. I commented everything out except this.rimai wrote:It will always use memory settings to pick up the mode.
If you add no SetMode() on your loop, it will use memory settings.
I think the confusion is when you use SetMode() without UseMemory=false.
You must use UseMemory=false to be able to use SetMode() properly or the controller may get confused and won't know which mode to use.
By looking at th previous code, you had this:You need to have this:Code: Select all
// ReefAngel.RF.UseMemory=false; ReefAngel.RF.SetMode(Smart_NTM,120,6);
If you don't add anything to your code, you should still be able to change modes by changing the internal memory.Code: Select all
ReefAngel.RF.UseMemory=false; ReefAngel.RF.SetMode(Smart_NTM,120,6);
Changing internal memory is slightly harder now, because we are in the process of revamping all apps (Client, Status, iPhone and Android), but they will all eventually offer that capability in the near future and it should be just open your prefered application and change modes.
Give this a shot and see if it works.
Code: Select all
if (hour()>=19 || hour()<7)
{
ReefAngel.PWM.SetActinic(MoonPhase()); //Moon phase schedule between 7:00pm - 7:00am
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Night,15,0);
}
else
{
ActinicPWMValue=PWMSlope(7,00,19,0,0,35,60,ActinicPWMValue); //Actinic turn on at 7am, off at 10am, and ramp up 0% to 50% PWM in 60 minutes
//ActinicPWMValue=PWMSlope(16,00,19,0,0,50,60,ActinicPWMValue); //Actinic turn on at 4pm, off at 7pm, and ramp up 0% to 50% PWM in 60 minutes
ReefAngel.PWM.SetActinic(ActinicPWMValue);
ReefAngel.RF.UseMemory=true;
}
Re: RF Expansion Module
Don't knock android I plan on testing this all out over the weekend, I had a similar idea before going to bed last night. I was just going to read the internal memory area and have if set a variable for the string and display that on the custom main.Deckoz2302 wrote:then at the end of the function return modestr;
Then call it in custom main with
ReefAngel.LCD.DrawText(#,#,#,#,vtechstr(vtechmode));
Let me know if it works, ii will try when I get home
Also last post in if statement it has to be double ==....post is to long to edit on phone...bleh android
And I think we need to use str not char
Re: RF Expansion Module
I just realized the issue with doing it like that, the internal memory would always be the same...StuGotz wrote: I was just going to read the internal memory area and have if set a variable for the string and display that on the custom main.
Re: RF Expansion Module
The upcoming library will offer you a way to pull the current mode. No date to be released yet thoughStuGotz wrote:I just realized the issue with doing it like that, the internal memory would always be the same...
But a work around is to follow what Deckoz posted earlier.
Create a variable to hold the current mode and display it on custom main.
Are you able to change modes by changing internal memory values without reboot now?
Roberto.
-
- Posts: 149
- Joined: Tue Nov 01, 2011 11:05 am
Re: RF Expansion Module
Which is why I said create a global bye such as vtechmode and whenever you change the mode you have a line following stating mode number like above, I realized the same thing typing the code earlier
Re: RF Expansion Module
I think I may have just figured out what might be locking it up.rimai wrote:Are you able to change modes by changing internal memory values without reboot now?
I tested by changing 857, and duration changed just fine. I change 857 back to my original value, still no problem. I changed 855 to 0, no problem, then to 5, still no problem. I change it to 9, no problem. But change 855 back to 5 and it locked up.
I think it has something to do with Night mode. It would explain why it was locked up again this morning. It didn't come out of night mode correctly then either.
Hard reset and the Vortech immediately went into mode 5.