RA reboots using cloud wifi

Expansion modules and attachments
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

RA reboots using cloud wifi

Post by GermanDude »

Hi there,
Has anyone had problems with the RA rebooting when you connect to the Cloud WIFI using the web Uapp?
As long as I do not close the browser and stay on the page it fine. If I reconnect using the Uapp the RA reboots and turns my ports back on that I turned off before. This happens with the iPhone, iPad or windows laptop.
-James-

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

Re: RA reboots using cloud wifi

Post by rimai »

I'm gonna try to replicate it.
I think someone else was having this same issue.
Roberto.
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

Thanks,Roberto.
-James-

Image
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

Here is the code I am running. Still reboots RA+ when I use the Uapp.

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 <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <PAR.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
    ReefAngel.AddStandardMenu();  // Add Standard Menu
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 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( 820 );

    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Port7 );
    ReefAngel.Relay.On( Port8 );

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


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

void loop()
{
    ReefAngel.Relay.DelayedOn( Port3,2 );
    ReefAngel.StandardHeater( T1_PROBE,Port5,735,780 );
    ReefAngel.PWM.SetDaylight( PWMSlope( 20,10,23,0,15,100,5,0 ) );

    ////// Place your custom code below here


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

    ReefAngel.CloudPortal();
    // This should always be the last line
    ReefAngel.ShowInterface();
}



// RA_STRING1=null
// RA_STRING2=null
// RA_STRING3=null
-James-

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

Re: RA reboots using cloud wifi

Post by rimai »

I can't seem to be able to replicate this even using your code.
Uapp connects to the cloud server and when I close the browser, the controller is still up and no reboot.
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RA reboots using cloud wifi

Post by rimai »

I can refresh the page or close browser and reopen and it will still be there.
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RA reboots using cloud wifi

Post by rimai »

Is it after a certain period of time or it reboots even in the first minute of turning RA on?
Roberto.
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

It was doing this the second I opened the browser page for the Uapp.
I am at work so I will recheck tonight.

Thanks,
-James-

Image
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

This ias the code loaded on the cloud wifi module.
In case it helps trouble shooting.

Code: Select all

#include <SPI.h>
#include <WiFi101.h>
#include <PubSubClient.h>
#include <RA_CustomSettings.h>

//char ssid[32];
//char pass[32];
//char username[16];
//char password[16];

unsigned long client_timeout = millis();
unsigned long wifi_connection = millis();
unsigned long serial_timeout = millis();
unsigned long led_blink = millis();
unsigned long MQTTReconnectmillis = millis();

boolean LED_status = false;
boolean PortalConnection = false;
boolean power_status = true;
boolean data_ready = false;
int status = WL_IDLE_STATUS;
WiFiServer server(2000);
WiFiClient client;
WiFiClient portalclient;
WiFiClient mqttclient;

void mqttcallback(char* topic, byte* payload, unsigned int length);

PubSubClient CloudClient(MQTTServer, MQTTPORT, mqttcallback, mqttclient);

String currentLine = "";                // make a String to hold incoming data from the client

void setup() {
  Serial.begin(57600);      // initialize serial communication
  Serial1.begin(57600);      // initialize serial communication
  pinMode(6, OUTPUT);      // set the LED pin mode
  pinMode(7, OUTPUT);      // set the LED pin mode
  wdt_initialize();
  wdt_enable();
}

