Bug on v0.9.6

Related to the development libraries, released by Curt Binder
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Bug on v0.9.6

Post by rimai »

I'm going to load this code and see what I can find out.
The wizard saves the choices you made everytime you quit the application.
If you open again, it will have the same choices of your last code.
Roberto.
00Warpig00
Posts: 289
Joined: Wed May 16, 2012 9:52 pm

Re: Bug on v0.9.6

Post by 00Warpig00 »

I used the Reef Angel Wizard to do some process of elimination.

I have successfully and repeatedly been able to make the problem appear/disappear.

Using the wizard I did the following

Memory Settings = In The Code
Temperature *F (probably doesnt matter but thats what I picked 86.0* setpoint)
Expansion Modules = nothing checked
Attachments = Wifi only
Main Relay Box Ports 1-8 = all checked "Not Used" (no port mode check marks)
Daylight Dimming = None
Actinic Dimming = None
WiFi Attachment Username 00Warpig00
Generate

This will produce the following code

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <ReefAngel.h>

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


////// 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 = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 860 );


    // Ports that are always on

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

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

void loop()
{
    ////// Place your custom code below here
    

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

    // This should always be the last line
    ReefAngel.Portal( "00Warpig00" );
    ReefAngel.ShowInterface();
}

This code WILL WORK FINE


Then I created another code using the wizard a second time. This time I did the following...

Memory Settings = In The Code
Temperature *F (probably doesnt matter but thats what I picked 86.0* setpoint)
Expansion Modules = Relay Only
Attachments = Wifi only
Main Relay Box Ports 1-8 = all checked "Not Used" (no port mode check marks)
Expansion Relay Box Ports 1-8 = all checked "Not Used" (no port mode check marks)
Daylight Dimming = None
Actinic Dimming = None
WiFi Attachment Username 00Warpig00
Generate

This will generate the following code...

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <ReefAngel.h>

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


////// 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;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    ReefAngel.WaterChangePortsE[0] = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    ReefAngel.OverheatShutoffPortsE[0] = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 860 );


    // Ports that are always on

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

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

void loop()
{
    ////// Place your custom code below here
    

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

    // This should always be the last line
    ReefAngel.Portal( "00Warpig00" );
    ReefAngel.ShowInterface();
}

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

    // Main Relay Box
    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox( 12, 93, TempRelay );
    pingSerial();

    // Relay Expansion
    TempRelay = ReefAngel.Relay.RelayDataE[0];
    TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
    TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
    ReefAngel.LCD.DrawOutletBox( 12, 106, TempRelay );
    pingSerial();

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

void DrawCustomGraph()
{
    ReefAngel.LCD.DrawGraph( 5, 5 );
}
This code will show the XML Parser error and will cause the portal to loose connection and not be able to reconnect.

NOTE: the only difference while running the wizard between the two is the selection of the Relay box as well as the "Not Used" selections for each port on the Expansion relay box.

I had Relay Expansion plugged into the USB port on the Main Relay box (eliminating the expansion hub) for both code samples above.

Nick
180G FOWLR
20GH QT#1
29G QT#2

Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Bug on v0.9.6

Post by rimai »

Try this command on the wifi attachment:

Code: Select all

set c s 1420
Let me know if it solves the problem.
Roberto.
00Warpig00
Posts: 289
Joined: Wed May 16, 2012 9:52 pm

Re: Bug on v0.9.6

Post by 00Warpig00 »

set comm size 1420

This appears to have resolved the issue at this time. I can now use both the Portal and the Android app the portal doesn't seem to have any trouble connecting so far nor do I get any parser errors in the android app at this time. Keeping an eye on it for now, but I was able to get it to fail within minutes and I have been messing around with it for the past hour with no trouble so far.

Thanks Roberto

Nick
180G FOWLR
20GH QT#1
29G QT#2

Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Bug on v0.9.6

Post by rimai »

Cool.
I'll add that to the wifi utility.
I remember that Dave added that setting to his utility in the past too.
The reason is that the default packet size is 450 bytes, so when you added the relay expansion module to the code, the size of the data stream went above 450 and the wifi attachment was splitting the payload in 2 packets.
I guess some routers don't like that and causes problems when you try to read the entire stream.
Roberto.
00Warpig00
Posts: 289
Joined: Wed May 16, 2012 9:52 pm

Re: Bug on v0.9.6

Post by 00Warpig00 »

I think the culprit may have been the wifi attachment.ttl script you sent me earlier in the thread to config the wifi.

That ttl script has sendln 'set c s 2048' in it.

BTW still working without issue. I get a url timeout once in a while from my android. but a subsequent refresh connects me and no more parser errors. The portal still is having no trouble. I have reverted to my full loaded code and it still is working fine.

Nick
180G FOWLR
20GH QT#1
29G QT#2

Image
Post Reply