Issues I've seen in the current Dev Library.

Related to the development libraries, released by Curt Binder
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

Anyway, I've made the pull request for the above changes. I also changed the range for Sine mode the same way we did for Gyre. Otherwise pumps would be off for a lot longer than expected...
AlanM
Posts: 263
Joined: Wed Jan 01, 2014 7:26 am

Re: Issues I've seen in the current Dev Library.

Post by AlanM »

Good idea. So it just stays at the threshold all the way down to 0, and then briefly stops at 0 and right back up to threshold? I haven't pulled your branch to try it. I get periodic errors when using the bluetooth with timeouts or port in use problems and it makes me nervous, so I only load when I really need to.
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Issues I've seen in the current Dev Library.

Post by cosmith71 »

AlanM wrote: I get periodic errors when using the bluetooth with timeouts or port in use problems and it makes me nervous, so I only load when I really need to.
Is this new behavior? I've had major problems this weekend with this. Usually I only see an occasional port in use error. The timeouts are new.

--Colin
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

AlanM wrote:Good idea. So it just stays at the threshold all the way down to 0, and then briefly stops at 0 and right back up to threshold?
For which mode?
AlanM
Posts: 263
Joined: Wed Jan 01, 2014 7:26 am

Re: Issues I've seen in the current Dev Library.

Post by AlanM »

cosmith71 wrote:
AlanM wrote: I get periodic errors when using the bluetooth with timeouts or port in use problems and it makes me nervous, so I only load when I really need to.
Is this new behavior? I've had major problems this weekend with this. Usually I only see an occasional port in use error. The timeouts are new.

--Colin
Not sure. I have only had one for a couple of weeks. Is it possible that it times out when the wifi is being used already since they kind of preempt each other being on the same wires?
AlanM
Posts: 263
Joined: Wed Jan 01, 2014 7:26 am

Re: Issues I've seen in the current Dev Library.

Post by AlanM »

lnevo wrote:
AlanM wrote:Good idea. So it just stays at the threshold all the way down to 0, and then briefly stops at 0 and right back up to threshold?
For which mode?
For the sine one that you said you changed.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

No i think it will just travel between threshold and speed. Otherwise it would spend an inordinate amount of time at the threshold value.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Issues I've seen in the current Dev Library.

Post by Sacohen »

In the last 3 days my random wave mode has choosen Gyre.

I don't think that is a random coincidence?

I can't see what (if any thing) in the threshold dev library that I've been running that would cause that.

And even though I'm the first to point towards my lack of coding knowledge. I don'tvsrr how adding ", Gyre" to my list of optional modes would have done it either.

Not a major thing. I pulled Gyre out of the options for nowz bit I thought I would mention it.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

Didn't you just include that mode for testing? Can you post the code you've been using again so i can check it out. Try putting Gyre in a different slot in the array. The thing about random numbers is they don't always seem random... :) plus the arduino doesn't seed the random number so if you keep bouncing the controller it may end up being the same random result each day.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Issues I've seen in the current Dev Library.

Post by Sacohen »

I'll try later today.
Right now I'm tearing apart a swing set.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Issues I've seen in the current Dev Library.

Post by Sacohen »

I was trying it for testing, but then I decided to leave it in and see how I like the mode.

I just uploaded it with Gyre in the middle of the options and it came up in Else mode after the Reboot, so it may be as you were saying about how the Arduino handles random numbers and reboots.

Here is the code I was testing with.
The code I have in there now is changed a little bit to narrow down the issue with the Muti WL sensor dropping.

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>fF
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>f
#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 <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>

// Define Relay Ports by Name
#define Actinic_Lights     1
#define Day_Lights         2
#define Kalkwasser         3
#define Pumps              4
#define Sump_Fan           5
#define DeNit_Doser        6
#define DeNit_Pump         7
#define ATO_Pump           8

#define Unused             Box1_Port1
#define Feeder             Box1_Port2
#define Unused             Box1_Port3
#define Unused             Box1_Port4
#define Unused             Box1_Port5
#define Unused             Box1_Port6
#define Unused             Box1_Port7
#define Dummy              Box1_Port8


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