void loop() {
  wdt_reset();
  status = WiFi.status();
  while ( status != WL_CONNECTED) {
    digitalWrite(6, true);
    digitalWrite(7, false);
    if (millis() - wifi_connection > 1000)
    {
      wifi_connection = millis();
      Serial.print("Attempting to connect to Network named: ");
      Serial.println(WIFI_SSID);                   // print the network name (SSID);
      if (WiFi.begin(WIFI_SSID, WIFI_PASS) == WL_CONNECTED)
      {
        status = WiFi.status();
        server.begin();                           // start the web server on port 2000
        printWifiStatus();                        // you're connected now, so print out the status
        digitalWrite(6, false);
        digitalWrite(7, true);
      }
    }
  }

  client = server.available();   // listen for incoming clients

  if (client) {                             // if you get a client,
    Serial.println(F("new incoming client"));           // print a message out the serial port
    client_timeout = millis();
    while (client.connected()) {            // loop while the client's connected
      if (millis() - client_timeout > 2000) client.stop();
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then
        Serial.write(c);                    // print it out the serial monitor
        Serial1.write(c);                   // send to Reef Angel
      }
      if (Serial1.available())
      {
        char c = Serial1.read();
        //Serial.write(c);
        currentLine += c;
        serial_timeout = millis();
        if (currentLine.length() == 255) {
          SendData();
        }
      }
      if (millis() - serial_timeout > 400)
      {
        if (currentLine.length() > 0) {
          SendData();
          Serial.println();
          client.println();
        }
      }
      if (millis() - led_blink > 50)
      {
        led_blink = millis();
        LED_status = !LED_status;
        digitalWrite(6, LED_status);
      }
    }
    // close the connection:
    client.stop();
    Serial.println(F("incoming client disconnected"));
    digitalWrite(6, false);
  }
  else
  {
    while (Serial1.available())
    {
      char c = Serial1.read();
      currentLine += c;
      if(c==10) data_ready=true;
      serial_timeout = millis();
      digitalWrite(6, true);
      if (millis() - serial_timeout > 200 || data_ready)
      {
        if (currentLine.length() > 0) 
        {
          data_ready=false;
          serial_timeout = millis();
          //        Serial.print(currentLine);
          if (currentLine.startsWith("GET"))
          {
            PortalConnection = true;
            Serial.println(F("Connecting to Portal Server"));
            if (portalclient.connect(PortalServer, 80)) {
              Serial.println(F("Connected"));
              // Make a HTTP request:
              portalclient.print(currentLine);
              portalclient.println(F(" HTTP/1.1"));
              portalclient.println(F("Host: forum.reefangel.com"));
              portalclient.println(F("Connection: close"));
              portalclient.println();
            }
            else
            {
              Serial.println(F("Failed to connect"));
            }
          }
          if (currentLine.startsWith("CLOUD:"))
          {
            //Serial.print(currentLine);
            if (currentLine.length() < 32)
            {
              if (CloudClient.connected())
              {
                //Serial.println(F("Publishing "));
                currentLine.replace("CLOUD:", "");
                Serial.print(currentLine);
                char pub_buffer[sizeof(CLOUD_USERNAME) + 5];
                sprintf(pub_buffer, "%s/out", CLOUD_USERNAME);
                char pub_msg[currentLine.length() + 1];
                currentLine.toCharArray(pub_msg, currentLine.length() + 1);
                CloudClient.publish(pub_buffer, pub_msg);
              }
            }
            else
            {
              Serial.print(F("Error on incoming data: "));
              Serial.println(currentLine.length());
            }
          }
          currentLine = "";
          digitalWrite(6, false);
        }
      }
    }
    digitalWrite(6, false);    
    while (portalclient.available()) {
      char c = portalclient.read();
      //      Serial.write(c);
    }
    if (PortalConnection && !portalclient.connected()) {
      PortalConnection = false;
      //      Serial.println();
      Serial.println(F("Disconnecting from Portal Server"));
      digitalWrite(6, false);
      portalclient.stop();
    }
  }

  CloudClient.loop();
  if (millis() - MQTTReconnectmillis > 5000)
  {
    if (!CloudClient.connected())
    {
      char sub_buffer[sizeof(CLOUD_USERNAME) + 6];
      MQTTReconnectmillis = millis();
      digitalWrite(6, true);
      Serial.println(F("MQTT Connecting..."));
      sprintf(sub_buffer, "RA-%s", CLOUD_USERNAME);
      if (CloudClient.connect(sub_buffer, CLOUD_USERNAME, CLOUD_PASSWORD))
      {
        sprintf(sub_buffer, "%s/in/#", CLOUD_USERNAME);
        Serial.println(F("MQTT succeeded"));
        CloudClient.subscribe(sub_buffer);
      }
      else
      {
        MQTTReconnectmillis = millis();
        Serial.println(F("MQTT failed"));
        CloudClient.disconnect();
      }
      digitalWrite(6, false);
    }
  }
  if (analogRead(0) < 600 && power_status)
  {
    power_status = false;
  }
  if (analogRead(0) > 600 && !power_status)
  {
    power_status = true;
  }
}

void SendData()
{
  serial_timeout = millis();
  //  Serial.print(currentLine);
  client.print(currentLine);
  currentLine = "";
}

void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

void mqttcallback(char* topic, byte* payload, unsigned int length)
{
  Serial1.print("cloud:");
  for (int a=0;a<length;a++)
  {
    Serial1.write(payload[a]);
    Serial.write(payload[a]);
  }
  Serial1.print(" ");
  Serial.println();
}

