Issues I've seen in the current Dev Library.

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

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

Post by lnevo »

How about long pulse / short pulse etc when chosen manually?
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 »

It's in NTM after feeding right now.
I'll double check them later, but I think they were fine.
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 watching TV while waiting for NTM for finished and noticed that my moonlights were flashing.

https://www.youtube.com/watch?v=luKhY1D7fFI

I've never had this happen before. I don't know if it is the new code or what.

I looked at the Andriod app and the Portal and all the channels on the dimming module were at 50%, but I caught an update a little later and they were all at 0.

I tried rebooting and the same issues.

After NTM it went to Lagoonal Mode and the moonlights stayed on at 50% (no flashing).

I manually set it to Short Pulse and it is pulsing at 50%, but so are all channels on the dimming port.

The dimming pory seems to be following the Daylight Channel of the Relay. The same thing is happening in Long Pulse, but at a slower rate.
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 just checked and it's happening with all the wave modes.
Whatever percentage the Daylight Dimming Channel is at all the channels on the Dimming Module are at the same percentage.
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 »

Just double checked and it does not happen with the old libraries and my old code for that set of libraries.

I was wondering if it had to do with the offset code, so I commented it out and it still happens, so it's not that.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

But is it when in custom or all the modes? Can you try a wizard code i need to look at your ino again...
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 »

It's all modes when changed thru the Internal Memory.
I'll try some Wizard code and let you know.
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 »

Created a totally Wizard code (the only thing I went back in and added was my Portal Key) and Moonlights still flashed while the channels on the Dimming Module were still matching the Daylight Dimming port on the Relay.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

Ok. Thanks. I'll see if any issue I can find. Alan, how about you are you seeing similar?
AlanM
Posts: 263
Joined: Wed Jan 01, 2014 7:26 am

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

Post by AlanM »

No. I don't see those issues, I don't have a 6 channel dimmer, though, and you don't have DC pumps, so maybe we would miss them. I'll look again at the reefangel .cpp stuff to see if somehow the pump settings are getting sent to all the lights or something for the expansion.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

I've added the DCPump to my sketch and running my two unused ports as DCPumps. Let's see if I get similar issues.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

Ok, I've definitely been able to reproduce it. I'm working on the issue now. It seems that the else got inside the hardware #ifdefs so it probably wasn't being seen on the current RA boards.

Yep, good values in Serial Monitor now. Going to remove the debug code and let it run. I'll verify shortly when I have positive results via the wifi. I'll have the code posted and a pull request ready to go :)

The error was only in the PWM expansion and not in the other code and not repeated in the sixteen channel.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

OK, the r99 output looks great. It is no longer affecting the other channels on the PWM expansion and it is setting the antisync channel properly. Before it was getting 0 and every channel was getting the Sync speed. It was a misplaced else that got inside the wrong #define. I also added some braces, but I think they weren't needed, but they're in the current pull request and updated in the pumpoffset branch.

Enjoy :)
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

And with that said, Roberto has merged the request :) You can re-download the official dev version :)
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

Here's all my pwm channels graphed. Looks pretty good to me :)

http://forum.reefangel.com/status/chart ... lter=pwme5
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 »

Looks good.

Downloaded and replaced the libraries.
Uploaded my text code to the unit and looking at the Portal my pumps are running at 30% (like they should be at night), but the moonlights are at 86% (Like they should be running the MoonPhase).

Hopefully that's the last of the issues and Roberto can distribute this version so everyone can enjoy all the new features.

Off Topic: What is the pattern for the Gyre wave mode?
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

It s a sine wave, but the two pumps slow down and speed up before they switch direction
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

And its one pump on while other is off.
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 »

Ok.
AlanM
Posts: 263
Joined: Wed Jan 01, 2014 7:26 am

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

Post by AlanM »

Think of Gyre like long pulse with rounded corners.
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 »

Oh. I remember you posting about it now.
I didn't know that was the name.
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 »

Everything has been running well with the new code.

One thing I did notice and I'm not sure if it was intentional or not was when with the current released libraries when I had the portal set to custom and I was running my random wave modes that Lee created the portal would display the actual wave mode that was running that day (Lagoonal, Short, Pulse ReefCrest, etc) with the dev libraries it displays Custom.

For me it was kind of nice knowing what mode was running that day or seeing that the mode actually changed when I reboot the controller.

Just something I wanted to mention.

Thanks;
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

That may be something in the portal. Are you looking in the Internal Memory section or on the portal main page. What's odd is that when the mode is custom we set memory to false and set the mode to the appropriate mode so it should be showing the correct mode. What do you see for DCM in the r99 output?
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 will look at the r99 when I get home, but I'm talking about the display on the portal, not the internal memory.

The Internal memory displays correctly as Custom 50/30

This is an older screen shot.

Image

This one on the new library.

Image
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 »

lnevo wrote:What do you see for DCM in the r99 output?
DCM in the r99 output is 11
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

That makes no sense we override the mode to the random setting. what happens when you're in night or feeding mode? and by feeding mode, I mean the time when you should have nutrient transport...
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 »

When I go into feeding mode the Jebao pumps go off for 15 min and the Portal and U-App display Nutrient Transport Mode 50/30
DCM = 5

After the 15 min the Portal and U-App display Nutrient Transport Mode 50/30
DCM = 5

In night mode the Portal and U-App display Constant 30/30
DCM = 0
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

That's wierd, we're not doing anything different with the modes when we're in the random section. we set the mode to the appropriate mode. Do the pumps look like they're doing the right then when they're in the random selection?
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'm not sure. I'm at work most of the time they are in Random mode.
By the time I get home they are in NTM from after feeding then between 7 and 10pm they go back to Random.
I'll have to look at it more carefully tomorrow.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

I see your problem. In the first page when you were troubleshooting the DNS code you posted your modified INO...

You have this code for the custom section:

Code: Select all

} 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.UseMemory=true; // Will reset all values from memory
}
In your original code you have this:

Code: Select all

} else if (InternalMemory.DCPumpMode_read()==11) { 
  // Custom Mode and nothing else going on
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
  if (modes[rmode]==Else) {
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Mode=Constant;
    ReefAngel.DCPump.Speed=ElseMode(InternalMemory.DCPumpSpeed_read(),20,true );    // ElseMode on sync mode, Portal Speed Setting +/- 20%
  } else {
    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
}
So it seems you took too much out :)

This is what that section should look like:

Code: Select all

} 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
}
And finally here is your updated future 1.1.11 code should look like:

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();
//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.ActinicChannel=Sync; // Now you're pump will be affected by the portal settings.
ReefAngel.DCPump.DaylightChannel=AntiSync; // Now you're pump will be affected by the portal settings.
ReefAngel.DCPump.AntiSyncOffset=0;

// 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(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(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(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(ATO_Pump,720,0,1);
    
  // Disable ATO if ATO High IsActive()
  if (ReefAngel.HighATO.IsActive()) 
    ReefAngel.WaterLevelATO(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 };

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()
{
}
Post Reply