Program size optimization for arduino uno
This commit is contained in:
1 parent
5f65b888b6
commit
186d1cc478
4 files changed
+12
-12
No files matched your search
+3
-3
@@ -191,18 +191,18 @@ void loop()
|
|||||||
#ifdef ZgatewayRF
|
#ifdef ZgatewayRF
|
||||||
boolean resultRF = RFtoMQTT();
|
boolean resultRF = RFtoMQTT();
|
||||||
if(resultRF)
|
if(resultRF)
|
||||||
trc(F("RF successfully sent by MQTT"));
|
trc(F("RF sent by MQTT"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef ZgatewayIR
|
#ifdef ZgatewayIR
|
||||||
boolean resultIR = IRtoMQTT();
|
boolean resultIR = IRtoMQTT();
|
||||||
if(resultIR)
|
if(resultIR)
|
||||||
trc(F("IR successfully sent by MQTT"));
|
trc(F("IR sent by MQTT"));
|
||||||
delay(100);
|
delay(100);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ZgatewayBT
|
#ifdef ZgatewayBT
|
||||||
boolean resultBT = BTtoMQTT();
|
boolean resultBT = BTtoMQTT();
|
||||||
if(resultBT)
|
if(resultBT)
|
||||||
trc(F("BT successfully sent by MQTT"));
|
trc(F("BT sent by MQTT"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -79,7 +79,7 @@ const byte subnet[] = { 255, 255, 255, 0 }; //ip adress
|
|||||||
#define subjectRFtoMQTTbits "home/433toMQTT/bits"
|
#define subjectRFtoMQTTbits "home/433toMQTT/bits"
|
||||||
#define subjectRFtoMQTTlength "home/433toMQTT/length"
|
#define subjectRFtoMQTTlength "home/433toMQTT/length"
|
||||||
#define RFprotocolKey "433_" // protocol will be defined if a subject contains RFprotocolKey followed by a value of 1 digit
|
#define RFprotocolKey "433_" // protocol will be defined if a subject contains RFprotocolKey followed by a value of 1 digit
|
||||||
#define repeatRFwMQTT true // do we repeat a received signal by using mqtt
|
#define repeatRFwMQTT false // do we repeat a received signal by using mqtt
|
||||||
/*
|
/*
|
||||||
RF supported protocols
|
RF supported protocols
|
||||||
433_1
|
433_1
|
||||||
@@ -104,7 +104,7 @@ RF supported protocols
|
|||||||
#define subjectMultiGTWIR "+/IRtoMQTT"
|
#define subjectMultiGTWIR "+/IRtoMQTT"
|
||||||
#define IRbitsKey "BITS_" // bits will be defined if a subject contains IRbitsKey followed by a value of 2 digits
|
#define IRbitsKey "BITS_" // bits will be defined if a subject contains IRbitsKey followed by a value of 2 digits
|
||||||
#define IRRptKey "RPT_" // repeats will be defined if a subject contains IRRptKey followed by a value of 1 digit
|
#define IRRptKey "RPT_" // repeats will be defined if a subject contains IRRptKey followed by a value of 1 digit
|
||||||
#define repeatIRwMQTT true // do we repeat a received signal by using mqtt
|
#define repeatIRwMQTT false // do we repeat a received signal by using mqtt
|
||||||
|
|
||||||
#define pubIRunknownPrtcl false // key to avoid mqtt publication of unknown IR protocol (set to true if you want to publish unknown protocol)
|
#define pubIRunknownPrtcl false // key to avoid mqtt publication of unknown IR protocol (set to true if you want to publish unknown protocol)
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -60,7 +60,7 @@ boolean IRtoMQTT(){
|
|||||||
if (pubIRunknownPrtcl == false && MQTTprotocol == "-1"){ // don't publish unknown IR protocol
|
if (pubIRunknownPrtcl == false && MQTTprotocol == "-1"){ // don't publish unknown IR protocol
|
||||||
trc(F("--------------don't publish the received code unknown protocol--------------"));
|
trc(F("--------------don't publish the received code unknown protocol--------------"));
|
||||||
} else if (!isAduplicate(MQTTvalue) && MQTTvalue!=0) {// conditions to avoid duplications of RF -->MQTT
|
} else if (!isAduplicate(MQTTvalue) && MQTTvalue!=0) {// conditions to avoid duplications of RF -->MQTT
|
||||||
trc(F("Sending advanced data to MQTT"));
|
trc(F("Sending adv data to MQTT"));
|
||||||
client.publish(subjectIRtoMQTTprotocol,(char *)MQTTprotocol.c_str());
|
client.publish(subjectIRtoMQTTprotocol,(char *)MQTTprotocol.c_str());
|
||||||
client.publish(subjectIRtoMQTTbits,(char *)MQTTbits.c_str());
|
client.publish(subjectIRtoMQTTbits,(char *)MQTTbits.c_str());
|
||||||
trc(F("Sending IR to MQTT"));
|
trc(F("Sending IR to MQTT"));
|
||||||
@@ -68,7 +68,7 @@ boolean IRtoMQTT(){
|
|||||||
trc(value);
|
trc(value);
|
||||||
boolean result = client.publish(subjectIRtoMQTT,(char *)value.c_str());
|
boolean result = client.publish(subjectIRtoMQTT,(char *)value.c_str());
|
||||||
if (repeatIRwMQTT){
|
if (repeatIRwMQTT){
|
||||||
trc(F("Publishing IR signal so as to make the gateway(s) repeat it"));
|
trc(F("Publishing IR signal so as to repeat it"));
|
||||||
client.publish(subjectMQTTtoIR,(char *)value.c_str());
|
client.publish(subjectMQTTtoIR,(char *)value.c_str());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -231,7 +231,7 @@ void MQTTtoIR(char * topicOri, char * datacallback) {
|
|||||||
if (signalSent){ // we acknowledge the sending by publishing the value to an acknowledgement topic, for the moment even if it is a signal repetition we acknowledge also
|
if (signalSent){ // we acknowledge the sending by publishing the value to an acknowledgement topic, for the moment even if it is a signal repetition we acknowledge also
|
||||||
boolean result = client.publish(subjectGTWIRtoMQTT, datacallback);
|
boolean result = client.publish(subjectGTWIRtoMQTT, datacallback);
|
||||||
if (result){
|
if (result){
|
||||||
trc(F("Signal below sent by IR and acknowledgment published"));
|
trc(F("Signal sent by IR and ack published"));
|
||||||
trc(String(data));
|
trc(String(data));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -59,7 +59,7 @@ boolean RFtoMQTT(){
|
|||||||
trc(value);
|
trc(value);
|
||||||
boolean result = client.publish(subjectRFtoMQTT,(char *)value.c_str());
|
boolean result = client.publish(subjectRFtoMQTT,(char *)value.c_str());
|
||||||
if (repeatRFwMQTT){
|
if (repeatRFwMQTT){
|
||||||
trc(F("Publishing IR signal so as to make the gateway(s) repeat it"));
|
trc(F("Publishing IR signal so as to repeat it"));
|
||||||
client.publish(subjectMQTTtoRF,(char *)value.c_str());
|
client.publish(subjectMQTTtoRF,(char *)value.c_str());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -99,10 +99,10 @@ void MQTTtoRF(char * topicOri, char * datacallback) {
|
|||||||
mySwitch.send(data, 24);
|
mySwitch.send(data, 24);
|
||||||
// Acknowledgement to the GTWRF topic
|
// Acknowledgement to the GTWRF topic
|
||||||
boolean result = client.publish(subjectGTWRFtoMQTT, datacallback);
|
boolean result = client.publish(subjectGTWRFtoMQTT, datacallback);
|
||||||
if (result)trc(F("Acknowedgement of reception published"));
|
if (result)trc(F("Ack of reception published"));
|
||||||
|
|
||||||
} else if ((valuePRT != 0) || (valuePLSL != 0)){
|
} else if ((valuePRT != 0) || (valuePLSL != 0)){
|
||||||
trc(F("Sending data by RF, user defined parameters"));
|
trc(F("Sending data by RF, MQTT parameters"));
|
||||||
if (valuePRT == 0) valuePRT = 1;
|
if (valuePRT == 0) valuePRT = 1;
|
||||||
if (valuePLSL == 0) valuePLSL = 350;
|
if (valuePLSL == 0) valuePLSL = 350;
|
||||||
trc(String(valuePRT));
|
trc(String(valuePRT));
|
||||||
@@ -112,7 +112,7 @@ void MQTTtoRF(char * topicOri, char * datacallback) {
|
|||||||
// Acknowledgement to the GTWRF topic
|
// Acknowledgement to the GTWRF topic
|
||||||
boolean result = client.publish(subjectGTWRFtoMQTT, datacallback);// we acknowledge the sending by publishing the value to an acknowledgement topic, for the moment even if it is a signal repetition we acknowledge also
|
boolean result = client.publish(subjectGTWRFtoMQTT, datacallback);// we acknowledge the sending by publishing the value to an acknowledgement topic, for the moment even if it is a signal repetition we acknowledge also
|
||||||
if (result){
|
if (result){
|
||||||
trc(F("Signal below sent by RF and acknowledgment published"));
|
trc(F("Signal sent by RF and ack published"));
|
||||||
trc(String(data));
|
trc(String(data));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user