From 7382e19f670e7a8c13f7c892f3724ddc314eed03 Mon Sep 17 00:00:00 2001 From: 1technophile Date: Fri, 2 Jun 2017 23:54:01 +0200 Subject: [PATCH] decrease code size again --- OpenMQTTGateway.ino | 12 ++++++------ ZgatewayIR.ino | 4 ++-- ZgatewayRF.ino | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/OpenMQTTGateway.ino b/OpenMQTTGateway.ino index dd91dd3..e8faec5 100644 --- a/OpenMQTTGateway.ino +++ b/OpenMQTTGateway.ino @@ -76,7 +76,7 @@ boolean reconnect() { #else if (client.connect(Gateway_Name, will_Topic, will_QoS, will_Retain, will_Message)) { #endif - trc(F("connected to MQTT broker")); + trc(F("connected to broker")); // Once connected, publish an announcement... client.publish(will_Topic,Gateway_AnnouncementMsg,will_Retain); //Subscribing to topic @@ -86,7 +86,7 @@ boolean reconnect() { } else { trc(F("failed, rc=")); trc(String(client.state())); - trc(F(" try again in 5 seconds")); + trc(F("try again in 5s")); // Wait 5 seconds before retrying delay(5000); } @@ -217,14 +217,14 @@ void storeValue(long MQTTvalue){ unsigned long now = millis(); // find oldest value of the buffer int o = getMin(); - trc(F("Minimum index: ")); + trc(F("Min index: ")); trc(String(o)); // replace it by the new one ReceivedSignal[o][0] = MQTTvalue; ReceivedSignal[o][1] = now; - trc(F("store this code :")); + trc(F("store code :")); trc(String(ReceivedSignal[o][0])+"/"+String(ReceivedSignal[o][1])); - trc(F("Col: value/timestamp")); + trc(F("Col: val/timestamp")); for (int i = 0; i < array_size; i++) { trc(String(i) + ":" + String(ReceivedSignal[i][0])+"/"+String(ReceivedSignal[i][1])); @@ -251,7 +251,7 @@ for (int i = 0; i < array_size;i++){ if (ReceivedSignal[i][0] == value){ unsigned long now = millis(); if (now - ReceivedSignal[i][1] < time_avoid_duplicate){ // change - trc(F("--------------don't publish the received code duplicate--------------")); + trc(F("---don't publish the code duplicate---")); return true; } } diff --git a/ZgatewayIR.ino b/ZgatewayIR.ino index 91dca9c..4a8e778 100644 --- a/ZgatewayIR.ino +++ b/ZgatewayIR.ino @@ -67,13 +67,13 @@ boolean IRtoMQTT(){ trc(rawCode); irrecv.resume(); // Receive the next value 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 code unknown protocol---")); } else if (!isAduplicate(MQTTvalue) && MQTTvalue!=0) {// conditions to avoid duplications of RF -->MQTT trc(F("Sending adv data to MQTT")); client.publish(subjectIRtoMQTTprotocol,(char *)MQTTprotocol.c_str()); client.publish(subjectIRtoMQTTbits,(char *)MQTTbits.c_str()); client.publish(subjectIRtoMQTTRaw,(char *)rawCode.c_str()); - trc(F("Sending IR to MQTT")); + trc(F("Sending IRtoMQTT")); String value = String(MQTTvalue); trc(value); boolean result = client.publish(subjectIRtoMQTT,(char *)value.c_str()); diff --git a/ZgatewayRF.ino b/ZgatewayRF.ino index 16cf6ec..c805b68 100644 --- a/ZgatewayRF.ino +++ b/ZgatewayRF.ino @@ -58,7 +58,7 @@ boolean RFtoMQTT(){ client.publish(subjectRFtoMQTTprotocol,(char *)MQTTprotocol.c_str()); client.publish(subjectRFtoMQTTbits,(char *)MQTTbits.c_str()); client.publish(subjectRFtoMQTTlength,(char *)MQTTlength.c_str()); - trc(F("Sending RF to MQTT")); + trc(F("Sending RFtoMQTT")); String value = String(MQTTvalue); trc(value); boolean result = client.publish(subjectRFtoMQTT,(char *)value.c_str()); @@ -106,15 +106,15 @@ void MQTTtoRF(char * topicOri, char * datacallback) { } if ((topic == subjectMQTTtoRF) && (valuePRT == 0) && (valuePLSL == 0) && (valueBITS == 0)){ - trc(F("Sending data by RF, default parameters")); + trc(F("MQTTtoRF default parameters")); mySwitch.setProtocol(1,350); mySwitch.send(data, 24); // Acknowledgement to the GTWRF topic boolean result = client.publish(subjectGTWRFtoMQTT, datacallback); - if (result)trc(F("Ack of reception published")); + if (result)trc(F("Ack published")); } else if ((valuePRT != 0) || (valuePLSL != 0)|| (valueBITS != 0)){ - trc(F("Sending data by RF, MQTT parameters")); + trc(F("MQTTtoRF user parameters")); if (valuePRT == 0) valuePRT = 1; if (valuePLSL == 0) valuePLSL = 350; if (valueBITS == 0) valueBITS = 24; @@ -126,7 +126,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 sent by RF and ack published")); + trc(F("MQTTtoRF OK and ack published")); trc(String(data)); }; }