diff --git a/libraries/HeatpumpIR/CarrierHeatpumpIR.cpp b/libraries/HeatpumpIR/CarrierHeatpumpIR.cpp index 026c1aa..244f03d 100644 --- a/libraries/HeatpumpIR/CarrierHeatpumpIR.cpp +++ b/libraries/HeatpumpIR/CarrierHeatpumpIR.cpp @@ -10,16 +10,16 @@ CarrierHeatpumpIR::CarrierHeatpumpIR() : HeatpumpIR() } -void CarrierHeatpumpIR::send(IRSender& IR, byte powerModeCmd, byte operatingModeCmd, byte fanSpeedCmd, byte temperatureCmd, byte swingVCmd, byte swingHCmd) +void CarrierHeatpumpIR::send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingModeCmd, uint8_t fanSpeedCmd, uint8_t temperatureCmd, uint8_t swingVCmd, uint8_t swingHCmd) { (void)swingVCmd; (void)swingHCmd; // Sensible defaults for the heat pump mode - byte operatingMode = CARRIER_AIRCON1_MODE_HEAT; - byte fanSpeed = CARRIER_AIRCON1_FAN_AUTO; - byte temperature = 23; + uint8_t operatingMode = CARRIER_AIRCON1_MODE_HEAT; + uint8_t fanSpeed = CARRIER_AIRCON1_FAN_AUTO; + uint8_t temperature = 23; if (powerModeCmd == POWER_OFF) { @@ -82,12 +82,12 @@ void CarrierHeatpumpIR::send(IRSender& IR, byte powerModeCmd, byte operatingMode // Send the Carrier code // Carrier has the LSB and MSB in different format than Panasonic -void CarrierHeatpumpIR::sendCarrier(IRSender& IR, byte operatingMode, byte fanSpeed, byte temperature) +void CarrierHeatpumpIR::sendCarrier(IRSender& IR, uint8_t operatingMode, uint8_t fanSpeed, uint8_t temperature) { - byte sendBuffer[9] = { 0x4f, 0xb0, 0xc0, 0x3f, 0x80, 0x00, 0x00, 0x00, 0x00 }; // The data is on the last four bytes + uint8_t sendBuffer[9] = { 0x4f, 0xb0, 0xc0, 0x3f, 0x80, 0x00, 0x00, 0x00, 0x00 }; // The data is on the last four uint8_ts - static const prog_uint8_t temperatures[] PROGMEM = { 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e, 0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b }; - byte checksum = 0; + static const uint8_t temperatures[] PROGMEM = { 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e, 0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b }; + uint8_t checksum = 0; // PROGMEM arrays cannot be addressed directly, see http://forum.arduino.cc/index.php?topic=106603.0 sendBuffer[5] = pgm_read_byte(&(temperatures[(temperature-17)])); @@ -149,7 +149,7 @@ void CarrierHeatpumpIR::sendCarrier(IRSender& IR, byte operatingMode, byte fanSp // Payload for (size_t i=0; i #include @@ -61,7 +60,7 @@ class HeatpumpIR const char * _info; public: - virtual void send(IRSender& IR, byte powerModeCmd, byte operatingModeCmd, byte fanSpeedCmd, byte temperatureCmd, byte swingVCmd, byte swingHCmd); + virtual void send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingModeCmd, uint8_t fanSpeedCmd, uint8_t temperatureCmd, uint8_t swingVCmd, uint8_t swingHCmd); const char PROGMEM* model(); const char PROGMEM* info(); }; diff --git a/libraries/HeatpumpIR/HisenseHeatpumpIR.cpp b/libraries/HeatpumpIR/HisenseHeatpumpIR.cpp index 5f7dd85..e01a092 100644 --- a/libraries/HeatpumpIR/HisenseHeatpumpIR.cpp +++ b/libraries/HeatpumpIR/HisenseHeatpumpIR.cpp @@ -10,19 +10,19 @@ HisenseHeatpumpIR::HisenseHeatpumpIR() : HeatpumpIR() } -void HisenseHeatpumpIR::send(IRSender& IR, byte powerModeCmd, byte operatingModeCmd , byte fanSpeedCmd , byte temperatureCmd , byte swingVCmd , byte swingHCmd ) +void HisenseHeatpumpIR::send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingModeCmd , uint8_t fanSpeedCmd , uint8_t temperatureCmd , uint8_t swingVCmd , uint8_t swingHCmd ) { (void)swingVCmd; (void)swingHCmd; // Sensible defaults for the heat pump mode - byte powerMode = HISENSE_AIRCON1_POWER_ON; - byte operatingMode = HISENSE_AIRCON1_MODE_HEAT; - byte fanSpeed = HISENSE_AIRCON1_FAN_AUTO; - byte temperature = 21; - byte swingV=0; - byte swingH=0; + uint8_t powerMode = HISENSE_AIRCON1_POWER_ON; + uint8_t operatingMode = HISENSE_AIRCON1_MODE_HEAT; + uint8_t fanSpeed = HISENSE_AIRCON1_FAN_AUTO; + uint8_t temperature = 21; + uint8_t swingV=0; + uint8_t swingH=0; if (powerModeCmd == POWER_OFF) { @@ -82,21 +82,21 @@ void HisenseHeatpumpIR::send(IRSender& IR, byte powerModeCmd, byte operatingMode } // Send the Hisense code -void HisenseHeatpumpIR::sendHisense(IRSender& IR, byte powerMode, byte operatingMode, byte fanSpeed, byte temperature, byte swingV ,byte swingH) +void HisenseHeatpumpIR::sendHisense(IRSender& IR, uint8_t powerMode, uint8_t operatingMode, uint8_t fanSpeed, uint8_t temperature, uint8_t swingV ,uint8_t swingH) { (void)swingV; (void)swingH; - byte HisenseTemplate[] = { 0x87, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, // Header byte 0-1 + uint8_t HisenseTemplate[] = { 0x87, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, // Header uint8_t 0-1 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00 }; // - byte i; + uint8_t i; // Set the Fan speed, On/Off. HisenseTemplate[2] = fanSpeed | powerMode; HisenseTemplate[3] = (((temperature - 18) << 4) | operatingMode ) ; - // Calculate the byte checksum EXOR byte 2 to 12 + // Calculate the uint8_t checksum EXOR uint8_t 2 to 12 HisenseTemplate[13] = HisenseTemplate[2]; for (i=3; i<13; i++) { HisenseTemplate[13]= HisenseTemplate[i] ^ HisenseTemplate[13]; @@ -111,7 +111,7 @@ void HisenseHeatpumpIR::sendHisense(IRSender& IR, byte powerMode, byte operating // Payload header part for (i=0; i<7; i++) { - IR.sendIRByte(HisenseTemplate[i], HISENSE_AIRCON1_BIT_MARK, HISENSE_AIRCON1_ZERO_SPACE, HISENSE_AIRCON1_ONE_SPACE); + IR.sendIRbyte(HisenseTemplate[i], HISENSE_AIRCON1_BIT_MARK, HISENSE_AIRCON1_ZERO_SPACE, HISENSE_AIRCON1_ONE_SPACE); } // Mesage space @@ -120,7 +120,7 @@ void HisenseHeatpumpIR::sendHisense(IRSender& IR, byte powerMode, byte operating // Payload message part for (; i<14; i++) { - IR.sendIRByte(HisenseTemplate[i], HISENSE_AIRCON1_BIT_MARK, HISENSE_AIRCON1_ZERO_SPACE, HISENSE_AIRCON1_ONE_SPACE); + IR.sendIRbyte(HisenseTemplate[i], HISENSE_AIRCON1_BIT_MARK, HISENSE_AIRCON1_ZERO_SPACE, HISENSE_AIRCON1_ONE_SPACE); } // End mark diff --git a/libraries/HeatpumpIR/HisenseHeatpumpIR.h b/libraries/HeatpumpIR/HisenseHeatpumpIR.h index 4cc2b01..eb2e69c 100644 --- a/libraries/HeatpumpIR/HisenseHeatpumpIR.h +++ b/libraries/HeatpumpIR/HisenseHeatpumpIR.h @@ -64,10 +64,10 @@ class HisenseHeatpumpIR : public HeatpumpIR { public: HisenseHeatpumpIR(); - void send(IRSender& IR, byte powerModeCmd, byte operatingModeCmd, byte fanSpeedCmd, byte temperatureCmd, byte swingVCmd, byte swingHCmd); + void send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingModeCmd, uint8_t fanSpeedCmd, uint8_t temperatureCmd, uint8_t swingVCmd, uint8_t swingHCmd); private: - void sendHisense(IRSender& IR, byte powerMode, byte operatingMode, byte fanSpeed, byte temperature, byte swingV, byte swingH); + void sendHisense(IRSender& IR, uint8_t powerMode, uint8_t operatingMode, uint8_t fanSpeed, uint8_t temperature, uint8_t swingV, uint8_t swingH); }; #endif diff --git a/libraries/HeatpumpIR/IRSender.cpp b/libraries/HeatpumpIR/IRSender.cpp index 8daffe6..fdf8b58 100644 --- a/libraries/HeatpumpIR/IRSender.cpp +++ b/libraries/HeatpumpIR/IRSender.cpp @@ -6,7 +6,7 @@ // // For PWM on Arduino, see http://playground.arduino.cc/Main/TimerPWMCheatsheet -IRSender::IRSender(byte pin) +IRSender::IRSender(uint8_t pin) { _pin = pin; } @@ -72,8 +72,8 @@ void IRSender::setFrequency(int frequency) } } -// Send a byte (8 bits) over IR -void IRSender::sendIRByte(byte sendByte, int bitMarkLength, int zeroSpaceLength, int oneSpaceLength) +// Send a uint8_t (8 bits) over IR +void IRSender::sendIRbyte(uint8_t sendByte, int bitMarkLength, int zeroSpaceLength, int oneSpaceLength) { for (int i=0; i<8 ; i++) { @@ -93,8 +93,8 @@ void IRSender::sendIRByte(byte sendByte, int bitMarkLength, int zeroSpaceLength, } // The Carrier IR protocol has the bits in a reverse order (compared to the other heatpumps) -// See http://www.nrtm.org/index.php/2013/07/25/reverse-bits-in-a-byte/ -byte IRSender::bitReverse(byte x) +// See http://www.nrtm.org/index.php/2013/07/25/reverse-bits-in-a-uint8_t/ +uint8_t IRSender::bitReverse(uint8_t x) { // 01010101 | 10101010 x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); diff --git a/libraries/HeatpumpIR/IRSender.h b/libraries/HeatpumpIR/IRSender.h index b0028ac..c99bb82 100644 --- a/libraries/HeatpumpIR/IRSender.h +++ b/libraries/HeatpumpIR/IRSender.h @@ -9,15 +9,15 @@ class IRSender { public: - IRSender(byte pin); + IRSender(uint8_t pin); void setFrequency(int frequency); - void sendIRByte(byte sendByte, int bitMarkLength, int zeroSpaceLength, int oneSpaceLength); - byte bitReverse(byte x); + void sendIRbyte(uint8_t sendByte, int bitMarkLength, int zeroSpaceLength, int oneSpaceLength); + uint8_t bitReverse(uint8_t x); void space(int spaceLength); void mark(int markLength); private: - byte _pin; + uint8_t _pin; }; #endif diff --git a/libraries/HeatpumpIR/MideaHeatpumpIR.cpp b/libraries/HeatpumpIR/MideaHeatpumpIR.cpp index 04e709d..bf58bab 100644 --- a/libraries/HeatpumpIR/MideaHeatpumpIR.cpp +++ b/libraries/HeatpumpIR/MideaHeatpumpIR.cpp @@ -10,15 +10,15 @@ MideaHeatpumpIR::MideaHeatpumpIR() : HeatpumpIR() } -void MideaHeatpumpIR::send(IRSender& IR, byte powerModeCmd, byte operatingModeCmd, byte fanSpeedCmd, byte temperatureCmd, byte swingVCmd, byte swingHCmd) +void MideaHeatpumpIR::send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingModeCmd, uint8_t fanSpeedCmd, uint8_t temperatureCmd, uint8_t swingVCmd, uint8_t swingHCmd) { (void)swingVCmd; (void)swingHCmd; // Sensible defaults for the heat pump mode - byte operatingMode = MIDEA_AIRCON1_MODE_HEAT; - byte fanSpeed = MIDEA_AIRCON1_FAN_AUTO; - byte temperature = 23; + uint8_t operatingMode = MIDEA_AIRCON1_MODE_HEAT; + uint8_t fanSpeed = MIDEA_AIRCON1_FAN_AUTO; + uint8_t temperature = 23; switch (powerModeCmd) { @@ -48,8 +48,8 @@ void MideaHeatpumpIR::send(IRSender& IR, byte powerModeCmd, byte operatingModeCm break; case MODE_MAINT: // Maintenance mode ('FP' on the remote) is a special mode on Midea - // Also, this is a switch between 'normal' operation and 'maintenance' operation, - // i.e. if already running on maintenance, the heatpump will go back to normal operation + // Also, this is a switch between 'normal' operation and 'maintenance' operation, + // i.e. if already running on maintenance, the heatpump will go back to normal operation operatingMode = MIDEA_AIRCON1_MODE_FP; break; } @@ -79,14 +79,14 @@ void MideaHeatpumpIR::send(IRSender& IR, byte powerModeCmd, byte operatingModeCm } // Send the Midea code -void MideaHeatpumpIR::sendMidea(IRSender& IR, byte operatingMode, byte fanSpeed, byte temperature) +void MideaHeatpumpIR::sendMidea(IRSender& IR, uint8_t operatingMode, uint8_t fanSpeed, uint8_t temperature) { - byte sendBuffer[3] = { 0x4D, 0x00, 0x00 }; // First byte is always 0x4D + uint8_t sendBuffer[3] = { 0x4D, 0x00, 0x00 }; // First uint8_t is always 0x4D - static const prog_uint8_t temperatures[] PROGMEM = {0, 8, 12, 4, 6, 14, 10, 2, 3, 11, 9, 1, 5, 13 }; + static const uint8_t temperatures[] PROGMEM = {0, 8, 12, 4, 6, 14, 10, 2, 3, 11, 9, 1, 5, 13 }; - static const prog_uint8_t OffMsg[] PROGMEM = {0x4D, 0xDE, 0x07 }; - static const prog_uint8_t FPMsg[] PROGMEM = {0xAD, 0xAF, 0xB5 }; + static const uint8_t OffMsg[] PROGMEM = {0x4D, 0xDE, 0x07 }; + static const uint8_t FPMsg[] PROGMEM = {0xAD, 0xAF, 0xB5 }; if (operatingMode == MIDEA_AIRCON1_MODE_OFF) { @@ -115,7 +115,7 @@ void MideaHeatpumpIR::sendMidea(IRSender& IR, byte operatingMode, byte fanSpeed, } // Send the Midea raw code -void MideaHeatpumpIR::sendMidearaw(IRSender& IR, byte sendBuffer[]) +void MideaHeatpumpIR::sendMidearaw(IRSender& IR, uint8_t sendBuffer[]) { // 40 kHz PWM frequency IR.setFrequency(40); @@ -124,24 +124,24 @@ void MideaHeatpumpIR::sendMidearaw(IRSender& IR, byte sendBuffer[]) IR.mark(MIDEA_AIRCON1_HDR_MARK); IR.space(MIDEA_AIRCON1_HDR_SPACE); - // Six bytes, every second byte is a bitwise not of the previous byte + // Six uint8_ts, every second uint8_t is a bitwise not of the previous uint8_t for (int i=0; i<3; i++) { - IR.sendIRByte(sendBuffer[i], MIDEA_AIRCON1_BIT_MARK, MIDEA_AIRCON1_ZERO_SPACE, MIDEA_AIRCON1_ONE_SPACE); - IR.sendIRByte(~sendBuffer[i], MIDEA_AIRCON1_BIT_MARK, MIDEA_AIRCON1_ZERO_SPACE, MIDEA_AIRCON1_ONE_SPACE); + IR.sendIRbyte(sendBuffer[i], MIDEA_AIRCON1_BIT_MARK, MIDEA_AIRCON1_ZERO_SPACE, MIDEA_AIRCON1_ONE_SPACE); + IR.sendIRbyte(~sendBuffer[i], MIDEA_AIRCON1_BIT_MARK, MIDEA_AIRCON1_ZERO_SPACE, MIDEA_AIRCON1_ONE_SPACE); } // Pause IR.mark(MIDEA_AIRCON1_BIT_MARK); IR.space(MIDEA_AIRCON1_MSG_SPACE); - // Header, two last bytes repeated + // Header, two last uint8_ts repeated IR.mark(MIDEA_AIRCON1_HDR_MARK); IR.space(MIDEA_AIRCON1_HDR_SPACE); - // Six bytes, every second byte is a bitwise not of the previous byte + // Six uint8_ts, every second uint8_t is a bitwise not of the previous uint8_t for (int i=0; i<3; i++) { - IR.sendIRByte(sendBuffer[i], MIDEA_AIRCON1_BIT_MARK, MIDEA_AIRCON1_ZERO_SPACE, MIDEA_AIRCON1_ONE_SPACE); - IR.sendIRByte(~sendBuffer[i], MIDEA_AIRCON1_BIT_MARK, MIDEA_AIRCON1_ZERO_SPACE, MIDEA_AIRCON1_ONE_SPACE); + IR.sendIRbyte(sendBuffer[i], MIDEA_AIRCON1_BIT_MARK, MIDEA_AIRCON1_ZERO_SPACE, MIDEA_AIRCON1_ONE_SPACE); + IR.sendIRbyte(~sendBuffer[i], MIDEA_AIRCON1_BIT_MARK, MIDEA_AIRCON1_ZERO_SPACE, MIDEA_AIRCON1_ONE_SPACE); } // End mark diff --git a/libraries/HeatpumpIR/MideaHeatpumpIR.h b/libraries/HeatpumpIR/MideaHeatpumpIR.h index d3490fe..20602a3 100644 --- a/libraries/HeatpumpIR/MideaHeatpumpIR.h +++ b/libraries/HeatpumpIR/MideaHeatpumpIR.h @@ -37,11 +37,11 @@ class MideaHeatpumpIR : public HeatpumpIR { public: MideaHeatpumpIR(); - void send(IRSender& IR, byte powerModeCmd, byte operatingModeCmd, byte fanSpeedCmd, byte temperatureCmd, byte swingVCmd, byte swingHCmd); + void send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingModeCmd, uint8_t fanSpeedCmd, uint8_t temperatureCmd, uint8_t swingVCmd, uint8_t swingHCmd); private: - void sendMidea(IRSender& IR, byte operatingMode, byte fanSpeed, byte temperature); - void sendMidearaw(IRSender& IR, byte sendBuffer[]); + void sendMidea(IRSender& IR, uint8_t operatingMode, uint8_t fanSpeed, uint8_t temperature); + void sendMidearaw(IRSender& IR, uint8_t sendBuffer[]); }; #endif diff --git a/libraries/HeatpumpIR/MitsubishiHeatpumpIR.cpp b/libraries/HeatpumpIR/MitsubishiHeatpumpIR.cpp index c9922dc..7823e57 100644 --- a/libraries/HeatpumpIR/MitsubishiHeatpumpIR.cpp +++ b/libraries/HeatpumpIR/MitsubishiHeatpumpIR.cpp @@ -31,16 +31,16 @@ MitsubishiFEHeatpumpIR::MitsubishiFEHeatpumpIR() : MitsubishiHeatpumpIR() } -void MitsubishiHeatpumpIR::send(IRSender& IR, byte powerModeCmd, byte operatingModeCmd, byte fanSpeedCmd, byte temperatureCmd, byte swingVCmd, byte swingHCmd) +void MitsubishiHeatpumpIR::send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingModeCmd, uint8_t fanSpeedCmd, uint8_t temperatureCmd, uint8_t swingVCmd, uint8_t swingHCmd) { // Sensible defaults for the heat pump mode - byte powerMode = MITSUBISHI_AIRCON1_MODE_ON; - byte operatingMode = MITSUBISHI_AIRCON1_MODE_HEAT; - byte fanSpeed = MITSUBISHI_AIRCON1_FAN_AUTO; - byte temperature = 23; - byte swingV = MITSUBISHI_AIRCON1_VS_AUTO; - byte swingH = MITSUBISHI_AIRCON1_HS_SWING; + uint8_t powerMode = MITSUBISHI_AIRCON1_MODE_ON; + uint8_t operatingMode = MITSUBISHI_AIRCON1_MODE_HEAT; + uint8_t fanSpeed = MITSUBISHI_AIRCON1_FAN_AUTO; + uint8_t temperature = 23; + uint8_t swingV = MITSUBISHI_AIRCON1_VS_AUTO; + uint8_t swingH = MITSUBISHI_AIRCON1_HS_SWING; if (powerModeCmd == 0) { @@ -155,12 +155,12 @@ void MitsubishiHeatpumpIR::send(IRSender& IR, byte powerModeCmd, byte operatingM sendMitsubishi(IR, powerMode, operatingMode, fanSpeed, temperature, swingV, swingH); } -void MitsubishiHeatpumpIR::sendMitsubishi(IRSender& IR, byte powerMode, byte operatingMode, byte fanSpeed, byte temperature, byte swingV, byte swingH) +void MitsubishiHeatpumpIR::sendMitsubishi(IRSender& IR, uint8_t powerMode, uint8_t operatingMode, uint8_t fanSpeed, uint8_t temperature, uint8_t swingV, uint8_t swingH) { - byte MitsubishiTemplate[] = { 0x23, 0xCB, 0x26, 0x01, 0x00, 0x20, 0x48, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00 }; + uint8_t MitsubishiTemplate[] = { 0x23, 0xCB, 0x26, 0x01, 0x00, 0x20, 0x48, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00 }; // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - byte checksum = 0x00; + uint8_t checksum = 0x00; // Set the operatingmode on the template message MitsubishiTemplate[5] = powerMode; @@ -198,7 +198,7 @@ void MitsubishiHeatpumpIR::sendMitsubishi(IRSender& IR, byte powerMode, byte ope // Data for (unsigned int i=0; i>= 1; + Samsunguint8_t >>= 1; } } @@ -142,7 +142,7 @@ void SamsungHeatpumpIR::sendSamsung(IRSender& IR, byte powerMode, byte operating // Payload header part for (int i=0; i<7; i++) { - IR.sendIRByte(SamsungTemplate[i], SAMSUNG_AIRCON1_BIT_MARK, SAMSUNG_AIRCON1_ZERO_SPACE, SAMSUNG_AIRCON1_ONE_SPACE); + IR.sendIRbyte(SamsungTemplate[i], SAMSUNG_AIRCON1_BIT_MARK, SAMSUNG_AIRCON1_ZERO_SPACE, SAMSUNG_AIRCON1_ONE_SPACE); } // Pause + new header @@ -154,7 +154,7 @@ void SamsungHeatpumpIR::sendSamsung(IRSender& IR, byte powerMode, byte operating // Payload power message part for (int i=7; i<14; i++) { - IR.sendIRByte(SamsungTemplate[i], SAMSUNG_AIRCON1_BIT_MARK, SAMSUNG_AIRCON1_ZERO_SPACE, SAMSUNG_AIRCON1_ONE_SPACE); + IR.sendIRbyte(SamsungTemplate[i], SAMSUNG_AIRCON1_BIT_MARK, SAMSUNG_AIRCON1_ZERO_SPACE, SAMSUNG_AIRCON1_ONE_SPACE); } // Pause + new header @@ -166,7 +166,7 @@ void SamsungHeatpumpIR::sendSamsung(IRSender& IR, byte powerMode, byte operating // Payload data message part for (int i=14; i<21; i++) { - IR.sendIRByte(SamsungTemplate[i], SAMSUNG_AIRCON1_BIT_MARK, SAMSUNG_AIRCON1_ZERO_SPACE, SAMSUNG_AIRCON1_ONE_SPACE); + IR.sendIRbyte(SamsungTemplate[i], SAMSUNG_AIRCON1_BIT_MARK, SAMSUNG_AIRCON1_ZERO_SPACE, SAMSUNG_AIRCON1_ONE_SPACE); } // End mark diff --git a/libraries/HeatpumpIR/SamsungHeatpumpIR.h b/libraries/HeatpumpIR/SamsungHeatpumpIR.h index aab79fd..c33e661 100644 --- a/libraries/HeatpumpIR/SamsungHeatpumpIR.h +++ b/libraries/HeatpumpIR/SamsungHeatpumpIR.h @@ -33,10 +33,10 @@ class SamsungHeatpumpIR : public HeatpumpIR { public: SamsungHeatpumpIR(); - void send(IRSender& IR, byte powerModeCmd, byte operatingModeCmd, byte fanSpeedCmd, byte temperatureCmd, byte swingVCmd, byte swingHCmd); + void send(IRSender& IR, uint8_t powerModeCmd, uint8_t operatingModeCmd, uint8_t fanSpeedCmd, uint8_t temperatureCmd, uint8_t swingVCmd, uint8_t swingHCmd); private: - void sendSamsung(IRSender& IR, byte powerMode, byte operatingMode, byte fanSpeed, byte temperature, byte swingV); + void sendSamsung(IRSender& IR, uint8_t powerMode, uint8_t operatingMode, uint8_t fanSpeed, uint8_t temperature, uint8_t swingV); }; #endif diff --git a/libraries/HeatpumpIR/examples/HisenseTest/HisenseTest.ino b/libraries/HeatpumpIR/examples/HisenseTest/HisenseTest.ino index b4a5481..3215480 100644 --- a/libraries/HeatpumpIR/examples/HisenseTest/HisenseTest.ino +++ b/libraries/HeatpumpIR/examples/HisenseTest/HisenseTest.ino @@ -1,47 +1,40 @@ +#include #include IRSender irSender(3); // IR led on Duemilanove digital pin 3 -HisenseHeatpumpIR *heatpumpIR; +HisenseHeatpumpIR *heatpumpIR; void setup() { - Serial.begin(9600); delay(500); heatpumpIR = new HisenseHeatpumpIR(); Serial.println(F("Starting")); - - - } void loop() { - int i = 0; - prog_char* buf; + const char* buf; - - // Send the same IR command to all supported heatpumps Serial.print(F("Sending IR to ")); // Print the model - buf = (prog_char*)heatpumpIR->model(); + buf = heatpumpIR->model(); // 'model' is a PROGMEM pointer, so need to write a byte at a time while (char modelChar = pgm_read_byte(buf++)) { Serial.print(modelChar); } Serial.print(F(", info: ")); - // Print the info - buf = (prog_char*)heatpumpIR->info(); + // Print the info + buf = heatpumpIR->info(); // 'info' is a PROGMEM pointer, so need to write a byte at a time while (char infoChar = pgm_read_byte(buf++)) { Serial.print(infoChar); } - Serial.println(); + Serial.println(); - heatpumpIR->send(irSender, POWER_ON, MODE_HEAT, FAN_3, 30, VDIR_AUTO, HDIR_AUTO); delay(1500); heatpumpIR->send(irSender, POWER_ON, MODE_DRY, FAN_2, 20, VDIR_AUTO, HDIR_AUTO); @@ -50,7 +43,6 @@ void loop() delay(1500); heatpumpIR->send(irSender, POWER_ON, MODE_COOL, FAN_1, 18, VDIR_AUTO, HDIR_AUTO); delay(2500); - heatpumpIR->send(irSender, POWER_OFF, NULL, NULL, NULL, NULL, NULL); + heatpumpIR->send(irSender, POWER_OFF, MODE_COOL, FAN_1, 18, VDIR_AUTO, HDIR_AUTO); delay(1500); - -} +} \ No newline at end of file diff --git a/libraries/HeatpumpIR/examples/MideaRelayControl/MideaRelayControl.ino b/libraries/HeatpumpIR/examples/MideaRelayControl/MideaRelayControl.ino index efd577d..80a5bdb 100644 --- a/libraries/HeatpumpIR/examples/MideaRelayControl/MideaRelayControl.ino +++ b/libraries/HeatpumpIR/examples/MideaRelayControl/MideaRelayControl.ino @@ -1,3 +1,4 @@ +#include #include // https://github.com/ToniA/arduino-heatpumpir #include // http://playground.arduino.cc/Code/Button @@ -34,8 +35,8 @@ const byte heatpumpOff = 0; const byte heatpumpNormal = 1; const byte heatpumpMaintenance = 2; -Button relay1 = Button(11,PULLUP); // Heatpump ON-OFF state -Button relay2 = Button(12,PULLUP); // FP mode (maintenance heating at 8 degrees C) ON-OFF state +Button relay1 = Button(11, INPUT_PULLUP); // Heatpump ON-OFF state +Button relay2 = Button(12, INPUT_PULLUP); // FP mode (maintenance heating at 8 degrees C) ON-OFF state IRSender irSender(9); // IR led on Duemilanove digital pin 9 diff --git a/libraries/HeatpumpIR/examples/MySensorsNode/MySensorsNode.ino b/libraries/HeatpumpIR/examples/MySensorsNode/MySensorsNode.ino index 366e79c..a5b303b 100644 --- a/libraries/HeatpumpIR/examples/MySensorsNode/MySensorsNode.ino +++ b/libraries/HeatpumpIR/examples/MySensorsNode/MySensorsNode.ino @@ -1,3 +1,5 @@ +#include + // HeatpumpIR libraries #include #include @@ -85,8 +87,7 @@ void loop() // Handle incoming messages from the MySensors Gateway void incomingMessage(const MyMessage &message) { - const char *irData; - long irCommand; + const char *irData; // V_IR type message if (message.type==V_IR_SEND) { @@ -156,10 +157,10 @@ libraries\HeatpumpIR\HeatpumpIR.h for the constants byte fan = (irCommand & 0x00000F00) >> 8; byte temp = (irCommand & 0x000000FF); - prog_char* buf; + const char* buf; Serial.print(F("Model: ")); - buf = (prog_char*)heatpumpIR[model]->model(); + buf = heatpumpIR[model]->model(); // 'model' is a PROGMEM pointer, so need to write a byte at a time while (char modelChar = pgm_read_byte(buf++)) { @@ -188,14 +189,14 @@ libraries\HeatpumpIR\HeatpumpIR.h for the constants if (model == 0) { Serial.println(F("Scheduling timer cancellation on Panasonic CKP heatpump...")); - panasonicCKPTimer = timer.after(120000, panasonicCancelTimer, (void *)NULL); // Called after 2 minutes + panasonicCKPTimer = timer.after(120000, panasonicCancelTimer); // Called after 2 minutes } } } // Cancel the timer on the Panasonic CKP heatpump -void panasonicCancelTimer(void *context) +void panasonicCancelTimer() { PanasonicCKPHeatpumpIR *panasonicCKPHeatpumpIR = new PanasonicCKPHeatpumpIR(); diff --git a/libraries/HeatpumpIR/examples/PanasonicCKPTimer/PanasonicCKPTimer.ino b/libraries/HeatpumpIR/examples/PanasonicCKPTimer/PanasonicCKPTimer.ino index 680026c..dcacf44 100644 --- a/libraries/HeatpumpIR/examples/PanasonicCKPTimer/PanasonicCKPTimer.ino +++ b/libraries/HeatpumpIR/examples/PanasonicCKPTimer/PanasonicCKPTimer.ino @@ -1,5 +1,7 @@ +#include + #include -#include +#include // https://github.com/JChristensen/Timer /* This schema demonstrates how to control the Panasonic CKP power state change. The CKP does not have discrete @@ -34,8 +36,8 @@ void setup() heatpumpIR->send(irSender, POWER_ON, MODE_HEAT, FAN_2, 24, VDIR_UP, HDIR_AUTO); Serial.println("The heatpump should have beeped, and the TIMER led should be ON"); - timer.after(60000, panasonicIsOn, NULL); // Called after 1 minute - timer.after(120000, panasonicCancelTimer, NULL); // Called after 2 minutes + timer.after(60000, panasonicIsOn); // Called after 1 minute + timer.after(120000, panasonicCancelTimer); // Called after 2 minutes } @@ -44,12 +46,12 @@ void loop() timer.update(); } -void panasonicIsOn(void *context) +void panasonicIsOn() { Serial.println("The heatpump should should turn ON by now, the TIMER led is still ON"); } -void panasonicCancelTimer(void *context) +void panasonicCancelTimer() { heatpumpIR->sendPanasonicCKPCancelTimer(irSender); Serial.println("The TIMER led should now be OFF"); diff --git a/libraries/HeatpumpIR/examples/simple/simple.ino b/libraries/HeatpumpIR/examples/simple/simple.ino index b5d0808..229c936 100644 --- a/libraries/HeatpumpIR/examples/simple/simple.ino +++ b/libraries/HeatpumpIR/examples/simple/simple.ino @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -25,13 +27,13 @@ void setup() void loop() { int i = 0; - prog_char* buf; + const char* buf; do { // Send the same IR command to all supported heatpumps Serial.print(F("Sending IR to ")); - buf = (prog_char*)heatpumpIR[i]->model(); + buf = heatpumpIR[i]->model(); // 'model' is a PROGMEM pointer, so need to write a byte at a time while (char modelChar = pgm_read_byte(buf++)) { @@ -39,7 +41,7 @@ void loop() } Serial.print(F(", info: ")); - buf = (prog_char*)heatpumpIR[i]->info(); + buf = heatpumpIR[i]->info(); // 'info' is a PROGMEM pointer, so need to write a byte at a time while (char infoChar = pgm_read_byte(buf++)) { diff --git a/libraries/MySensors/examples/HeatpumpIRController/HeatpumpIRController.ino b/libraries/MySensors/examples/HeatpumpIRController/HeatpumpIRController.ino index 84ffd71..79e153f 100644 --- a/libraries/MySensors/examples/HeatpumpIRController/HeatpumpIRController.ino +++ b/libraries/MySensors/examples/HeatpumpIRController/HeatpumpIRController.ino @@ -1,3 +1,5 @@ +#include + // HeatpumpIR libraries, https://github.com/ToniA/arduino-heatpumpir #include #include