// Does not need to be global.
// unsigned long ATOUpdate=0;

////// Place global variable code above here


void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port4Bit;
ReefAngel.WaterChangePortsE[0] = Port1Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit;
// 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 );
//Set Standard Menu
ReefAngel.AddStandardMenu();
//Water Level
ReefAngel.AddMultiChannelWaterLevelExpansion();
//Webserver Authentication
//ReefAngel.Network.WifiAuthentication("Sacohen:xxxxxxxx");
//DDNS Server
ReefAngel.DDNS("xxxxxxxx");

// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
ReefAngel.DCPump.DaylightChannel=Sync; // Now you're pump will be affected by the portal settings.
ReefAngel.DCPump.ActinicChannel=AntiSync; // Now you're pump will be affected by the portal settings.
ReefAngel.DCPump.AntiSyncOffset=85;

// Ports that are always on
ReefAngel.Relay.On( Pumps );
ReefAngel.Relay.On( Dummy );

////// Place additional initialization code below here


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

void loop()
{
  ReefAngel.StandardLights( Actinic_Lights,12,0,22,0 );
  ReefAngel.StandardLights( Day_Lights,13,0,21,0 );
  ReefAngel.StandardLights( Sump_Fan,13,0,21,0 );
  ReefAngel.WaterLevelATO(0,ATO_Pump,720,28,31);
  if ( hour()>=13 && hour()<21 )
  ReefAngel.PWM.SetChannel( 5, 0 );
  else
  ReefAngel.PWM.SetChannel( 5, PWMSlope(21,0,13,0,0,MoonPhase() ,60,0) );
 
  ////// Place your custom code below here
  
  //Mix Kalkwasser
static unsigned long Kalk_Mixing = 0;

static unsigned long stopTime = 0;
static byte prevWL=0;

if (ReefAngel.WaterLevel.GetLevel(1)==100 && prevWL<100) {   
  stopTime=now()+3600; // Get time one hour from now.
}
prevWL = ReefAngel.WaterLevel.GetLevel(1); // Store the water level

if (now() < stopTime) { ReefAngel.Relay.On(Kalkwasser); } else { ReefAngel.Relay.Off(Kalkwasser); } 
  
  //AutoFeeder
static unsigned long autofeeding = 0;

if ((now()%SECS_PER_DAY==64800)) //if it is 6 pm
{
ReefAngel.FeedingModeStart(); //START FEEDING MODE
}

if (ReefAngel.DisplayedMenu==FEEDING_MODE)
{
if ( autofeeding == 0 ) {
autofeeding = now(); //set the time of the start of feeding to variable feeding
}

if ((now()-autofeeding>=60) && (now()-autofeeding<=61)) //if between 60 and 61 seconds has past
{
ReefAngel.Relay.On(Feeder); //TURN FEEDER RELAY ON
}
else 
{
ReefAngel.Relay.Off(Feeder); //TURN FEEDER RELAY OFF
}
} else {
if ( autofeeding > 0 ) {
autofeeding = 0;
}
}
  // DeNitrate Routine
int DeNit_Offset=3600; 
int DeNit_Repeat=21600;
int DeNit_Doser_Offset=1200;
int DeNit_Doser_Runtime=600;
int DeNit_Pump_Runtime=1200;
int DeNit_ATO_Offtime=1500;

// Pump comes on first
ReefAngel.Relay.Set(DeNit_Pump,(now()-DeNit_Offset)%DeNit_Repeat<DeNit_Pump_Runtime);  // Runs denitrator pump
// Doser comes on second
ReefAngel.Relay.Set(DeNit_Doser,((now()-DeNit_Offset)-DeNit_Doser_Offset)%DeNit_Repeat<DeNit_Doser_Runtime); // Runs denitrator doser
   
  // Disable ATO
if ( (now()-3600)%21600<DeNit_ATO_Offtime) ReefAngel.WaterLevelATO(0,ATO_Pump,720,0,1);

  // Delay WL ATO after water change and DeNit_Dosing
  static time_t wcTimer=0;
  if (ReefAngel.DisplayedMenu == WATERCHANGE_MODE) wcTimer=now();

  // First 10 minutes after WC disable ATO
  if (now()-wcTimer >= 0 && now()-wcTimer < 600)
    ReefAngel.WaterLevelATO(0,ATO_Pump,720,0,1);

    // Track Salinity low duration
    static unsigned long lastGoodSal;
    static boolean lowSalFlag;
   
    // Salinity is good, update counter
    if (ReefAngel.Params.Salinity>=335) lastGoodSal=now(); 
    
    // Counter hasn't been updating in 300 seconds..
    if (now()-lastGoodSal>300) {
      lowSalFlag=true; // Salinity is definitely below 33.5
    } else {
      lowSalFlag=false; // Salinity back to normal
    }
    
    // Disable ATO if lowSalFlag is true
    if (lowSalFlag) ReefAngel.WaterLevelATO(0,ATO_Pump,720,0,1);
    
  // Disable ATO if ATO High IsActive()
  if (ReefAngel.HighATO.IsActive()) 
    ReefAngel.WaterLevelATO(0,ATO_Pump,720,0,1);
    

// Add random mode if we set to Mode to Custom in portal
static int rmode;
static boolean changeMode=true;


// These are the modes we can cycle through. You can add more and even repeat...
byte modes[] = { ReefCrest, Lagoon, Constant, TidalSwell, ShortPulse, LongPulse, Else, Gyre };

if (now()%SECS_PER_DAY==0 || changeMode==true) { // Change at midnight or if controller rebooted
rmode=random(100)%sizeof(modes); // Change the mode once per day to pick from our array
changeMode=false;
}

// Set timer when in feeding mode
static unsigned long feeding;
if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();

if (now()-feeding<3600) { 
  // Continue NTM for the 60 minutes
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
  ReefAngel.DCPump.Mode=NutrientTransport;
} else if (now()%SECS_PER_DAY<43200 || now()%SECS_PER_DAY>=79200) { // 12pm / 10pm
  // Night mode (go to 30%)
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
  ReefAngel.DCPump.Mode=Constant;
  ReefAngel.DCPump.Speed=30;
} else if (InternalMemory.DCPumpMode_read()==11) { 
  // Custom Mode and nothing else going on
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
  ReefAngel.DCPump.Mode=modes[rmode];  // Put the mode to the random mode :)
  ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
} else {
  ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
}

  ////// Place your custom code above here

  // This should always be the last line
  ReefAngel.Portal( "Sacohen","xxxxxxxx" );
  ReefAngel.ShowInterface();
}

