16 Commits

Author SHA1 Message Date
Rafi Khan
4cdac5fcc8 Revert "Added ESP32 IR receive support (IRsend not implemented yet)." 2017-04-05 10:27:46 -06:00
Rafi Khan
e0c2649b9f Merge pull request #425 from marcmerlin/master
Added ESP32 IR receive support (IRsend not implemented yet).
2017-04-01 12:55:05 -06:00
Marc MERLIN
419c948c29 Fixed rev to 2.3.3 and added info on timer used. 2017-04-01 08:32:37 -07:00
Marc MERLIN
9133814e60 Rev'ed to 2.2.4. 2017-03-31 23:10:07 -07:00
Marc MERLIN
3875097df9 Merge branch 'master' of github.com:marcmerlin/Arduino-IRremote 2017-03-31 22:33:16 -07:00
Marc MERLIN
88b294a0cd change no-op defines from '1' to ''. 2017-03-31 22:32:48 -07:00
Marc MERLIN
ffdb6081ae Merge branch 'master' into master 2017-03-31 22:04:36 -07:00
Marc MERLIN
6b8f2bdbfc move comment about 'or else' chips that use TIMER2. 2017-03-31 22:01:31 -07:00
Marc MERLIN
eae9de4307 Cleaned up ESP32 integration, reverted ESP32 ifdefs on irreceive examples.
- fixed indenting on existing code in a few places for consistency
- introduced IR_TIMER_USE_ESP32 for ifdefs within the code as per
  request
- added comments explaining what's missing for irsend support on ESP32
- IRrecvDemo.ino gets a warning before and after interrupt is enabled in
  case it causes a crash

TESTED=IoTuz ESP32 board and original 328p arduino to make sure current
code did not break.
2017-03-31 21:52:52 -07:00
Rafi Khan
513e104515 Merge pull request #427 from philipphenkel/lego_pf_integer_overflow_2
Fix calculation of pause length in LEGO PF protocol
2017-03-27 16:25:19 -06:00
Philipp Henkel
ccc9d0135c Add Lego fix to change and bump version up to 2.2.3 2017-03-27 19:57:25 +02:00
Philipp Henkel
257a15130f Fix calculation of pause length in LEGO PF protocol
Fix #384 Integer overflow in LEGO Power Functions affects pause between
messages
Is rebased version of PR #385
2017-03-26 22:32:55 +02:00
Marc MERLIN
1b56da6cc7 Rename ESP32 timer name so that it doesn't conflict with other timers. 2017-03-19 21:28:14 -07:00
Marc MERLIN
aa8f7b31fe Added ESP32 IR receive support (IRsend not implemented yet).
- disable a lot of defines not relevant to ESP32, set them to 1 (no-op)
- change default IR pin to 35 from 11
- changed serial speed to 115200 (9600 is too slow to keep up with IR input)
- irSend disables code that will not compile on ESP32. It won't work,
  but it won't break compilation either.
2017-03-19 20:27:56 -07:00
Rafi Khan
048efb23a2 Merge pull request #414 from z3t0/z3t0-patch-1
Update ISSUE_TEMPLATE.md
2017-02-06 22:26:51 -06:00
Rafi Khan
4f24b696cf Update ISSUE_TEMPLATE.md 2017-02-03 21:18:47 -06:00
13 changed files with 54 additions and 221 deletions

View File