void wdt_initialize()
{
  GCLK->GENDIV.reg = GCLK_GENDIV_ID(2) | GCLK_GENDIV_DIV(4);
  GCLK->GENCTRL.reg = GCLK_GENCTRL_ID(2) |
                      GCLK_GENCTRL_GENEN |
                      GCLK_GENCTRL_SRC_OSCULP32K |
                      GCLK_GENCTRL_DIVSEL;
  while (GCLK->STATUS.bit.SYNCBUSY);  // Syncronize write to GENCTRL reg.
  GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID_WDT |
                      GCLK_CLKCTRL_CLKEN |
                      GCLK_CLKCTRL_GEN_GCLK2;
}

void wdt_enable()
{
  WDT->CTRL.reg &= ~WDT_CTRL_ENABLE;
  while (WDT->STATUS.bit.SYNCBUSY);  // Syncronize write to CTRL reg.
  WDT->CONFIG.reg = WDT_CONFIG_PER(0xA);  // 0xA = 8192 ms
  while (WDT->STATUS.bit.SYNCBUSY);  // Syncronize write to CONFIG reg.
  WDT->INTENCLR.reg |= WDT_INTENCLR_EW;
  WDT->CTRL.reg |= WDT_CTRL_ENABLE;
  while (WDT->STATUS.bit.SYNCBUSY);  // Syncronize write to CTRL reg.
}

void wdt_disable()
{
  WDT->CTRL.reg &= ~WDT_CTRL_ENABLE;
  while (WDT->STATUS.bit.SYNCBUSY);  // Syncronize write to CTRL reg.
}

void wdt_reset()
{
  WDT->CLEAR.reg = WDT_CLEAR_CLEAR_KEY;
  while (WDT->STATUS.bit.SYNCBUSY);  // Syncronize write to CLEAR reg.
}



// RA_STRING1=U2FsdGVkX19/au2AykFSeuvh7Ef0WBhNw2fGDTBJTmA=
// RA_STRING2=U2FsdGVkX18OMaDMIUP5GZQUBkPiWBixOeo/eh7U/b8=
// RA_STRING3=Dakota
-James-

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

Re: RA reboots using cloud wifi

Post by rimai »

Let's try this....
We are going to use the cloud wifi attachment and the USB-TLL cable.
1. Connect the cloud wifi to the usb ttl cable. Black wire to the right. This should power the unit on.
2. Using the arduino ide, open serial monitor and make sure you are using 57600 baud rate.
3. Open Uapp on your browser, it should print some stuff on serial monitor window.
Paste here.
Roberto.
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

Ok, cant copy and past so I will type it.
cloud wifi connected with USB-TLLcable on com 3 57600baud. As soon as i open the serial monitor I get this:

GET /r99 HTTP/1.1
Host: 73.148.165.18:2000


This repeats forever. Now I open the Uapp on the web and I get:


GET /r99 HTTP/1.1
Host: 73.148.165.18:2000

cloud:all:0 GET /r99 HTTP/1.1
Host: 73.148.165.18:2000


GET /r99 HTTP/1.1
Host: 73.148.165.18:2000


This repeats every time I open the Uapp.
Hope this helps.
-James-

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

Re: RA reboots using cloud wifi

Post by rimai »

It looks good as far as the cloud command.
I do see the pings for the Client suite.
Can you turn it off and see if it makes any difference?
It should show only "cloud:all:0"
The other requests are coming from the Client suite.
Roberto.
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

Do you mean the Reef Angel client suite , that runs the services in the background, by Dave Molton?
-James-

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

Re: RA reboots using cloud wifi

Post by rimai »

correct.
Shut that service off and see if that makes any difference on the log and rebooting.
Roberto.
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

Followed your directions and this is what I see in the serial monitor:

cloud:all:0

Still reboots RA when I connect with the Uapp.
-James-

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

Re: RA reboots using cloud wifi

Post by rimai »

Ok, so let's try the other end now.
Plug the usb-ttl on RA instead of wifi attachment.
Open serial monitor at 57600 baud and make sure that you have Both CR & LF selected.
Then, send this string "cloud:all:0 ". Note that there is a space after 0.
Paste the log.
Does it reboot RA?
Roberto.
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

Yes it rebooted. As a matter of fact it rebooted when I hooked up the usb to the pc, started the IDE and started the serial monitor. I received data after each reboot and after I send the cloud:all: command like this;

