arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.16k stars 4.8k forks source link

Feature Request: update IRremoteESP8266 to v 2.x and add support for the panasonic protocol #1014

Closed stylab closed 7 years ago

stylab commented 7 years ago

First thanks for the great work you are doing

I am hoping that you will update IRremoteESP8266 to v 2.x and add support for the panasonic protocol

arendst commented 7 years ago

Could you please test Panasonic functionality with current library by making the following addition to file xdrv_ir_send.ino around line 324:

else if (!strcasecmp_P(protocol, PSTR("SAMSUNG")))
  irsend->sendSAMSUNG(data, bits);
else if (!strcasecmp_P(protocol, PSTR("PANASONIC")))
  irsend->sendPanasonic(data, bits);
else {
  snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_PROTOCOL_NOT_SUPPORTED "\"}"));
          }

and feedback your result.

Upgrading the library to 2.2.0 adds 6k to the code while not bringing any new features.

If this is unusable/unstable you might want to edit file IRremote.h in the IRremoteESP8266 library regarding specific Panasonic timing parameters introduced in version 1.2.0:

// Ref: http://www.remotecentral.com/cgi-bin/mboard/rc-pronto/thread.cgi?26152
#define PANASONIC_HDR_MARK             3456
#define PANASONIC_HDR_SPACE            1728
#define PANASONIC_BIT_MARK              432
#define PANASONIC_ONE_SPACE            1296
#define PANASONIC_ZERO_SPACE            432

And if it still doesn't work you might want to edit file IRremoteESP8266.cpp in the same library regarding IR led frequency from 35 to 37 according to version 1.2.0 too:

  // Set IR carrier frequency
  enableIROut(37);
stylab commented 7 years ago

Thanks for the fast replay ill test it out tonight when i am at home and report back

stylab commented 7 years ago

Hi

Sorry for the long test time, but life got in the way I did finaly find time to test it out For the panasonic protocol to work we need to define a address

user_config.h

#define USE_IR_REMOTE                            // Send IR remote commands using library IRremoteESP8266 and ArduinoJson (+3k code, 0.3k mem)
#ifdef USE_IR_REMOTE
  #define PanasonicAddress      0x4004           // Panasonic address (Pre data)
#endif

and in xdrv_ir_send

else if (!strcasecmp_P(protocol, PSTR("PANASONIC")))
  irsend->sendPanasonic(PanasonicAddress, data);
else {

ugly as hell but it is working :) ill do some more testing on my setup but for now with that hack it works the command still expect a bit value, but we dont use it

arendst commented 7 years ago

Ok, In version 5.8.0p I've swapped the data and the bits fields for Panasonic and increased the sizie of bits from 8 to 32 bits. This way you should be able to use the Panasonic protocol as follows:

IrSend {"Protocol":"Panasonic", "Bits":16388, "Data":<Panasonic data>}

Where 16388 is hexadecimal 0x4004.

arendst commented 7 years ago

Implemented in master release v5.9.0