@@ -223,6 +223,7 @@ void checkReceivedRawData(IRRawDataType aRawData) {
223223 Serial.println ();
224224}
225225
226+ #if defined(DECODE_DISTANCE_WIDTH)
226227void checkReceivedArray (uint32_t *aRawDataArrayPointer, uint8_t aArraySize) {
227228 // wait until signal has received
228229 while (!sDataJustReceived ) {
@@ -243,15 +244,16 @@ void checkReceivedArray(uint32_t *aRawDataArrayPointer, uint8_t aArraySize) {
243244 IrReceiver.printIRResultRawFormatted (&Serial, true );
244245 }
245246#endif
247+
246248 if (IrReceiver.decodedIRData .protocol == PULSE_DISTANCE || IrReceiver.decodedIRData .protocol == PULSE_WIDTH) {
247249 for (uint_fast8_t i = 0 ; i < aArraySize; ++i) {
248250 if (IrReceiver.decodedIRData .decodedRawDataArray [i] != *aRawDataArrayPointer) {
249251 Serial.print (F (" ERROR: Received data=0x" ));
250- #if (__INT_WIDTH__ < 32)
252+ # if (__INT_WIDTH__ < 32)
251253 Serial.print (IrReceiver.decodedIRData .decodedRawDataArray [i], HEX);
252- #else
254+ # else
253255 PrintULL::print (&Serial, IrReceiver.decodedIRData .decodedRawDataArray [i], HEX);
254- #endif
256+ # endif
255257 Serial.print (F (" != sent data=0x" ));
256258 Serial.println (*aRawDataArrayPointer, HEX);
257259 }
@@ -264,6 +266,7 @@ void checkReceivedArray(uint32_t *aRawDataArrayPointer, uint8_t aArraySize) {
264266 }
265267 Serial.println ();
266268}
269+ #endif
267270
268271/*
269272 * Test callback function
@@ -466,65 +469,67 @@ void loop() {
466469 delay (DELAY_AFTER_SEND);
467470# endif
468471
469- # if defined(DISTANCE_DO_MSB_DECODING)
472+ # if defined(DECODE_DISTANCE_WIDTH)
473+ # if defined(DISTANCE_DO_MSB_DECODING)
470474 Serial.println (F (" Send generic 52 bit PulseDistance 0x43D8613C and 0x3BC3B MSB first" ));
471475 Serial.flush ();
472- # if __INT_WIDTH__ < 32
476+ # if __INT_WIDTH__ < 32
473477 tRawData[0 ] = 0x43D8613C ; // MSB of tRawData[0] is sent first
474478 tRawData[1 ] = 0x3BC3B ;
475479 IrSender.sendPulseDistanceWidthFromArray (38 , 8900 , 4450 , 550 , 1700 , 550 , 600 , &tRawData[0 ], 52 , PROTOCOL_IS_MSB_FIRST,
476480 SEND_STOP_BIT, 0 , NO_REPEATS);
477481 checkReceivedArray (tRawData, 2 );
478- # else
482+ # else
479483 IrSender.sendPulseDistanceWidth (38 , 8900 , 4450 , 550 , 1700 , 550 , 600 , 0x43D8613CBC3B , 52 , PROTOCOL_IS_MSB_FIRST,
480484 SEND_STOP_BIT, 0 , NO_REPEATS);
481485 checkReceivedRawData (0x43D8613CBC3B );
482- # endif
486+ # endif
483487 delay (DELAY_AFTER_SEND);
484488
485489 Serial.println (F (" Send generic 52 bit PulseDistanceWidth 0x43D8613C and 0x3BC3B MSB first" ));
486490 Serial.flush ();
487491 // Real PulseDistanceWidth (constant bit length) does not require a stop bit
488- # if __INT_WIDTH__ < 32
492+ # if __INT_WIDTH__ < 32
489493 IrSender.sendPulseDistanceWidthFromArray (38 , 300 , 600 , 600 , 300 , 300 , 600 , &tRawData[0 ], 52 , PROTOCOL_IS_MSB_FIRST,
490494 SEND_NO_STOP_BIT, 0 , 0 );
491495 checkReceivedArray (tRawData, 2 );
492- # else
496+ # else
493497 IrSender.sendPulseDistanceWidth (38 , 300 , 600 , 600 , 300 , 300 , 600 , 0x123456789ABC , 52 , PROTOCOL_IS_MSB_FIRST,
494498 SEND_NO_STOP_BIT, 0 , 0 );
495499 checkReceivedRawData (0x123456789ABC );
496- # endif
500+ # endif
497501 delay (DELAY_AFTER_SEND);
498- # else
502+ # else // defined(DISTANCE_DO_MSB_DECODING)
499503 Serial.println (F (" Send generic 52 bit PulseDistance 0xDCBA9 87654321 LSB first" ));
500504 Serial.flush ();
501- # if __INT_WIDTH__ < 32
505+ # if __INT_WIDTH__ < 32
502506 tRawData[0 ] = 0x87654321 ; // LSB of tRawData[0] is sent first
503507 tRawData[1 ] = 0xDCBA9 ;
504508 IrSender.sendPulseDistanceWidthFromArray (38 , 8900 , 4450 , 550 , 1700 , 550 , 600 , &tRawData[0 ], 52 , PROTOCOL_IS_LSB_FIRST,
505509 SEND_STOP_BIT, 0 , NO_REPEATS);
506510 checkReceivedArray (tRawData, 2 );
507- # else
511+ # else
508512 IrSender.sendPulseDistanceWidth (38 , 8900 , 4450 , 550 , 1700 , 550 , 600 , 0xDCBA987654321 , 52 , PROTOCOL_IS_LSB_FIRST,
509513 SEND_STOP_BIT, 0 , NO_REPEATS);
510514 checkReceivedRawData (0xDCBA987654321 );
511- # endif
515+ # endif
512516 delay (DELAY_AFTER_SEND);
513517
514518 Serial.println (F (" Send generic 52 bit PulseDistanceWidth 0xDCBA9 87654321 LSB first" ));
515519 Serial.flush ();
516520 // Real PulseDistanceWidth (constant bit length) does not require a stop bit
517- # if __INT_WIDTH__ < 32
521+ # if __INT_WIDTH__ < 32
518522 IrSender.sendPulseDistanceWidthFromArray (38 , 300 , 600 , 600 , 300 , 300 , 600 , &tRawData[0 ], 52 , PROTOCOL_IS_LSB_FIRST,
519523 SEND_NO_STOP_BIT, 0 , 0 );
520524 checkReceivedArray (tRawData, 2 );
521- # else
525+ # else
522526 IrSender.sendPulseDistanceWidth (38 , 300 , 600 , 600 , 300 , 300 , 600 , 0xDCBA987654321 , 52 , PROTOCOL_IS_LSB_FIRST,
523527 SEND_NO_STOP_BIT, 0 , 0 );
524528 checkReceivedRawData (0xDCBA987654321 );
525- # endif
529+ # endif
526530 delay (DELAY_AFTER_SEND);
527- # endif
531+ # endif // defined(DISTANCE_DO_MSB_DECODING)
532+ # endif // defined(DECODE_DISTANCE_WIDTH)
528533
529534# if defined(DECODE_MAGIQUEST)
530535 Serial.println (F (" Send MagiQuest 0x6BCDFF00, 0x176 as generic 55 bit PulseDistanceWidth MSB first" ));
0 commit comments