integrate V2.X.X of irremote esp8266 library (#72)
* Compatibility with IRRemoteESP8266 V2
This commit is contained in:
1 parent
916f46c34d
commit
97a68a247e
6 files changed
+11
-10
No files matched your search
+1
-1
@@ -19,7 +19,7 @@ install:
|
|||||||
- wget https://github.com/z3t0/Arduino-IRremote/archive/2.1.0.zip -O /tmp/IRremote.zip
|
- wget https://github.com/z3t0/Arduino-IRremote/archive/2.1.0.zip -O /tmp/IRremote.zip
|
||||||
- unzip /tmp/IRremote.zip -d /usr/local/share/arduino/libraries
|
- unzip /tmp/IRremote.zip -d /usr/local/share/arduino/libraries
|
||||||
- rm -rf /usr/local/share/arduino/libraries/RobotIRremote
|
- rm -rf /usr/local/share/arduino/libraries/RobotIRremote
|
||||||
- wget https://github.com/markszabo/IRremoteESP8266/archive/v1.2.0.zip -O /tmp/IRremoteESP8266.zip
|
- wget https://github.com/markszabo/IRremoteESP8266/archive/v2.1.1.zip -O /tmp/IRremoteESP8266.zip
|
||||||
- unzip /tmp/IRremoteESP8266.zip -d /usr/local/share/arduino/libraries
|
- unzip /tmp/IRremoteESP8266.zip -d /usr/local/share/arduino/libraries
|
||||||
- git clone https://github.com/ekstrand/ESP8266wifi /usr/local/share/arduino/libraries/ESP8266wifi
|
- git clone https://github.com/ekstrand/ESP8266wifi /usr/local/share/arduino/libraries/ESP8266wifi
|
||||||
- wget https://github.com/knolleary/pubsubclient/archive/v2.6.zip -O /tmp/pubsubclient.zip
|
- wget https://github.com/knolleary/pubsubclient/archive/v2.6.zip -O /tmp/pubsubclient.zip
|
||||||
|
|||||||
+6
-5
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
#include <IRremoteESP8266.h>
|
#include <IRremoteESP8266.h>
|
||||||
|
#include <IRsend.h> // Needed if you want to send IR commands.
|
||||||
|
#include <IRrecv.h> // Needed if you want to receive IR commands.
|
||||||
IRrecv irrecv(IR_RECEIVER_PIN);
|
IRrecv irrecv(IR_RECEIVER_PIN);
|
||||||
IRsend irsend(IR_EMITTER_PIN);
|
IRsend irsend(IR_EMITTER_PIN);
|
||||||
#else
|
#else
|
||||||
@@ -92,7 +94,7 @@ void MQTTtoIR(char * topicOri, char * datacallback) {
|
|||||||
// IR DATA ANALYSIS
|
// IR DATA ANALYSIS
|
||||||
//send received MQTT value by IR signal
|
//send received MQTT value by IR signal
|
||||||
boolean signalSent = false;
|
boolean signalSent = false;
|
||||||
unsigned long data = 0;
|
uint64_t data = 0;
|
||||||
String strcallback = String(datacallback);
|
String strcallback = String(datacallback);
|
||||||
trc(String(datacallback));
|
trc(String(datacallback));
|
||||||
int s = strcallback.length();
|
int s = strcallback.length();
|
||||||
@@ -111,7 +113,7 @@ void MQTTtoIR(char * topicOri, char * datacallback) {
|
|||||||
else if(strstr(topicOri, "IR_GC") != NULL){ // sending GC data from https://irdb.globalcache.com
|
else if(strstr(topicOri, "IR_GC") != NULL){ // sending GC data from https://irdb.globalcache.com
|
||||||
trc("IR_GC");
|
trc("IR_GC");
|
||||||
//buffer allocation from char datacallback
|
//buffer allocation from char datacallback
|
||||||
unsigned int GC[count+1];
|
uint16_t GC[count+1];
|
||||||
String value = "";
|
String value = "";
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for(int i = 0; i < s; i++)
|
for(int i = 0; i < s; i++)
|
||||||
@@ -134,7 +136,7 @@ void MQTTtoIR(char * topicOri, char * datacallback) {
|
|||||||
else if(strstr(topicOri, "IR_Raw") != NULL){ // sending Raw data
|
else if(strstr(topicOri, "IR_Raw") != NULL){ // sending Raw data
|
||||||
trc("IR_Raw");
|
trc("IR_Raw");
|
||||||
//buffer allocation from char datacallback
|
//buffer allocation from char datacallback
|
||||||
unsigned int Raw[count+1];
|
uint16_t Raw[count+1];
|
||||||
String value = "";
|
String value = "";
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for(int i = 0; i < s; i++)
|
for(int i = 0; i < s; i++)
|
||||||
@@ -157,7 +159,7 @@ void MQTTtoIR(char * topicOri, char * datacallback) {
|
|||||||
//We look into the subject to see if a special Bits number is defined
|
//We look into the subject to see if a special Bits number is defined
|
||||||
String topic = topicOri;
|
String topic = topicOri;
|
||||||
int valueRPT = 0;
|
int valueRPT = 0;
|
||||||
int valueBITS = 0;
|
unsigned int valueBITS = 0;
|
||||||
int pos = topic.lastIndexOf(IRbitsKey);
|
int pos = topic.lastIndexOf(IRbitsKey);
|
||||||
if (pos != -1){
|
if (pos != -1){
|
||||||
pos = pos + +strlen(IRbitsKey);
|
pos = pos + +strlen(IRbitsKey);
|
||||||
@@ -255,7 +257,6 @@ void MQTTtoIR(char * topicOri, char * datacallback) {
|
|||||||
boolean result = client.publish(subjectGTWIRtoMQTT, datacallback);
|
boolean result = client.publish(subjectGTWIRtoMQTT, datacallback);
|
||||||
if (result){
|
if (result){
|
||||||
trc(F("MQTTtoIR OK ack published"));
|
trc(F("MQTTtoIR OK ack published"));
|
||||||
trc(String(data));
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
irrecv.enableIRIn(); // ReStart the IR receiver (if not restarted it is not able to receive data)
|
irrecv.enableIRIn(); // ReStart the IR receiver (if not restarted it is not able to receive data)
|
||||||
|
|||||||
+1
-1
Submodule libraries/IRremote updated: 841e77a642...eb7a0bee7d.
Submodule libraries/IRremoteESP8266 updated: 0222d97367...bad6676cae.
+1
-1
Submodule libraries/pubsubclient updated: f46d0011ee...dddfffbe0c.
+1
-1
Submodule libraries/rcswitch updated: f820d2e46a...cf4b0053d7.
Reference in new issue
Block a user