void DrawCustomMain()
{
int x,y;
char text[10];
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 20, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 20, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();

// Water Level
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,75,57, "WL:" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,99,57, ReefAngel.WaterLevel.GetLevel() );

ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,66,66, "WL 1:" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,99,66, ReefAngel.WaterLevel.GetLevel(1) );

//Salinity  
  ConvertNumToString(text, ReefAngel.Params.Salinity, 10);
  strcat(text,"  ");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,39,75,"Salinity:");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,99,75,text);
pingSerial();

// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 92, TempRelay );
pingSerial();
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox(12, 104, TempRelay);

// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}

void DrawCustomGraph()
{
}
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

Its because you've been rebooting every day. If you look in my setup() function you can see how the random function gets "seeded" so that each reboot would give a different random number. I believe I use the current time as the seed.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Issues I've seen in the current Dev Library.

Post by lnevo »

Roberto, does setting Feeding_Start recognize the speed arg on the RF module, or does it follow the speed set by the driver?

In ReefAngel.cpp we set the speed to 0 when going into feeding mode and I was thinking of adding the WaterChange and FeedingMode speed to the RF class like we did with DCPump.

RF.SetMode(Feeding_Start,0,0);
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

Ok, I have a patch I will try and if it works, I have a pull request ready :)
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Issues I've seen in the current Dev Library.

Post by rimai »

The drivers will dictate the vortech speed on feeding.
You can adjust it directly on the driver itself. Check the vortech manual for more info.
Roberto.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

