spliting the code into different files

Differentiate 4 categories of files:
-gateway file for bridging signal and MQTT
-user config
-sensor files
-actuators files
This commit is contained in:
1technophile committed 2017-04-18 22:42:43 +02:00
1 parent 0bbf882b30
commit a65e5fa595
4 files changed
+140 -13

No files matched your search

+63
View File
@@ -0,0 +1,63 @@
void setupIR()
{
//IR init parameters
#ifdef ESP8266
irsend.begin();
#endif
irrecv.enableIRIn(); // Start the receiver
}
void receivingMQTTIR(char * topicOri, char * datacallback) {
// IR DATA ANALYSIS
//send received MQTT value by IR signal (example of signal sent data = 1086296175)
boolean signalSent = false;
#ifdef ESP8266 // send coolix not available for arduino IRRemote library
if (topic.lastIndexOf("IR_COOLIX") != -1 ){
irsend.sendCOOLIX(data, 24);
signalSent = true;
}
#endif
if (topic.lastIndexOf("IR_NEC")!= -1 || topic == subjectMQTTtoIR){
irsend.sendNEC(data, 32);
signalSent = true;
}
if (topic.lastIndexOf("IR_Whynter")!=-1){
irsend.sendWhynter(data, 32);
signalSent = true;
}
if (topic.lastIndexOf("IR_LG")!=-1){
irsend.sendLG(data, 28);
signalSent = true;
}
if (topic.lastIndexOf("IR_Sony")!=-1){
irsend.sendSony(data, 12);
signalSent = true;
}
if (topic.lastIndexOf("IR_DISH")!=-1){
irsend.sendDISH(data, 16);
signalSent = true;
}
if (topic.lastIndexOf("IR_RC5")!=-1){
irsend.sendRC5(data, 12);
signalSent = true;
}
if (topic.lastIndexOf("IR_Sharp")!=-1){
irsend.sendSharpRaw(data, 15);
signalSent = true;
}
if (topic.lastIndexOf("IR_SAMSUNG")!=-1){
irsend.sendSAMSUNG(data, 32);
signalSent = true;
}
if (signalSent){
boolean result = client.publish(subjectGTWIRtoMQTT, datacallback);
if (result)trc(F("Acknowedgement of reception published"));
}
irrecv.enableIRIn(); // ReStart the IR receiver (if not restarted it is not able to receive data)
}