Program size optimization for arduino uno

This commit is contained in:
1technophile committed 2017-05-20 14:42:15 +02:00
1 parent 5f65b888b6
commit 186d1cc478
4 files changed
+12 -12

No files matched your search

+3 -3
View File
@@ -191,18 +191,18 @@ void loop()
#ifdef ZgatewayRF
boolean resultRF = RFtoMQTT();
if(resultRF)
trc(F("RF successfully sent by MQTT"));
trc(F("RF sent by MQTT"));
#endif
#ifdef ZgatewayIR
boolean resultIR = IRtoMQTT();
if(resultIR)
trc(F("IR successfully sent by MQTT"));
trc(F("IR sent by MQTT"));
delay(100);
#endif
#ifdef ZgatewayBT
boolean resultBT = BTtoMQTT();
if(resultBT)
trc(F("BT successfully sent by MQTT"));
trc(F("BT sent by MQTT"));
#endif
}
+2 -2
View File
@@ -79,7 +79,7 @@ const byte subnet[] = { 255, 255, 255, 0 }; //ip adress
#define subjectRFtoMQTTbits "home/433toMQTT/bits"
#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 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
433_1
@@ -104,7 +104,7 @@ RF supported protocols
#define subjectMultiGTWIR "+/IRtoMQTT"
#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 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)
+3 -3
View File
@@ -60,7 +60,7 @@ boolean IRtoMQTT(){
if (pubIRunknownPrtcl == false && MQTTprotocol == "-1"){ // don't publish unknown IR protocol
trc(F("--------------don't publish the received code unknown protocol--------------"));
} 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(subjectIRtoMQTTbits,(char *)MQTTbits.c_str());
trc(F("Sending IR to MQTT"));
@@ -68,7 +68,7 @@ boolean IRtoMQTT(){
trc(value);
boolean result = client.publish(subjectIRtoMQTT,(char *)value.c_str());
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());
}
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
boolean result = client.publish(subjectGTWIRtoMQTT, datacallback);
if (result){
trc(F("Signal below sent by IR and acknowledgment published"));
trc(F("Signal sent by IR and ack published"));
trc(String(data));
};
}
+4 -4
View File
@@ -59,7 +59,7 @@ boolean RFtoMQTT(){
trc(value);
boolean result = client.publish(subjectRFtoMQTT,(char *)value.c_str());
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());
}
return result;
@@ -99,10 +99,10 @@ void MQTTtoRF(char * topicOri, char * datacallback) {
mySwitch.send(data, 24);
// Acknowledgement to the GTWRF topic
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)){
trc(F("Sending data by RF, user defined parameters"));
trc(F("Sending data by RF, MQTT parameters"));
if (valuePRT == 0) valuePRT = 1;
if (valuePLSL == 0) valuePLSL = 350;
trc(String(valuePRT));
@@ -112,7 +112,7 @@ void MQTTtoRF(char * topicOri, char * datacallback) {
// 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
if (result){
trc(F("Signal below sent by RF and acknowledgment published"));
trc(F("Signal sent by RF and ack published"));
trc(String(data));
};
}