1182 Commits

Author SHA1 Message Date
David Conran
a575a42504 Initial support for sending Pronto IR codes. (#251)
* Initial support for sending Pronto IR codes.
* Code for sendPronto().
* Enable it in the default build.
* Tweak calculating the period of the modulation frequency to be able to ignore the preset
offset.
* Unit tests for sendPronto().
* Tweak decodeSony() to use matchAtLeast, and thus remove some unit test-only code.

* Example code for using sendPronto()
2017-06-23 00:21:16 +10:00
David Conran
7ae3bbc381 Update version to v2.0.3 (#254)
- Version bump due to Issue #246
- Add library version as a #define in src/IRremoteESP8266.h
- Add check to Travis config to ensure version numbers all match.
v2.0.3
2017-06-18 15:43:47 +10:00
David Conran
74797a045a Fix decoding issue after buffer overflow. (#253)
The bug was tickled when the capture buffer overflowed.
Though, it probably also manifests when are large or garbage message is
captured, and writes data through out the buffer.
When a smaller message comes in, the last entry which is typically the
post message gap, is not cleared. This could caused the decoder(s) to get
confused as they would be reading previous messages (or garbage) data.

- Fixes Issue #246
- No unit tests for this bug is only tickled 'on device' due to interrupt
  handling. Our unit tests don't really cover that aspect.
2017-06-18 12:19:43 +10:00
David Conran
57a4ef003a Create a makefile target to build and run all the unit tests. (#252) 2017-06-18 12:19:00 +10:00
crankyoldgit
1f93a4e8a2 Bump version number to 2.0.2 v2.0.2 2017-06-15 17:29:57 +10:00
David Conran
f9780d6f59 Handle the end of a capture better, plus more debug code. (#249)
- [bug] Issue #243 uncovered an odd case where a zero length end gap is encountered.
- Add unit test to cover zero length space at the end.
- Add more debugging code for matchAtLeast()
- [bug] fix incorrect end of buffer calculation in decodes
2017-06-15 16:55:40 +10:00
David Conran
2e58f229e9 Fix decoding of real Panasonic codes. (#247)
* Fix decoding of real Panasonic codes.
- Should fix Issue #245
- Add tests to cover the issue found.
- [bugfix] Add real-life values for the gap at the end of a panasonic command when decoding.
- [bugfix] uint64 print routine in the examples was subtly broken.

* Adjust overflow warning in IRrecvDumpV2
2017-06-15 15:59:01 +10:00
David Conran
37e6a146c6 Fix decoding issue on most protocols. (#244)
- Fixes Issue #243
- [bugfix] Incorrect assumption on minimum entry length when decoding. Off by one.
- [bugfix] Make matching the trailing gap/space on commands optional if we run out of buffer.
- Fix a wayward Serial.println() debug statement that got missed.
- Add unit tests to add coverage for the bug found.
- Bump version to v2.0.1
v2.0.1
2017-06-14 17:42:26 +10:00
crankyoldgit
235eb67e45 Merge branch 'master' into v2.0-dev v2.0.0 2017-06-12 20:24:05 +10:00
David Conran
173e6c2889 Update documentation prior to v2.0 launch. (#239)
* Move github related documentation to a .github directory.
* Create a issue template per Github examples.
* Create a contributing guide per Github suggestion. Influenced by the [Contributing to Atom](https://github.com/atom/atom/blob/master/CONTRIBUTING.md) docs.
* Update main README file to reflect a v2.0 launch.
2017-06-11 21:52:28 +10:00
David Conran
5b879afcb1 Update README.md announcing v2.0.0-RC1 (#236)
Add links to v2.0.0-RC1 and upgrade documentation, and request for more testers.
2017-06-06 17:27:42 +10:00
crankyoldgit
1c0c0c0235 Update library version numbers to 2.0.0 v2.0.0-RC1 2017-06-05 09:50:23 +10:00
David Conran
2838ab5f31 Add matching of an expected minimum gap at the end of a message. (#231)
Makes decoding more strict and should reduce the number of false positive
matches and wrong decodes.

Issue #204
2017-06-05 09:44:45 +10:00
David Conran
b8f2d0a4ff Add send support for Gree Heat Pumps. (#228)
- Merge PR #226 (@scop) upstream to the v2.0 branch.
- v2.0-ify sendGree() by adding repeat and different bit/byte size support.
- Unit tests for sendGree().
- As char[8] fits into a uint64, make a version of sendGree() that
  supports being called with a uint64 rather than a char array. This gives
  users a more traditional interface if desired.
2017-06-04 23:15:52 +10:00
David Conran
48d5c30369 Use a common Debug printing mechanism. (#235)
* For Arduino use Serial.
* For Unit Testing (e.g. Unix) use iostreams/cout etc.
2017-06-03 22:01:12 +10:00
David Conran
7c273de869 Add ability to invert the output of the GPIO. (#230)
i.e. IR LED off for mark signals, on for spaces.

Fixes issue #229
2017-06-03 02:18:29 +10:00
David Conran
0d237367f1 Unit tests for decode() & Makefile cleanup. (#234)
- Add unit tests for decode(). Run every protocol we support decoding for through.
- [bugfix] Move the order of decodeDenon() so that it doesn't mis-match on Panasonic.
- Fix a comment in another file.
- Cleanup the unit test Makefile.
2017-06-03 00:35:23 +10:00
David Conran
13241e8a71 Unit test coverage for sendRaw(). (#233) 2017-05-30 19:19:33 +10:00
Ville Skyttä
3bce21e2a2 Use initialization list instead of assignment in IRsend constructor (#232) 2017-05-30 17:25:19 +10:00
David Conran
57e2ef233f Unit tests for Coolix protocol. (#224)
- Unit tests
- Change the way decoding is done so that it supports 64 bit sizes.
- Update status of the decoder from ALPHA to BETA.
v2.0.0-RC0
2017-05-28 17:38:09 +10:00
David Conran
c85c2b4cdb Unit tests for and re-work of the Sanyo protocol(s). (#227)
- Unit tests for sendSanyoLC7461(), encodeSanyoLC7461, & decodeSanyoLC7461.
- As the protocol appears to be a NEC 42-bit varient, use send/decode NEC.
- Disable the dodgy decodeSanyo() until it gets fixed.
2017-05-28 17:35:47 +10:00
David Conran
6a424a4ca3 Unit tests for the Daikin A/C protocol and v2.0 upgrade. (#225)
- Add unit tests for sendDaikin() and the IRDaikinESP class.
- Add additional methods to the IRDaikinESP class to bring it inline with
  similar A/C classes.
- Add some useful defines/constants for users and code style.
- Re-work how mode and temp are set.
- Support sending longer byte lengths, and repeats to sendDaikin().
  i.e. v2.0 spec.
- Remove a C+11-ism compiler warning. (setting an array when declaring it.)
2017-05-28 17:33:16 +10:00
Ville Skyttä
f14b8cb55a Add Gree send support (#226)
Initial support for Gree Heat Pumps by @scop
2017-05-27 00:00:38 +10:00
David Conran
6ef9ec8749 Unit tests and bug fix for the Aiwa protocol. (#223)
- Unit tests for send & decode.
- Fix incorrect used of non-inverted LIRC values.
- GlobalCache data indicates there is always a repeat, so set the default.
- Fix a typo.
- Testing based on simulated data from known okay source (GlobalCache)
- Status update for the methods.
2017-05-26 13:59:47 +10:00
David Conran
d1d4516c20 Denon Unit Tests and complete re-work. (#221)
- Unit tests for sendDenon & decodeDenon.
- Re-do sendDenon & decodeDenon to use Sharp & Panasonic protocols
  as that is what the Denon documentation indicates and GlobalCache data
  backs up. The previous Denon implementation was just a special case of
  the Sharp protocol, and only half of the protocol.
- Add a flag to decodeSharp() to set if we are checking for the expansion bit.
  This is something that differs between Denon and Sharp.
- Add setting the expected manufacturer to decodePanasonic()'s parameters.
  The manufacturer code differs between Denon and Panasonic protocols.
- Add support for sending & decoding Kaseikyo-like Denon messages.
- Add support for sending/decoding the legacy (poorly implemented) Denon
  implementation.
2017-05-26 13:48:29 +10:00
David Conran
3ff1a9fd47 Unit tests for Dish protocol. (#220)
- Unit tests for sendDISH() and decodeDISH().
- Slightly change how the data bits are collected.
- Minor change to the repeat interval.
- Change how the HDR is sent to avoid duplication with the footer when
  there are repeats.
2017-05-24 22:22:35 +10:00
David Conran
64ddb7477b Add Unit Tests for the Whynter protocol (#219) 2017-05-24 22:05:06 +10:00
David Conran
acac505144 Unit tests for the Panasonic protocol. (#218)
- Unit tests for all Panasonic methods.
- Fix the Panasonic manufacturer code.
- Allow setting the manufacturer in encodePanasonic().
- Minor code & style cleanup.
2017-05-23 14:10:41 +10:00
David Conran
d398548bc8 Unit tests & improvements for RC-6. (#217)
- Test coverage for the RC-6 methods, and toggleRC5().
- Add helper functions for encoding, and toggling the required bit to simulate
  key press/release state change.
- Support decoding of repeated messages.
- Fix a potential issue where matching the wide-bit in RC6 wasn't always
  successful. Discovered in unit tests.
- Code cleanup.
- Confirmed support for RC-6 36-bit mode (i.e. Xbox-360) in simulation.
2017-05-23 14:10:02 +10:00
David Conran
8c12b960cb Unit tests and timing tweaks for the Sharp protocol. (#215)
- Unit test coverage for sendSharp(), sendSharpRaw(), encodeSharp(), and
  decodeSharp().
- [Testing Only] Turn on matching of the inverted code in unit tests in prep for
  when it is used in the ESP8266 code.
- Tweak timing values based on Global Cache data.
- Improve matching by increasing the error tolerance on the bit marks for Sharp.
- [Testing Only] Add a handy debugging routine for the unit tests to see what
  is in the rawbuf.
- Usual extra comments and code cleanup.
2017-05-21 18:29:25 +10:00
David Conran
2f2f79144c Unit test coverage and encoders for RC-5/RC-5X, plus bug fixes. (#216)
- Add unit tests.
- Add address/command/key press encoders for RC-5/RC-5X.
- Fix all the bugs found when unit testing. So so many bugs.
- Turn on strict decoding now we have unit tests and things pass etc.
2017-05-21 18:22:41 +10:00
David Conran
de5db67154 Unit tests for Mitsubishi devices. (#214)
- Unit test coverage for Mitsubishi "normal" devices, and Air-Conditioning.
- [bugfix] decodeMitsubishi() falsely matched RC-MM due to having no length
           requirement. #21
- [bugfix] Unit tests uncovered failure to clear previous state in setFan() &
           setVane().
- [Compiler warning] C++11-ism removed.
- Updated MitsubishiAC to v2.0 spec.
- Comments and style improvements.
- Turned on strict compliance in decodeMitsubishi() to help stop false
  detecting on RC-MM messages. #21
2017-05-21 01:32:34 +10:00
David Conran
be35559ae7 Update linter options in Travis. (#213)
Update the Google C++ linter to point to the correct directory after
the directory change a while back. Add the unit test directory as well.
2017-05-20 14:28:55 +10:00
David Conran
764b7ea6bb Unit tests & improvements for the LG protocol(s). (#212)
- Unit test coverage for the various LG methods.
- Improve LG 32-bit protocol support.
- Minor LG protocol fixes along the way.
- Minor timing changes for the LG protocol time values.
- Add unit test to Travis.
2017-05-19 09:16:46 +10:00
David Conran
1dcd5af6d0 Unit tests and improvements for the RC-MM protocol. (#211)
- Unit test coverage for sendRCMM() and decodeRCMM()
- Update status for those to Beta as tests now work on them.
- Minor code/ordering optimisation.
- [Fix] Removed special tolerence for the bit mark which caused issues in
  decoding.
- Bring RC-MM up to 64bit support.
- Add repeating to sendRCMM.

This should address issue #21 when v2.0 is released.
2017-05-17 17:12:40 +10:00
David Conran
254015f818 Unit tests for Kelvinator A/C & JVC. (#210)
* Unit tests for Kelvinator A/C.
- Unit test coverage for sendKelvinator() and the message construction class.
- Add repeats to sendKelvinator(), make it look like a more standard call.
- White space and code style cleanups.
- Set the default temp for Dry mode.
- Minor cleanups.

* Add unit tests for the JVC protocol.
- Add unit test coverage for sendJVC(), encodeJVC(), & decodeJVC().
- Extend the unit test helper makeDecodeResults() to start from a given offset.
- [bug fix] decodeJVC() had the address & command values swapped.
2017-05-16 19:03:39 +10:00
David Conran
a423925bab Use the NEC style repeats for Aiwa RC T501. (#209)
Further reading indicates this protocol uses the NEC-style repeat method,
so we are safe to completely use the sendNEC() method.
2017-05-15 23:36:58 +10:00
crankyoldgit
0cec7edca2 Spelling fixes.
Per #208 , @scop noticed some spelling mistakes. Ported them to the v2.0 tree
as well.
2017-05-15 01:06:39 +10:00
Ville Skyttä
f1262071a1 Spelling fixes (#208) 2017-05-15 00:56:23 +10:00
David Conran
9a7ec6e099 Add Samsung Unit Tests. (#207)
- Test coverage for sendSAMSUNG(), encodeSAMSUNG(), & decodeSAMSUNG().
- [bug fix] Incorrect sizes for reverseBits calls.
- [bug fix] Incorrect ordering of the result for encodeSAMSUNG().
2017-05-15 00:54:19 +10:00
David Conran
790be5ee26 Cleanup IRGCTCPserver.ino (#195)
- [bug] Actually free up the dynamically allocated memory.
- Simplify the mess of malloc/reallocs. Make a single malloc instead.
- Add check for malloc failing. Report & reboot if failed.
- Change variables to match style guide.
- Basically re-write the parsing code.
- Add detailed instructions on how to use this sketch.

Fixes #33
2017-05-14 10:55:54 +10:00
David Conran
33c80c1c68 Unit tests for GlobalCache, Sherwood, & Sony. (#206)
* Unit tests for sendGC()

* Add Sherwood unit tests.

* Unit tests for ir_Sony
- Also go back to official timings for Sony's protocol.
2017-05-14 10:55:08 +10:00
David Conran
4c48338e22 Unit Testing initial check-in. (#205)
* Initial check-in of Unit Testing for IRremoteESP8266.

TL;DR:  \o/ for finally having (some) Unit Testing.
- Add googletest as a submodule.
- Create unit tests for IRutils as a first step.
- Create a Makefile under test/ which builds and uses the test framework.
- De-Arduino-ise some of the code with #ifndef UNIT_TEST guards to allow it
  to compile and run outside of the Arduino Framework.

Note:
  The Unit Tests are designed to run on a unix box. Not on the ESP8266.
  This should allow them to be run under Travis. We can do this fairly safely
  in v2.0 of the library, as everything now uses c98-style type definitions.
  e.g. uint16_t etc.
  Any Arduino/ESP8266 specific code needs to be neutered using #ifndef UNIT_TEST
  lines.

* Update travis to build and run the unit tests.

* Unit tests for IRsend's sendData()
- Modify files to handle unit tests when compiled on non-arduino frameworks.
- Add unit tests to cover sendData()
- Fix an issue with sendData() when sending zero bit lengths.
- Update .gitignore for some generated content we don't want checked in.

* Add unit tests for sending NEC protocol.
- Unit tests for sendNEC() & encodeNEC()
- Make the unit test infrastructre for IRsend availble for other unit tests.
- Fix an issue with encodeNEC() which didn't count for address and command
  being in LSB order in the protocol spec.
- Other changes to make the library more portable when not compiled against
  the Arduino framework.

* Add Unit tests for decodeNEC().
- Add unit tests that cover most of decodeNEC().
- [Bug] Address and Command values needed to be reversed. LSB order etc.
- Change the way non-standard NEC messages handle address and command decoding.
- Add support methods for converting sendBlah() output into a decode_result.
- Include <stdint.h> modifier for Travis compilation.
- Update Travis for new unit tests to run.

* Update README.md with Unit Test info
2017-05-13 09:24:24 +10:00
David Conran
449f401f4e Fix reverseBits() (#202)
Not sure what I was thinking when I wrote this originally.
It certainly didn't reverse the bits.
I stepped this version through with pen and paper, it should do the job.
Also added preserving the unreversed bits.
2017-05-12 23:45:51 +10:00
David Conran
c7dfa87dd2 Remove duplicate RAWBUF definition. (#200) 2017-05-07 21:46:00 +10:00
David Conran
d2ee636533 Initial checkin of the Aiwa RC T501 send and decode routines. (#199)
Untested & untried.
2017-05-07 19:27:06 +10:00
David Conran
2b96fc79ff Split the library into smaller separate files similar to upstream. (#196)
- Enable #define flags to enable/disable protocols as needed.
- No material changes to program flow etc were made.
- Tonnes & tonnes of modifications to support the new structure.
- Loads of comments added/changed.
- Changes to #include order, and correct mistaken usage of #include <> vs.
  #include "" per c++ library writting guides.
- Move directories and location to make it work with both Platformio and
  the Arduino IDE.
- Update platform.ini files for new dir structure.
- Update Travis for new path.
2017-05-07 11:51:40 +10:00
David Conran
178b09d5eb Improve the accuracy of software PWM in mark(). (#192)
- Apply an external offset for the period calculation so we
allow for code/execution time in producing the software based PWM signal
in mark().
- Add a simple calibrate() method to IRsend().
- First check in of a routine to calculate the execution delays in mark()
  and create an offset based on that for future mark() calls.

Note: Requires a user to call IRsend.calibrate() before sending a signal.
      If not, defaults to '-3' as determined experimentally in Issue #62

WARNING: The calibrate() routine will generate a PWM pulse when called, thus
         it is left as an optional step for users who are interested.
2017-05-04 11:44:39 +10:00
David Conran
a137ceb6d0 Update keywords.txt (#194)
- Add missing keywords.
- convert tabs to spaces.
2017-05-03 18:13:46 +10:00
David Conran
7e17cb09cb Rework/Upgrade RC5/RC6 to v2.0 spec. (#176)
- Add support for 64 bit values.
- Add sending/decoding of RC-5X (Extended RC-5) protocol.
- Code clean up.
- Code style clean up.
- Function descriptions.
- More comments.
- Update examples to handle RC-5X protocol and minor clean up.
- Add strict compliance options for the protocols.
- Add repeat functionality, and calculate/obtain repeat timing data.
- Develop a deep loathing of Manchester code, and thus RC-5, RC-5X, & RC-6.
- Add sarcastic comments.
- Fix some compiler warnings.
- c99 data types.
- Fix lint errors.
2017-05-03 15:43:28 +10:00