Yeah, I know. I'm thinking though of having FeedingSpeed if set not have the RF go into feeding mode, but in constant whatever speed RF.FeedingSpeed is set to. This way the default is the current behavior, but if someone wanted to override, then it would go into Constant ReefAngel.RF.FeedingSpeed. Changing the drivers is a pain in the ass and then you have to do it on all of them. I'd rather do it in one place and be able to change it on the fly. About to try that now.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

That worked exceedingly well. I tested with the value set and also with it cleared. The default works fine. I'll be making a pull request for this one shortly :)
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

Roberto, merge that patch :) it's awesome
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Issues I've seen in the current Dev Library.

Post by rimai »

Sorry, done :)
Roberto.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

It's my new favorite feature :)
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

For the record I like 3% is a perfect amount :)

Roberto,

What else is left for us to release 1.1.11? Are there still hardware support items that you're dependent on for release? I haven't seen any bugs at this point other than to confirm the ph/date&time issue I had.

I think we should add a Release_Notes.txt file in the repo so we can all start working on our contrib items in one place. That would taunt me to actually add things there.

I know a few people are testing but we should probably also make an official call for additional beta testers.

Is there portal support still pending for things (threshold settings?)

I know we talked about doing some redesign on some things like threshold and offsets per channel in the PWM library...lets get 1.1.11 out so we can start on those for 1.1.12 :)

Anything I missed?
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Issues I've seen in the current Dev Library.

Post by Sacohen »

The only thing I know about for the Portal was the server authentication. Roberto may already have that set up in then next version of the Portal.
We also need to get with Reeftronics to set up for that feature or else you lose connectivity with them.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Issues I've seen in the current Dev Library.

Post by rimai »

I don't think there is anything pending except for making sure it is working.
Can you add the release notes file to the github?
Roberto.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Issues I've seen in the current Dev Library.

Post by lnevo »

Cool. I'll add the file and review the commits to see what can start going in. I'll get that other stuff verified too.

Steve, for reeftronics you should be able to add http authentication in the URL for your controller. Its not a portal issue they poll you directly. Just ask them to change the URL to:

http://user:password@your.ip.address:2000/r99
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Issues I've seen in the current Dev Library.

Post by Sacohen »

I know it's not a Portal issue.
I was saying that according to Roberto, the current Portal is not set for the server authentication.
I was also saying that Reeftronics would need something similar, but I can email Russ and see if he can do that with the URL.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

That should work you can test that too to make sure the URL pulls up properly. He might have a problem storing it but i doubt it. He just uses php so shouldn't be a big deal.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

Any issue to use the README.md file for the release notes? Not sure if it's there for something like the mainpage.h :)
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Issues I've seen in the current Dev Library.

Post by rimai »

Whatever you have on readme, gets displayed on the main page of github.com

Sent from my Galaxy S5 with Tapatalk
Roberto.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Issues I've seen in the current Dev Library.

Post by lnevo »

Well, I've created an initial stab at the release notes. I've made a pull request for it. You can track the branch "release" in my repo if you want to work on it until it's merged.

Ahh.. so I'll revert and move it to a separate file. :)

Edit: Updated. Also incremented version in ReefAngel.h to 1.1.1
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Issues I've seen in the current Dev Library.

Post by cosmith71 »

I had this in the Reef Angel Status thread, but it's more appropriate here.
cosmith71 wrote:Possible bug? Library or programming issue?

On the dimming expansion screen:

Channel 0 is at 0%. I override to value x. Value changes to **x%. Clear override. Value changes to x% (not zero) and light stays on at x%. The only way to get it back to zero is to override to 0 and then clear.

I'm using this:

Code: Select all

  ReefAngel.PWM.Channel0PWMSlope(30);

--Colin
To which Lee replied:
lnevo wrote:
Expected behavior

Right which only sets the channel during your StandardLights time otherwise it uses the channels previous value.
I'm wondering if it would be better if this returned the min % in the off hours instead of the previous value?

--Colin
Post Reply