ip statico su esp

571 views
Skip to first unread message

Andrea Pic

unread,
Nov 14, 2016, 4:21:07 PM11/14/16
to souliss-it
Ciao,
mi sto appena avvicinando alle esp e ho preso una per fare i test in visione di espandere la rete con le Dino ESP.
 questa è una NODEMCU AMICA.
beh ... sono diverse ore che cerco di impostarle un ip statico a 19 e configurarla come peer visto che nel codice della dino che ho come Gateway avevo già dicharato un paio di peer LAN in più per non ricaricare il codice ad ogni aggiunta di schede.
 insomma come vedete dal codice qui sotto, tento di impostare la esp sull'ip 19 ma lei se ne frega di tutto ciò che scrivo nel codice e resta sul 10.
ho più volte caricato lo sketch clean eeprom che a dire il vero mi ha aiutato dopo aver provato Web config.
per 1 volta sono riuscito a impostare l'ip sul 19 (visibile da fing) ma comunque  in souliss app il nodo non veniva aggiunto.
spero in un aiuto


/**************************************************************************
    Souliss - Hello World for Expressif ESP8266
   
    This is the basic example, create a software push-button on Android
    using SoulissApp (get it from Play Store).  
   
    Load this code on ESP8266 board using the porting of the Arduino core
    for this platform.
       
***************************************************************************/


// 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/IPBroadcast.h"

// **** Define the WiFi name and password ****
#define WIFICONF_INSKETCH
#define WiFi_SSID               "TIM-12....7"
#define WiFi_Password           "WLFpy.....8Xc8...."    

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

// Define the network configuration
uint8_t ip_address
[4]  = {192, 168, 1, 17};
uint8_t subnet_mask
[4] = {255, 255, 255, 0};
uint8_t ip_gateway
[4]  = {192, 168, 1, 1};
#define Gateway_address         17
#define myvNet_address          ip_address[3]       // The last byte of the IP address (77) is also the vNet address
#define Gateway_RS485_address   0xCE01
#define Peer1_address           0xCE11
#define Peer2_address           0xCE12
#define Peer3_address           18
#define Peer4_address           19
#define Peer5_address           20
#define myvNet_subnet           0xFF00
#define myvNet_supern           Gateway_RS485_address
/*** All configuration includes should be above this line ***/
#include "Souliss.h"

// This identify the number of the LED logic
#define MYLEDLOGIC          0      
         
// **** Define here the right pin for your ESP module ****
#define    OUTPUTPIN            5

void setup()
{  
   
Initialize();
Souliss_SetAddress(Peer4_address, myvNet_subnet, Gateway_address);    
 
//   SetAsGateway(myvNet_address);  
   
// Connect to the WiFi network and get an address from DHCP
   
// GetIPAddress();                          

   
// This is the vNet address for this node, used to communicate with other
   
// nodes in your Souliss network
 
//  SetAddress(0x0013, 0xFF00, 0x0011);
   
   
Set_SimpleLight(MYLEDLOGIC);        // Define a simple LED light logic
    pinMode
(OUTPUTPIN, OUTPUT);         // Use pin as output
}

void loop()
{
   
// Here we start to play
    EXECUTEFAST
() {                    
        UPDATEFAST
();  
       
        FAST_50ms
() {   // We process the logic and relevant input and output every 50 milliseconds
           
Logic_SimpleLight(MYLEDLOGIC);
           
DigOut(OUTPUTPIN, Souliss_T1n_Coil,MYLEDLOGIC);
       
}
             
       
// Here we handle here the communication with Android
        FAST_PeerComms
();                                        
   
}
}

Grazie
Andrea

Di Maio, Dario

unread,
Nov 14, 2016, 5:22:24 PM11/14/16
to souliss-it

L'ESP parte sempre in DHCP e poi dopo viene forzato l'indirizzo manuale nello stack.

Quindi inizialmente dovresti vedere un ip diverso.

Dario.

From Mobile.

--
Hai ricevuto questo messaggio perché sei iscritto al gruppo "souliss-it" di Google Gruppi.
Per annullare l'iscrizione a questo gruppo e non ricevere più le sue email, invia un'email a souliss-it+unsubscribe@googlegroups.com.
Per postare in questo gruppo, invia un'email a souli...@googlegroups.com.
Per visualizzare questa discussione sul Web, visita https://groups.google.com/d/msgid/souliss-it/310c978d-a12e-406e-a98f-d624eae595c2%40googlegroups.com.
Per altre opzioni visita https://groups.google.com/d/optout.

Di Maio, Dario

unread,
Nov 14, 2016, 5:25:31 PM11/14/16
to souliss-it

Andrea Pic

unread,
Nov 14, 2016, 8:01:56 PM11/14/16
to souliss-it
Grazie mille...
infine nei tanti cambiamenti forse ci avevo azzeccato ma il vero problema, che sono andato a cercare dopo la tua risposta, è che il gateway montava una vecchia libreria  e aggiungendo
#include "SoulissFramework.h"
 tutto è andato a posto
di nuovo grazie
andrea
Reply all
Reply to author
Forward
0 new messages