Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for decoding Toshiba A/C remote messages. #340

Merged
merged 8 commits into from
Nov 16, 2017

Conversation

crankyoldgit
Copy link
Owner

Ref #339

FYI @mwildbolz for additional review & testing.

@mwildbolz
Copy link

@crankyoldgit I implemented this with a minor change (RPT Mark timing) and was able to decode a real remote signal. But there is an issue with repeated decoding.
If i send a second signal with my remote, i get a memory alloc problem on my ESP causing it to restart, it just works once?!?

check_poison_block is called for free block 0x3fff12b8
Fatal exception 3(LoadStoreErrorCause):
epc1=0x4010011d, epc2=0x00000000, epc3=0x00000000, excvaddr=0x40031af8, depc=0x00000000

Exception (3):
epc1=0x4010011d epc2=0x00000000 epc3=0x00000000 excvaddr=0x40031af8 depc=0x00000000

ctx: cont 
sp: 3fff0150 end: 3fff03b0 offset: 01a0

>>>stack>>>
3fff02f0:  3ffeee20 00000000 3ffef2c4 401003e9  
3fff0300:  3ffef2a0 000000dd 000000dd 4010020c  
3fff0310:  3ffef2c4 3ffeee20 3fff12bc 401008e0  
3fff0320:  3ffe0111 3ffef2c4 3fff0364 40205f84  
3fff0330:  3ffeee20 3ffef2c4 00000128 402046c2  
3fff0340:  3ffef2c4 3ffeee20 3ffeee70 40202cdf  
3fff0350:  fc030df2 00000001 00010001 00000000  
3fff0360:  00fd000d 3fff16d4 3ffeef50 402026fe  
3fff0370:  00000009 feefeffe 40206258 40206240  
3fff0380:  00000000 00000000 00000001 3ffef380  
3fff0390:  3fffdad0 00000000 3ffef378 40206078  
3fff03a0:  feefeffe feefeffe 3ffef390 40100970  
<<<stack<<<

My current library code is commited to GitHub:
https://github.com/mwildbolz/IRremoteESP8266/commit/52ee828d251ab73717b6df78d52f6d347b349370

@crankyoldgit
Copy link
Owner Author

crankyoldgit commented Nov 15, 2017 via email

* @mwildbolz reported different timings were needed to capture correctly.
* fix a typo.
@crankyoldgit
Copy link
Owner Author

crankyoldgit commented Nov 16, 2017

Thanks @mwildbolz for the feedback. I've altered the timings to something I think is better. Can you please verify it works?
Can you please try this using this branch's IRrecvDumpV2.ino and see if that works (detects it) and doesn't crash on subsequent presses etc?

Also, could you please give me a copy of the raw data from one of your successful captures? That will be useful to add as a unit test case, and potentially allow me to reproduce the problems/issues you are encountering.

As for the crash, given your own repository reference, it looks like you've modified the code and are using something else (non-standard) to call the code. It may be the rest of the code or your changes which may be causing the crash. I've left a note in your branch to where I think the problem is, but without the rest of the code, I can't be sure what is causing your problem, nor can I reproduce it without it.

* Add a calcChecksum() method that can be called from outside the class.
* Add optional lengths to the checksum routines, just in case.
* Unit tests for the above changes.
I had a brain fade and used the wrong bit mask.
Added unit tests to cover this code & issue.
According to @mwildbolz Toshiba A/C messages are sent at least twice.
Updated accordingly.
Copy link
Collaborator

@markszabo markszabo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one small comment :)

@@ -25,8 +28,7 @@
#define TOSHIBA_AC_BIT_MARK 543U
#define TOSHIBA_AC_ONE_SPACE 1623U
#define TOSHIBA_AC_ZERO_SPACE 472U
#define TOSHIBA_AC_RPT_MARK 440U
#define TOSHIBA_AC_RPT_SPACE 7048U
#define TOSHIBA_AC_MIN_GAP 7048U
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to add an additional space here, just to keep the indentation.

@crankyoldgit
Copy link
Owner Author

@markszabo Fixed. Curse you, search & replace! ;-)

@crankyoldgit
Copy link
Owner Author

@mwildbolz I'm going to merge this PR into the v2.3.0-dev branch, but don't let that stop you from comment on this PR or logging a new issue etc. I still want your feedback and comments etc. I've just got some other code I want to get merged that depends on some of the changes here.

@crankyoldgit crankyoldgit merged commit 9b98424 into v2.3.0-dev Nov 16, 2017
@mwildbolz
Copy link

