quitar warnings y defines segun placas
parent
7555635e51
commit
0497ba436d
|
|
@ -31,14 +31,14 @@ class Actuador: public DomoEspSensorReceiver
|
||||||
activador[i].sen=NULL;
|
activador[i].sen=NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void set(char* topic_id, char* topic_id_out, char* _valSend)
|
void set(const char* topic_id, const char* topic_id_out, const char* _valSend)
|
||||||
{
|
{
|
||||||
val=0;
|
val=0;
|
||||||
strcpy(valSend, _valSend);
|
strcpy(valSend, _valSend);
|
||||||
strcpy(topic, topic_id);
|
strcpy(topic, topic_id);
|
||||||
strcpy(topicOut, topic_id_out);
|
strcpy(topicOut, topic_id_out);
|
||||||
}
|
}
|
||||||
void setId(char* st)
|
void setId(const char* st)
|
||||||
{
|
{
|
||||||
strcpy(id, st);
|
strcpy(id, st);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class AutomatismoPulsador//automatismo para encender luz con interruptor o pulsa
|
||||||
{
|
{
|
||||||
inicia(man, tp_pul->topic, tpOut->topic, bloqueo);
|
inicia(man, tp_pul->topic, tpOut->topic, bloqueo);
|
||||||
}
|
}
|
||||||
void inicia(ISensorManager* man, char* tp_pul, char* tpOut, DomoEspSensorReceiver* bloqueo=NULL )
|
void inicia(ISensorManager* man, const char* tp_pul, const char* tpOut, DomoEspSensorReceiver* bloqueo=NULL )
|
||||||
{
|
{
|
||||||
pulsador.set(tp_pul, tpOut, "X");
|
pulsador.set(tp_pul, tpOut, "X");
|
||||||
pulsador.setId("Pulsa");
|
pulsador.setId("Pulsa");
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
#ifndef DomoEspApiConexionDef
|
#ifndef DomoEspApiConexionDef
|
||||||
#define DomoEspApiConexionDef 1
|
#define DomoEspApiConexionDef 1
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#ifndef ESP32_DEF
|
#ifdef ESP8266
|
||||||
#include <ESP8266HTTPClient.h>
|
#include <ESP8266HTTPClient.h>
|
||||||
//sensor Replica, sensor interno que se setea con get y no se publica
|
//sensor Replica, sensor interno que se setea con get y no se publica
|
||||||
class DomoEspApiConexion
|
class DomoEspApiConexion //hay que arreglar compatibilidad con esp32
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DomoEspApiConexion()
|
DomoEspApiConexion()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#define ESP32_DEF 1
|
|
||||||
#include "DomoEspSensorManager.h"
|
#include "DomoEspSensorManager.h"
|
||||||
#include "configuracionActual.h"
|
#include "configuracionActual.h"
|
||||||
DomoEspManager manager;
|
DomoEspManager manager;
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,12 @@ void DomoEspManager::loop()
|
||||||
{
|
{
|
||||||
if(tNoConexion.onTimer())
|
if(tNoConexion.onTimer())
|
||||||
{
|
{
|
||||||
#ifndef ESP32_DEF
|
#if defined(ESP8266)
|
||||||
ESP.reset();
|
ESP.reset();
|
||||||
|
#elif defined(ESP32) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(ESP32C3)
|
||||||
|
ESP.restart();
|
||||||
#else
|
#else
|
||||||
ESP.restart();
|
#error "Placa no soportada"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -80,10 +82,12 @@ void DomoEspManager::loop()
|
||||||
suscrito=false;
|
suscrito=false;
|
||||||
if(tNomqtt.onTimer())
|
if(tNomqtt.onTimer())
|
||||||
{
|
{
|
||||||
#ifndef ESP32_DEF
|
#if defined(ESP8266)
|
||||||
ESP.reset();
|
ESP.reset();
|
||||||
|
#elif defined(ESP32) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(ESP32C3)
|
||||||
|
ESP.restart();
|
||||||
#else
|
#else
|
||||||
ESP.restart();
|
#error "Placa no soportada"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -102,11 +106,9 @@ void DomoEspManager::loop()
|
||||||
int tiempoAux=0;
|
int tiempoAux=0;
|
||||||
if(timer.onTimerReset())
|
if(timer.onTimerReset())
|
||||||
{
|
{
|
||||||
#ifndef ESP32_DEF
|
#ifdef ESP8266
|
||||||
if(conf->conexionPorApi)
|
if(conf->conexionPorApi)
|
||||||
{
|
{
|
||||||
#ifndef ESP32_DEF
|
|
||||||
|
|
||||||
|
|
||||||
char topic_aux[32];
|
char topic_aux[32];
|
||||||
char payload_aux[128];
|
char payload_aux[128];
|
||||||
|
|
@ -115,7 +117,6 @@ void DomoEspManager::loop()
|
||||||
{
|
{
|
||||||
OnMqtt(topic_aux, payload_aux);
|
OnMqtt(topic_aux, payload_aux);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tiempo=(tiempo+1)%2;
|
tiempo=(tiempo+1)%2;
|
||||||
|
|
@ -185,7 +186,7 @@ void DomoEspManager::MqttSend(char* topic, char* payload)
|
||||||
{
|
{
|
||||||
if(conf->conexionPorApi)
|
if(conf->conexionPorApi)
|
||||||
{
|
{
|
||||||
#ifndef ESP32_DEF
|
#ifdef ESP8266
|
||||||
api.send(topic, payload);
|
api.send(topic, payload);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,12 @@
|
||||||
|
|
||||||
|
|
||||||
#include <PubSubClient.h>
|
#include <PubSubClient.h>
|
||||||
#ifndef ESP32_DEF
|
#if defined(ESP8266)
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#endif
|
#elif defined(ESP32) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(ESP32C3)
|
||||||
#ifdef ESP32_DEF
|
#include <WiFi.h>
|
||||||
#include <WiFi.h>
|
#else
|
||||||
|
#error "Placa no soportada"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "utiles.h"
|
#include "utiles.h"
|
||||||
|
|
@ -30,8 +31,8 @@ class DomoEspManager: public MqttReceiver, public IMqttManager, public ISensorMa
|
||||||
WiFiClient espClient;
|
WiFiClient espClient;
|
||||||
PubSubClient clienteMqtt;
|
PubSubClient clienteMqtt;
|
||||||
MqttManager mqtt;
|
MqttManager mqtt;
|
||||||
#ifndef ESP32_DEF
|
#ifdef ESP8266
|
||||||
DomoEspApiConexion api;
|
DomoEspApiConexion api;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class SensorAin: public DomoEspSensorReceiver
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
SensorAin(){}
|
SensorAin(){}
|
||||||
void set(uint8_t _pin, char* topic_id, bool _negado, float _dif)
|
void set(uint8_t _pin,const char* topic_id, bool _negado, float _dif)
|
||||||
{
|
{
|
||||||
timer.inicia();
|
timer.inicia();
|
||||||
timer.set(1);
|
timer.set(1);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class SensorBMP180: public DomoEspSensorReceiver
|
||||||
t=p=a=0;
|
t=p=a=0;
|
||||||
topic[0]=0;
|
topic[0]=0;
|
||||||
}
|
}
|
||||||
void set(char* topic_id, int _sda, int _scl)
|
void set(const char* topic_id, int _sda, int _scl)
|
||||||
{
|
{
|
||||||
sda=_sda;
|
sda=_sda;
|
||||||
scl=_scl;
|
scl=_scl;
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,11 @@ class SensorBuzzer: public DomoEspSensorReceiver
|
||||||
val=0;
|
val=0;
|
||||||
topic[0]=0;
|
topic[0]=0;
|
||||||
}
|
}
|
||||||
void setMelodia(int i, char* melodia)
|
void setMelodia(int i, const char* melodia)
|
||||||
{
|
{
|
||||||
buz.Set(i, melodia);
|
buz.Set(i, melodia);
|
||||||
}
|
}
|
||||||
void set(char* topic_id, int _pin)
|
void set(const char* topic_id, int _pin)
|
||||||
{
|
{
|
||||||
val=0;
|
val=0;
|
||||||
strcpy(topic, topic_id);
|
strcpy(topic, topic_id);
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class SensorDHT: public DomoEspSensorReceiver
|
||||||
t=h=0;
|
t=h=0;
|
||||||
topic[0]=0;
|
topic[0]=0;
|
||||||
}
|
}
|
||||||
void set(uint8_t _pin, char* topic_id)
|
void set(uint8_t _pin, const char* topic_id)
|
||||||
{
|
{
|
||||||
pin=_pin;
|
pin=_pin;
|
||||||
t=h=9.99998;
|
t=h=9.99998;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class SensorDin: public DomoEspSensorReceiver
|
||||||
SensorDin(){
|
SensorDin(){
|
||||||
logTiempo2=true;
|
logTiempo2=true;
|
||||||
}
|
}
|
||||||
void set(uint8_t _pin, char* topic_id, bool _logTiempo2=true)
|
void set(uint8_t _pin, const char* topic_id, bool _logTiempo2=true)
|
||||||
{
|
{
|
||||||
logTiempo2=_logTiempo2;
|
logTiempo2=_logTiempo2;
|
||||||
pin=_pin;
|
pin=_pin;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ bool negado;
|
||||||
topic[0]=0;
|
topic[0]=0;
|
||||||
negado=false;
|
negado=false;
|
||||||
}
|
}
|
||||||
void set(uint8_t _pin, char* topic_id, bool valdef,bool _negado=false)
|
void set(uint8_t _pin, const char* topic_id, bool valdef,bool _negado=false)
|
||||||
{
|
{
|
||||||
pin=_pin;
|
pin=_pin;
|
||||||
val=valdef;
|
val=valdef;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ public:
|
||||||
apan=0;
|
apan=0;
|
||||||
|
|
||||||
}
|
}
|
||||||
void set(char* topic_id, LiquidCrystal * _lcd, int _nchar, int lineas, int seg)
|
void set(const char* topic_id, LiquidCrystal * _lcd, int _nchar, int lineas, int seg)
|
||||||
{
|
{
|
||||||
val = 0;
|
val = 0;
|
||||||
strcpy(topic, topic_id);
|
strcpy(topic, topic_id);
|
||||||
|
|
@ -49,7 +49,7 @@ public:
|
||||||
nlin = lineas;
|
nlin = lineas;
|
||||||
|
|
||||||
}
|
}
|
||||||
void AddPan(char* msg, DomoEspSensorReceiver *sen1=0, DomoEspSensorReceiver *sen2=0)
|
void AddPan(const char* msg, DomoEspSensorReceiver *sen1=0, DomoEspSensorReceiver *sen2=0)
|
||||||
{
|
{
|
||||||
if(npan<MAX_PAN_LCD)
|
if(npan<MAX_PAN_LCD)
|
||||||
{
|
{
|
||||||
|
|
@ -126,7 +126,7 @@ private:
|
||||||
Muestra(msg);
|
Muestra(msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
void Muestra(char * txt)
|
void Muestra(const char * txt)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_PS
|
#ifdef DEBUG_PS
|
||||||
Serial.println("SenLcd muestra: ");
|
Serial.println("SenLcd muestra: ");
|
||||||
|
|
@ -134,7 +134,7 @@ private:
|
||||||
#endif
|
#endif
|
||||||
int linea=0;
|
int linea=0;
|
||||||
int i=0;
|
int i=0;
|
||||||
char* ini=txt;
|
const char* ini=txt;
|
||||||
bool sigue=true;
|
bool sigue=true;
|
||||||
while(sigue && linea<nlin)
|
while(sigue && linea<nlin)
|
||||||
{
|
{
|
||||||
|
|
@ -166,7 +166,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void Muestra(char * txt,int nStr, int linea)
|
void Muestra(const char * txt,int nStr, int linea)
|
||||||
{
|
{
|
||||||
char buf[MAXTOPICVAR];
|
char buf[MAXTOPICVAR];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ bool negado;
|
||||||
initDS1803();
|
initDS1803();
|
||||||
}
|
}
|
||||||
|
|
||||||
void set( char* topic_id, int valdef,bool _negado=false)
|
void set( const char* topic_id, int valdef,bool _negado=false)
|
||||||
{
|
{
|
||||||
val=valdef;
|
val=valdef;
|
||||||
negado=_negado;
|
negado=_negado;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class SensorPulsante: public DomoEspSensorReceiver
|
||||||
espera=false;
|
espera=false;
|
||||||
timer.setmilis(500);
|
timer.setmilis(500);
|
||||||
}
|
}
|
||||||
void set(uint8_t _pin, char* topic_id, bool _valDef)
|
void set(uint8_t _pin, const char* topic_id, bool _valDef)
|
||||||
{
|
{
|
||||||
pin=_pin;
|
pin=_pin;
|
||||||
valDef=_valDef;
|
valDef=_valDef;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ class SensorRF: public DomoEspSensorReceiver
|
||||||
val=0;
|
val=0;
|
||||||
topic[0]=0;
|
topic[0]=0;
|
||||||
}
|
}
|
||||||
void set(char* topic_id,bool _negado=0, float valdef=0)
|
void set(const char* topic_id,bool _negado=0, float valdef=0)
|
||||||
{
|
{
|
||||||
negado=_negado;
|
negado=_negado;
|
||||||
val=valdef;
|
val=valdef;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class SensorSplitter: public DomoEspSensorReceiver
|
||||||
for(int i=0; i<MAX_ACTIVADORES; i++)
|
for(int i=0; i<MAX_ACTIVADORES; i++)
|
||||||
sensorSend[i].sen=0;
|
sensorSend[i].sen=0;
|
||||||
}
|
}
|
||||||
void set(char* topic_id, float =0)
|
void set(const char* topic_id, float =0)
|
||||||
{
|
{
|
||||||
val=0;
|
val=0;
|
||||||
strcpy(topic, topic_id);
|
strcpy(topic, topic_id);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class SensorTimer: public DomoEspSensorReceiver
|
||||||
val=0;
|
val=0;
|
||||||
topic[0]=0;
|
topic[0]=0;
|
||||||
}
|
}
|
||||||
void set(char* topic_id, bool _valdef, int segTime)
|
void set(const char* topic_id, bool _valdef, int segTime)
|
||||||
{
|
{
|
||||||
t.set(segTime);
|
t.set(segTime);
|
||||||
valDef=_valdef;
|
valDef=_valdef;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ class SensorVF: public DomoEspSensorReceiver
|
||||||
val=0;
|
val=0;
|
||||||
topic[0]=0;
|
topic[0]=0;
|
||||||
}
|
}
|
||||||
void set(char* topic_id, float valdef=0)
|
void set(const char* topic_id, float valdef=0)
|
||||||
{
|
{
|
||||||
val=valdef;
|
val=valdef;
|
||||||
strcpy(topic, topic_id);
|
strcpy(topic, topic_id);
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#define ESP32_DEF 1
|
|
||||||
#ifndef ESP32_DEF
|
#if defined(ESP8266)
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <ESP8266mDNS.h>
|
#include <ESP8266mDNS.h>
|
||||||
#endif
|
#elif defined(ESP32) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(ESP32C3)
|
||||||
#ifdef ESP32_DEF
|
#include <WiFi.h>
|
||||||
#include <WiFi.h>
|
#else
|
||||||
|
#error "Placa no soportada"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
|
|
@ -19,11 +20,12 @@
|
||||||
void MqttUtiles::resetFunc()
|
void MqttUtiles::resetFunc()
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef ESP32_DEF
|
#if defined(ESP32) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(ESP32C3)
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
#endif
|
#elif defined(ESP8266)
|
||||||
#ifndef ESP32_DEF
|
ESP.wdtEnable(1);
|
||||||
ESP.wdtEnable(1);
|
#else
|
||||||
|
#error "Placa no soportada"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while(1){};
|
while(1){};
|
||||||
|
|
@ -354,7 +356,7 @@ void SonidoBuzzer::Toca(int pin, int imel)
|
||||||
mel[imel].Toca(pin);
|
mel[imel].Toca(pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SonidoBuzzer::Set(int i, char* melo)
|
void SonidoBuzzer::Set(int i, const char* melo)
|
||||||
{
|
{
|
||||||
if(i<MAX_MELODIAS)
|
if(i<MAX_MELODIAS)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@
|
||||||
#define UtilesDef 1
|
#define UtilesDef 1
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
class PubSubClient;
|
class PubSubClient;
|
||||||
|
#ifdef ESP8266
|
||||||
#ifndef ESP32_DEF
|
|
||||||
class WiFiClient;
|
class WiFiClient;
|
||||||
#endif
|
#endif
|
||||||
class MqttUtiles
|
class MqttUtiles
|
||||||
|
|
@ -99,7 +98,7 @@ class SonidoBuzzer
|
||||||
int n;
|
int n;
|
||||||
SonidoBuzzer();
|
SonidoBuzzer();
|
||||||
void Toca(int pin, int melodia);
|
void Toca(int pin, int melodia);
|
||||||
void Set(int i, char* melo);
|
void Set(int i, const char* melo);
|
||||||
char* getMelSubSt(char* orig, char caracter, int lim, char* bufOut);
|
char* getMelSubSt(char* orig, char caracter, int lim, char* bufOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,7 @@
|
||||||
#ifndef DefinesDef
|
#ifndef DefinesDef
|
||||||
|
|
||||||
#define ESP32_DEF 1
|
|
||||||
|
|
||||||
#define DefinesDef 1
|
#define DefinesDef 1
|
||||||
|
|
||||||
#define DEBUG_PS 1
|
#define DEBUG_PS 1
|
||||||
|
|
||||||
#define MAXTOPICVAR 32//maximo de caracteres de los topic de las variables
|
#define MAXTOPICVAR 32//maximo de caracteres de los topic de las variables
|
||||||
#define MAX_CHAR_PAN_LCD 35//MAXIMO DE CARACTRES POR PANTALLA LCD
|
#define MAX_CHAR_PAN_LCD 35//MAXIMO DE CARACTRES POR PANTALLA LCD
|
||||||
#define MAX_PAN_LCD 3//MAXIMO DE PANTALLAS POR SENSOR LCD
|
#define MAX_PAN_LCD 3//MAXIMO DE PANTALLAS POR SENSOR LCD
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue