Page 1 of 1

http access to Reef Angel

Posted: Sun Sep 04, 2011 9:18 am
by Xender
I've got error when I try to see the http page on Internet Explorer
It's says "Please wait Loading"
Librairies : V.8.5.16

My scketch :

Code: Select all

#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>

#define Pump1               8
#define DrainPump           7
#define Osmoseur            6
#define CO2                 5
#define Heater              4
#define Bubbles             3
#define Light2              2
#define Light1              1

// Labels for the web banner
#include <avr/pgmspace.h>
prog_char id_label[] PROGMEM = "xender";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "NA";
prog_char probe3_label[] PROGMEM = "NA";
prog_char relay1_label[] PROGMEM = "Light%201";
prog_char relay2_label[] PROGMEM = "Light%202";
prog_char relay3_label[] PROGMEM = "Bubbles";
prog_char relay4_label[] PROGMEM = "Heater";
prog_char relay5_label[] PROGMEM = "CO2";
prog_char relay6_label[] PROGMEM = "RO%20Osmoseur";
prog_char relay7_label[] PROGMEM = "Drain%20Pump";
prog_char relay8_label[] PROGMEM = "Pump%201";
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()
{
    ReefAngel.Init();  //Initialize controller
    ReefAngel.SetTemperatureUnit(1);  // set to Celsius Temperature
    // Ports that are always on
    ReefAngel.Relay.On(Port8);
    
    ReefAngel.StandardHeater(Heater,842,860);  // Setup Heater to turn on at 78.9F and off at 79.1F
    
    //WifiAuthentication("xender:test");
    
    ReefAngel.LoadWebBanner(pgm_read_word(&(webbanner_items[0])), SIZE(webbanner_items));
    ReefAngel.Timer[4].SetInterval(60);  // set interval to 120 seconds
    ReefAngel.Timer[4].Start();
}

void loop()
{
  ReefAngel.ShowInterface();

  // Specific functions
  ReefAngel.StandardLights(Port1);
  ReefAngel.MHLights(Port2);
  ReefAngel.StandardHeater(Port4);

// Web Banner stuff
  if(ReefAngel.Timer[4].IsTriggered())
  {
        ReefAngel.Timer[4].Start();
        ReefAngel.WebBanner();
  }

//CO2
  if ( ReefAngel.Params.PH <= 600 )
    ReefAngel.Relay.Off(Port5);
  if ( ReefAngel.Params.PH >= 650 )
    ReefAngel.Relay.On(Port5);

//Bubbles
  if ( ReefAngel.Params.PH <= 580 )
    ReefAngel.Relay.On(Port3);
  if ( ReefAngel.Params.PH >= 595 )
    ReefAngel.Relay.Off(Port3);

//Chiller 
  if ( ReefAngel.Params.Temp1 >=315 )
    ReefAngel.PWM.SetDaylight(100);
  if ( ReefAngel.Params.Temp1 <=300 )
    ReefAngel.PWM.SetDaylight(0);

  if (hour()>23 || hour()<7)
  {
    ReefAngel.PWM.SetActinic(PWMSlope(23,0,7,0,0,MoonPhase(),90,ReefAngel.PWM.GetActinicValue()));
    ReefAngel.Relay.Off(Port5);
    ReefAngel.Relay.On(Port3);
  }
 
}

byte MoonPhase()
{
  int m,d,y;
  int yy,mm;
  long K1,K2,K3,J,V;
  byte PWMvalue;
  m=month();
  d=day();
  y=year();
  yy=y-((12-m)/10);
  mm=m+9;
  if (mm>=12) mm-=12;
  K1=365.25*(yy+4712);
  K2=30.6*mm+.5;
  K3=int(int((yy/100)+49)*.75)-38;
  J=K1+K2+d+59-K3;
  V=(J-2451550.1)/0.29530588853;
  V-=int(V/100)*100;
  V=abs(V-50);
  PWMvalue=4*abs(50-V); // 5.12=100% 4=~80%
  //pinMode(lowATOPin,OUTPUT);
  return (PWMvalue*100)/255;
}

Code: Select all

Détails de l’erreur de la page Web

Agent utilisateur : Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E)
Horodateur : Sun, 4 Sep 2011 16:15:23 UTC

Message : 'x' a la valeur Null ou n'est pas un objet.
Ligne : 74
Caractère : 4
Code : 0
URI : http://www.reefangel.com/wifi/ra1.js