CLOUD:SAL:0
CLOUD:PHE:0
CLOUD:PAR:0
CLOUD:CEXP0:0
CLOUD:CEXP2:0
CLOUD:ATOLOW:1
CLOUD:BID:1
CLOUD:PWMD:100
CLOUD:PWMDO:255
CLOUD:R:251
CLOUD:ROFF:255
CLOUD:T1:766
CLOUD:PH:776
-James-

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

Re: RA reboots using cloud wifi

Post by rimai »

I just can't replicate the problem :(
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RA reboots using cloud wifi

Post by rimai »

The controller does reboot everytime the com port is opened. So it is normal for it to reboot when you plug cable or open serial monitor.
One thing odd in that log is the fact that it is showing SAL, PHE, PAR and other stuff that wasn't supposed to be there when you reboot RA.
This is what I get when I reboot RA with the same code:

Code: Select all

CLOUD:BID:1
CLOUD:PWMDO:255
CLOUD:PWMAO:255
CLOUD:R:235
CLOUD:ROFF:255
CLOUD:PH:438
And this is what I get when I send the cloud:all:0 command:

Code: Select all

CLOUD:ATOLOW:0
CLOUD:ATOHIGH:0
CLOUD:EM:0
CLOUD:EM1:0
CLOUD:REM:0
CLOUD:BID:1
CLOUD:AF:0
CLOUD:SF:0
CLOUD:PWMD:0
CLOUD:PWMA:0
CLOUD:PWMDO:255
CLOUD:PWMAO:255
CLOUD:R1:0
CLOUD:ROFF1:0
CLOUD:RON1:0
CLOUD:R2:0
CLOUD:ROFF2:0
CLOUD:RON2:0
CLOUD:R3:0
CLOUD:ROFF3:0
CLOUD:RON3:0
CLOUD:R4:0
CLOUD:ROFF4:0
CLOUD:RON4:0
CLOUD:R5:0
CLOUD:ROFF5:0
CLOUD:RON5:0
CLOUD:R6:0
CLOUD:ROFF6:0
CLOUD:RON6:0
CLOUD:R7:0
CLOUD:ROFF7:0
CLOUD:RON7:0
CLOUD:R8:0
CLOUD:ROFF8:0
CLOUD:RON8:0
CLOUD:ALARM:0
CLOUD:PWMD2:0
CLOUD:PWMA2:0
CLOUD:PWMD2O:0
CLOUD:PWMA2O:0
CLOUD:WL:0
CLOUD:WL1:0
CLOUD:WL2:0
CLOUD:WL3:0
CLOUD:WL4:0
CLOUD:HUM:0
CLOUD:DCM:0
CLOUD:DCS:0
CLOUD:DCD:0
CLOUD:DCT:0
CLOUD:PWME0:0
CLOUD:PWME1:0
CLOUD:PWME2:0
CLOUD:PWME3:0
CLOUD:PWME4:0
CLOUD:PWME5:0
CLOUD:PWME0O:0
CLOUD:PWME1O:0
CLOUD:PWME2O:0
CLOUD:PWME3O:0
CLOUD:PWME4O:0
CLOUD:PWME5O:0
CLOUD:AIW:0
CLOUD:AIB:0
CLOUD:AIRB:0
CLOUD:RFM:0
CLOUD:RFS:0
CLOUD:RFD:0
CLOUD:RFW:0
CLOUD:RFRB:0
CLOUD:RFR:0
CLOUD:RFG:0
CLOUD:RFB:0
CLOUD:RFI:0
CLOUD:RFWO:0
CLOUD:RFRBO:0
CLOUD:RFRO:0
CLOUD:RFGO:0
CLOUD:RFBO:0
CLOUD:RFIO:0
CLOUD:IO:0
CLOUD:LEAK:0
CLOUD:C0:0
CLOUD:C1:0
CLOUD:C2:0
CLOUD:C3:0
CLOUD:C4:0
CLOUD:C5:0
CLOUD:C6:0
CLOUD:C7:0
CLOUD:R:235
CLOUD:ROFF:255
CLOUD:RON:0
CLOUD:T1:0
CLOUD:T2:0
CLOUD:T3:0
CLOUD:PH:439
CLOUD:ORP:0
CLOUD:SAL:0
CLOUD:PHE:0
CLOUD:PAR:0
CLOUD:CEXP0:0
CLOUD:CEXP1:0
CLOUD:CEXP2:0
CLOUD:CEXP3:0
CLOUD:CEXP4:0
CLOUD:CEXP5:0
CLOUD:CEXP6:0
CLOUD:CEXP7:0
Roberto.
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

