diff --git a/IRSender.h b/IRSender.h index 60de0e7..9de035e 100644 --- a/IRSender.h +++ b/IRSender.h @@ -6,6 +6,14 @@ #include +#if defined(DEBUG) && (DEBUG > 0) +#define LOG(...) Serial.print(__VA_ARGS__) +#define LOGLN(...) Serial.println(__VA_ARGS__) +#else +#define LOG(...) +#define LOGLN(...) +#endif + #ifdef ESP8266 #include // From IRremoteESP8266 library #include diff --git a/MitsubishiHeatpumpIR.cpp b/MitsubishiHeatpumpIR.cpp index cf5899e..fecedaf 100644 --- a/MitsubishiHeatpumpIR.cpp +++ b/MitsubishiHeatpumpIR.cpp @@ -292,7 +292,7 @@ void MitsubishiHeatpumpIR::sendMitsubishi(IRSender& IR, uint8_t powerMode, uint8 // Set the temperature on the template message if (temperature == 10) { - Serial.println(F("Temp=10 maintenance mode")); + LOGLN(F("Temp=10 maintenance mode")); MitsubishiTemplate[7] = 0x00; // Maintenance mode MitsubishiTemplate[15] = 0x20; // This seems to be set to 0x20 on maintenance mode } else { @@ -329,7 +329,7 @@ void MitsubishiHeatpumpIR::sendMitsubishi(IRSender& IR, uint8_t powerMode, uint8 #ifdef IR_SEND_TIME if (_mitsubishiModel == MITSUBISHI_KJ) { #ifdef DEBUG - Serial.printf("Send time %02d:%02d day %d --> %x\n", sendHour, sendMinute, sendWeekday, (sendHour * 60 + sendMinute)/10); + LOGf("Send time %02d:%02d day %d --> %x\n", sendHour, sendMinute, sendWeekday, (sendHour * 60 + sendMinute)/10); #endif MitsubishiTemplate[10] = (uint8_t)((sendHour * 60 + sendMinute)/10); // Sunday is start if week , value 1 @@ -337,7 +337,7 @@ void MitsubishiHeatpumpIR::sendMitsubishi(IRSender& IR, uint8_t powerMode, uint8 } else { #ifdef DEBUG - Serial.printf("Send time %02d:%02d --> %x\n", sendHour, sendMinute, (sendHour * 60 + sendMinute)/6); + LOGf("Send time %02d:%02d --> %x\n", sendHour, sendMinute, (sendHour * 60 + sendMinute)/6); #endif MitsubishiTemplate[10] = (uint8_t)((sendHour * 60 + sendMinute)/6); } @@ -351,7 +351,7 @@ void MitsubishiHeatpumpIR::sendMitsubishi(IRSender& IR, uint8_t powerMode, uint8 sprintf_P(pbyte, PSTR("[%02d]=%02x "), i, (int) MitsubishiTemplate[i]); strcat(IRPacket, pbyte); } - Serial.println(IRPacket); + LOGLN(IRPacket); #else // Calculate the checksum for (int i=0; i<17; i++) { diff --git a/MitsubishiHeavyHeatpumpIR.cpp b/MitsubishiHeavyHeatpumpIR.cpp index c4e7ff5..6d40afd 100644 --- a/MitsubishiHeavyHeatpumpIR.cpp +++ b/MitsubishiHeavyHeatpumpIR.cpp @@ -422,21 +422,21 @@ void MitsubishiHeavyZMPHeatpumpIR::send(IRSender& IR, uint8_t powerModeCmd, uint /* ZMP model has no horizontal swing */ - Serial.println("Calling sendHeavy from ZMP with"); - Serial.print(F("PowerMode: ")); - Serial.println(powerMode); - Serial.print(F("OperatingMode: ")); - Serial.println(operatingMode); - Serial.print(F("FanSpeed: ")); - Serial.println(fanSpeed); - Serial.print(F("Temperature: ")); - Serial.println(temperature); - Serial.print(F("swingV: ")); - Serial.println(swingV); - Serial.print(F("swingH: ")); - Serial.println(swingH); - Serial.print(F("cleanMode: ")); - Serial.println(cleanMode); + LOGLN("Calling sendHeavy from ZMP with"); + LOG(F("PowerMode: ")); + LOGLN(powerMode); + LOG(F("OperatingMode: ")); + LOGLN(operatingMode); + LOG(F("FanSpeed: ")); + LOGLN(fanSpeed); + LOG(F("Temperature: ")); + LOGLN(temperature); + LOG(F("swingV: ")); + LOGLN(swingV); + LOG(F("swingH: ")); + LOGLN(swingH); + LOG(F("cleanMode: ")); + LOGLN(cleanMode); sendMitsubishiHeavy(IR, powerMode, operatingMode, fanSpeed, temperature, swingV, swingH, cleanMode); } @@ -553,10 +553,10 @@ void MitsubishiHeavyZMPHeatpumpIR::sendMitsubishiHeavy(IRSender& IR, uint8_t pow // Data for (uint8_t i=0; i