I tested the code with IRrecvDumpV2 and it worked :-)
The problem from yesterday was caused by a loose connection on hardware side - interesting, that it always worked once but not the second time (I tested 10 times).

Attached some real time data for the test cases
testData.txt

crankyoldgit added a commit that referenced this pull request Dec 8, 2017
* Progress commit, working but with debug and incomplete

* Timers not working

* Working Daikin decode, updated send & timer support

* Remove  set overflow

* Dev branch for the 2.3.0 release.

* Update README information
* For v2.3
* General cleanup.
* More instructions and links.

* Add support for decoding Kelvinator A/C messages. (#332)

* Add support for decoding Kelvinator A/C messages.
* Add a decodeKelvinator() method.
* Tweak Kelvinator timings to use a large-ish common tick size.
* Unit test(s) for decodeKelvinator().
* Use a union for state to use less memory.
* Add support for Kelvinator A/C decoding to the dump example code.

* Initial support for sending Toshiba A/C messages. (#333)

* Initial support for sending Toshiba A/C messages.
* Add known-working A/C unit model info.

* Add support for all A/C units in MQTT example code.

* Update the AirCon HTML form to send all complex A/C types.

* Correct missing Fujitsu A/C functionality.

* Cleanups and move header1 to flash

* Don't include Arduion.h in tests

* Use new State data when decoding

* Initial support for sending Toshiba A/C messages. (#333)

* Initial support for sending Toshiba A/C messages.
* Add known-working A/C unit model info.

* Progress commit, working but with debug and incomplete

* Timers not working

* Working Daikin decode, updated send & timer support

* Cleanups and move header1 to flash

* Don't include Arduion.h in tests

* Clean up a bunch of cpplint.py issues.

* More linter/style issues fixed.

* Fix a number of compiler warnings and allow unit tests to compile.
- Unit tests don't pass yet.

* Minor enhancements and working example

* Move a bunch of #define's to the header file.
Fix a few linter/style issues as reported by cpplint.py

* Rework checkheader() & readbits(). Add unit tests for decoding.
* Refactor checkheader() & readbits() to use a pointer for offset.
  This cleans up the code quite a lot & makes it more readable IMHO.
* Add some unit tests for decodeDaikin() using real and synthetic data.
  This allowed the refactoring above to happen without causing issues.
  Note: Not all (old) unit tests are passing at this point.
* Clean up some #define usage to make it more presentable and useful.
* General code clean up (lint and style etc)

* Fix setting econo, quiet, & powerful modes.

Unit tests were failing because econo, quiet, & powerful modes were
not mutually exclusive. Previous code did this.
The manual confirms this is correct. i.e. setting one of these modes cancels
the other conflicting modes.

The relevant unit tests now pass again.

* Update unit tests for getFan() & setFan().
- Update test cases to reflect new usage etc.
- Minor code cleanup.

* Powerful & Quiet, and Powerful & Econo are incompatible. Not Quiet & Econo.
@sillyfrog correctly pointed out Econo mode & Quiet mode are not mutually
exclusive.
Created unit tests for those cases, as well as created unit tests for
Econo mode.

* Update old unit test output to new daikin message protocol.
* Replace old formatted unit test data with data based on current sendDaikin()
* The unit test routines need more capacity to handle larger outputs.
  e.g. sendDaikin() with repeats has more than 1000 entries. Bumped to 10k.

* Fix Time/Timer methods.
* Assigning 16bit values on to a char array caused issues on some architectures.
* Cleaned up time(r) methods and correctly cleared/masked bits.
* Unit Tests added for the time/timer related methods.
* Turned off the DAIKIN_DEBUG flag.
* Minor code quality cleanups.

* Zero entire state on reset.
- We were missing zero'ing of daikin[3].

* Add unit test coverage for Sensor, Mold, & Eye modes.

* Set TIMEOUT to something more appropriate for A/C decoding.
This reverts/alters an earlier change.

* Initial support for decoding Toshiba A/C remote messages. (#340)

* Initial support for decoding Toshiba A/C remote messages. For #339
* Update Toshiba timings based on user feedback.
* Toshiba A/C always has at least one repeat according to @mwildbolz

* Add outputing the state to a human readable format.

* Typo: Fix an indent issue.

* Update Daikin to similar spec as Toshiba A/C. (#349)

* Add toString() & validChecksum() methods.
* Refactor the code for calculating state checksums.
* Add checksum verification in decodeDaikin()
* Unit test coverage for all of the above plus setRaw().
* Change the debug code to be platform neutral and use toString().
* Fix a typo.
* Make the example code more verbose.

* Update tools. (#343)

* Update tools.
* Add RawToGlobalCache.sh bash script to convert rawData into Global Cache
* Update gc_decode to handle air conditioners.
* Fix a typo

* Allow changing of the threshold of reported UNKNOWN messages. (#347)

* Value is now easily set at compile-time and/or run-time.
* Allow decodeHash() a.k.a. UNKNOWN message decoding to be completely removed.

Ref: Issue #341

* Unit tests for Toshiba A/C based on captures from a remote. (#346)

* Unit tests for Toshiba based on captures from a remote.
Data provided by @mwildbolz

* Update unit test for a 'real' power off example.

* Update working status and known-working models etc.

* Update Toshiba compatiablity list.
@mwildbolz reported it works these particular models.

* Update Kelvinator to similar spec as Toshiba A/C. (#348)

* Add setRaw(), toString(), & validChecksum() methods.
* Refactor the code for calculating state checksums.
* Add checksum verification in decodeKelvinator()
* Unit test coverage for all of the above.

* BugFix: Formatting error when rawData values > UINT16_MAX. (#355)

* Add new AutoAnalyseRawData tool (#345)

* New AutoAnalyseRawData tool
A bash script that attempts to automatically analyse raw data to
find key values and details needed to aid writing appropriate
sendXYZ() and decodeXYZ() routines.

Very ALPHA code, only supports common space encoded message formats.

* Improve AutoAnalyseRawData.sh
* Provide more detail output and values in hex/dec/bin and MSB/LSB order
* Remove some unused code.
* Use 'bc' to do the base conversion, rather than my hacky attempt.

* Add generation of suggested code to AutoAnalyseRawData

* More improvements to AutoAnalyseRawData

* Warn on > 64bit values
* Duplicate/repeate detection.
* Handle protocols without HDRs. e.g. Sharp.

* Initial check-in of Midea A/C support. (#359)

* Initial check-in of Midea A/C support.
Per Issue #354

* Midea protocol improvements.
* Add IRMideaAC class to enable message construction for Midea A/C
* Support basic settings (power, fan, standard temp, mode, sleep)
* Unit tests for the class.
* Add checksum verification to decode.
* Update real example to a cleaner one. Re-tune tolerance lower.

* Update Sharp compatablity list based on feedback. (#357)

* bugfix: Panasonic-based protocols have incorrect message gap. (#358)

See issue #356 for more details.
We were short by approx. 33.7mSecs.

* Update release notes for next (2.3.0) release.

* [PR] Magiquest Wands (#365)

Send and decode support for MagiQuest wands.

* Upgrade IRrecvDumpV2 to v0.3 (#363)

* Simplify & improve IRrecvDumpV2 example code.
* Bump version to v0.3
* Display human-readable out of compatible A/C messages.
* Move display code to IRutils.cpp
* Add unit tests for parts moved to IRutils.
* Fix a number of minor display issues.
* Layout of code in dumpV2 improved.
* Set the UNKNOWN minimum threashold to 12 to reduce noise.
* General housekeeping
* Tidy up the parameter section and add more comments/help text.

* [Bug] Fix an underlying off-by-one error in unit test helper code.
  This lead to correcting some off-by-one errors in other protocols.

* Ensure IRsendTest::reset() does a better job of reseting. (#368)

The unit test `reset()` function could allow data from previous
unit tests to leak through. So, don't use a short-cut, do a full
zero of the arrays.
This also exposed situations where a `decode()` would still work after
a `reset()`, hence a need to re-order some of the unit tests as
`IRsendTest::outputStr()` does an `implicit reset()`.

* Tweak Midea A/C timings based on user feedback. (#369)

@bwze advised different timings in #354 (comment)
Using the same final result as suggested, but with a smaller common factor for the tick to aid the automatic timing corrections.
Ref #354

* Improve Fujitsu A/C support (#367)

* Improve Fujitsu A/C support
* Fujitsu AR-DB1 support.
* add decodeFujitsuAC().
* Improve code quality.
* More unit tests.
* Add a lot of the 2.3.0 features for A/Cs to Fujitsu.
* Update IRMQTTServer.ino to support the new state sizes.
* Update IRrecvDumpV2.ino for Fujitsu A/C decoding.
* Update IRutils.ino for Fujitsu decoding.
* Add appropriate #ifdef's for A/C decoding to example code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants