crankyoldgit / IRremoteESP8266

Infrared remote library for ESP8266/ESP32: send and receive infrared signals with multiple protocols. Based on: https://github.com/shirriff/Arduino-IRremote/
GNU Lesser General Public License v2.1
2.94k stars 831 forks source link

Irremote does not work at 160MHz #728

Closed sblantipodi closed 5 years ago

sblantipodi commented 5 years ago

Hi, using irremote latest on a D1 Mini and a or shield from lolin

Irremote works perfectly when D1 Mini runs at 80mhz but signal appears to be really "weak" when D1 Mini runs at 160MHz.

Please fix and congrats for the good work guys

crankyoldgit commented 5 years ago

Have you tried using the calibrate() function? e.g. Before you start transmitting for the first time after instantiating the IRsend object add:

irsend.calibrate();

The default calibration (if not run) is typically fine for an ESP8266 running at 80MHz. I have no experience running the ESP8266 at 160Mhz. Care to share some minimal example code so I can reproduce your problem?

If the calibrate(); works for you, please let us know what value it returns so we can add it to the code.

crankyoldgit commented 5 years ago

Alternatively, can you please try the code in this branch? https://github.com/markszabo/IRremoteESP8266/tree/periodoffset_at_cpufreq

I ran a ESP8266 at 160Mhz and calculated the offset required at that freq.

I also tested a D1 Mini running at @ 160Mhz using PR #729 and without, but using the calibrate() function. It correctly controlled real IR devices using signals it generated.

Thus this issue is effectively closed but I'll leave it open until the PR is merged.

sblantipodi commented 5 years ago

I will check as soon as I can if calibrate() will solve my 160MHz issues. I will update the issue. thanks

crankyoldgit commented 5 years ago

Based on your other Issue, I assume it went okay?

sblantipodi commented 5 years ago

@crankyoldgit I'm using 80MHz now. Too many problems to solve first. Can I use calibrate() even when not using rawdata? For example with samsung.h?

crankyoldgit commented 5 years ago

calibrate() tunes any IRsend object/instance to have the internal timing offsets for the current given hardware. So, yes. Just call it once per instance, and after that, every thing else should use the correct timings for your hardware from then on. e.g. Put it in your setup() routine.

crankyoldgit commented 5 years ago

After PR #729 is merged, you shouldn't need it, as the default should change based on the clock frequency defined in F_CPU

sblantipodi commented 5 years ago

After PR #729 is merged, you shouldn't need it, as the default should change based on the clock frequency defined in F_CPU

when will we see the update in the public repository? I use platformio to download the libraries

crankyoldgit commented 5 years ago

Probably in less than a week.

You can add a custom environment in your project's platformio.ini file, or modify your existing one by adding something like the follow to use a specific branch:

[env:whatever_youwant]
platform=espressif8266
framework=arduino
board=d1_mini
lib_deps =
  https://github.com/markszabo/IRremoteESP8266.git#periodoffset_at_cpufreq

See https://docs.platformio.org/en/latest/projectconf/section_env_library.html#lib-deps

sblantipodi commented 5 years ago

thanks!!!

crankyoldgit commented 5 years ago

FYI, The changes mentioned above have been include in v2.6.1 of this library, which has just been released.