Odd. I did load a new program on it tonight before I did your test. It is the same code, I just added a ATO float switch code to it.
Keep in mind that it does NOT reboot if I use the Reef Angel client or the portal. Only the web based Uapp. One more thing, I cannot connect with the standalone Uapp on my iPhone or iPad at all, only the web Uapp. Of course that reboots the controller.
Is nobody else having this problem?
I know this cloud wifi is new, so I am hoping it is a bug somewhere.
-James-

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

Re: RA reboots using cloud wifi

Post by rimai »

The uapp for ios is an older release and it will not connect to the cloud server.
I'm trying to fix a few bugs before I release it a new version.
I know it doesn't reboot when you use the standard ip/port connection. It's something related to the cloud protocol, but I just can't replicate to see where it is.
Roberto.
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

No problem.
Let me know if you want me to do more testing. I love this stuff ( IT guy during the day).
-James-

Image
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

current code on my RA+

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 <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <PAR.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
    ReefAngel.AddStandardMenu();  // Add Standard Menu
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port5Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 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( 800 );

    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Port7 );
    ReefAngel.Relay.On( Port8 );

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

void loop()
{
    ReefAngel.Relay.DelayedOn( Port3,2 );
    ReefAngel.StandardHeater( T1_PROBE,Port5,770,780 );
    ReefAngel.PWM.SetDaylight( PWMSlope( 20,10,23,0,50,100,5,0 ) );

    ////// Place your custom code below here
    
    //if (ReefAngel.HighATO.IsActive() ) ReefAngel.Relay.Off( Port1 );
    ReefAngel.Relay.Set(Port1,ReefAngel.LowATO.IsActive() );
    ////// Place your custom code above here

    ReefAngel.CloudPortal();
    // This should always be the last line
    ReefAngel.ShowInterface();
}



// RA_STRING1=U2FsdGVkX1+k9UBojA2Zl/cGlo+KsPGdeqVYyPkLiZ4ANu8kYtgn0na/dT0wET6s
// RA_STRING2=U2FsdGVkX19G+/qidwTF5uA/QEK9x7ZM12MiXZWqtO8=
// RA_STRING3=Dakota
Why are they two copies of #include <InternalEEPROM.h> ?
-James-

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

Re: RA reboots using cloud wifi

Post by rimai »

Probably an oversight I made, but it doesn't hurt any.
I still cannot replicate the problem.
Just for the hell of it, the only thing different is that I don't use the relay box to power the head unit.
Can you try that code with the controller head unit alone powered with the USB power cable and see if it reboots too?
Roberto.
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

Yes I can.
Water change time for my tank is tomorrow which will give me the perfect opportunity to test just the head unit.
I will return with the results.
-James-

Image
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

Never mind. I went ahead and tested.
RA+, Cloud Wifi , PH probe, Temp probe and 1 float switch connected. Disconnected relay box and power head unit with USB.
Opened web page to the Uapp and....head unit rebooted.
:-(
-James-

Image
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

I have noticed when I use the webwizard and compile code it gives me this message at the end of a succesfull compile:


Dimming Signal
Cloud Wifi Attachment
Wifi Attachment
2014 Main Screen
Extra Font - Medium Size (8x8 pixels)
Standard Menu
Standard Menu
Standard Menu
Standard Menu
===info ||| Sketch uses {0} bytes ({2}%%) of program storage space. Maximum is {1} bytes. ||| [66646 253952 26]
===info ||| Global variables use {0} bytes ({2}%%) of dynamic memory, leaving {3} bytes for local variables. Maximum is {1} bytes. ||| [3282 8192 40 4910]

Progress: 100.00%
Your code was compiled sucessfully.

Is it normal to have both the Cloud Wifi Attachment and the Wifi Attchment in the code? I only pick the Cloud Wifi Attachment from the wizard since that is what I have.
-James-

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

Re: RA reboots using cloud wifi

Post by rimai »

Yeah. It is normal.
Roberto.
GermanDude
Posts: 87
Joined: Tue Dec 27, 2016 6:26 am
Location: Jacksonville,FL

Re: RA reboots using cloud wifi

Post by GermanDude »

Ok, thanks.
Were you able to find anything that would cause the rebooting of the RA yet?
-James-

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

Re: RA reboots using cloud wifi

Post by rimai »

Sorry, I didn't have time.
I'm in Germany in fact since last Saturday.
I'll check some more next week when I get back to USA.
Roberto.
Post Reply