Testing experimental NEC-48 support (#1463)

This commit is contained in:
Michal Škuta
2024-12-15 09:03:36 +01:00
committed by GitHub
parent 31cdec52d5
commit 8325a85d09
3 changed files with 19 additions and 1 deletions

View File

@ -194,7 +194,11 @@ size_t IRsend::write(IRData *aIRSendData, int_fast8_t aNumberOfRepeats) {
* Order of protocols is in guessed relevance :-)
*/
if (tProtocol == NEC) {
sendNEC(tAddress, tCommand, aNumberOfRepeats);
if (aIRSendData->numberOfBits == 48) {
sendNEC48(tAddress, tCommand, aNumberOfRepeats);
} else {
sendNEC(tAddress, tCommand, aNumberOfRepeats);
}
} else if (tProtocol == SAMSUNG) {
sendSamsung(tAddress, tCommand, aNumberOfRepeats);

View File

@ -522,6 +522,7 @@ public:
void sendNEC2(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats);
void sendNECRaw(uint32_t aRawData, int_fast8_t aNumberOfRepeats = NO_REPEATS);
// NEC variants
void sendNEC48(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats);
void sendOnkyo(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats);
void sendApple(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats);

View File

@ -152,6 +152,19 @@ void IRsend::sendNEC2(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOf
sendPulseDistanceWidth(&NEC2ProtocolConstants, computeNECRawDataAndChecksum(aAddress, aCommand), NEC_BITS, aNumberOfRepeats);
}
/*
* Experimental nec48 protocol based by:
* aCommand contains command and E variable
*/
void IRsend::sendNEC48(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats) {
uint32_t necRawArray[2];
necRawArray[0] = computeNECRawDataAndChecksum(aAddress, aCommand >> 8);
uint8_t eValue = aCommand & 0x00FF;
necRawArray[1] = (uint32_t) ((~eValue) << 8) | eValue;
sendPulseDistanceWidthFromArray(&NECProtocolConstants, (uint32_t *) &necRawArray, NEC_BITS + 16, aNumberOfRepeats);
}
/*
* Repeat commands should be sent in a 110 ms raster.
* There is NO delay after the last sent repeat!