Merge pull request #97 from nelgi/master

Enable Arduino Mega pins 44,45,46 + checksum calc fixes
This commit is contained in:
Toni 2019-11-19 08:42:58 +02:00 committed by GitHub
commit 6d472ca17a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 44 deletions

View File

@ -114,10 +114,12 @@ void IRSenderPWM::setFrequency(int frequency)
// Fall-through to 46, timer 5 controls pins 44, 45 and 46 on Arduino Mega
case 45:
case 46:
TCCR5A = _BV(WGM51) | _BV(WGM50);
TCCR5A = _BV(WGM51); // This gives correct data from pins 44,45,46 and similar range to pin 9
TCCR5B = _BV(WGM53) | _BV(CS50);
ICR5 = pwmval16;
OCR5A = pwmval16 / 3;
OCR5B = pwmval16 / 3; // Also enable pin 45
OCR5C = pwmval16 / 3; // Also enable pin 44
#else
// Arduino Duemilanove etc
#if !defined(__AVR_ATmega8__)
@ -264,4 +266,4 @@ void IRSenderPWM::space(int spaceLength)
}
}
#endif // ESP8266
#endif // ESP8266

View File

@ -97,45 +97,7 @@ void ToshibaDaiseikaiHeatpumpIR::sendDaiseikai(IRSender& IR, uint8_t operatingMo
// Checksum
for (int i=0; i<8; i++) {
checksum += IR.bitReverse(sendBuffer[i]);
}
// There's something really strange with the checksum calculation...
// With these many of the codes matchs with the code from the real Carrier remote
// Still certain temperatures do not work with fan speeds 1, 2 or 5
switch (sendBuffer[6] & 0xF0) {
case 0x00: // MODE_AUTO - certain temperature / fan speed combinations do not work
checksum += 0x02;
switch (sendBuffer[6] & 0x0F) {
case 0x02: // FAN1
case 0x03: // FAN5
case 0x06: // FAN2
checksum += 0x80;
break;
}
break;
case 0x40: // MODE_DRY - all settings should work
checksum += 0x02;
break;
case 0xC0: // MODE_HEAT - certain temperature / fan speed combinations do not work
switch (sendBuffer[6] & 0x0F) {
case 0x05: // FAN4
case 0x06: // FAN2
checksum += 0xC0;
break;
}
break;
case 0x20: // MODE_FAN - all settings should work
checksum += 0x02;
switch (sendBuffer[6] & 0x0F) {
case 0x02: // FAN1
case 0x03: // FAN5
case 0x06: // FAN2
checksum += 0x80;
break;
}
break;
checksum ^= IR.bitReverse(sendBuffer[i]);
}
sendBuffer[8] = IR.bitReverse(checksum);

View File

@ -12,10 +12,13 @@
// https://github.com/ToniA/arduino-heatpumpir/issues/23
#define DAISEIKAI_AIRCON1_HDR_MARK 4320
#define DAISEIKAI_AIRCON1_HDR_SPACE 4350
#define DAISEIKAI_AIRCON1_BIT_MARK 500
//#define DAISEIKAI_AIRCON1_BIT_MARK 500 // Adjusted for compatibility - remote WH-H05JE
#define DAISEIKAI_AIRCON1_BIT_MARK 550 // Adjusted for compatibility - remote WH-H05JE
#define DAISEIKAI_AIRCON1_ONE_SPACE 1650
#define DAISEIKAI_AIRCON1_ZERO_SPACE 550
#define DAISEIKAI_AIRCON1_MSG_SPACE 7400
//#define DAISEIKAI_AIRCON1_ZERO_SPACE 550 // Adjusted for compatibility - remote WH-H05JE
#define DAISEIKAI_AIRCON1_ZERO_SPACE 485 // Adjusted for compatibility - remote WH-H05JE
//#define DAISEIKAI_AIRCON1_MSG_SPACE 7400 // Adjusted so that MSG_SPACE would be always inserted
#define DAISEIKAI_AIRCON1_MSG_SPACE 7900 // Adjusted so that MSG_SPACE would be always inserted
// Toshiba Daiseikai (Carrier) codes. Same as CarrierNQV ?
#define DAISEIKAI_AIRCON1_MODE_AUTO 0x00 // Operating mode