peer to peer comunicacion fail

24 views
Skip to first unread message

Enrique Hurtado

unread,
Jun 25, 2019, 6:45:27 PM6/25/19
to souliss
Hi guys
I am trying to mount my souliss network with ESP8622 as the gateway and through max485 two nodes one and mega. In node 1 I want an entry to act on typical in node2. But I do not get it.
I also have problems updating database in app. Gw takes a long time to see node.
I hope you can help me, because I can not solve it.
Thank you...

GW  ESP8266:

// Let the IDE point to the Souliss framework
#include "SoulissFramework.h"

// Configure the framework
#include "bconf/MCU_ESP8266.h"              // Load the code directly on the ESP8266
#include "conf/Gateway.h"                   // The main node is the Gateway, we have just one node
#include "conf/IPBroadcast.h"
#include "conf/SuperNode.h"                   // The main node is the Gateway, we have just one node
#define USARTDRIVER_INSKETCH
#define USART_TXENABLE          1
#define USART_TXENPIN           5  //D1
#define USARTDRIVER             Serial
#define USART_DEBUG   0

#include "conf/usart.h"                      // USART / RS485 transceiver


// **** Define the WiFi name and password ****
#define WIFICONF_INSKETCH
#define WiFi_SSID               "xxxxxxxx"
#define WiFi_Password           "xxxxxxxx"    

// Include framework code and libraries
#include <ESP8266WiFi.h>
#include <EEPROM.h>



/*** All configuration includes should be above this line ***/ 
#include "Souliss.h"



// Define the network configuration according to your router settings
uint8_t ip_address[4]  = {192, 168, 1,110 };
uint8_t subnet_mask[4] = {255, 255, 255, 0};
uint8_t ip_gateway[4]  = {192, 168, 1, 1};
#define myvNet_address  ip_address[3]       // The last byte of the IP address (77) is also the vNet address
#define myvNet_subnet   0xFF00



void setup()
{   
    Initialize();

   // Set network parameters
    Souliss_SetIPAddress(ip_address, subnet_mask, ip_gateway);
    SetAsGateway(myvNet_address);                                   // Set this node as gateway for SoulissApp


    // This is the vNet address for this node, used to communicate with other
  // nodes in your Souliss network
 
    SetAddress(0xAB01, 0xFF00, 0x0000);
    SetAddress(0xDE01, 0xFF00, 0x0000);
    
    // Nodos MAX 485 
      SetAsPeerNode(0xDE02, 1);//nodo 485 garaje
      SetAsPeerNode(0xDE03, 2);//nodo 485 lavadora  
 }

void loop()
    EXECUTEFAST() {                     
        FAST_GatewayComms();   
        FAST_PeerComms();                                      
    }
 EXECUTESLOW() {
        UPDATESLOW();
            SLOW_10s() {  
                
            } 
    }  

NODE mega  :

#define USARTDRIVER_INSKETCH
#define USART_TXENABLE          1
#define USART_TXENPIN           3
#define USARTDRIVER             Serial
#define USART_DEBUG   0


//---------------------------------------------------
// 1.     Configure the framework
//---------------------------------------------------
#include "SoulissFramework.h"
#include "bconf/StandardArduino.h"       
#include "conf/usart.h"              

//---------------------------------------------------
// 2.     Include framework code and libraries
//---------------------------------------------------
#include <SPI.h>
#include "Souliss.h"

// Define the RS485 network configuration
#define myvNet_subnet   0xFF00
#define Gateway_RS485   0xDE01
#define Peer_RS485      0xDE02

//----------------------------------------------------
// 4. Slots
//----------------------------------------------------
// This identify the number of the LED logic

#define L_ESCALERA1          0

//----------------------------------------------------
// 5. Pines
//----------------------------------------------------

// INPUTS

#define   puls_escalera1     26   // pulsador luz escalera

// OUTPUTS

#define   luz_escalera1     27   //  luz escalera

void setup()
{   
    Initialize();

   SetAddress(Peer_RS485, myvNet_subnet, Gateway_RS485);       
          
     Set_SimpleLight(L_ESCALERA1);        // modulo luz pasillo 
    pinMode(puls_escalera1, INPUT);         // Use pin as input 
    pinMode(luz_escalera1, OUTPUT);         // Use pin as input 


}
void loop()
    EXECUTEFAST() {                     
        UPDATEFAST();   
    
         FAST_70ms() {  
        
      if(DigIn(puls_escalera1, Souliss_T1n_ToggleCmd, L_ESCALERA1))       //SI PULSAMOS EL PULS_ESCALERA                                           
         {  
            Send(0xDE03,0, Souliss_T1n_ToggleCmd); // MANDAMOS LA SEÑAL A nodo2    
            }
            Logic_SimpleLight(L_ESCALERA1); 
            DigOut(luz_escalera1, Souliss_T1n_Coil,L_ESCALERA1);  
}
               
        FAST_PeerComms(); 
        START_PeerJoin();
    }
 EXECUTESLOW() {
       UPDATESLOW();
           SLOW_10s()  {               
         SLOW_PeerJoin();    
           }
    }      

NODE UNO:

#define USARTDRIVER_INSKETCH
#define USART_TXENABLE          1
#define USART_TXENPIN           3
#define USARTDRIVER             Serial
#define USART_DEBUG   0



//
/*NODO 1 mega comunicacion mediante   max485/ esp8266 / 
 * Contiene habitacion principal
 *          baño y pasillo 
 */
//---------------------------------------------------
// 1.     Configure the framework
//---------------------------------------------------
#include "SoulissFramework.h"
#include "bconf/StandardArduino.h"       
#include "conf/usart.h"              

// Use the following if you are using an RS485 transceiver with 
// transmission enable pin, otherwise delete this section.
//



//---------------------------------------------------
// 2.     Include framework code and libraries
//---------------------------------------------------
#include <SPI.h>
#include "Souliss.h"

// Define the RS485 network configuration
#define myvNet_subnet   0xFF00
#define Gateway_RS485   0xDE01
#define Peer_RS485      0xDE03

//----------------------------------------------------
// 4. Slots
//----------------------------------------------------
// This identify the number of the LED logic

#define L_ESCALERA           0

//----------------------------------------------------
// 5. Pines
//----------------------------------------------------

// INPUTS

#define   puls_escalera    10   // pulsador luz escalera

// OUTPUTS
   
#define   luz_escalera     11

void setup()
{   
    Initialize();

   SetAddress(Peer_RS485, myvNet_subnet, Gateway_RS485);       

     Set_SimpleLight(L_ESCALERA);        // modulo luz pasillo 
    pinMode(puls_escalera, INPUT);         // Use pin as input 
    pinMode(luz_escalera, OUTPUT);         // Use pin as output  
    digitalWrite(luz_escalera, LOW);
    
}
void loop()
    EXECUTEFAST() {                     
        UPDATEFAST();   
  FAST_50ms() {  
          DigIn(puls_escalera, Souliss_T1n_ToggleCmd, L_ESCALERA);
          Logic_SimpleLight(L_ESCALERA);
          DigOut(luz_escalera, Souliss_T1n_Coil,L_ESCALERA);
     }
        
     FAST_PeerComms(); 
     START_PeerJoin();
    }
 EXECUTESLOW() {
       UPDATESLOW();
           SLOW_10s()  {          
        
         SLOW_PeerJoin();    
           }
    }      
Reply all
Reply to author
Forward
0 new messages