@@ -15,9 +15,8 @@ These are the active contributors of this project that you may contact if there
- [csBlueChip](https://github.com/csbluechip) : Active contributor, who contributed major and vital changes to the code base.
- [Sebazzz](https://github.com/sebazz): Contributor
- [lumbric](https://github.com/lumbric): Contributor
- [ElectricRCAircraftGuy](https://github.com/electricrcaircraftguy): Contributor
- [henkel](https://github.com/henkel): Contributor
- [ElectricRCAircraftGuy](https://github.com/electricrcaircraftguy): Active Contributor
- [philipphenkel](https://github.com/philipphenkel): Active Contributor
- [MCUdude](https://github.com/MCUdude): Contributor
- [salocinx](https://github.com/salocinx): Contributor
Note: This list is being updated constantly so please let [z3t0](https://github.com/z3t0) know if you have been missed.

View File

@@ -79,9 +79,6 @@
#define DECODE_LEGO_PF 0 // NOT WRITTEN
#define SEND_LEGO_PF 1
#define DECODE_CDTV 1
#define SEND_CDTV 1
//------------------------------------------------------------------------------
// When sending a Pronto code we request to send either the "once" code
// or the "repeat" code
@@ -122,7 +119,6 @@ typedef
DENON,
PRONTO,
LEGO_PF,
CDTV,
}
decode_type_t;
@@ -251,13 +247,9 @@ class IRrecv
# if DECODE_DENON
bool decodeDenon (decode_results *results) ;
# endif
//......................................................................
//......................................................................
# if DECODE_LEGO_PF
bool decodeLegoPowerFunctions (decode_results *results) ;
# endif
//......................................................................
# if DECODE_CDTV
bool decodeCDTV (decode_results *results) ;
# endif
} ;
@@ -343,13 +335,9 @@ class IRsend
# if SEND_PRONTO
void sendPronto (char* code, bool repeat, bool fallback) ;
# endif
//......................................................................
//......................................................................
# if SEND_LEGO_PF
void sendLegoPowerFunctions (uint16_t data, bool repeat = true) ;
# endif
//......................................................................
# if SEND_CDTV
void sendCDTV (unsigned long data, int nbits) ;
# endif
} ;

View File

@@ -108,6 +108,6 @@ EXTERN volatile irparams_t irparams;
#define SPACE 1
// All board specific stuff has been moved to its own file, included here.
#include "IRremoteBoardDefs.h"
#include "boarddefs.h"
#endif

View File

@@ -14,8 +14,12 @@
Use [a gist](gist.github.com) if the code exceeds 30 lines
**checklist:**
- [] I have **read** the README.md file thoroughly
- [] I have searched existing issues to see if there is anything I have missed.
- [] The latest [release](https://github.com/z3t0/Arduino-IRremote/releases/latest) is used
- [] Any code referenced is provided
- [] Any code referenced is provided and if over 30 lines a gist is linked INSTEAD of it being pasted in here
- [] The title of the issue is helpful and relevant
The above is a short template allowing you to make detailed issues!
** We will start to close issues that do not follow these guidelines as it doesn't help the contributors who spend time trying to solve issues if the community ignores guidelines!**
The above is a short template allowing you to make detailed issues!

View File

@@ -8,7 +8,7 @@ This library enables you to send and receive using infra-red signals on an Ardui
Tutorials and more information will be made available on [the official homepage](http://z3t0.github.io/Arduino-IRremote/).
## Version - 2.2.1
## Version - 2.2.3
## Installation
1. Navigate to the [Releases](https://github.com/z3t0/Arduino-IRremote/releases) page.
@@ -65,7 +65,7 @@ Check [here](Contributing.md) for some guidelines.
## Contact
Email: zetoslab@gmail.com
Please only email me if it is more appropriate than creating an Issue / PR. I **will** not respond to requests for adding support for particular boards, unless of course you are the creator of the board and would like to cooperate on the project. I will also **ignore** any emails asking me to tell you how to implement your ideas. However, if you have a private inquiry that you would only apply to you and you would prefer it to be via email, by all means.
Please only email me if it is more appropriate than creating an Issue / PR. I **will** not respond to requests for adding support for particular boards, unless of course you are the creator of the board and would like to cooperate on the project. I will also **ignore** any emails asking me to tell you how to implement your ideas. However, if you have a private inquiry that you would only apply to you and you would prefer it to be via email, by all means.
## Contributors
Check [here](Contributors.md)

View File

@@ -17,8 +17,8 @@
// Whynter A/C ARC-110WD added by Francesco Meschia
//******************************************************************************
#ifndef IRremoteBoardDefs_h
#define IRremoteBoardDefs_h
#ifndef boarddefs_h
#define boarddefs_h
//------------------------------------------------------------------------------
// Defines for blinking the LED
@@ -545,4 +545,4 @@
# error "Internal code configuration error, no known IR_USE_TIMER# defined\n"
#endif
#endif // ! IRremoteBoardDefs_h
#endif // ! boarddefs_h

View File

@@ -1,8 +1,7 @@
## 2.3.0 - 2017/02/06
- Added Commodore Amiga CDTV Support [ISSUE #407](https://github.com/z3t0/Arduino-IRremote/issues/407) [PR #413](https://github.com/z3t0/Arduino-IRremote/pull/413)
## 2.2.3 - 2017/03/27
- Fix calculation of pause length in LEGO PF protocol [PR #427](https://github.com/z3t0/Arduino-IRremote/pull/427)
## 2.2.2 - 2017/01/20
- Renamed "boarddefs.h" [ISSUE #375](https://github.com/z3t0/Arduino-IRremote/issues/375)
- Fixed naming bug [PR #398](https://github.com/z3t0/Arduino-IRremote/pull/398)
## 2.2.1 - 2016/07/27

View File

@@ -1,6 +1,6 @@
/*
* LegoPowerFunctionsTest: LEGO Power Functions Tests
* Copyright (c) 2016 Philipp Henkel
* Copyright (c) 2016, 2017 Philipp Henkel
*/
#include <ir_Lego_PF_BitStreamEncoder.h>
@@ -78,14 +78,14 @@ void testMessageBitCount(LegoPfBitStreamEncoder& bitStreamEncoder) {
logTestResult(bitCount == 18);
}
boolean check(LegoPfBitStreamEncoder& bitStreamEncoder, int markDuration, int pauseDuration) {
boolean check(LegoPfBitStreamEncoder& bitStreamEncoder, unsigned long markDuration, unsigned long pauseDuration) {
bool result = true;
result = result && bitStreamEncoder.getMarkDuration() == markDuration;
result = result && bitStreamEncoder.getPauseDuration() == pauseDuration;
return result;
}
boolean checkNext(LegoPfBitStreamEncoder& bitStreamEncoder, int markDuration, int pauseDuration) {
boolean checkNext(LegoPfBitStreamEncoder& bitStreamEncoder, unsigned long markDuration, unsigned long pauseDuration) {
bool result = bitStreamEncoder.next();
result = result && check(bitStreamEncoder, markDuration, pauseDuration);
return result;
@@ -129,16 +129,16 @@ void testMessage407Repeated(LegoPfBitStreamEncoder& bitStreamEncoder) {
bool result = true;
result = result && check(bitStreamEncoder, 158, 1026);
result = result && checkDataBitsOfMessage407(bitStreamEncoder);
result = result && checkNext(bitStreamEncoder, 158, 1026 + 5 * 16000 - 10844);
result = result && checkNext(bitStreamEncoder, 158, 1026L + 5L * 16000L - 10844L);
result = result && checkNext(bitStreamEncoder, 158, 1026);
result = result && checkDataBitsOfMessage407(bitStreamEncoder);
result = result && checkNext(bitStreamEncoder, 158, 1026 + 5 * 16000 - 10844);
result = result && checkNext(bitStreamEncoder, 158, 1026L + 5L * 16000L - 10844L);
result = result && checkNext(bitStreamEncoder, 158, 1026);
result = result && checkDataBitsOfMessage407(bitStreamEncoder);
result = result && checkNext(bitStreamEncoder, 158, 1026 + 8 * 16000 - 10844);
result = result && checkNext(bitStreamEncoder, 158, 1026L + 8L * 16000L - 10844L);
result = result && checkNext(bitStreamEncoder, 158, 1026);
result = result && checkDataBitsOfMessage407(bitStreamEncoder);
result = result && checkNext(bitStreamEncoder, 158, 1026 + 8 * 16000 - 10844);
result = result && checkNext(bitStreamEncoder, 158, 1026L + 8L * 16000L - 10844L);
result = result && checkNext(bitStreamEncoder, 158, 1026);
result = result && checkDataBitsOfMessage407(bitStreamEncoder);
result = result && checkNext(bitStreamEncoder, 158, 1026);
@@ -191,7 +191,3 @@ void testGetMessageLengthAllLow(LegoPfBitStreamEncoder& bitStreamEncoder) {
bitStreamEncoder.reset(0x0, false);
logTestResult(bitStreamEncoder.getMessageLength() == 9104);
}

View File

@@ -84,11 +84,6 @@ int IRrecv::decode (decode_results *results)
DBG_PRINTLN("Attempting Lego Power Functions");
if (decodeLegoPowerFunctions(results)) return true ;
#endif
#if DECODE_CDTV
DBG_PRINTLN("Attempting Commodore Amiga CDTV decode");
if (decodeCDTV(results)) return true;
#endif
// decodeHash returns a hash on any input.
// Thus, it needs to be last in the list.

View File

@@ -1,148 +0,0 @@
#include "IRremote.h"
#include "IRremoteInt.h"
//==============================================================================
// COMMODORE AMIGA CD-TV
//==============================================================================
//==============================================================================
// CCCC DDDD TTTTT V V
// C D D T V V
// C D D T V V
// C D D T V V
// CCCC DDDD T V
//==============================================================================
//==============================================================================
// MEASUREMENTS
//==============================================================================
/*Encoding: UNKNOWN
Code : 72A03D6B(32 bits)
Timing[51] :
+8900, -4450 + 400, -1200 + 350, -400 + 400, -400
+ 400, -400 + 400, -1200 + 400, -400 + 350, -450
+ 350, -400 + 400, -400 + 400, -350 + 450, -400
+ 350, -450 + 350, -400 + 400, -1200 + 400, -1200
+ 350, -1200 + 400, -450 + 350, -1200 + 400, -1200
+ 350, -1200 + 400, -1200 + 350, -1250 + 350, -1200
+ 400, -1200 + 350
unsigned int rawData[51] = { 8900,4450, 400,1200, 350,400, 400,400, 400,400, 400,1200, 400,400, 350,450, 350,400, 400,400, 400,350, 450,400, 350,450, 350,400, 400,1200, 400,1200, 350,1200, 400,450, 350,1200, 400,1200, 350,1200, 400,1200, 350,1250, 350,1200, 400,1200, 350 }; // UNKNOWN 72A03D6B
*/
// NOTE: The array dump above begins at index = 1; therefore offset = 1 in the code below
//==============================================================================
#define CDTV_BITS 24
// timing intervals in usec
#define CDTV_HDR_MARK 8850 // start burst
#define CDTV_HDR_SPACE 4450 // pause after start
#define CDTV_BIT_MARK 350 // pulse
#define CDTV_ONE_SPACE 1250 // receive a '1'
#define CDTV_ZERO_SPACE 450 // receive a '0'
#define CDTV_RPT_SPACE 2250 // repeat signal
// message sizes measured in raw pulses
#define CDTV_RAW_REPEAT_LENGTH 4 // CDTV_HDR_MARK + CDTV_HDR_SPACE + CDTV_BIT_MARK
#define CDTV_RAW_SIGNAL_LENGTH 52 // CDTV_HDR_MARK + CDTV_HDR_SPACE + CDTV_BITS * (CDTV_BIT_MARK + CDTV_ZERO_SPACE | CDTV_ONE_SPACE)
//+=============================================================================
#if SEND_CDTV
void IRsend::sendCDTV(unsigned long data, int nbits) {
// set IR carrier frequency
enableIROut(40);
// send header
mark(CDTV_HDR_MARK);
space(CDTV_HDR_SPACE);
// send data
for (unsigned long mask = 1UL << (nbits - 1); mask; mask >>= 1) {
if (data & mask) {
mark(CDTV_BIT_MARK);
space(CDTV_ONE_SPACE);
} else {
mark(CDTV_BIT_MARK);
space(CDTV_ZERO_SPACE);
}
}
// send footer
mark(CDTV_BIT_MARK);
// always end with the LED off
space(0);
}
#endif
//+=============================================================================
// CDTV have a repeat signal that is 4-bits long [#FFFFFF]
//
#if DECODE_CDTV
bool IRrecv::decodeCDTV(decode_results *results) {
unsigned long data = 0; // we decode into this field; start with empty placeholder
int offset = 1; // skip first entry since it has not a lot of meaning
// check if header mark is within range
if (!MATCH_MARK(results->rawbuf[offset], CDTV_HDR_MARK)) {
return false;
}
offset++; // -> offset[2]
// check for 4-bit repeat signal
if ((irparams.rawlen == CDTV_RAW_REPEAT_LENGTH)
&& MATCH_SPACE(results->rawbuf[offset], CDTV_RPT_SPACE)
&& MATCH_MARK(results->rawbuf[offset+1], CDTV_BIT_MARK)) {
results->bits = 4;
results->value = 0xFFFFFF;
results->decode_type = CDTV;
return true;
}
// check on minimal raw length for decoding the 24-bit signal correctly
if (irparams.rawlen < CDTV_RAW_SIGNAL_LENGTH) {
return false;
}
// check header space
if (!MATCH_SPACE(results->rawbuf[offset], CDTV_HDR_SPACE)) {
return false;
}
offset++; // -> offset[3]
// build the data
for (int i = 0; i < CDTV_BITS; i++) {
// check if data mark is available; otherwise break
if (!MATCH_MARK(results->rawbuf[offset], CDTV_BIT_MARK)) {
return false;
}
offset++; // -> offset[4->28]
// append this bit
if (MATCH_SPACE(results->rawbuf[offset], CDTV_ONE_SPACE)) {
data = (data << 1) | 1;
} else if (MATCH_SPACE(results->rawbuf[offset], CDTV_ZERO_SPACE)) {
data = (data << 1) | 0;
} else {
return false;
}
offset++;
}
// validate checksum by comparing lower 12-bits with inverted higher 12-bits
unsigned long lo = data & 0xFFF; // extract lower 12-bit
unsigned long hi = data >> 12; // extract higher 12-bit
// success if (low XOR high == 0xFFF)
if (lo^hi == 0xFFF) {
results->bits = CDTV_BITS;
results->value = data;
results->decode_type = CDTV;
return true;
}
return false;
}
#endif

View File

@@ -4,7 +4,7 @@
// L E E O O
// L EEEE E EEE O O
// L E E E O O LEGO Power Functions
// LLLLLL EEEEEE EEEE OOOO Copyright (c) 2016 Philipp Henkel
// LLLLLL EEEEEE EEEE OOOO Copyright (c) 2016, 2017 Philipp Henkel
//==============================================================================
//+=============================================================================
@@ -14,25 +14,25 @@ class LegoPfBitStreamEncoder {
private:
uint16_t data;
bool repeatMessage;
int messageBitIdx;
int repeatCount;
int messageLength;
// HIGH data bit = IR mark + high pause
// LOW data bit = IR mark + low pause
static const int LOW_BIT_DURATION = 421;
static const int HIGH_BIT_DURATION = 711;
static const int START_BIT_DURATION = 1184;
static const int STOP_BIT_DURATION = 1184;
static const int IR_MARK_DURATION = 158;
static const int HIGH_PAUSE_DURATION = HIGH_BIT_DURATION - IR_MARK_DURATION;
static const int LOW_PAUSE_DURATION = LOW_BIT_DURATION - IR_MARK_DURATION;
static const int START_PAUSE_DURATION = START_BIT_DURATION - IR_MARK_DURATION;
static const int STOP_PAUSE_DURATION = STOP_BIT_DURATION - IR_MARK_DURATION;
static const int MESSAGE_BITS = 18;
static const int MAX_MESSAGE_LENGTH = 16000;
uint8_t messageBitIdx;
uint8_t repeatCount;
uint16_t messageLength;
public:
// HIGH data bit = IR mark + high pause
// LOW data bit = IR mark + low pause
static const uint16_t LOW_BIT_DURATION = 421;
static const uint16_t HIGH_BIT_DURATION = 711;
static const uint16_t START_BIT_DURATION = 1184;
static const uint16_t STOP_BIT_DURATION = 1184;
static const uint8_t IR_MARK_DURATION = 158;
static const uint16_t HIGH_PAUSE_DURATION = HIGH_BIT_DURATION - IR_MARK_DURATION;
static const uint16_t LOW_PAUSE_DURATION = LOW_BIT_DURATION - IR_MARK_DURATION;
static const uint16_t START_PAUSE_DURATION = START_BIT_DURATION - IR_MARK_DURATION;
static const uint16_t STOP_PAUSE_DURATION = STOP_BIT_DURATION - IR_MARK_DURATION;
static const uint8_t MESSAGE_BITS = 18;
static const uint16_t MAX_MESSAGE_LENGTH = 16000;
void reset(uint16_t data, bool repeatMessage) {
this->data = data;
this->repeatMessage = repeatMessage;
@@ -43,9 +43,9 @@ class LegoPfBitStreamEncoder {
int getChannelId() const { return 1 + ((data >> 12) & 0x3); }
int getMessageLength() const {
uint16_t getMessageLength() const {
// Sum up all marks
int length = MESSAGE_BITS * IR_MARK_DURATION;
uint16_t length = MESSAGE_BITS * IR_MARK_DURATION;
// Sum up all pauses
length += START_PAUSE_DURATION;
@@ -75,9 +75,9 @@ class LegoPfBitStreamEncoder {
}
}
int getMarkDuration() const { return IR_MARK_DURATION; }
uint8_t getMarkDuration() const { return IR_MARK_DURATION; }
int getPauseDuration() const {
uint32_t getPauseDuration() const {
if (messageBitIdx == 0)
return START_PAUSE_DURATION;
else if (messageBitIdx < MESSAGE_BITS - 1) {
@@ -88,13 +88,13 @@ class LegoPfBitStreamEncoder {
}
private:
int getDataBitPause() const {
uint16_t getDataBitPause() const {
const int pos = MESSAGE_BITS - 2 - messageBitIdx;
const bool isHigh = data & (1 << pos);
return isHigh ? HIGH_PAUSE_DURATION : LOW_PAUSE_DURATION;
}
int getStopPause() const {
uint32_t getStopPause() const {
if (repeatMessage) {
return getRepeatStopPause();
} else {
@@ -102,12 +102,12 @@ class LegoPfBitStreamEncoder {
}
}
int getRepeatStopPause() const {
uint32_t getRepeatStopPause() const {
if (repeatCount == 0 || repeatCount == 1) {
return STOP_PAUSE_DURATION + 5 * MAX_MESSAGE_LENGTH - messageLength;
return STOP_PAUSE_DURATION + (uint32_t)5 * MAX_MESSAGE_LENGTH - messageLength;
} else if (repeatCount == 2 || repeatCount == 3) {
return STOP_PAUSE_DURATION
+ (6 + 2 * getChannelId()) * MAX_MESSAGE_LENGTH - messageLength;
+ (uint32_t)(6 + 2 * getChannelId()) * MAX_MESSAGE_LENGTH - messageLength;
} else {
return STOP_PAUSE_DURATION;
}

View File

@@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/z3t0/Arduino-IRremote.git"
},
"version": "2.2.1",
"version": "2.2.3",
"frameworks": "arduino",
"platforms": "atmelavr",
"authors" :

View File

@@ -1,5 +1,5 @@
name=IRremote
version=2.2.1
version=2.2.3
author=shirriff
maintainer=shirriff
sentence=Send and receive infrared signals with multiple protocols