quitar warnings y defines segun placas
parent
7555635e51
commit
0497ba436d
|
|
@ -31,14 +31,14 @@ class Actuador: public DomoEspSensorReceiver
|
|||
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;
|
||||
strcpy(valSend, _valSend);
|
||||
strcpy(topic, topic_id);
|
||||
strcpy(topicOut, topic_id_out);
|
||||
}
|
||||
void setId(char* st)
|
||||
void setId(const char* 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);
|
||||
}
|
||||
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.setId("Pulsa");
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef DomoEspApiConexionDef
|
||||
#define DomoEspApiConexionDef 1
|
||||
#include "defines.h"
|
||||
#ifndef ESP32_DEF
|
||||
#ifdef ESP8266
|
||||
#include <ESP8266HTTPClient.h>
|
||||
//sensor Replica, sensor interno que se setea con get y no se publica
|
||||
class DomoEspApiConexion
|
||||
class DomoEspApiConexion //hay que arreglar compatibilidad con esp32
|
||||
{
|
||||
public:
|
||||
DomoEspApiConexion()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#define ESP32_DEF 1
|
||||
|
||||
#include "DomoEspSensorManager.h"
|
||||
#include "configuracionActual.h"
|
||||
DomoEspManager manager;
|
||||
|
|
|
|||
|
|
@ -64,10 +64,12 @@ void DomoEspManager::loop()
|
|||
{
|
||||
if(tNoConexion.onTimer())
|
||||
{
|
||||
#ifndef ESP32_DEF
|
||||
#if defined(ESP8266)
|
||||
ESP.reset();
|
||||
#elif defined(ESP32) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(ESP32C3)
|
||||
ESP.restart();
|
||||
#else
|
||||
ESP.restart();
|
||||
#error "Placa no soportada"
|
||||
#endif
|
||||
|
||||
return;
|
||||
|
|
@ -80,10 +82,12 @@ void DomoEspManager::loop()
|
|||
suscrito=false;
|
||||
if(tNomqtt.onTimer())
|
||||
{
|
||||
#ifndef ESP32_DEF
|
||||
#if defined(ESP8266)
|
||||
ESP.reset();
|
||||
#elif defined(ESP32) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(ESP32C3)
|
||||
ESP.restart();
|
||||
#else
|
||||
ESP.restart();
|
||||
#error "Placa no soportada"
|
||||
#endif
|
||||
|
||||
return;
|
||||
|
|
@ -102,11 +106,9 @@ void DomoEspManager::loop()
|
|||
int tiempoAux=0;
|
||||
if(timer.onTimerReset())
|
||||
{
|
||||
#ifndef ESP32_DEF
|
||||
#ifdef ESP8266
|
||||
if(conf->conexionPorApi)
|
||||
{
|
||||
#ifndef ESP32_DEF
|
||||
|
||||
|
||||
char topic_aux[32];
|
||||
char payload_aux[128];
|
||||
|
|
@ -115,7 +117,6 @@ void DomoEspManager::loop()
|
|||
{
|
||||
OnMqtt(topic_aux, payload_aux);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
tiempo=(tiempo+1)%2;
|
||||
|
|
@ -185,7 +186,7 @@ void DomoEspManager::MqttSend(char* topic, char* payload)
|
|||
{
|
||||
if(conf->conexionPorApi)
|
||||
{
|
||||
#ifndef ESP32_DEF
|
||||
#ifdef ESP8266
|
||||
api.send(topic, payload);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@
|
|||
|
||||
|
||||
#include <PubSubClient.h>
|
||||
#ifndef ESP32_DEF
|
||||
#include <ESP8266WiFi.h>
|
||||
#endif
|
||||
#ifdef ESP32_DEF
|
||||
#include <WiFi.h>
|
||||
#if defined(ESP8266)
|
||||
#include <ESP8266WiFi.h>
|
||||
#elif defined(ESP32) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(ESP32C3)
|
||||
#include <WiFi.h>
|
||||
#else
|
||||
#error "Placa no soportada"
|
||||
#endif
|
||||
|
||||
#include "utiles.h"
|
||||
|
|
@ -30,8 +31,8 @@ class DomoEspManager: public MqttReceiver, public IMqttManager, public ISensorMa
|
|||
WiFiClient espClient;
|
||||
PubSubClient clienteMqtt;
|
||||
MqttManager mqtt;
|
||||
#ifndef ESP32_DEF
|
||||
DomoEspApiConexion api;
|
||||
#ifdef ESP8266
|
||||
DomoEspApiConexion api;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class SensorAin: public DomoEspSensorReceiver
|
|||
return val;
|
||||
}
|
||||
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.set(1);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class SensorBMP180: public DomoEspSensorReceiver
|
|||
t=p=a=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;
|
||||
scl=_scl;
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ class SensorBuzzer: public DomoEspSensorReceiver
|
|||
val=0;
|
||||
topic[0]=0;
|
||||
}
|
||||
void setMelodia(int i, char* melodia)
|
||||
void setMelodia(int i, const char* melodia)
|
||||
{
|
||||
buz.Set(i, melodia);
|
||||
}
|
||||
void set(char* topic_id, int _pin)
|
||||
void set(const char* topic_id, int _pin)
|
||||
{
|
||||
val=0;
|
||||
strcpy(topic, topic_id);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class SensorDHT: public DomoEspSensorReceiver
|
|||
t=h=0;
|
||||
topic[0]=0;
|
||||
}
|
||||
void set(uint8_t _pin, char* topic_id)
|
||||
void set(uint8_t _pin, const char* topic_id)
|
||||
{
|
||||
pin=_pin;
|
||||
t=h=9.99998;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class SensorDin: public DomoEspSensorReceiver
|
|||
SensorDin(){
|
||||
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;
|
||||
pin=_pin;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ bool negado;
|
|||
topic[0]=0;
|
||||
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;
|
||||
val=valdef;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public:
|
|||
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;
|
||||
strcpy(topic, topic_id);
|
||||
|
|
@ -49,7 +49,7 @@ public:
|
|||
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)
|
||||
{
|
||||
|
|
@ -126,7 +126,7 @@ private:
|
|||
Muestra(msg);
|
||||
|
||||
}
|
||||
void Muestra(char * txt)
|
||||
void Muestra(const char * txt)
|
||||
{
|
||||
#ifdef DEBUG_PS
|
||||
Serial.println("SenLcd muestra: ");
|
||||
|
|
@ -134,7 +134,7 @@ private:
|
|||
#endif
|
||||
int linea=0;
|
||||
int i=0;
|
||||
char* ini=txt;
|
||||
const char* ini=txt;
|
||||
bool sigue=true;
|
||||
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];
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ bool negado;
|
|||
initDS1803();
|
||||
}
|
||||
|
||||
void set( char* topic_id, int valdef,bool _negado=false)
|
||||
void set( const char* topic_id, int valdef,bool _negado=false)
|
||||
{
|
||||
val=valdef;
|
||||
negado=_negado;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class SensorPulsante: public DomoEspSensorReceiver
|
|||
espera=false;
|
||||
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;
|
||||
valDef=_valDef;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class SensorRF: public DomoEspSensorReceiver
|
|||
val=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;
|
||||
val=valdef;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class SensorSplitter: public DomoEspSensorReceiver
|
|||
for(int i=0; i<MAX_ACTIVADORES; i++)
|
||||
sensorSend[i].sen=0;
|
||||
}
|
||||
void set(char* topic_id, float =0)
|
||||
void set(const char* topic_id, float =0)
|
||||
{
|
||||
val=0;
|
||||
strcpy(topic, topic_id);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class SensorTimer: public DomoEspSensorReceiver
|
|||
val=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);
|
||||
valDef=_valdef;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class SensorVF: public DomoEspSensorReceiver
|
|||
val=0;
|
||||
topic[0]=0;
|
||||
}
|
||||
void set(char* topic_id, float valdef=0)
|
||||
void set(const char* topic_id, float valdef=0)
|
||||
{
|
||||
val=valdef;
|
||||
strcpy(topic, topic_id);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
#include <Arduino.h>
|
||||
#define ESP32_DEF 1
|
||||
#ifndef ESP32_DEF
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266mDNS.h>
|
||||
#endif
|
||||
#ifdef ESP32_DEF
|
||||
#include <WiFi.h>
|
||||
|
||||
#if defined(ESP8266)
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266mDNS.h>
|
||||
#elif defined(ESP32) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(ESP32C3)
|
||||
#include <WiFi.h>
|
||||
#else
|
||||
#error "Placa no soportada"
|
||||
#endif
|
||||
|
||||
#include <WiFiUdp.h>
|
||||
|
|
@ -19,11 +20,12 @@
|
|||
void MqttUtiles::resetFunc()
|
||||
{
|
||||
|
||||
#ifdef ESP32_DEF
|
||||
ESP.restart();
|
||||
#endif
|
||||
#ifndef ESP32_DEF
|
||||
ESP.wdtEnable(1);
|
||||
#if defined(ESP32) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(ESP32C3)
|
||||
ESP.restart();
|
||||
#elif defined(ESP8266)
|
||||
ESP.wdtEnable(1);
|
||||
#else
|
||||
#error "Placa no soportada"
|
||||
#endif
|
||||
|
||||
while(1){};
|
||||
|
|
@ -354,7 +356,7 @@ void SonidoBuzzer::Toca(int pin, int imel)
|
|||
mel[imel].Toca(pin);
|
||||
}
|
||||
|
||||
void SonidoBuzzer::Set(int i, char* melo)
|
||||
void SonidoBuzzer::Set(int i, const char* melo)
|
||||
{
|
||||
if(i<MAX_MELODIAS)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
#define UtilesDef 1
|
||||
#include "defines.h"
|
||||
class PubSubClient;
|
||||
|
||||
#ifndef ESP32_DEF
|
||||
#ifdef ESP8266
|
||||
class WiFiClient;
|
||||
#endif
|
||||
class MqttUtiles
|
||||
|
|
@ -99,7 +98,7 @@ class SonidoBuzzer
|
|||
int n;
|
||||
SonidoBuzzer();
|
||||
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);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#ifndef DefinesDef
|
||||
|
||||
#define ESP32_DEF 1
|
||||
|
||||
#define DefinesDef 1
|
||||
|
||||
#define DEBUG_PS 1
|
||||
|
||||
#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_PAN_LCD 3//MAXIMO DE PANTALLAS POR SENSOR LCD
|
||||
|
|
|
|||
Loading…
Reference in New Issue