The default length in the IRLib sendRAW function call is defined as 8 bit which limits the length to 255 marks and spaces. This is sufficient for 99.9% of Infrared protocols, but only 99% of long Air Conditioner protocols.
We have recently added support to AnlysIR for the DAIKIN280AC protocol, which as our naming convention suggests has 280 bits which translates to circa 583 marks and spaces when taking headers into account.
If you fall into the unlucky 0.1% (or 1%), below are some changes that can be made to the IRlib library source to allow sending signals with more than 255 marks/spaces...in this case 583.
These changes relates to following version of IRLib.
File: IRLib.cpp Lines 151->163 Notes: variable "i" and "len" are changed to type unsigned int.* Version 1.5 June 2014
* Copyright 2014 by Chris Young http://cyborg5.com
https://github.com/cyborg5/IRLib/
Code: Select all
void IRsendRaw::send(unsigned int buf[], unsigned int len, unsigned char hz)
{
enableIROut(hz);
for (unsigned int i = 0; i < len; i++) {
if (i & 1) {
space(buf[i]);
}
else {
mark(buf[i]);
}
}
space(0); // Just to be sure
}
File: IRLib.h Lines 205->209 Notes: variable "len" is changed to type unsigned int.
Code: Select all
class IRsendRaw: public virtual IRsendBase
{
public:
void send(unsigned int buf[], unsigned int len, unsigned char khz);
};
for reference here is an example sketch using this workaround to send a very very long DAKIN280AC Infrared signal using IRLib.
Code: Select all
#include <IRLib.h>
IRsend My_Sender;
int led = 13;
int khz = 37;//modulation frequency
unsigned int Signal_0_0[] = {504, 360, 512, 360, 504, 360, 508, 356, 508, 360, 504, 25052, 3536, 1664, 504, 1228, 504, 360, 508, 360, 508, 360, 480, 1252, 504, 360, 508, 360, 508, 356, 512, 360, 504, 1224, 536, 332, 504, 1232, 504, 1224, 508, 360, 504, 1228, 504, 1228, 508, 1224, 508, 1224, 512, 1224, 504, 364, 504, 360, 504, 1224, 512, 360, 508, 360, 504, 360, 504, 360, 508, 364, 504, 360, 480, 388, 504, 360, 504, 360, 508, 360, 508, 1224, 508, 360, 504, 1228, 508, 360, 504, 360, 508, 360, 504, 1224, 512, 1224, 508, 356, 508, 360, 512, 352, 512, 360, 504, 1224, 508, 360, 508, 356, 512, 356, 508, 360, 504, 360, 508, 360, 504, 364, 508, 356, 508, 360, 504, 360, 508, 360, 508, 1224, 508, 1224, 508, 1224, 508, 360, 508, 360, 504, 1228, 504, 1228, 508, 1224, 508, 35448, 3540, 1656, 508, 1224, 508, 360, 508, 360, 504, 360, 508, 1224, 508, 356, 512, 360, 500, 360, 512, 360, 504, 1224, 508, 360, 512, 1220, 508, 1228, 504, 360, 508, 1224, 504, 1232, 504, 1224, 508, 1224, 512, 1224, 508, 364, 500, 360, 504, 1232, 504, 360, 508, 356, 508, 360, 504, 360, 508, 360, 508, 360, 508, 356, 508, 360, 508, 360, 504, 360, 508, 360, 508, 1224, 504, 360, 508, 360, 508, 360, 508, 360, 504, 1224, 508, 360, 508, 360, 508, 356, 508, 1224, 508, 1224, 512, 360, 504, 360, 508, 356, 508, 360, 504, 360, 508, 360, 508, 1224, 508, 360, 504, 360, 508, 1224, 512, 356, 508, 360, 504, 360, 508, 360, 504, 1232, 504, 360, 532, 336, 504, 360, 504, 360, 512, 1224, 504, 35448, 3540, 1656, 508, 1224, 512, 360, 504, 360, 508, 356, 508, 1224, 512, 360, 504, 360, 508, 356, 508, 360, 504, 1228, 508, 360, 504, 1228, 504, 1228, 508, 356, 508, 1228, 504, 1228, 504, 1232, 504, 1224, 508, 1224, 508, 360, 504, 360, 512, 1224, 504, 360, 508, 360, 504, 360, 508, 364, 504, 360, 508, 356, 508, 360, 504, 360, 508, 360, 508, 356, 512, 356, 508, 360, 508, 356, 508, 360, 504, 364, 508, 360, 504, 360, 508, 356, 508, 360, 504, 360, 504, 368, 504, 1224, 508, 1224, 508, 1228, 508, 356, 508, 360, 504, 360, 512, 356, 508, 360, 508, 356, 508, 1224, 508, 1228, 504, 360, 508, 360, 504, 360, 508, 356, 508, 360, 512, 356, 508, 360, 504, 360, 508, 360, 504, 360, 504, 364, 508, 360, 504, 360, 508, 360, 504, 360, 508, 1224, 508, 360, 508, 1224, 508, 356, 508, 360, 508, 356, 512, 360, 504, 360, 508, 360, 504, 360, 508, 360, 504, 360, 512, 356, 508, 360, 504, 360, 484, 384, 504, 360, 512, 360, 504, 360, 504, 360, 508, 1224, 512, 1224, 504, 360, 508, 360, 504, 360, 508, 360, 508, 356, 512, 356, 508, 360, 504, 360, 508, 360, 532, 332, 508, 1228, 504, 1228, 504, 360, 508, 356, 512, 360, 508, 356, 508, 360, 504, 360, 508, 360, 508, 356, 508, 360, 508, 360, 504, 360, 508, 360, 504, 364, 508, 352, 512, 360, 504, 360, 512, 356, 504, 1224, 512, 360, 504, 360, 508, 360, 504, 360, 508, 360, 504, 1228, 508, 1224, 508, 360, 512, 352, 508, 360, 508, 360, 504, 360, 508, 360, 504, 360, 504, 1228, 508, 360, 508, 360, 504, 360, 504, 360, 512, 360, 504, 360, 508, 360, 504, 360, 508, 1224, 508, 360, 508, 356, 508, 360, 504, 364, 504, 360, 504, 1232, 504, 1224, 536}; //AnalysIR Batch Export - RAW
void setup()
{
Serial.begin(9600);
delay(5000);
Serial.println(sizeof(Signal_0_0) / sizeof(int));
pinMode(led, OUTPUT);
}
void loop() {
digitalWrite(led, HIGH);
My_Sender.IRsendRaw::send(Signal_0_0, sizeof(Signal_0_0) / sizeof(int), khz);
delay(100);
digitalWrite(led, LOW);
delay(4900);
}