Skip to content

Commit ef69840

Browse files
committed
Improved printIRSendUsage()
1 parent 2c2be06 commit ef69840

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,8 @@ Send with: IrSender.sendLG(0x2, 0x3434, <numberOfRepeats>);
387387
You will discover that **the address is a constant** and the commands sometimes are sensibly grouped.<br/>
388388
If you are uncertain about the numbers of repeats to use for sending, **3** is a good starting point. If this works, you can check lower values afterwards.
389389

390+
If you have enabled `DECODE_DISTANCE_WIDTH`, the code printed by `printIRSendUsage()` **differs between 8 and 32 bit platforms**, so it is best to run the receiving program on the same platform as the sending program.
391+
390392
The codes found in the [irdb database](https://github.com/probonopd/irdb/tree/master/codes) specify a **device**, a **subdevice** and a **function**. Most of the times, *device* and *subdevice* can be taken as upper and lower byte of the **address parameter** and *function* is the **command parameter** for the **new structured functions** with address, command and repeat-count parameters like e.g. `IrSender.sendNEC((device << 8) | subdevice, 0x19, 2)`.<br/>
391393
An **exact mapping** can be found in the [IRP definition files for IR protocols](https://github.com/probonopd/MakeHex/tree/master/protocols). "D" and "S" denotes device and subdevice and "F" denotes the function.
392394

src/IRReceive.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1243,22 +1243,24 @@ uint32_t IRrecv::getTotalDurationOfRawData() {
12431243
/**
12441244
* Function to print values and flags of IrReceiver.decodedIRData in one line.
12451245
* Ends with println().
1246+
* !!!Attention: The result differs on a 8 bit or 32 bit platform!!!
12461247
*
12471248
* @param aSerial The Print object on which to write, for Arduino you can use &Serial.
12481249
*/
12491250
void IRrecv::printIRSendUsage(Print *aSerial) {
12501251
if (decodedIRData.protocol != UNKNOWN
12511252
&& (decodedIRData.flags & (IRDATA_FLAGS_IS_AUTO_REPEAT | IRDATA_FLAGS_IS_REPEAT)) == 0x00) {
12521253
#if defined(DECODE_DISTANCE_WIDTH)
1253-
aSerial->print(F("Send with:"));
12541254
uint_fast8_t tNumberOfArrayData = 0;
12551255
if (decodedIRData.protocol == PULSE_DISTANCE || decodedIRData.protocol == PULSE_WIDTH) {
12561256
# if __INT_WIDTH__ < 32
1257+
aSerial->print(F("Send on a 8 bit platform with:"));
12571258
tNumberOfArrayData = ((decodedIRData.numberOfBits - 1) / 32) + 1;
12581259
if(tNumberOfArrayData > 1) {
12591260
aSerial->println();
12601261
aSerial->print(F(" uint32_t tRawData[]={0x"));
12611262
# else
1263+
aSerial->print(F("Send on a 32 bit platform with:"));
12621264
tNumberOfArrayData = ((decodedIRData.numberOfBits - 1) / 64) + 1;
12631265
if(tNumberOfArrayData > 1) {
12641266
aSerial->println();
@@ -1358,6 +1360,11 @@ void IRrecv::printIRSendUsage(Print *aSerial) {
13581360
aSerial->print(F(");"));
13591361
aSerial->println();
13601362
}
1363+
#if defined(DECODE_DISTANCE_WIDTH)
1364+
else {
1365+
aSerial->print(F("Send with:"));
1366+
}
1367+
#endif
13611368
}
13621369

13631370
/**

0 commit comments

Comments
 (0)