Re: http access to Reef Angel

Posted: Sun Sep 04, 2011 9:54 am
by rimai
Does any parameter show on the screen at all?

Re: http access to Reef Angel

Posted: Sun Sep 04, 2011 2:33 pm
by Xender
No parameters on the web page.
I see the parameters on the controler.

You CAN see it here : http://82.236.104.229:2000/wifi/

Re: http access to Reef Angel

Posted: Sun Sep 04, 2011 4:31 pm
by rimai
It's a bug.
I'm going to investigate.
The problem is on the calculation of the XML string length
The request is this:

Code: Select all

GET /r99 HTTP/1.1

Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, */*

Accept-Language: en-US

User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)

Accept-Encoding: gzip, deflate

Host: 82.236.104.229:2000

Connection: Keep-Alive
And this is what I got:

Code: Select all

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: 162



<RA><T1>303</T1><T2>0</T2><T3>0</T3><PH>674</PH><R>140</R><RON>0</RON><ROFF>255</ROFF><ATOLOW>0</ATOLOW><ATOHIGH>0</ATOHIGH><PWMA>50</PWMA><PWMD>0</PWMD></RA>
The 162 is wrong.
It's supposed to be 158.

Re: http access to Reef Angel

Posted: Sun Sep 04, 2011 7:30 pm
by binder
This is good to know. I can never get the wifi page to work on my controller either and i just dealt with it. I was having the exact same problem.

curt

Re: http access to Reef Angel

Posted: Mon Sep 05, 2011 10:19 am
by rimai
Hey Curt,
I pushed the fix.
Can you try to see if it fixes the problem?

Re: http access to Reef Angel

Posted: Mon Sep 05, 2011 2:48 pm
by binder
rimai wrote:Hey Curt,
I pushed the fix.
Can you try to see if it fixes the problem?
Still having the problem. Looking at the developer tools inside chrome & firefox, the error says "ra1.js:72 Uncaught TypeError: Cannot read property 'documentElement' of null".
So somewhere along the line the statement you do "x=a.responseXML.documentElement;" is null and it errors out.

curt

Re: http access to Reef Angel

Posted: Mon Sep 05, 2011 4:11 pm
by rimai
I tested on firefox and it was working for me on Win7 x64.
Let me download chrome.

Re: http access to Reef Angel

Posted: Mon Sep 05, 2011 4:12 pm
by rimai
What happens when you browse /r99??
Do you get the correct and formated properly XML?

Re: http access to Reef Angel

Posted: Mon Sep 05, 2011 4:20 pm
by binder
rimai wrote:What happens when you browse /r99??
Do you get the correct and formated properly XML?
the /r99 works fine for me. i've always gotten the proper results back from it. it's just browsing that wifi page does not work for me under all of my machines: 32bit xp-chrome & ie, 64bit linux-chrome & firefox

i get the same error on all of them about the documentElement being null. i made the exact same changes you sent me with the code, so i doubt it's the code.

curt

Re: http access to Reef Angel

Posted: Mon Sep 05, 2011 7:40 pm
by rimai
Hey Curt,
Just out of curiosity, could you try loading standard libraries to see if you get same error?

Re: http access to Reef Angel

Posted: Tue Sep 06, 2011 3:32 pm
by binder
Loaded the stock 0.8.3.13 from your github and still encountered the same error with the documentElement being null under both xp ie and linux chrome. I can view the /r99 command and get a nicely formatted XML structure though.

curt

Re: http access to Reef Angel

Posted: Mon Sep 19, 2011 10:32 am
by rimai
I tried Chrome 14, IE8, Firefox 6 and for some reason I can't get it to replicate the error. All tests were done on Win7 x64.
I used the online dev board you put up.
http://curtbinder.dyndns.info:2000/wifi
Let me try different machines

Re: http access to Reef Angel

Posted: Mon Sep 19, 2011 10:50 am
by binder
rimai wrote:I tried Chrome 14, IE8, Firefox 6 and for some reason I can't get it to replicate the error. All tests were done on Win7 x64.
I used the online dev board you put up.
http://curtbinder.dyndns.info:2000/wifi
Let me try different machines
I just tested Chrome 14 on my Win7 x64 laptop AND my desktop running Chrome 12 (ubunutu) to my dev board and it worked just fine. So, I don't know what is going on with it.

curt