diff --git a/I2CDEVICES.md b/I2CDEVICES.md index cb42d97a4..788145d3e 100644 --- a/I2CDEVICES.md +++ b/I2CDEVICES.md @@ -69,4 +69,6 @@ Index | Define | Driver | Device | Address(es) | Description 45 | USE_HDC1080 | xsns_65 | HDC1080 | 0x40 | Temperature and Humidity sensor 46 | USE_IAQ | xsns_66 | IAQ | 0x5a | Air quality sensor 47 | USE_DISPLAY_SEVENSEG| xdsp_11 | HT16K33 | 0x70 - 0x77 | Seven segment LED - 48 | USE_AS3935 | xsns_67 | AS3935 | 0x03 | Franklin Lightning Sensor \ No newline at end of file + 48 | USE_AS3935 | xsns_67 | AS3935 | 0x03 | Franklin Lightning Sensor + 49 | USE_VEML6075 | xsns_70 | VEML6075 | 0x10 | UVA/UVB/UVINDEX Sensor + 50 | USE_VEML7700 | xsns_71 | VEML7700 | 0x10 | Ambient light intensity sensor \ No newline at end of file diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 75c484388..ab62c092f 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -54,5 +54,8 @@ The following binary downloads have been compiled with ESP8266/Arduino library c ### Version 8.3.1.1 +- Change IRremoteESP8266 library updated to v2.7.7 - Add command ``Rule0`` to change global rule parameters - Add more functionality to ``Switchmode`` 11 and 12 (#8450) +- Add support for VEML6075 UVA/UVB/UVINDEX Sensor by device111 (#8432) +- Add support for VEML7700 Ambient light intensity Sensor by device111 (#8432) diff --git a/lib/Adafruit_BusIO/.travis.yml b/lib/Adafruit_BusIO/.travis.yml new file mode 100644 index 000000000..40754054e --- /dev/null +++ b/lib/Adafruit_BusIO/.travis.yml @@ -0,0 +1,23 @@ +language: c +sudo: false +cache: + directories: + - ~/arduino_ide + - ~/.arduino15/packages/ +git: + depth: false + quiet: true +env: + global: + - PRETTYNAME="Adafruit BusIO Library" + +before_install: + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh) + +script: + - build_main_platforms + +# Generate and deploy documentation +after_success: + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/library_check.sh) + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh) \ No newline at end of file diff --git a/lib/Adafruit_BusIO/Adafruit_BusIO_Register.cpp b/lib/Adafruit_BusIO/Adafruit_BusIO_Register.cpp new file mode 100644 index 000000000..2c2b22e00 --- /dev/null +++ b/lib/Adafruit_BusIO/Adafruit_BusIO_Register.cpp @@ -0,0 +1,258 @@ +#include + +/*! + * @brief Create a register we access over an I2C Device (which defines the bus and address) + * @param i2cdevice The I2CDevice to use for underlying I2C access + * @param reg_addr The address pointer value for the I2C/SMBus register, can be 8 or 16 bits + * @param width The width of the register data itself, defaults to 1 byte + * @param bitorder The bit order of the register (used when width is > 1), defaults to LSBFIRST + * @param address_width The width of the register address itself, defaults to 1 byte + */ +Adafruit_BusIO_Register::Adafruit_BusIO_Register(Adafruit_I2CDevice *i2cdevice, uint16_t reg_addr, + uint8_t width, uint8_t bitorder, uint8_t address_width) { + _i2cdevice = i2cdevice; + _spidevice = NULL; + _addrwidth = address_width; + _address = reg_addr; + _bitorder = bitorder; + _width = width; +} + +/*! + * @brief Create a register we access over an SPI Device (which defines the bus and CS pin) + * @param spidevice The SPIDevice to use for underlying I2C access + * @param reg_addr The address pointer value for the I2C/SMBus register, can be 8 or 16 bits + * @param type The method we use to read/write data to SPI (which is not as well defined as I2C) + * @param width The width of the register data itself, defaults to 1 byte + * @param bitorder The bit order of the register (used when width is > 1), defaults to LSBFIRST + * @param address_width The width of the register address itself, defaults to 1 byte + */ +Adafruit_BusIO_Register::Adafruit_BusIO_Register(Adafruit_SPIDevice *spidevice, uint16_t reg_addr, + Adafruit_BusIO_SPIRegType type, + uint8_t width, uint8_t bitorder, uint8_t address_width) { + _spidevice = spidevice; + _spiregtype = type; + _i2cdevice = NULL; + _addrwidth = address_width; + _address = reg_addr; + _bitorder = bitorder; + _width = width; +} + +/*! + * @brief Create a register we access over an I2C or SPI Device. This is a handy function because we + * can pass in NULL for the unused interface, allowing libraries to mass-define all the registers + * @param i2cdevice The I2CDevice to use for underlying I2C access, if NULL we use SPI + * @param spidevice The SPIDevice to use for underlying I2C access, if NULL we use I2C + * @param reg_addr The address pointer value for the I2C/SMBus register, can be 8 or 16 bits + * @param type The method we use to read/write data to SPI (which is not as well defined as I2C) + * @param width The width of the register data itself, defaults to 1 byte + * @param bitorder The bit order of the register (used when width is > 1), defaults to LSBFIRST + * @param address_width The width of the register address itself, defaults to 1 byte + */ +Adafruit_BusIO_Register::Adafruit_BusIO_Register(Adafruit_I2CDevice *i2cdevice, Adafruit_SPIDevice *spidevice, + Adafruit_BusIO_SPIRegType type, uint16_t reg_addr, + uint8_t width, uint8_t bitorder, uint8_t address_width) { + _spidevice = spidevice; + _i2cdevice = i2cdevice; + _spiregtype = type; + _addrwidth = address_width; + _address = reg_addr; + _bitorder = bitorder; + _width = width; +} + + +/*! + * @brief Write a buffer of data to the register location + * @param buffer Pointer to data to write + * @param len Number of bytes to write + * @return True on successful write (only really useful for I2C as SPI is uncheckable) + */ +bool Adafruit_BusIO_Register::write(uint8_t *buffer, uint8_t len) { + + uint8_t addrbuffer[2] = {(uint8_t)(_address & 0xFF), (uint8_t)(_address>>8)}; + + if (_i2cdevice) { + return _i2cdevice->write(buffer, len, true, addrbuffer, _addrwidth); + } + if (_spidevice) { + if (_spiregtype == ADDRBIT8_HIGH_TOREAD) { + addrbuffer[0] &= ~0x80; + } + return _spidevice->write( buffer, len, addrbuffer, _addrwidth); + } + return false; +} + +/*! + * @brief Write up to 4 bytes of data to the register location + * @param value Data to write + * @param numbytes How many bytes from 'value' to write + * @return True on successful write (only really useful for I2C as SPI is uncheckable) + */ +bool Adafruit_BusIO_Register::write(uint32_t value, uint8_t numbytes) { + if (numbytes == 0) { + numbytes = _width; + } + if (numbytes > 4) { + return false; + } + + for (int i=0; i>= 8; + } + return write(_buffer, numbytes); +} + +/*! + * @brief Read data from the register location. This does not do any error checking! + * @return Returns 0xFFFFFFFF on failure, value otherwise + */ +uint32_t Adafruit_BusIO_Register::read(void) { + if (! read(_buffer, _width)) { + return -1; + } + + uint32_t value = 0; + + for (int i=0; i < _width; i++) { + value <<= 8; + if (_bitorder == LSBFIRST) { + value |= _buffer[_width-i-1]; + } else { + value |= _buffer[i]; + } + } + + return value; +} + + +/*! + * @brief Read a buffer of data from the register location + * @param buffer Pointer to data to read into + * @param len Number of bytes to read + * @return True on successful write (only really useful for I2C as SPI is uncheckable) + */ +bool Adafruit_BusIO_Register::read(uint8_t *buffer, uint8_t len) { + uint8_t addrbuffer[2] = {(uint8_t)(_address & 0xFF), (uint8_t)(_address>>8)}; + + if (_i2cdevice) { + return _i2cdevice->write_then_read(addrbuffer, _addrwidth, buffer, len); + } + if (_spidevice) { + if (_spiregtype == ADDRBIT8_HIGH_TOREAD) { + addrbuffer[0] |= 0x80; + } + return _spidevice->write_then_read(addrbuffer, _addrwidth, buffer, len); + } + return false; +} + +/*! + * @brief Read 2 bytes of data from the register location + * @param value Pointer to uint16_t variable to read into + * @return True on successful write (only really useful for I2C as SPI is uncheckable) + */ +bool Adafruit_BusIO_Register::read(uint16_t *value) { + if (! read(_buffer, 2)) { + return false; + } + + if (_bitorder == LSBFIRST) { + *value = _buffer[1]; + *value <<= 8; + *value |= _buffer[0]; + } else { + *value = _buffer[0]; + *value <<= 8; + *value |= _buffer[1]; + } + return true; +} + +/*! + * @brief Read 1 byte of data from the register location + * @param value Pointer to uint8_t variable to read into + * @return True on successful write (only really useful for I2C as SPI is uncheckable) + */ +bool Adafruit_BusIO_Register::read(uint8_t *value) { + if (! read(_buffer, 1)) { + return false; + } + + *value = _buffer[0]; + return true; +} + +/*! + * @brief Pretty printer for this register + * @param s The Stream to print to, defaults to &Serial + */ +void Adafruit_BusIO_Register::print(Stream *s) { + uint32_t val = read(); + s->print("0x"); s->print(val, HEX); +} + +/*! + * @brief Pretty printer for this register + * @param s The Stream to print to, defaults to &Serial + */ +void Adafruit_BusIO_Register::println(Stream *s) { + print(s); + s->println(); +} + + +/*! + * @brief Create a slice of the register that we can address without touching other bits + * @param reg The Adafruit_BusIO_Register which defines the bus/register + * @param bits The number of bits wide we are slicing + * @param shift The number of bits that our bit-slice is shifted from LSB + */ +Adafruit_BusIO_RegisterBits::Adafruit_BusIO_RegisterBits(Adafruit_BusIO_Register *reg, uint8_t bits, uint8_t shift) { + _register = reg; + _bits = bits; + _shift = shift; +} + +/*! + * @brief Read 4 bytes of data from the register + * @return data The 4 bytes to read + */ +uint32_t Adafruit_BusIO_RegisterBits::read(void) { + uint32_t val = _register->read(); + val >>= _shift; + return val & ((1 << (_bits)) - 1); +} + + +/*! + * @brief Write 4 bytes of data to the register + * @param data The 4 bytes to write + */ +void Adafruit_BusIO_RegisterBits::write(uint32_t data) { + uint32_t val = _register->read(); + + // mask off the data before writing + uint32_t mask = (1 << (_bits)) - 1; + data &= mask; + + mask <<= _shift; + val &= ~mask; // remove the current data at that spot + val |= data << _shift; // and add in the new data + + _register->write(val, _register->width()); +} + +/*! + * @brief The width of the register data, helpful for doing calculations + * @returns The data width used when initializing the register + */ +uint8_t Adafruit_BusIO_Register::width(void) { return _width; } diff --git a/lib/Adafruit_BusIO/Adafruit_BusIO_Register.h b/lib/Adafruit_BusIO/Adafruit_BusIO_Register.h new file mode 100644 index 000000000..45ae1e146 --- /dev/null +++ b/lib/Adafruit_BusIO/Adafruit_BusIO_Register.h @@ -0,0 +1,69 @@ +#include +#include +#include + + +#ifndef Adafruit_BusIO_Register_h +#define Adafruit_BusIO_Register_h + +typedef enum _Adafruit_BusIO_SPIRegType { + ADDRBIT8_HIGH_TOREAD = 0, +} Adafruit_BusIO_SPIRegType; + +/*! + * @brief The class which defines a device register (a location to read/write data from) + */ +class Adafruit_BusIO_Register { + public: + Adafruit_BusIO_Register(Adafruit_I2CDevice *i2cdevice, uint16_t reg_addr, + uint8_t width=1, uint8_t bitorder=LSBFIRST, + uint8_t address_width=1); + Adafruit_BusIO_Register(Adafruit_SPIDevice *spidevice, uint16_t reg_addr, + Adafruit_BusIO_SPIRegType type, + uint8_t width=1, uint8_t bitorder=LSBFIRST, + uint8_t address_width=1); + + Adafruit_BusIO_Register(Adafruit_I2CDevice *i2cdevice, + Adafruit_SPIDevice *spidevice, + Adafruit_BusIO_SPIRegType type, + uint16_t reg_addr, + uint8_t width=1, uint8_t bitorder=LSBFIRST, + uint8_t address_width=1); + + bool read(uint8_t *buffer, uint8_t len); + bool read(uint8_t *value); + bool read(uint16_t *value); + uint32_t read(void); + bool write(uint8_t *buffer, uint8_t len); + bool write(uint32_t value, uint8_t numbytes=0); + + uint8_t width(void); + + void print(Stream *s=&Serial); + void println(Stream *s=&Serial); + + private: + Adafruit_I2CDevice *_i2cdevice; + Adafruit_SPIDevice *_spidevice; + Adafruit_BusIO_SPIRegType _spiregtype; + uint16_t _address; + uint8_t _width, _addrwidth, _bitorder; + uint8_t _buffer[4]; // we wont support anything larger than uint32 for non-buffered read +}; + + +/*! + * @brief The class which defines a slice of bits from within a device register (a location to read/write data from) + */ +class Adafruit_BusIO_RegisterBits { + public: + Adafruit_BusIO_RegisterBits(Adafruit_BusIO_Register *reg, uint8_t bits, uint8_t shift); + void write(uint32_t value); + uint32_t read(void); + private: + Adafruit_BusIO_Register *_register; + uint8_t _bits, _shift; +}; + + +#endif //BusIO_Register_h diff --git a/lib/Adafruit_BusIO/Adafruit_I2CDevice.cpp b/lib/Adafruit_BusIO/Adafruit_I2CDevice.cpp new file mode 100644 index 000000000..7813a6df7 --- /dev/null +++ b/lib/Adafruit_BusIO/Adafruit_I2CDevice.cpp @@ -0,0 +1,213 @@ +#include +#include + +//#define DEBUG_SERIAL Serial + +/*! + * @brief Create an I2C device at a given address + * @param addr The 7-bit I2C address for the device + * @param theWire The I2C bus to use, defaults to &Wire + */ +Adafruit_I2CDevice::Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire) { + _addr = addr; + _wire = theWire; + _begun = false; +#ifdef ARDUINO_ARCH_SAMD + _maxBufferSize = 250; // as defined in Wire.h's RingBuffer +#else + _maxBufferSize = 32; +#endif +} + +/*! + * @brief Initializes and does basic address detection + * @param addr_detect Whether we should attempt to detect the I2C address with a scan. + * 99% of sensors/devices don't mind but once in a while, they spaz on a scan! + * @return True if I2C initialized and a device with the addr found + */ +bool Adafruit_I2CDevice::begin(bool addr_detect) { + _wire->begin(); + _begun = true; + + if (addr_detect) { + return detected(); + } + return true; +} + + +/*! + * @brief Scans I2C for the address - note will give a false-positive + * if there's no pullups on I2C + * @return True if I2C initialized and a device with the addr found + */ +bool Adafruit_I2CDevice::detected(void) { + // Init I2C if not done yet + if (!_begun && !begin()) { + return false; + } + + // A basic scanner, see if it ACK's + _wire->beginTransmission(_addr); + if (_wire->endTransmission () == 0) { + return true; + } + return false; +} + +/*! + * @brief Write a buffer or two to the I2C device. Cannot be more than maxBufferSize() bytes. + * @param buffer Pointer to buffer of data to write + * @param len Number of bytes from buffer to write + * @param prefix_buffer Pointer to optional array of data to write before buffer. + * Cannot be more than maxBufferSize() bytes. + * @param prefix_len Number of bytes from prefix buffer to write + * @param stop Whether to send an I2C STOP signal on write + * @return True if write was successful, otherwise false. + */ +bool Adafruit_I2CDevice::write(uint8_t *buffer, size_t len, bool stop, uint8_t *prefix_buffer, size_t prefix_len) { + if ((len+prefix_len) > maxBufferSize()) { + // currently not guaranteed to work if more than 32 bytes! + // we will need to find out if some platforms have larger + // I2C buffer sizes :/ +#ifdef DEBUG_SERIAL + DEBUG_SERIAL.println(F("\tI2CDevice could not write such a large buffer")); +#endif + return false; + } + + _wire->beginTransmission(_addr); + + // Write the prefix data (usually an address) + if ((prefix_len != 0) && (prefix_buffer != NULL)) { + if (_wire->write(prefix_buffer, prefix_len) != prefix_len) { +#ifdef DEBUG_SERIAL + DEBUG_SERIAL.println(F("\tI2CDevice failed to write")); +#endif + return false; + } + } + + // Write the data itself + if (_wire->write(buffer, len) != len) { +#ifdef DEBUG_SERIAL + DEBUG_SERIAL.println(F("\tI2CDevice failed to write")); +#endif + return false; + } + +#ifdef DEBUG_SERIAL + DEBUG_SERIAL.print(F("\tI2CDevice Wrote: ")); + if ((prefix_len != 0) && (prefix_buffer != NULL)) { + for (uint16_t i=0; iendTransmission(stop) == 0) { +#ifdef DEBUG_SERIAL + DEBUG_SERIAL.println("Sent!"); +#endif + return true; + } else { +#ifdef DEBUG_SERIAL + DEBUG_SERIAL.println("Failed to send!"); +#endif + return false; + } +} + + +/*! + * @brief Read from I2C into a buffer from the I2C device. + * Cannot be more than maxBufferSize() bytes. + * @param buffer Pointer to buffer of data to read into + * @param len Number of bytes from buffer to read. + * @param stop Whether to send an I2C STOP signal on read + * @return True if read was successful, otherwise false. + */ +bool Adafruit_I2CDevice::read(uint8_t *buffer, size_t len, bool stop) { + if (len > maxBufferSize()) { + // currently not guaranteed to work if more than 32 bytes! + // we will need to find out if some platforms have larger + // I2C buffer sizes :/ +#ifdef DEBUG_SERIAL + DEBUG_SERIAL.println(F("\tI2CDevice could not read such a large buffer")); +#endif + return false; + } + + size_t recv = _wire->requestFrom((uint8_t)_addr, (uint8_t)len, (uint8_t)stop); + if (recv != len) { + // Not enough data available to fulfill our obligation! +#ifdef DEBUG_SERIAL + DEBUG_SERIAL.print(F("\tI2CDevice did not receive enough data: ")); + DEBUG_SERIAL.println(recv); +#endif + return false; + } + + for (uint16_t i=0; iread(); + } + +#ifdef DEBUG_SERIAL + DEBUG_SERIAL.print(F("\tI2CDevice Read: ")); + for (uint16_t i=0; i + +#ifndef Adafruit_I2CDevice_h +#define Adafruit_I2CDevice_h + +///< The class which defines how we will talk to this device over I2C +class Adafruit_I2CDevice { + public: + Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire=&Wire); + uint8_t address(void); + bool begin(bool addr_detect=true); + bool detected(void); + + bool read(uint8_t *buffer, size_t len, bool stop=true); + bool write(uint8_t *buffer, size_t len, bool stop=true, uint8_t *prefix_buffer=NULL, size_t prefix_len=0); + bool write_then_read(uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len, bool stop=false); + + /*! @brief How many bytes we can read in a transaction + * @return The size of the Wire receive/transmit buffer */ + uint16_t maxBufferSize() { return _maxBufferSize; } + + private: + uint8_t _addr; + TwoWire *_wire; + bool _begun; + uint16_t _maxBufferSize; +}; + +#endif // Adafruit_I2CDevice_h diff --git a/lib/Adafruit_BusIO/Adafruit_I2CRegister.h b/lib/Adafruit_BusIO/Adafruit_I2CRegister.h new file mode 100644 index 000000000..703e93b76 --- /dev/null +++ b/lib/Adafruit_BusIO/Adafruit_I2CRegister.h @@ -0,0 +1,8 @@ +#include "Adafruit_BusIO_Register.h" +#ifndef _ADAFRUIT_I2C_REGISTER_H_ +#define _ADAFRUIT_I2C_REGISTER_H_ + +typedef Adafruit_BusIO_Register Adafruit_I2CRegister; +typedef Adafruit_BusIO_RegisterBits Adafruit_I2CRegisterBits; + +#endif diff --git a/lib/Adafruit_BusIO/Adafruit_SPIDevice.cpp b/lib/Adafruit_BusIO/Adafruit_SPIDevice.cpp new file mode 100644 index 000000000..1d599bb11 --- /dev/null +++ b/lib/Adafruit_BusIO/Adafruit_SPIDevice.cpp @@ -0,0 +1,301 @@ +#include +#include + +//#define DEBUG_SERIAL Serial + +/*! + * @brief Create an SPI device with the given CS pin and settins + * @param cspin The arduino pin number to use for chip select + * @param freq The SPI clock frequency to use, defaults to 1MHz + * @param dataOrder The SPI data order to use for bits within each byte, defaults to SPI_BITORDER_MSBFIRST + * @param dataMode The SPI mode to use, defaults to SPI_MODE0 + * @param theSPI The SPI bus to use, defaults to &theSPI + */ +Adafruit_SPIDevice::Adafruit_SPIDevice(int8_t cspin, uint32_t freq, BitOrder dataOrder, uint8_t dataMode, SPIClass *theSPI) { + _cs = cspin; + _sck = _mosi = _miso = -1; + _spi = theSPI; + _begun = false; + _spiSetting = new SPISettings(freq, dataOrder, dataMode); + _freq = freq; + _dataOrder = dataOrder; + _dataMode = dataMode; +} + +/*! + * @brief Create an SPI device with the given CS pin and settins + * @param cspin The arduino pin number to use for chip select + * @param sckpin The arduino pin number to use for SCK + * @param misopin The arduino pin number to use for MISO, set to -1 if not used + * @param mosipin The arduino pin number to use for MOSI, set to -1 if not used + * @param freq The SPI clock frequency to use, defaults to 1MHz + * @param dataOrder The SPI data order to use for bits within each byte, defaults to SPI_BITORDER_MSBFIRST + * @param dataMode The SPI mode to use, defaults to SPI_MODE0 + */ +Adafruit_SPIDevice::Adafruit_SPIDevice(int8_t cspin, int8_t sckpin, int8_t misopin, int8_t mosipin, + uint32_t freq, BitOrder dataOrder, uint8_t dataMode) { + _cs = cspin; + _sck = sckpin; + _miso = misopin; + _mosi = mosipin; + _freq = freq; + _dataOrder = dataOrder; + _dataMode = dataMode; + _begun = false; + _spiSetting = new SPISettings(freq, dataOrder, dataMode); + _spi = NULL; +} + + +/*! + * @brief Initializes SPI bus and sets CS pin high + * @return Always returns true because there's no way to test success of SPI init + */ +bool Adafruit_SPIDevice::begin(void) { + pinMode(_cs, OUTPUT); + digitalWrite(_cs, HIGH); + + if (_spi) { // hardware SPI + _spi->begin(); + } else { + pinMode(_sck, OUTPUT); + + if (_dataMode==SPI_MODE0) { + digitalWrite(_sck, HIGH); + } else { + digitalWrite(_sck, LOW); + } + if (_mosi != -1) { + pinMode(_mosi, OUTPUT); + digitalWrite(_mosi, HIGH); + } + if (_miso != -1) { + pinMode(_miso, INPUT); + } + } + + _begun = true; + return true; +} + + +/*! + * @brief Transfer (send/receive) one byte over hard/soft SPI + * @param buffer The buffer to send and receive at the same time + * @param len The number of bytes to transfer + */ +void Adafruit_SPIDevice::transfer(uint8_t *buffer, size_t len) { + if (_spi) { + // hardware SPI is easy + _spi->transfer(buffer, len); + return; + } + + // for softSPI we'll do it by hand + for (size_t i=0; i> b) & 0x1) << (7-b); + } + send = temp; + } + for (int b=7; b>=0; b--) { + reply <<= 1; + if (_dataMode == SPI_MODE0) { + digitalWrite(_sck, LOW); + digitalWrite(_mosi, send & (1<> b) & 0x1) << (7-b); + } + reply = temp; + } + + buffer[i] = reply; + } + return; +} + + + +/*! + * @brief Transfer (send/receive) one byte over hard/soft SPI + * @param send The byte to send + * @return The byte received while transmitting + */ +uint8_t Adafruit_SPIDevice::transfer(uint8_t send) { + uint8_t data = send; + transfer(&data, 1); + return data; +} + + +/*! + * @brief Write a buffer or two to the SPI device. + * @param buffer Pointer to buffer of data to write + * @param len Number of bytes from buffer to write + * @param prefix_buffer Pointer to optional array of data to write before buffer. + * @param prefix_len Number of bytes from prefix buffer to write + * @return Always returns true because there's no way to test success of SPI writes + */ +bool Adafruit_SPIDevice::write(uint8_t *buffer, size_t len, uint8_t *prefix_buffer, size_t prefix_len) { + if (_spi) { + _spi->beginTransaction(*_spiSetting); + } + + digitalWrite(_cs, LOW); + // do the writing + for (size_t i=0; iendTransaction(); + } + +#ifdef DEBUG_SERIAL + DEBUG_SERIAL.print(F("\tSPIDevice Wrote: ")); + if ((prefix_len != 0) && (prefix_buffer != NULL)) { + for (uint16_t i=0; ibeginTransaction(*_spiSetting); + } + digitalWrite(_cs, LOW); + transfer(buffer, len); + digitalWrite(_cs, HIGH); + + if (_spi) { + _spi->endTransaction(); + } + +#ifdef DEBUG_SERIAL + DEBUG_SERIAL.print(F("\tSPIDevice Read: ")); + for (uint16_t i=0; ibeginTransaction(*_spiSetting); + } + + digitalWrite(_cs, LOW); + // do the writing + for (size_t i=0; iendTransaction(); + } + + return true; +} diff --git a/lib/Adafruit_BusIO/Adafruit_SPIDevice.h b/lib/Adafruit_BusIO/Adafruit_SPIDevice.h new file mode 100644 index 000000000..987cb3f62 --- /dev/null +++ b/lib/Adafruit_BusIO/Adafruit_SPIDevice.h @@ -0,0 +1,62 @@ +#include + +#ifndef Adafruit_SPIDevice_h +#define Adafruit_SPIDevice_h + +// some modern SPI definitions don't have BitOrder enum +#if (defined(__AVR__) && !defined(ARDUINO_ARCH_MEGAAVR)) || defined(ESP8266) || defined(TEENSYDUINO) +typedef enum _BitOrder { + SPI_BITORDER_MSBFIRST = MSBFIRST, + SPI_BITORDER_LSBFIRST = LSBFIRST, +} BitOrder; +#endif + +// some modern SPI definitions don't have BitOrder enum and have different SPI mode defines +#if defined(ESP32) +typedef enum _BitOrder { + SPI_BITORDER_MSBFIRST = SPI_MSBFIRST, + SPI_BITORDER_LSBFIRST = SPI_LSBFIRST, +} BitOrder; +#endif + +// Some platforms have a BitOrder enum but its named MSBFIRST/LSBFIRST +#if defined(ARDUINO_ARCH_SAMD) || defined(__SAM3X8E__) || defined(NRF52_SERIES) || defined(ARDUINO_ARCH_ARDUINO_CORE_STM32) || defined(ARDUINO_ARCH_MEGAAVR) || defined(_STM32_DEF_) + #define SPI_BITORDER_MSBFIRST MSBFIRST + #define SPI_BITORDER_LSBFIRST LSBFIRST +#endif + +///< The class which defines how we will talk to this device over SPI +class Adafruit_SPIDevice { + public: + Adafruit_SPIDevice(int8_t cspin, + uint32_t freq=1000000, + BitOrder dataOrder=SPI_BITORDER_MSBFIRST, + uint8_t dataMode=SPI_MODE0, + SPIClass *theSPI=&SPI); + + Adafruit_SPIDevice(int8_t cspin, int8_t sck, int8_t miso, int8_t mosi, + uint32_t freq=1000000, + BitOrder dataOrder=SPI_BITORDER_MSBFIRST, + uint8_t dataMode=SPI_MODE0); + + bool begin(void); + bool read(uint8_t *buffer, size_t len, uint8_t sendvalue=0xFF); + bool write(uint8_t *buffer, size_t len, uint8_t *prefix_buffer=NULL, size_t prefix_len=0); + bool write_then_read(uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len, uint8_t sendvalue=0xFF); + + uint8_t transfer(uint8_t send); + void transfer(uint8_t *buffer, size_t len); + + private: + + SPIClass *_spi; + SPISettings *_spiSetting; + uint32_t _freq; + BitOrder _dataOrder; + uint8_t _dataMode; + + int8_t _cs, _sck, _mosi, _miso; + bool _begun; +}; + +#endif // Adafruit_SPIDevice_h diff --git a/lib/Adafruit_BusIO/LICENSE b/lib/Adafruit_BusIO/LICENSE new file mode 100644 index 000000000..860e3e285 --- /dev/null +++ b/lib/Adafruit_BusIO/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Adafruit Industries + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/lib/Adafruit_BusIO/README.md b/lib/Adafruit_BusIO/README.md new file mode 100644 index 000000000..a1830809c --- /dev/null +++ b/lib/Adafruit_BusIO/README.md @@ -0,0 +1,7 @@ +# Adafruit Bus IO Library [![Build Status](https://travis-ci.com/adafruit/Adafruit_BusIO.svg?branch=master)](https://travis-ci.com/adafruit/Adafruit_BusIO) + +This is a helper libary to abstract away I2C & SPI transactions and registers + +Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! + +MIT license, all text above must be included in any redistribution diff --git a/lib/Adafruit_BusIO/examples/i2c_address_detect/i2c_address_detect.ino b/lib/Adafruit_BusIO/examples/i2c_address_detect/i2c_address_detect.ino new file mode 100644 index 000000000..b1505254e --- /dev/null +++ b/lib/Adafruit_BusIO/examples/i2c_address_detect/i2c_address_detect.ino @@ -0,0 +1,21 @@ +#include + +Adafruit_I2CDevice i2c_dev = Adafruit_I2CDevice(0x10); + +void setup() { + while (!Serial) { delay(10); } + Serial.begin(115200); + Serial.println("I2C address detection test"); + + if (!i2c_dev.begin()) { + Serial.print("Did not find device at 0x"); + Serial.println(i2c_dev.address(), HEX); + while (1); + } + Serial.print("Device found on address 0x"); + Serial.println(i2c_dev.address(), HEX); +} + +void loop() { + +} diff --git a/lib/Adafruit_BusIO/examples/i2c_readwrite/i2c_readwrite.ino b/lib/Adafruit_BusIO/examples/i2c_readwrite/i2c_readwrite.ino new file mode 100644 index 000000000..909cf3118 --- /dev/null +++ b/lib/Adafruit_BusIO/examples/i2c_readwrite/i2c_readwrite.ino @@ -0,0 +1,41 @@ +#include + +#define I2C_ADDRESS 0x60 +Adafruit_I2CDevice i2c_dev = Adafruit_I2CDevice(I2C_ADDRESS); + + +void setup() { + while (!Serial) { delay(10); } + Serial.begin(115200); + Serial.println("I2C device read and write test"); + + if (!i2c_dev.begin()) { + Serial.print("Did not find device at 0x"); + Serial.println(i2c_dev.address(), HEX); + while (1); + } + Serial.print("Device found on address 0x"); + Serial.println(i2c_dev.address(), HEX); + + uint8_t buffer[32]; + // Try to read 32 bytes + i2c_dev.read(buffer, 32); + Serial.print("Read: "); + for (uint8_t i=0; i<32; i++) { + Serial.print("0x"); Serial.print(buffer[i], HEX); Serial.print(", "); + } + Serial.println(); + + // read a register by writing first, then reading + buffer[0] = 0x0C; // we'll reuse the same buffer + i2c_dev.write_then_read(buffer, 1, buffer, 2, false); + Serial.print("Write then Read: "); + for (uint8_t i=0; i<2; i++) { + Serial.print("0x"); Serial.print(buffer[i], HEX); Serial.print(", "); + } + Serial.println(); +} + +void loop() { + +} diff --git a/lib/Adafruit_BusIO/examples/i2c_registers/i2c_registers.ino b/lib/Adafruit_BusIO/examples/i2c_registers/i2c_registers.ino new file mode 100644 index 000000000..41a30436e --- /dev/null +++ b/lib/Adafruit_BusIO/examples/i2c_registers/i2c_registers.ino @@ -0,0 +1,38 @@ +#include +#include + +#define I2C_ADDRESS 0x60 +Adafruit_I2CDevice i2c_dev = Adafruit_I2CDevice(I2C_ADDRESS); + + +void setup() { + while (!Serial) { delay(10); } + Serial.begin(115200); + Serial.println("I2C device register test"); + + if (!i2c_dev.begin()) { + Serial.print("Did not find device at 0x"); + Serial.println(i2c_dev.address(), HEX); + while (1); + } + Serial.print("Device found on address 0x"); + Serial.println(i2c_dev.address(), HEX); + + Adafruit_BusIO_Register id_reg = Adafruit_BusIO_Register(&i2c_dev, 0x0C, 2, LSBFIRST); + uint16_t id; + id_reg.read(&id); + Serial.print("ID register = 0x"); Serial.println(id, HEX); + + Adafruit_BusIO_Register thresh_reg = Adafruit_BusIO_Register(&i2c_dev, 0x01, 2, LSBFIRST); + uint16_t thresh; + thresh_reg.read(&thresh); + Serial.print("Initial threshold register = 0x"); Serial.println(thresh, HEX); + + thresh_reg.write(~thresh); + + Serial.print("Post threshold register = 0x"); Serial.println(thresh_reg.read(), HEX); +} + +void loop() { + +} \ No newline at end of file diff --git a/lib/Adafruit_BusIO/examples/i2corspi_register/i2corspi_register.ino b/lib/Adafruit_BusIO/examples/i2corspi_register/i2corspi_register.ino new file mode 100644 index 000000000..555cf3b0d --- /dev/null +++ b/lib/Adafruit_BusIO/examples/i2corspi_register/i2corspi_register.ino @@ -0,0 +1,38 @@ +#include + +// Define which interface to use by setting the unused interface to NULL! + +#define SPIDEVICE_CS 10 +Adafruit_SPIDevice *spi_dev = NULL; // new Adafruit_SPIDevice(SPIDEVICE_CS); + +#define I2C_ADDRESS 0x5D +Adafruit_I2CDevice *i2c_dev = new Adafruit_I2CDevice(I2C_ADDRESS); + +void setup() { + while (!Serial) { delay(10); } + Serial.begin(115200); + Serial.println("I2C or SPI device register test"); + + if (spi_dev && !spi_dev->begin()) { + Serial.println("Could not initialize SPI device"); + } + + if (i2c_dev) { + if (i2c_dev->begin()) { + Serial.print("Device found on I2C address 0x"); + Serial.println(i2c_dev->address(), HEX); + } else { + Serial.print("Did not find I2C device at 0x"); + Serial.println(i2c_dev->address(), HEX); + } + } + + Adafruit_BusIO_Register id_reg = Adafruit_BusIO_Register(i2c_dev, spi_dev, ADDRBIT8_HIGH_TOREAD, 0x0F); + uint8_t id; + id_reg.read(&id); + Serial.print("ID register = 0x"); Serial.println(id, HEX); +} + +void loop() { + +} \ No newline at end of file diff --git a/lib/Adafruit_BusIO/examples/spi_modetest/spi_modetest.ino b/lib/Adafruit_BusIO/examples/spi_modetest/spi_modetest.ino new file mode 100644 index 000000000..10168c5ff --- /dev/null +++ b/lib/Adafruit_BusIO/examples/spi_modetest/spi_modetest.ino @@ -0,0 +1,29 @@ +#include + +#define SPIDEVICE_CS 10 +Adafruit_SPIDevice spi_dev = Adafruit_SPIDevice(SPIDEVICE_CS, 100000, SPI_BITORDER_MSBFIRST, SPI_MODE1); +//Adafruit_SPIDevice spi_dev = Adafruit_SPIDevice(SPIDEVICE_CS, 13, 12, 11, 100000, SPI_BITORDER_MSBFIRST, SPI_MODE1); + + +void setup() { + while (!Serial) { delay(10); } + Serial.begin(115200); + Serial.println("SPI device mode test"); + + if (!spi_dev.begin()) { + Serial.println("Could not initialize SPI device"); + while (1); + } +} + +void loop() { + Serial.println("\n\nTransfer test"); + for (uint16_t x=0; x<=0xFF; x++) { + uint8_t i = x; + Serial.print("0x"); Serial.print(i, HEX); + spi_dev.read(&i, 1, i); + Serial.print("/"); Serial.print(i, HEX); + Serial.print(", "); + delay(25); + } +} \ No newline at end of file diff --git a/lib/Adafruit_BusIO/examples/spi_readwrite/spi_readwrite.ino b/lib/Adafruit_BusIO/examples/spi_readwrite/spi_readwrite.ino new file mode 100644 index 000000000..6f2c063f0 --- /dev/null +++ b/lib/Adafruit_BusIO/examples/spi_readwrite/spi_readwrite.ino @@ -0,0 +1,39 @@ +#include + +#define SPIDEVICE_CS 10 +Adafruit_SPIDevice spi_dev = Adafruit_SPIDevice(SPIDEVICE_CS); + + +void setup() { + while (!Serial) { delay(10); } + Serial.begin(115200); + Serial.println("SPI device read and write test"); + + if (!spi_dev.begin()) { + Serial.println("Could not initialize SPI device"); + while (1); + } + + uint8_t buffer[32]; + + // Try to read 32 bytes + spi_dev.read(buffer, 32); + Serial.print("Read: "); + for (uint8_t i=0; i<32; i++) { + Serial.print("0x"); Serial.print(buffer[i], HEX); Serial.print(", "); + } + Serial.println(); + + // read a register by writing first, then reading + buffer[0] = 0x8F; // we'll reuse the same buffer + spi_dev.write_then_read(buffer, 1, buffer, 2, false); + Serial.print("Write then Read: "); + for (uint8_t i=0; i<2; i++) { + Serial.print("0x"); Serial.print(buffer[i], HEX); Serial.print(", "); + } + Serial.println(); +} + +void loop() { + +} diff --git a/lib/Adafruit_BusIO/examples/spi_registers/spi_registers.ino b/lib/Adafruit_BusIO/examples/spi_registers/spi_registers.ino new file mode 100644 index 000000000..e24f1aa9a --- /dev/null +++ b/lib/Adafruit_BusIO/examples/spi_registers/spi_registers.ino @@ -0,0 +1,34 @@ +#include +#include + +#define SPIDEVICE_CS 10 +Adafruit_SPIDevice spi_dev = Adafruit_SPIDevice(SPIDEVICE_CS); + +void setup() { + while (!Serial) { delay(10); } + Serial.begin(115200); + Serial.println("SPI device register test"); + + if (!spi_dev.begin()) { + Serial.println("Could not initialize SPI device"); + while (1); + } + + Adafruit_BusIO_Register id_reg = Adafruit_BusIO_Register(&spi_dev, 0x0F, ADDRBIT8_HIGH_TOREAD); + uint8_t id; + id_reg.read(&id); + Serial.print("ID register = 0x"); Serial.println(id, HEX); + + Adafruit_BusIO_Register thresh_reg = Adafruit_BusIO_Register(&spi_dev, 0x0C, ADDRBIT8_HIGH_TOREAD, 2, LSBFIRST); + uint16_t thresh; + thresh_reg.read(&thresh); + Serial.print("Initial threshold register = 0x"); Serial.println(thresh, HEX); + + thresh_reg.write(~thresh); + + Serial.print("Post threshold register = 0x"); Serial.println(thresh_reg.read(), HEX); +} + +void loop() { + +} \ No newline at end of file diff --git a/lib/Adafruit_BusIO/library.properties b/lib/Adafruit_BusIO/library.properties new file mode 100644 index 000000000..f63425a7d --- /dev/null +++ b/lib/Adafruit_BusIO/library.properties @@ -0,0 +1,9 @@ +name=Adafruit BusIO +version=1.0.10 +author=Adafruit +maintainer=Adafruit +sentence=This is a library for abstracting away UART, I2C and SPI interfacing +paragraph=This is a library for abstracting away UART, I2C and SPI interfacing +category=Signal Input/Output +url=https://github.com/adafruit/Adafruit_BusIO +architectures=* diff --git a/lib/Adafruit_VEML7700/.github/ISSUE_TEMPLATE.md b/lib/Adafruit_VEML7700/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..f0e26146f --- /dev/null +++ b/lib/Adafruit_VEML7700/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,46 @@ +Thank you for opening an issue on an Adafruit Arduino library repository. To +improve the speed of resolution please review the following guidelines and +common troubleshooting steps below before creating the issue: + +- **Do not use GitHub issues for troubleshooting projects and issues.** Instead use + the forums at http://forums.adafruit.com to ask questions and troubleshoot why + something isn't working as expected. In many cases the problem is a common issue + that you will more quickly receive help from the forum community. GitHub issues + are meant for known defects in the code. If you don't know if there is a defect + in the code then start with troubleshooting on the forum first. + +- **If following a tutorial or guide be sure you didn't miss a step.** Carefully + check all of the steps and commands to run have been followed. Consult the + forum if you're unsure or have questions about steps in a guide/tutorial. + +- **For Arduino projects check these very common issues to ensure they don't apply**: + + - For uploading sketches or communicating with the board make sure you're using + a **USB data cable** and **not** a **USB charge-only cable**. It is sometimes + very hard to tell the difference between a data and charge cable! Try using the + cable with other devices or swapping to another cable to confirm it is not + the problem. + + - **Be sure you are supplying adequate power to the board.** Check the specs of + your board and plug in an external power supply. In many cases just + plugging a board into your computer is not enough to power it and other + peripherals. + + - **Double check all soldering joints and connections.** Flakey connections + cause many mysterious problems. See the [guide to excellent soldering](https://learn.adafruit.com/adafruit-guide-excellent-soldering/tools) for examples of good solder joints. + + - **Ensure you are using an official Arduino or Adafruit board.** We can't + guarantee a clone board will have the same functionality and work as expected + with this code and don't support them. + +If you're sure this issue is a defect in the code and checked the steps above +please fill in the following fields to provide enough troubleshooting information. +You may delete the guideline and text above to just leave the following details: + +- Arduino board: **INSERT ARDUINO BOARD NAME/TYPE HERE** + +- Arduino IDE version (found in Arduino -> About Arduino menu): **INSERT ARDUINO + VERSION HERE** + +- List the steps to reproduce the problem below (if possible attach a sketch or + copy the sketch code in too): **LIST REPRO STEPS BELOW** diff --git a/lib/Adafruit_VEML7700/.github/PULL_REQUEST_TEMPLATE.md b/lib/Adafruit_VEML7700/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..7b641eb86 --- /dev/null +++ b/lib/Adafruit_VEML7700/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,26 @@ +Thank you for creating a pull request to contribute to Adafruit's GitHub code! +Before you open the request please review the following guidelines and tips to +help it be more easily integrated: + +- **Describe the scope of your change--i.e. what the change does and what parts + of the code were modified.** This will help us understand any risks of integrating + the code. + +- **Describe any known limitations with your change.** For example if the change + doesn't apply to a supported platform of the library please mention it. + +- **Please run any tests or examples that can exercise your modified code.** We + strive to not break users of the code and running tests/examples helps with this + process. + +Thank you again for contributing! We will try to test and integrate the change +as soon as we can, but be aware we have many GitHub repositories to manage and +can't immediately respond to every request. There is no need to bump or check in +on a pull request (it will clutter the discussion of the request). + +Also don't be worried if the request is closed or not integrated--sometimes the +priorities of Adafruit's GitHub code (education, ease of use) might not match the +priorities of the pull request. Don't fret, the open source community thrives on +forks and GitHub makes it easy to keep your changes in a forked repo. + +After reviewing the guidelines above you can delete this text from the pull request. diff --git a/lib/Adafruit_VEML7700/.gitignore b/lib/Adafruit_VEML7700/.gitignore new file mode 100644 index 000000000..542d266a9 --- /dev/null +++ b/lib/Adafruit_VEML7700/.gitignore @@ -0,0 +1,8 @@ +# osx +.DS_Store + +# doxygen +Doxyfile* +doxygen_sqlite3.db +html +*.tmp diff --git a/lib/Adafruit_VEML7700/.travis.yml b/lib/Adafruit_VEML7700/.travis.yml new file mode 100644 index 000000000..b967e9a08 --- /dev/null +++ b/lib/Adafruit_VEML7700/.travis.yml @@ -0,0 +1,26 @@ +language: c +sudo: false +cache: + directories: + - ~/arduino_ide + - ~/.arduino15/packages/ +git: + depth: false + quiet: true +env: + global: + - PRETTYNAME="Adafruit VEML7700 Arduino Library" + +before_install: + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh) + +install: + - arduino --install-library "Adafruit BusIO" + +script: + - build_main_platforms + +# Generate and deploy documentation +after_success: + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/library_check.sh) + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh) \ No newline at end of file diff --git a/lib/Adafruit_VEML7700/Adafruit_VEML7700.cpp b/lib/Adafruit_VEML7700/Adafruit_VEML7700.cpp new file mode 100644 index 000000000..001d4995e --- /dev/null +++ b/lib/Adafruit_VEML7700/Adafruit_VEML7700.cpp @@ -0,0 +1,322 @@ +/*! + * @file Adafruit_VEML7700.cpp + * + * @mainpage Adafruit VEML7700 I2C Lux Sensor + * + * @section intro_sec Introduction + * + * I2C Driver for the VEML7700 I2C Lux sensor + * + * This is a library for the Adafruit VEML7700 breakout: + * http://www.adafruit.com/ + * + * Adafruit invests time and resources providing this open source code, + * please support Adafruit and open-source hardware by purchasing products from + * Adafruit! + * + * @section author Author + * + * Limor Fried (Adafruit Industries) + * + * @section license License + * + * BSD (see license.txt) + * + * @section HISTORY + * + * v1.0 - First release + */ + +#include "Arduino.h" +#include + +#include "Adafruit_VEML7700.h" + +/*! + * @brief Instantiates a new VEML7700 class + */ +Adafruit_VEML7700::Adafruit_VEML7700(void) {} + +/*! + * @brief Setups the hardware for talking to the VEML7700 + * @param theWire An optional pointer to an I2C interface + * @return True if initialization was successful, otherwise false. + */ +boolean Adafruit_VEML7700::begin(TwoWire *theWire) { + i2c_dev = new Adafruit_I2CDevice(VEML7700_I2CADDR_DEFAULT, theWire); + + if (!i2c_dev->begin()) { + return false; + } + + ALS_Config = new Adafruit_I2CRegister(i2c_dev, VEML7700_ALS_CONFIG, 2, LSBFIRST); + ALS_HighThreshold = new Adafruit_I2CRegister(i2c_dev, VEML7700_ALS_THREHOLD_HIGH, 2, LSBFIRST); + ALS_LowThreshold = new Adafruit_I2CRegister(i2c_dev, VEML7700_ALS_THREHOLD_LOW, 2, LSBFIRST); + Power_Saving = new Adafruit_I2CRegister(i2c_dev, VEML7700_ALS_POWER_SAVE, 2, LSBFIRST); + ALS_Data = new Adafruit_I2CRegister(i2c_dev, VEML7700_ALS_DATA, 2, LSBFIRST); + White_Data = new Adafruit_I2CRegister(i2c_dev, VEML7700_WHITE_DATA, 2, LSBFIRST); + Interrupt_Status = new Adafruit_I2CRegister(i2c_dev, VEML7700_INTERRUPTSTATUS, 2, LSBFIRST); + + ALS_Shutdown = new Adafruit_I2CRegisterBits(ALS_Config, 1, 0); // # bits, bit_shift + ALS_Interrupt_Enable = new Adafruit_I2CRegisterBits(ALS_Config, 1, 1); + ALS_Persistence = new Adafruit_I2CRegisterBits(ALS_Config, 2, 4); + ALS_Integration_Time = new Adafruit_I2CRegisterBits(ALS_Config, 4, 6); + ALS_Gain = new Adafruit_I2CRegisterBits(ALS_Config, 2, 11); + PowerSave_Enable = new Adafruit_I2CRegisterBits(Power_Saving, 1, 0); + PowerSave_Mode = new Adafruit_I2CRegisterBits(Power_Saving, 2, 1); + + enable(false); + interruptEnable(false); + setPersistence(VEML7700_PERS_1); + setGain(VEML7700_GAIN_1); + setIntegrationTime(VEML7700_IT_100MS); + powerSaveEnable(false); + enable(true); + + return true; +} + + +float Adafruit_VEML7700::normalize_resolution(float value) { + // adjust for gain (1x is normalized) + switch (getGain()) { + case VEML7700_GAIN_2: + value /= 2.0; break; + case VEML7700_GAIN_1_4: + value *= 4; break; + case VEML7700_GAIN_1_8: + value *= 8; break; + } + + // adjust for integrationtime (100ms is normalized) + switch (getIntegrationTime()) { + case VEML7700_IT_25MS: + value *= 4; break; + case VEML7700_IT_50MS: + value *= 2; break; + case VEML7700_IT_200MS: + value /= 2.0; break; + case VEML7700_IT_400MS: + value /= 4.0; break; + case VEML7700_IT_800MS: + value /= 8.0; break; + } + + return value; +} + +/*! + * @brief Read the calibrated lux value. See app note lux table on page 5 + * @returns Floating point Lux data (ALS multiplied by 0.0576) + */ +float Adafruit_VEML7700::readLux() { + return ( normalize_resolution(ALS_Data->read()) * 0.0576); // see app note lux table on page 5 +} + +/*! + * @brief Read the lux value with correction for non-linearity at high-lux settings + * @returns Floating point Lux data (ALS multiplied by 0.0576 and corrected for high-lux settings) + */ +float Adafruit_VEML7700::readLuxNormalized() { + float lux = readLux(); + + // user-provided correction for non-linearities at high lux/white values: + // https://forums.adafruit.com/viewtopic.php?f=19&t=152997&p=758582#p759346 + if ((getGain() == VEML7700_GAIN_1_8) && (getIntegrationTime() == VEML7700_IT_25MS)){ + lux = 6.0135e-13*pow(lux,4) - 9.3924e-9*pow(lux,3) + 8.1488e-5*pow(lux,2) + 1.0023*lux; + } + + return lux; +} + +/*! + * @brief Read the raw ALS data + * @returns 16-bit data value from the ALS register + */ +uint16_t Adafruit_VEML7700::readALS() { + return ALS_Data->read(); +} + +/*! + * @brief Read the white light data + * @returns Floating point 'white light' data multiplied by 0.0576 + */ +float Adafruit_VEML7700::readWhite() { + // white_corrected= 2E-15*pow(VEML_white,4) + 4E-12*pow(VEML_white,3) + 9E-06*pow(VEML_white,)2 + 1.0179*VEML_white - 11.052; + return normalize_resolution(White_Data->read()) * 0.0576; // Unclear if this is the right multiplier +} + +/*! + * @brief Read the 'white light' value with correction for non-linearity at high-lux settings + * @returns Floating point 'white light' data multiplied by 0.0576 and corrected for high-lux settings + */ +float Adafruit_VEML7700::readWhiteNormalized() { + float white = readWhite(); + + // user-provided correction for non-linearities at high lux values: + // https://forums.adafruit.com/viewtopic.php?f=19&t=152997&p=758582#p759346 + if ((getGain() == VEML7700_GAIN_1_8) && (getIntegrationTime() == VEML7700_IT_25MS)){ + white = 2E-15*pow(white,4) + 4E-12*pow(white,3) + 9E-06*pow(white,2) + 1.0179*white - 11.052; + } + + return white; +} + +/*! + * @brief Enable or disable the sensor + * @param enable The flag to enable/disable + */ +void Adafruit_VEML7700::enable(bool enable) { + ALS_Shutdown->write(!enable); +} + +/*! + * @brief Ask if the interrupt is enabled + * @returns True if enabled, false otherwise + */ +bool Adafruit_VEML7700::enabled(void) { + return !ALS_Shutdown->read(); +} + +/*! + * @brief Enable or disable the interrupt + * @param enable The flag to enable/disable + */ +void Adafruit_VEML7700::interruptEnable(bool enable) { + ALS_Interrupt_Enable->write(enable); +} + + +/*! + * @brief Ask if the interrupt is enabled + * @returns True if enabled, false otherwise + */ +bool Adafruit_VEML7700::interruptEnabled(void) { + return ALS_Interrupt_Enable->read(); +} + + +/*! + * @brief Set the ALS IRQ persistance setting + * @param pers Persistance constant, can be VEML7700_PERS_1, VEML7700_PERS_2, + * VEML7700_PERS_4 or VEML7700_PERS_8 + */ +void Adafruit_VEML7700::setPersistence(uint8_t pers) { + ALS_Persistence->write(pers); +} + +/*! + * @brief Get the ALS IRQ persistance setting + * @returns Persistance constant, can be VEML7700_PERS_1, VEML7700_PERS_2, + * VEML7700_PERS_4 or VEML7700_PERS_8 + */ +uint8_t Adafruit_VEML7700::getPersistence(void) { + return ALS_Persistence->read(); +} + +/*! + * @brief Set ALS integration time + * @param it Can be VEML7700_IT_100MS, VEML7700_IT_200MS, VEML7700_IT_400MS, + * VEML7700_IT_800MS, VEML7700_IT_50MS or VEML7700_IT_25MS + */ +void Adafruit_VEML7700::setIntegrationTime(uint8_t it) { + ALS_Integration_Time->write(it); +} + +/*! + * @brief Get ALS integration time + * @returns IT index, can be VEML7700_IT_100MS, VEML7700_IT_200MS, VEML7700_IT_400MS, + * VEML7700_IT_800MS, VEML7700_IT_50MS or VEML7700_IT_25MS + */ +uint8_t Adafruit_VEML7700::getIntegrationTime(void) { + return ALS_Integration_Time->read(); +} + +/*! + * @brief Set ALS gain + * @param gain Can be VEML7700_GAIN_1, VEML7700_GAIN_2, VEML7700_GAIN_1_8 or VEML7700_GAIN_1_4 + */ +void Adafruit_VEML7700::setGain(uint8_t gain) { + ALS_Gain->write(gain); +} + +/*! + * @brief Get ALS gain + * @returns Gain index, can be VEML7700_GAIN_1, VEML7700_GAIN_2, VEML7700_GAIN_1_8 or VEML7700_GAIN_1_4 + */ +uint8_t Adafruit_VEML7700::getGain(void) { + return ALS_Gain->read(); +} + + +/*! + * @brief Enable power save mode + * @param enable True if power save should be enabled + */ +void Adafruit_VEML7700::powerSaveEnable(bool enable) { + PowerSave_Enable->write(enable); +} + +/*! + * @brief Check if power save mode is enabled + * @returns True if power save is enabled + */ +bool Adafruit_VEML7700::powerSaveEnabled(void) { + return PowerSave_Enable->read(); +} + +/*! + * @brief Assign the power save register data + * @param mode The 16-bit data to write to VEML7700_ALS_POWER_SAVE + */ +void Adafruit_VEML7700::setPowerSaveMode(uint8_t mode) { + PowerSave_Mode->write(mode); +} + +/*! + * @brief Retrieve the power save register data + * @return 16-bit data from VEML7700_ALS_POWER_SAVE + */ +uint8_t Adafruit_VEML7700::getPowerSaveMode(void) { + return PowerSave_Mode->read(); +} + +/*! + * @brief Assign the low threshold register data + * @param value The 16-bit data to write to VEML7700_ALS_THREHOLD_LOW + */ +void Adafruit_VEML7700::setLowThreshold(uint16_t value) { + ALS_LowThreshold->write(value); +} + +/*! + * @brief Retrieve the low threshold register data + * @return 16-bit data from VEML7700_ALS_THREHOLD_LOW + */ +uint16_t Adafruit_VEML7700::getLowThreshold(void) { + return ALS_LowThreshold->read(); +} + +/*! + * @brief Assign the high threshold register data + * @param value The 16-bit data to write to VEML7700_ALS_THREHOLD_HIGH + */ +void Adafruit_VEML7700::setHighThreshold(uint16_t value) { + ALS_HighThreshold->write(value); +} + +/*! + * @brief Retrieve the high threshold register data + * @return 16-bit data from VEML7700_ALS_THREHOLD_HIGH + */ +uint16_t Adafruit_VEML7700::getHighThreshold(void) { + return ALS_HighThreshold->read(); +} + +/*! + * @brief Retrieve the interrupt status register data + * @return 16-bit data from VEML7700_INTERRUPTSTATUS + */ +uint16_t Adafruit_VEML7700::interruptStatus(void) { + return Interrupt_Status->read(); +} diff --git a/lib/Adafruit_VEML7700/Adafruit_VEML7700.h b/lib/Adafruit_VEML7700/Adafruit_VEML7700.h new file mode 100644 index 000000000..b842a7bc1 --- /dev/null +++ b/lib/Adafruit_VEML7700/Adafruit_VEML7700.h @@ -0,0 +1,113 @@ +/*! + * @file Adafruit_VEML7700.h + * + * I2C Driver for VEML7700 Lux sensor + * + * This is a library for the Adafruit VEML7700 breakout: + * http://www.adafruit.com/ + * + * Adafruit invests time and resources providing this open source code, + *please support Adafruit and open-source hardware by purchasing products from + * Adafruit! + * + * + * BSD license (see license.txt) + */ + +#ifndef _ADAFRUIT_VEML7700_H +#define _ADAFRUIT_VEML7700_H + +#include "Arduino.h" +#include +#include +#include + +#define VEML7700_I2CADDR_DEFAULT 0x10 ///< I2C address + +#define VEML7700_ALS_CONFIG 0x00 ///< Light configuration register +#define VEML7700_ALS_THREHOLD_HIGH 0x01 ///< Light high threshold for irq +#define VEML7700_ALS_THREHOLD_LOW 0x02 ///< Light low threshold for irq +#define VEML7700_ALS_POWER_SAVE 0x03 ///< Power save regiester +#define VEML7700_ALS_DATA 0x04 ///< The light data output +#define VEML7700_WHITE_DATA 0x05 ///< The white light data output +#define VEML7700_INTERRUPTSTATUS 0x06 ///< What IRQ (if any) + +#define VEML7700_INTERRUPT_HIGH 0x4000 ///< Interrupt status for high threshold +#define VEML7700_INTERRUPT_LOW 0x8000 ///< Interrupt status for low threshold + +#define VEML7700_GAIN_1 0x00 ///< ALS gain 1x +#define VEML7700_GAIN_2 0x01 ///< ALS gain 2x +#define VEML7700_GAIN_1_8 0x02 ///< ALS gain 1/8x +#define VEML7700_GAIN_1_4 0x03 ///< ALS gain 1/4x + +#define VEML7700_IT_100MS 0x00 ///< ALS intetgration time 100ms +#define VEML7700_IT_200MS 0x01 ///< ALS intetgration time 200ms +#define VEML7700_IT_400MS 0x02 ///< ALS intetgration time 400ms +#define VEML7700_IT_800MS 0x03 ///< ALS intetgration time 800ms +#define VEML7700_IT_50MS 0x08 ///< ALS intetgration time 50ms +#define VEML7700_IT_25MS 0x0C ///< ALS intetgration time 25ms + +#define VEML7700_PERS_1 0x00 ///< ALS irq persisance 1 sample +#define VEML7700_PERS_2 0x01 ///< ALS irq persisance 2 samples +#define VEML7700_PERS_4 0x02 ///< ALS irq persisance 4 samples +#define VEML7700_PERS_8 0x03 ///< ALS irq persisance 8 samples + +#define VEML7700_POWERSAVE_MODE1 0x00 ///< Power saving mode 1 +#define VEML7700_POWERSAVE_MODE2 0x01 ///< Power saving mode 2 +#define VEML7700_POWERSAVE_MODE3 0x02 ///< Power saving mode 3 +#define VEML7700_POWERSAVE_MODE4 0x03 ///< Power saving mode 4 + + +/*! + * @brief Class that stores state and functions for interacting with + * VEML7700 Temp Sensor + */ +class Adafruit_VEML7700 { +public: + Adafruit_VEML7700(); + boolean begin(TwoWire *theWire = &Wire); + + void enable(bool enable); + bool enabled(void); + + void interruptEnable(bool enable); + bool interruptEnabled(void); + void setPersistence(uint8_t pers); + uint8_t getPersistence(void); + void setIntegrationTime(uint8_t it); + uint8_t getIntegrationTime(void); + void setGain(uint8_t gain); + uint8_t getGain(void); + void powerSaveEnable(bool enable); + bool powerSaveEnabled(void); + void setPowerSaveMode(uint8_t mode); + uint8_t getPowerSaveMode(void); + + void setLowThreshold(uint16_t value); + uint16_t getLowThreshold(void); + void setHighThreshold(uint16_t value); + uint16_t getHighThreshold(void); + uint16_t interruptStatus(void); + + + float readLux(); + float readLuxNormalized(); + + uint16_t readALS(); + float readWhite(); + float readWhiteNormalized(); + +private: + Adafruit_I2CRegister *ALS_Config, *ALS_Data, *White_Data, + *ALS_HighThreshold, *ALS_LowThreshold, *Power_Saving, *Interrupt_Status; + Adafruit_I2CRegisterBits *ALS_Shutdown, *ALS_Interrupt_Enable, + *ALS_Persistence, *ALS_Integration_Time, *ALS_Gain, + *PowerSave_Enable, *PowerSave_Mode; + + float normalize_resolution(float value); + + Adafruit_I2CDevice *i2c_dev; + +}; + +#endif diff --git a/lib/Adafruit_VEML7700/README.md b/lib/Adafruit_VEML7700/README.md new file mode 100644 index 000000000..fe3f3c898 --- /dev/null +++ b/lib/Adafruit_VEML7700/README.md @@ -0,0 +1,16 @@ +Adafruit_VEML7700 [![Build Status](https://travis-ci.com/adafruit/Adafruit_VEML7700.svg?branch=master)](https://travis-ci.com/adafruit/Adafruit_VEML7700) +================ + +This is the Adafruit VEML7700 Lux sensor library + +Tested and works great with the [Adafruit VEML7700 Breakout Board](http://www.adafruit.com/) + +This chip uses I2C to communicate, 2 pins are required to interface + +Adafruit invests time and resources providing this open source code, +please support Adafruit and open-source hardware by purchasing +products from Adafruit! + +Written by Kevin Townsend/Limor Fried for Adafruit Industries. +BSD license, check license.txt for more information +All text above must be included in any redistribution diff --git a/lib/Adafruit_VEML7700/examples/veml7700_test/veml7700_test.ino b/lib/Adafruit_VEML7700/examples/veml7700_test/veml7700_test.ino new file mode 100644 index 000000000..64718112d --- /dev/null +++ b/lib/Adafruit_VEML7700/examples/veml7700_test/veml7700_test.ino @@ -0,0 +1,58 @@ +#include "Adafruit_VEML7700.h" + +Adafruit_VEML7700 veml = Adafruit_VEML7700(); + +void setup() { + while (!Serial) { delay(10); } + Serial.begin(115200); + Serial.println("Adafruit VEML7700 Test"); + + if (!veml.begin()) { + Serial.println("Sensor not found"); + while (1); + } + Serial.println("Sensor found"); + + veml.setGain(VEML7700_GAIN_1); + veml.setIntegrationTime(VEML7700_IT_800MS); + + Serial.print(F("Gain: ")); + switch (veml.getGain()) { + case VEML7700_GAIN_1: Serial.println("1"); break; + case VEML7700_GAIN_2: Serial.println("2"); break; + case VEML7700_GAIN_1_4: Serial.println("1/4"); break; + case VEML7700_GAIN_1_8: Serial.println("1/8"); break; + } + + Serial.print(F("Integration Time (ms): ")); + switch (veml.getIntegrationTime()) { + case VEML7700_IT_25MS: Serial.println("25"); break; + case VEML7700_IT_50MS: Serial.println("50"); break; + case VEML7700_IT_100MS: Serial.println("100"); break; + case VEML7700_IT_200MS: Serial.println("200"); break; + case VEML7700_IT_400MS: Serial.println("400"); break; + case VEML7700_IT_800MS: Serial.println("800"); break; + } + + //veml.powerSaveEnable(true); + //veml.setPowerSaveMode(VEML7700_POWERSAVE_MODE4); + + veml.setLowThreshold(10000); + veml.setHighThreshold(20000); + veml.interruptEnable(true); +} + +void loop() { + Serial.print("Lux: "); Serial.println(veml.readLux()); + Serial.print("White: "); Serial.println(veml.readWhite()); + Serial.print("Raw ALS: "); Serial.println(veml.readALS()); + + uint16_t irq = veml.interruptStatus(); + if (irq & VEML7700_INTERRUPT_LOW) { + Serial.println("** Low threshold"); + } + if (irq & VEML7700_INTERRUPT_HIGH) { + Serial.println("** High threshold"); + } + delay(500); +} diff --git a/lib/Adafruit_VEML7700/library.properties b/lib/Adafruit_VEML7700/library.properties new file mode 100644 index 000000000..754bd2fd7 --- /dev/null +++ b/lib/Adafruit_VEML7700/library.properties @@ -0,0 +1,9 @@ +name=Adafruit VEML7700 Library +version=1.0.0 +author=Adafruit +maintainer=Adafruit +sentence=Arduino library for the VEML7700 sensors in the Adafruit shop +paragraph=Arduino library for the VEML7700 sensors in the Adafruit shop +category=Sensors +url=https://github.com/adafruit/Adafruit_VEML7700 +architectures=* diff --git a/lib/Adafruit_VEML7700/license.txt b/lib/Adafruit_VEML7700/license.txt new file mode 100644 index 000000000..f6a0f22b8 --- /dev/null +++ b/lib/Adafruit_VEML7700/license.txt @@ -0,0 +1,26 @@ +Software License Agreement (BSD License) + +Copyright (c) 2012, Adafruit Industries +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of the copyright holders nor the +names of its contributors may be used to endorse or promote products +derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Carrier.cpp b/lib/IRremoteESP8266-2.7.6/src/ir_Carrier.cpp deleted file mode 100644 index 293711a03..000000000 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Carrier.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2018 David Conran - -// Supports: -// Brand: Carrier/Surrey, Model: 42QG5A55970 remote -// Brand: Carrier/Surrey, Model: 619EGX0090E0 A/C -// Brand: Carrier/Surrey, Model: 619EGX0120E0 A/C -// Brand: Carrier/Surrey, Model: 619EGX0180E0 A/C -// Brand: Carrier/Surrey, Model: 619EGX0220E0 A/C -// Brand: Carrier/Surrey, Model: 53NGK009/012 Inverter - -#include "IRrecv.h" -#include "IRsend.h" -#include "IRutils.h" - -// Constants -// Ref: -// https://github.com/crankyoldgit/IRremoteESP8266/issues/385 -const uint16_t kCarrierAcHdrMark = 8532; -const uint16_t kCarrierAcHdrSpace = 4228; -const uint16_t kCarrierAcBitMark = 628; -const uint16_t kCarrierAcOneSpace = 1320; -const uint16_t kCarrierAcZeroSpace = 532; -const uint16_t kCarrierAcGap = 20000; - -#if SEND_CARRIER_AC -// Send a Carrier HVAC formatted message. -// -// Args: -// data: The message to be sent. -// nbits: The bit size of the message being sent. typically kCarrierAcBits. -// repeat: The number of times the message is to be repeated. -// -// Status: STABLE / Work on real devices. -// -void IRsend::sendCarrierAC(uint64_t data, uint16_t nbits, uint16_t repeat) { - for (uint16_t r = 0; r <= repeat; r++) { - uint64_t temp_data = data; - // Carrier sends the data block three times. normal + inverted + normal. - for (uint16_t i = 0; i < 3; i++) { - sendGeneric(kCarrierAcHdrMark, kCarrierAcHdrSpace, kCarrierAcBitMark, - kCarrierAcOneSpace, kCarrierAcBitMark, kCarrierAcZeroSpace, - kCarrierAcBitMark, kCarrierAcGap, temp_data, nbits, 38, true, - 0, kDutyDefault); - temp_data = invertBits(temp_data, nbits); - } - } -} -#endif - -#if DECODE_CARRIER_AC -// Decode the supplied Carrier HVAC message. -// Carrier HVAC messages contain only 32 bits, but it is sent three(3) times. -// i.e. normal + inverted + normal -// Args: -// results: Ptr to the data to decode and where to store the decode result. -// offset: The starting index to use when attempting to decode the raw data. -// Typically/Defaults to kStartOffset. -// nbits: Nr. of bits to expect in the data portion. -// Typically kCarrierAcBits. -// strict: Flag to indicate if we strictly adhere to the specification. -// Returns: -// boolean: True if it can decode it, false if it can't. -// -// Status: BETA / Probably works. -// -bool IRrecv::decodeCarrierAC(decode_results *results, uint16_t offset, - const uint16_t nbits, const bool strict) { - if (results->rawlen < ((2 * nbits + kHeader + kFooter) * 3) - 1 + offset) - return false; // Can't possibly be a valid Carrier message. - if (strict && nbits != kCarrierAcBits) - return false; // We expect Carrier to be 32 bits of message. - - uint64_t data = 0; - uint64_t prev_data = 0; - - for (uint8_t i = 0; i < 3; i++) { - prev_data = data; - // Match Header + Data + Footer - uint16_t used; - used = matchGeneric(results->rawbuf + offset, &data, - results->rawlen - offset, nbits, - kCarrierAcHdrMark, kCarrierAcHdrSpace, - kCarrierAcBitMark, kCarrierAcOneSpace, - kCarrierAcBitMark, kCarrierAcZeroSpace, - kCarrierAcBitMark, kCarrierAcGap, true); - if (!used) return false; - offset += used; - // Compliance. - if (strict) { - // Check if the data is an inverted copy of the previous data. - if (i > 0 && prev_data != invertBits(data, nbits)) return false; - } - } - - // Success - results->bits = nbits; - results->value = data; - results->decode_type = CARRIER_AC; - results->address = data >> 16; - results->command = data & 0xFFFF; - return true; -} -#endif diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Sharp.h b/lib/IRremoteESP8266-2.7.6/src/ir_Sharp.h deleted file mode 100644 index 03d27d44f..000000000 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Sharp.h +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2019 crankyoldgit - -// Supports: -// Brand: Sharp, Model: LC-52D62U TV -// Brand: Sharp, Model: AY-ZP40KR A/C -// Brand: Sharp, Model: AH-AxSAY A/C - -#ifndef IR_SHARP_H_ -#define IR_SHARP_H_ - -#ifndef UNIT_TEST -#include -#endif -#include "IRrecv.h" -#include "IRremoteESP8266.h" -#include "IRsend.h" -#ifdef UNIT_TEST -#include "IRsend_test.h" -#endif - -// Constants -const uint16_t kSharpAcHdrMark = 3800; -const uint16_t kSharpAcHdrSpace = 1900; -const uint16_t kSharpAcBitMark = 470; -const uint16_t kSharpAcZeroSpace = 500; -const uint16_t kSharpAcOneSpace = 1400; -const uint32_t kSharpAcGap = kDefaultMessageGap; - -const uint8_t kSharpAcAuto = 0b000; -const uint8_t kSharpAcDry = 0b011; -const uint8_t kSharpAcCool = 0b010; -const uint8_t kSharpAcHeat = 0b001; -const uint8_t kSharpAcMinTemp = 15; // Celsius -const uint8_t kSharpAcMaxTemp = 30; // Celsius -const uint8_t kSharpAcFanAuto = 0b010; // 2 -const uint8_t kSharpAcFanMin = 0b100; // 4 (FAN1) -const uint8_t kSharpAcFanMed = 0b011; // 3 (FAN2) -const uint8_t kSharpAcFanHigh = 0b101; // 5 (FAN3) -const uint8_t kSharpAcFanMax = 0b111; // 7 (FAN4) -const uint8_t kSharpAcByteTemp = 4; -const uint8_t kSharpAcBytePower = 5; -const uint8_t kSharpAcBitPowerOffset = 4; // 0b000x0000 -const uint8_t kSharpAcBitPreviousPowerOffset = 5; // 0b00x00000 -const uint8_t kSharpAcByteMode = 6; -const uint8_t kSharpAcModeSize = 2; // Mask 0b00000011; -const uint8_t kSharpAcByteFan = kSharpAcByteMode; -const uint8_t kSharpAcFanOffset = 4; // Mask 0b01110000 -const uint8_t kSharpAcFanSize = 3; // Nr. of Bits -const uint8_t kSharpAcByteButton = 10; -const uint8_t kSharpAcButtonOffset = 0; -const uint8_t kSharpAcButtonSize = 3; // Mask 0b00000xxx -const uint8_t kSharpAcButtonPowerMode = 0b000; // 0 -const uint8_t kSharpAcButtonTemp = 0b100; // 4 -const uint8_t kSharpAcButtonFan = 0b101; // 5 - -class IRSharpAc { - public: - explicit IRSharpAc(const uint16_t pin, const bool inverted = false, - const bool use_modulation = true); - -#if SEND_SHARP_AC - void send(const uint16_t repeat = kSharpAcDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } -#endif // SEND_SHARP_AC - void begin(void); - void on(void); - void off(void); - void setPower(const bool on); - void setPower(const bool on, const bool prev); - bool getPower(void); - void setPreviousPower(const bool on); - bool getPreviousPower(void); - void setTemp(const uint8_t temp); - uint8_t getTemp(void); - void setFan(const uint8_t fan); - uint8_t getFan(void); - void setMode(const uint8_t mode); - uint8_t getMode(void); - void setButton(const uint8_t button); - uint8_t getButton(void); - uint8_t* getRaw(void); - void setRaw(const uint8_t new_code[], - const uint16_t length = kSharpAcStateLength); - static bool validChecksum(uint8_t state[], - const uint16_t length = kSharpAcStateLength); - static uint8_t convertMode(const stdAc::opmode_t mode); - static uint8_t convertFan(const stdAc::fanspeed_t speed); - static stdAc::opmode_t toCommonMode(const uint8_t mode); - static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed); - stdAc::state_t toCommon(void); - String toString(void); -#ifndef UNIT_TEST - - private: - IRsend _irsend; -#else - IRsendTest _irsend; -#endif - // # of bytes per command - uint8_t remote[kSharpAcStateLength]; - void stateReset(void); - void checksum(void); - static uint8_t calcChecksum(uint8_t state[], - const uint16_t length = kSharpAcStateLength); -}; - -#endif // IR_SHARP_H_ diff --git a/lib/IRremoteESP8266-2.7.6/test/Makefile b/lib/IRremoteESP8266-2.7.6/test/Makefile deleted file mode 100644 index dc0574a1d..000000000 --- a/lib/IRremoteESP8266-2.7.6/test/Makefile +++ /dev/null @@ -1,653 +0,0 @@ -# SYNOPSIS: -# -# make [all] - makes everything. -# make TARGET - makes the given target. -# make run - makes everything and runs all the tests. -# make clean - removes all files generated by make. -# make install-googletest - install the googletest code suite - -# Please tweak the following variable definitions as needed by your -# project, except GTEST_HEADERS, which you can use in your own targets -# but shouldn't modify. - -# Points to the root of Google Test, relative to where this file is. -# Remember to tweak this if you move this file. -GTEST_DIR = ../lib/googletest/googletest - -# Where to find user code. -USER_DIR = ../src -INCLUDES = -I$(USER_DIR) -I. - -# Flags passed to the preprocessor. -# Set Google Test's header directory as a system directory, such that -# the compiler doesn't generate warnings in Google Test headers. -CPPFLAGS += -isystem $(GTEST_DIR)/include -DUNIT_TEST -D_IR_LOCALE_=en-AU - -# Flags passed to the C++ compiler. -CXXFLAGS += -g -Wall -Wextra -pthread -std=gnu++11 - -# All tests produced by this Makefile. Remember to add new tests you -# created to the list. -TESTS = IRutils_test IRsend_test ir_NEC_test ir_GlobalCache_test \ - ir_Sherwood_test ir_Sony_test ir_Samsung_test ir_Kelvinator_test \ - ir_JVC_test ir_RCMM_test ir_LG_test ir_Mitsubishi_test ir_Sharp_test \ - ir_RC5_RC6_test ir_Panasonic_test ir_Dish_test ir_Whynter_test \ - ir_Aiwa_test ir_Denon_test ir_Sanyo_test ir_Daikin_test ir_Coolix_test \ - ir_Gree_test IRrecv_test ir_Pronto_test ir_Fujitsu_test ir_Nikai_test \ - ir_Toshiba_test ir_Midea_test ir_Magiquest_test ir_Lasertag_test \ - ir_Carrier_test ir_Haier_test ir_Hitachi_test ir_GICable_test \ - ir_Whirlpool_test ir_Lutron_test ir_Electra_test ir_Pioneer_test \ - ir_MWM_test ir_Vestel_test ir_Teco_test ir_Tcl_test ir_Lego_test IRac_test \ - ir_MitsubishiHeavy_test ir_Trotec_test ir_Argo_test ir_Goodweather_test \ - ir_Inax_test ir_Neoclima_test ir_Amcor_test ir_Epson_test ir_Symphony_test \ - ir_Airwell_test - -# All Google Test headers. Usually you shouldn't change this -# definition. -GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \ - $(GTEST_DIR)/include/gtest/internal/*.h - -# House-keeping build targets. - -all : $(TESTS) - -clean : - rm -f $(TESTS) gtest.a gtest_main.a *.o - -# Build and run all the tests. -run : all - failed=""; \ - for unittest in $(TESTS); do \ - ./$${unittest} || failed="$${failed} $${unittest}"; \ - done; \ - if [ -n "$${failed}" ]; then \ - echo "FAIL: :-( :-( Unit test(s)$${failed} failed! :-( :-("; exit 1; \ - else \ - echo "PASS: \o/ \o/ All unit tests passed. \o/ \o/"; \ - fi - -run_tests : run - -install-googletest : - git clone -b v1.8.x https://github.com/google/googletest.git ../lib/googletest - -# Builds gtest.a and gtest_main.a. - -# Usually you shouldn't tweak such internal variables, indicated by a -# trailing _. -GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS) - -# All the IR protocol object files. -PROTOCOLS = ir_NEC.o ir_Sony.o ir_Samsung.o ir_JVC.o ir_RCMM.o ir_RC5_RC6.o \ - ir_LG.o ir_Mitsubishi.o ir_Fujitsu.o ir_Sharp.o ir_Sanyo.o ir_Denon.o ir_Dish.o \ - ir_Panasonic.o ir_Whynter.o ir_Coolix.o ir_Aiwa.o ir_Sherwood.o \ - ir_Kelvinator.o ir_Daikin.o ir_Gree.o ir_Pronto.o ir_Nikai.o ir_Toshiba.o \ - ir_Midea.o ir_Magiquest.o ir_Lasertag.o ir_Carrier.o ir_Haier.o \ - ir_Hitachi.o ir_GICable.o ir_Whirlpool.o ir_Lutron.o ir_Electra.o \ - ir_Pioneer.o ir_MWM.o ir_Vestel.o ir_Teco.o ir_Tcl.o ir_Lego.o ir_Argo.o \ - ir_Trotec.o ir_MitsubishiHeavy.o ir_Goodweather.o ir_Inax.o ir_Neoclima.o \ - ir_Amcor.o ir_Epson.o ir_Symphony.o ir_Airwell.o - -# All the IR Protocol header files. -PROTOCOLS_H = $(USER_DIR)/ir_Amcor.h \ - $(USER_DIR)/ir_Argo.h \ - $(USER_DIR)/ir_Gree.h \ - $(USER_DIR)/ir_Magiquest.h \ - $(USER_DIR)/ir_Coolix.h \ - $(USER_DIR)/ir_Electra.h \ - $(USER_DIR)/ir_Haier.h \ - $(USER_DIR)/ir_Hitachi.h \ - $(USER_DIR)/ir_Midea.h \ - $(USER_DIR)/ir_Toshiba.h \ - $(USER_DIR)/ir_Daikin.h \ - $(USER_DIR)/ir_Goodweather.h \ - $(USER_DIR)/ir_Kelvinator.h \ - $(USER_DIR)/ir_Mitsubishi.h \ - $(USER_DIR)/ir_MitsubishiHeavy.h \ - $(USER_DIR)/ir_NEC.h \ - $(USER_DIR)/ir_Neoclima.h \ - $(USER_DIR)/ir_Sharp.h \ - $(USER_DIR)/ir_Samsung.h \ - $(USER_DIR)/ir_Trotec.h \ - $(USER_DIR)/ir_Fujitsu.h \ - $(USER_DIR)/ir_LG.h \ - $(USER_DIR)/ir_Panasonic.h \ - $(USER_DIR)/ir_Whirlpool.h \ - $(USER_DIR)/ir_Vestel.h \ - $(USER_DIR)/ir_Tcl.h \ - $(USER_DIR)/ir_Teco.h \ - $(USER_DIR)/ir_Trotec.h -# Common object files -COMMON_OBJ = IRutils.o IRtimer.o IRsend.o IRrecv.o IRac.o ir_GlobalCache.o \ - IRtext.o $(PROTOCOLS) gtest_main.a -# Common dependencies -COMMON_DEPS = $(USER_DIR)/IRrecv.h $(USER_DIR)/IRsend.h $(USER_DIR)/IRtimer.h \ - $(USER_DIR)/IRutils.h $(USER_DIR)/IRremoteESP8266.h \ - $(USER_DIR)/IRac.h $(USER_DIR)/i18n.h $(USER_DIR)/IRtext.h \ - $(PROTOCOLS_H) - -# Common test dependencies -COMMON_TEST_DEPS = $(COMMON_DEPS) IRrecv_test.h IRsend_test.h - -# For simplicity and to avoid depending on Google Test's -# implementation details, the dependencies specified below are -# conservative and not optimized. This is fine as Google Test -# compiles fast and for ordinary users its source rarely changes. -gtest-all.o : $(GTEST_SRCS_) - $(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \ - $(GTEST_DIR)/src/gtest-all.cc - -gtest_main.o : $(GTEST_SRCS_) - $(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \ - $(GTEST_DIR)/src/gtest_main.cc - -gtest.a : gtest-all.o - $(AR) $(ARFLAGS) $@ $^ - -gtest_main.a : gtest-all.o gtest_main.o - $(AR) $(ARFLAGS) $@ $^ - -# Builds our test. A test should link with either gtest.a or -# gtest_main.a, depending on whether it defines its own main() -# function. - -IRtext.o : $(USER_DIR)/IRtext.cpp $(USER_DIR)/IRtext.h $(USER_DIR)/IRremoteESP8266.h $(USER_DIR)/i18n.h $(USER_DIR)/locale/*.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/IRtext.cpp - -IRutils.o : $(USER_DIR)/IRutils.cpp $(USER_DIR)/IRutils.h $(USER_DIR)/IRremoteESP8266.h $(USER_DIR)/i18n.h $(USER_DIR)/IRtext.cpp $(USER_DIR)/IRtext.h $(USER_DIR)/locale/*.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/IRutils.cpp - -IRutils_test.o : IRutils_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c IRutils_test.cpp - -IRutils_test : IRutils_test.o ir_NEC.o ir_Nikai.o ir_Toshiba.o IRtext.o $(COMMON_OBJ) gtest_main.a - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -IRtimer.o : $(USER_DIR)/IRtimer.cpp $(USER_DIR)/IRtimer.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/IRtimer.cpp - -IRsend.o : $(USER_DIR)/IRsend.cpp $(USER_DIR)/IRsend.h $(USER_DIR)/IRremoteESP8266.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/IRsend.cpp - -IRsend_test.o : IRsend_test.cpp $(USER_DIR)/IRsend.h $(USER_DIR)/IRrecv.h IRsend_test.h $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c IRsend_test.cpp - -IRsend_test : IRsend_test.o $(COMMON_OBJ) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -IRrecv.o : $(USER_DIR)/IRrecv.cpp $(USER_DIR)/IRrecv.h $(USER_DIR)/IRremoteESP8266.h $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/IRrecv.cpp - -IRrecv_test.o : IRrecv_test.cpp $(USER_DIR)/IRsend.h $(USER_DIR)/IRrecv.h IRsend_test.h $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c IRrecv_test.cpp - -IRrecv_test : IRrecv_test.o $(COMMON_OBJ) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -IRac.o : $(USER_DIR)/IRac.cpp $(USER_DIR)/IRac.h $(COMMON_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/IRac.cpp - -IRac_test.o : IRac_test.cpp $(USER_DIR)/IRac.h $(COMMON_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c IRac_test.cpp - -IRac_test : IRac_test.o $(COMMON_OBJ) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_NEC.o : $(USER_DIR)/ir_NEC.cpp $(USER_DIR)/ir_NEC.h $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_NEC.cpp - -ir_NEC_test.o : ir_NEC_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_NEC_test.cpp - -ir_NEC_test : $(COMMON_OBJ) ir_NEC_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_GlobalCache.o : $(USER_DIR)/ir_GlobalCache.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_GlobalCache.cpp - -ir_GlobalCache_test.o : ir_GlobalCache_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_GlobalCache_test.cpp - -ir_GlobalCache_test : $(COMMON_OBJ) ir_GlobalCache_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Sherwood.o : $(USER_DIR)/ir_Sherwood.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Sherwood.cpp - -ir_Sherwood_test.o : ir_Sherwood_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Sherwood_test.cpp - -ir_Sherwood_test : $(COMMON_OBJ) ir_Sherwood_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Sony.o : $(USER_DIR)/ir_Sony.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Sony.cpp - -ir_Sony_test.o : ir_Sony_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Sony_test.cpp - -ir_Sony_test : $(COMMON_OBJ) ir_Sony_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Samsung.o : $(USER_DIR)/ir_Samsung.cpp $(USER_DIR)/ir_Samsung.h $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Samsung.cpp - -ir_Samsung_test.o : ir_Samsung_test.cpp $(USER_DIR)/ir_Samsung.h $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Samsung_test.cpp - -ir_Samsung_test : $(COMMON_OBJ) ir_Samsung_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Kelvinator.o : $(USER_DIR)/ir_Kelvinator.cpp $(USER_DIR)/ir_Kelvinator.h $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Kelvinator.cpp - -ir_Kelvinator_test.o : ir_Kelvinator_test.cpp $(USER_DIR)/ir_Kelvinator.h $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Kelvinator_test.cpp - -ir_Kelvinator_test : $(COMMON_OBJ) ir_Kelvinator_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_JVC.o : $(USER_DIR)/ir_JVC.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_JVC.cpp - -ir_JVC_test.o : ir_JVC_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_JVC_test.cpp - -ir_JVC_test : $(COMMON_OBJ) ir_JVC_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_RCMM.o : $(USER_DIR)/ir_RCMM.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_RCMM.cpp - -ir_RCMM_test.o : ir_RCMM_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_RCMM_test.cpp - -ir_RCMM_test : $(COMMON_OBJ) ir_RCMM_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_LG.o : $(USER_DIR)/ir_LG.h $(USER_DIR)/ir_LG.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_LG.cpp - -ir_LG_test.o : ir_LG_test.cpp $(USER_DIR)/ir_LG.h $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_LG_test.cpp - -ir_LG_test : $(COMMON_OBJ) ir_LG_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Mitsubishi.o : $(USER_DIR)/ir_Mitsubishi.h $(USER_DIR)/ir_Mitsubishi.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Mitsubishi.cpp - -ir_Mitsubishi_test.o : ir_Mitsubishi_test.cpp $(USER_DIR)/ir_Mitsubishi.h $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Mitsubishi_test.cpp - -ir_Mitsubishi_test : $(COMMON_OBJ) ir_Mitsubishi_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_MitsubishiHeavy.o : $(USER_DIR)/ir_MitsubishiHeavy.h $(USER_DIR)/ir_MitsubishiHeavy.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_MitsubishiHeavy.cpp - -ir_MitsubishiHeavy_test.o : ir_MitsubishiHeavy_test.cpp $(USER_DIR)/ir_MitsubishiHeavy.h $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_MitsubishiHeavy_test.cpp - -ir_MitsubishiHeavy_test : $(COMMON_OBJ) ir_MitsubishiHeavy_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Fujitsu.o : $(USER_DIR)/ir_Fujitsu.h $(USER_DIR)/ir_Fujitsu.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Fujitsu.cpp - -ir_Fujitsu_test.o : ir_Fujitsu_test.cpp $(USER_DIR)/ir_Fujitsu.h $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Fujitsu_test.cpp - -ir_Fujitsu_test : $(COMMON_OBJ) ir_Fujitsu_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Sharp.o : $(USER_DIR)/ir_Sharp.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Sharp.cpp - -ir_Sharp_test.o : ir_Sharp_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Sharp_test.cpp - -ir_Sharp_test : $(COMMON_OBJ) ir_Sharp_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_RC5_RC6.o : $(USER_DIR)/ir_RC5_RC6.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_RC5_RC6.cpp - -ir_RC5_RC6_test.o : ir_RC5_RC6_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_RC5_RC6_test.cpp - -ir_RC5_RC6_test : $(COMMON_OBJ) ir_RC5_RC6_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Panasonic.o : $(USER_DIR)/ir_Panasonic.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Panasonic.cpp - -ir_Panasonic_test.o : ir_Panasonic_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Panasonic_test.cpp - -ir_Panasonic_test : $(COMMON_OBJ) ir_Panasonic_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Dish.o : $(USER_DIR)/ir_Dish.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Dish.cpp - -ir_Dish_test.o : ir_Dish_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Dish_test.cpp - -ir_Dish_test : $(COMMON_OBJ) ir_Dish_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Whynter.o : $(USER_DIR)/ir_Whynter.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Whynter.cpp - -ir_Whynter_test.o : ir_Whynter_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Whynter_test.cpp - -ir_Whynter_test : $(COMMON_OBJ) ir_Whynter_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Coolix.o : $(USER_DIR)/ir_Coolix.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Coolix.cpp - -ir_Coolix_test.o : ir_Coolix_test.cpp $(USER_DIR)/ir_Coolix.h $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Coolix_test.cpp - -ir_Coolix_test : $(COMMON_OBJ) ir_Coolix_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Aiwa.o : $(USER_DIR)/ir_Aiwa.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Aiwa.cpp - -ir_Aiwa_test.o : ir_Aiwa_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Aiwa_test.cpp - -ir_Aiwa_test : $(COMMON_OBJ) ir_Aiwa_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Denon.o : $(USER_DIR)/ir_Denon.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Denon.cpp - -ir_Denon_test.o : ir_Denon_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Denon_test.cpp - -ir_Denon_test : $(COMMON_OBJ) ir_Denon_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Sanyo.o : $(USER_DIR)/ir_Sanyo.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Sanyo.cpp - -ir_Sanyo_test.o : ir_Sanyo_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Sanyo_test.cpp - -ir_Sanyo_test : $(COMMON_OBJ) ir_Sanyo_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Daikin.o : $(USER_DIR)/ir_Daikin.cpp $(USER_DIR)/ir_Daikin.h $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Daikin.cpp - -ir_Daikin_test.o : ir_Daikin_test.cpp $(USER_DIR)/ir_Daikin.h $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Daikin_test.cpp - -ir_Daikin_test : $(COMMON_OBJ) ir_Daikin_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Gree.o : $(USER_DIR)/ir_Gree.cpp $(GTEST_HEADERS) $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Gree.cpp - -ir_Gree_test.o : ir_Gree_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Gree_test.cpp - -ir_Gree_test : $(COMMON_OBJ) ir_Gree_test.o ir_Kelvinator.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Pronto.o : $(USER_DIR)/ir_Pronto.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Pronto.cpp - -ir_Pronto_test.o : ir_Pronto_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Pronto_test.cpp - -ir_Pronto_test : $(COMMON_OBJ) ir_Pronto_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Nikai.o : $(USER_DIR)/ir_Nikai.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Nikai.cpp - -ir_Nikai_test.o : ir_Nikai_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Nikai_test.cpp - -ir_Nikai_test : $(COMMON_OBJ) ir_Nikai_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Toshiba.o : $(USER_DIR)/ir_Toshiba.cpp $(USER_DIR)/ir_Toshiba.h $(COMMON_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Toshiba.cpp - -ir_Toshiba_test.o : ir_Toshiba_test.cpp $(USER_DIR)/ir_Toshiba.h $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Toshiba_test.cpp - -ir_Toshiba_test : $(COMMON_OBJ) ir_Toshiba_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Midea.o : $(USER_DIR)/ir_Midea.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Midea.cpp - -ir_Midea_test.o : ir_Midea_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Midea_test.cpp - -ir_Midea_test : $(COMMON_OBJ) ir_Midea_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Magiquest.o : $(USER_DIR)/ir_Magiquest.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Magiquest.cpp - -ir_Magiquest_test.o : ir_Magiquest_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Magiquest_test.cpp - -ir_Magiquest_test : $(COMMON_OBJ) ir_Magiquest_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Lasertag.o : $(USER_DIR)/ir_Lasertag.cpp $(USER_DIR)/ir_RC5_RC6.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Lasertag.cpp - -ir_Lasertag_test.o : ir_Lasertag_test.cpp $(USER_DIR)/ir_RC5_RC6.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Lasertag_test.cpp - -ir_Lasertag_test : $(COMMON_OBJ) ir_Lasertag_test.o ir_RC5_RC6.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Carrier.o : $(USER_DIR)/ir_Carrier.cpp $(COMMON_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Carrier.cpp - -ir_Carrier_test.o : ir_Carrier_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Carrier_test.cpp - -ir_Carrier_test : $(COMMON_OBJ) ir_Carrier_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Haier.o : $(USER_DIR)/ir_Haier.cpp $(USER_DIR)/ir_Haier.h $(COMMON_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Haier.cpp - -ir_Haier_test.o : ir_Haier_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Haier_test.cpp - -ir_Haier_test : $(COMMON_OBJ) ir_Haier_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Hitachi.o : $(USER_DIR)/ir_Hitachi.cpp $(USER_DIR)/ir_Hitachi.h $(COMMON_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Hitachi.cpp - -ir_Hitachi_test.o : ir_Hitachi_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Hitachi_test.cpp - -ir_Hitachi_test : $(COMMON_OBJ) ir_Hitachi_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_GICable.o : $(USER_DIR)/ir_GICable.cpp $(COMMON_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_GICable.cpp - -ir_GICable_test.o : ir_GICable_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_GICable_test.cpp - -ir_GICable_test : $(COMMON_OBJ) ir_GICable_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Whirlpool.o : $(USER_DIR)/ir_Whirlpool.cpp $(COMMON_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Whirlpool.cpp - -ir_Whirlpool_test.o : ir_Whirlpool_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Whirlpool_test.cpp - -ir_Whirlpool_test : $(COMMON_OBJ) ir_Whirlpool_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Lutron.o : $(USER_DIR)/ir_Lutron.cpp $(COMMON_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Lutron.cpp - -ir_Lutron_test.o : ir_Lutron_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Lutron_test.cpp - -ir_Lutron_test : $(COMMON_OBJ) ir_Lutron_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Electra.o : $(USER_DIR)/ir_Electra.h $(USER_DIR)/ir_Electra.cpp $(COMMON_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Electra.cpp - -ir_Electra_test.o : ir_Electra_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Electra_test.cpp - -ir_Electra_test : $(COMMON_OBJ) ir_Electra_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Pioneer.o : $(USER_DIR)/ir_Pioneer.cpp $(COMMON_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Pioneer.cpp - -ir_Pioneer_test.o : ir_Pioneer_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Pioneer_test.cpp - -ir_Pioneer_test : $(COMMON_OBJ) ir_Pioneer_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_MWM.o : $(USER_DIR)/ir_MWM.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_MWM.cpp - -ir_MWM_test.o : ir_MWM_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_MWM_test.cpp - -ir_MWM_test : $(COMMON_OBJ) ir_MWM_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Vestel.o : $(USER_DIR)/ir_Vestel.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Vestel.cpp - -ir_Vestel_test.o : ir_Vestel_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Vestel_test.cpp - -ir_Vestel_test : $(COMMON_OBJ) ir_Vestel_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Teco.o : $(USER_DIR)/ir_Teco.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Teco.cpp - -ir_Teco_test.o : ir_Teco_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Teco_test.cpp - -ir_Teco_test : $(COMMON_OBJ) ir_Teco_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Tcl.o : $(USER_DIR)/ir_Tcl.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Tcl.cpp - -ir_Tcl_test.o : ir_Tcl_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Tcl_test.cpp - -ir_Tcl_test : $(COMMON_OBJ) ir_Tcl_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Lego.o : $(USER_DIR)/ir_Lego.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Lego.cpp - -ir_Lego_test.o : ir_Lego_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Lego_test.cpp - -ir_Lego_test : $(COMMON_OBJ) ir_Lego_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Argo.o : $(USER_DIR)/ir_Argo.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Argo.cpp - -ir_Argo_test.o : ir_Argo_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Argo_test.cpp - -ir_Argo_test : $(COMMON_OBJ) ir_Argo_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Trotec.o : $(USER_DIR)/ir_Trotec.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Trotec.cpp - -ir_Trotec_test.o : ir_Trotec_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Trotec_test.cpp - -ir_Trotec_test : $(COMMON_OBJ) ir_Trotec_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Goodweather.o : $(USER_DIR)/ir_Goodweather.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Goodweather.cpp - -ir_Goodweather_test.o : ir_Goodweather_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Goodweather_test.cpp - -ir_Goodweather_test : $(COMMON_OBJ) ir_Goodweather_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Inax.o : $(USER_DIR)/ir_Inax.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Inax.cpp - -ir_Inax_test.o : ir_Inax_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Inax_test.cpp - -ir_Inax_test : $(COMMON_OBJ) ir_Inax_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Neoclima.o : $(USER_DIR)/ir_Neoclima.h $(USER_DIR)/ir_Neoclima.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Neoclima.cpp - -ir_Neoclima_test.o : ir_Neoclima_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Neoclima_test.cpp - -ir_Neoclima_test : $(COMMON_OBJ) ir_Neoclima_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Amcor.o : $(USER_DIR)/ir_Amcor.h $(USER_DIR)/ir_Amcor.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Amcor.cpp - -ir_Amcor_test.o : ir_Amcor_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Amcor_test.cpp - -ir_Amcor_test : $(COMMON_OBJ) ir_Amcor_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Epson.o : $(USER_DIR)/ir_Epson.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Epson.cpp - -ir_Epson_test.o : ir_Epson_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Epson_test.cpp - -ir_Epson_test : $(COMMON_OBJ) ir_Epson_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Symphony.o : $(USER_DIR)/ir_Symphony.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Symphony.cpp - -ir_Symphony_test.o : ir_Symphony_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Symphony_test.cpp - -ir_Symphony_test : $(COMMON_OBJ) ir_Symphony_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -ir_Airwell.o : $(USER_DIR)/ir_Airwell.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Airwell.cpp - -ir_Airwell_test.o : ir_Airwell_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_Airwell_test.cpp - -ir_Airwell_test : $(COMMON_OBJ) ir_Airwell_test.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ diff --git a/lib/IRremoteESP8266-2.7.6/tools/Makefile b/lib/IRremoteESP8266-2.7.6/tools/Makefile deleted file mode 100644 index cfbf2e33c..000000000 --- a/lib/IRremoteESP8266-2.7.6/tools/Makefile +++ /dev/null @@ -1,248 +0,0 @@ -# SYNOPSIS: -# -# make [all] - makes everything. -# make clean - removes all files generated by make. - -# Please tweak the following variable definitions as needed by your -# project, except GTEST_HEADERS, which you can use in your own targets -# but shouldn't modify. - - -# Where to find user code. -USER_DIR = ../src - -# Where to find test code. -TEST_DIR = ../test - -INCLUDES = -I$(USER_DIR) -I$(TEST_DIR) -# Flags passed to the preprocessor. -# Set Google Test's header directory as a system directory, such that -# the compiler doesn't generate warnings in Google Test headers. -CPPFLAGS += -DUNIT_TEST -D_IR_LOCALE_=en-AU - -# Flags passed to the C++ compiler. -CXXFLAGS += -g -Wall -Wextra -pthread -std=gnu++11 - -all : gc_decode mode2_decode - -run_tests : all - failed=""; \ - for py_unittest in *_test.py; do \ - echo "RUNNING: $${py_unittest}"; \ - python3 ./$${py_unittest} || failed="$${failed} $${py_unittest}"; \ - done; \ - if [ -n "$${failed}" ]; then \ - echo "FAIL: :-( :-( Unit test(s)$${failed} failed! :-( :-("; exit 1; \ - else \ - echo "PASS: \o/ \o/ All unit tests passed. \o/ \o/"; \ - fi - -clean : - rm -f *.o *.pyc gc_decode mode2_decode - - -# All the IR protocol object files. -PROTOCOLS = ir_NEC.o ir_Sony.o ir_Samsung.o ir_JVC.o ir_RCMM.o ir_RC5_RC6.o \ - ir_LG.o ir_Mitsubishi.o ir_Fujitsu.o ir_Sharp.o ir_Sanyo.o \ - ir_Denon.o ir_Dish.o ir_Panasonic.o ir_Whynter.o ir_Coolix.o \ - ir_Aiwa.o ir_Sherwood.o ir_Kelvinator.o ir_Daikin.o ir_Gree.o \ - ir_Pronto.o ir_GlobalCache.o ir_Nikai.o ir_Toshiba.o ir_Midea.o \ - ir_Magiquest.o ir_Lasertag.o ir_Carrier.o ir_Haier.o ir_Hitachi.o \ - ir_GICable.o ir_Whirlpool.o ir_Lutron.o ir_Electra.o ir_Pioneer.o \ - ir_MWM.o ir_Vestel.o ir_Teco.o ir_Tcl.o ir_Lego.o \ - ir_MitsubishiHeavy.o ir_Goodweather.o ir_Inax.o ir_Argo.o \ - ir_Trotec.o ir_Neoclima.o ir_Amcor.o ir_Epson.o ir_Symphony.o \ - ir_Airwell.o - -# Common object files -COMMON_OBJ = IRutils.o IRtimer.o IRsend.o IRrecv.o IRtext.o IRac.o $(PROTOCOLS) - -# Common dependencies -COMMON_DEPS = $(USER_DIR)/IRrecv.h $(USER_DIR)/IRsend.h $(USER_DIR)/IRtimer.h \ - $(USER_DIR)/IRutils.h $(USER_DIR)/IRremoteESP8266.h \ - $(TEST_DIR)/IRsend_test.h $(USER_DIR)/IRtext.h $(USER_DIR)/i18n.h -# Common test dependencies -COMMON_TEST_DEPS = $(COMMON_DEPS) $(TEST_DIR)/IRsend_test.h - -gc_decode.o : gc_decode.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c gc_decode.cpp - -gc_decode : $(COMMON_OBJ) gc_decode.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -mode2_decode.o : mode2_decode.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c mode2_decode.cpp - -mode2_decode : $(COMMON_OBJ) mode2_decode.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ - -IRtext.o : $(USER_DIR)/IRtext.cpp $(USER_DIR)/IRtext.h $(USER_DIR)/IRremoteESP8266.h $(USER_DIR)/i18n.h $(USER_DIR)/locale/*.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/IRtext.cpp - -IRutils.o : $(USER_DIR)/IRutils.cpp $(USER_DIR)/IRutils.h $(USER_DIR)/IRremoteESP8266.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/IRutils.cpp - -IRtimer.o : $(USER_DIR)/IRtimer.cpp $(USER_DIR)/IRtimer.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/IRtimer.cpp - -IRsend.o : $(USER_DIR)/IRsend.cpp $(USER_DIR)/IRsend.h $(USER_DIR)/IRremoteESP8266.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/IRsend.cpp - -IRrecv.o : $(USER_DIR)/IRrecv.cpp $(USER_DIR)/IRrecv.h $(USER_DIR)/IRremoteESP8266.h $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/IRrecv.cpp - -ir_NEC.o : $(USER_DIR)/ir_NEC.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_NEC.cpp - -ir_GlobalCache.o : $(USER_DIR)/ir_GlobalCache.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_GlobalCache.cpp - -ir_Sherwood.o : $(USER_DIR)/ir_Sherwood.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Sherwood.cpp - -ir_Sony.o : $(USER_DIR)/ir_Sony.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Sony.cpp - -ir_Samsung.o : $(USER_DIR)/ir_Samsung.cpp $(USER_DIR)/ir_Samsung.h $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Samsung.cpp - -ir_Kelvinator.o : $(USER_DIR)/ir_Kelvinator.cpp $(USER_DIR)/ir_Kelvinator.h $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Kelvinator.cpp - -ir_Inax.o : $(USER_DIR)/ir_Inax.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Inax.cpp - -ir_JVC.o : $(USER_DIR)/ir_JVC.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_JVC.cpp - -ir_RCMM.o : $(USER_DIR)/ir_RCMM.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_RCMM.cpp - -ir_LG.o : $(USER_DIR)/ir_LG.h $(USER_DIR)/ir_LG.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_LG.cpp - -ir_Mitsubishi.o : $(USER_DIR)/ir_Mitsubishi.h $(USER_DIR)/ir_Mitsubishi.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Mitsubishi.cpp - -ir_MitsubishiHeavy.o : $(USER_DIR)/ir_MitsubishiHeavy.h $(USER_DIR)/ir_MitsubishiHeavy.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_MitsubishiHeavy.cpp - -ir_Fujitsu.o : $(USER_DIR)/ir_Fujitsu.h $(USER_DIR)/ir_Fujitsu.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Fujitsu.cpp - -ir_Sharp.o : $(USER_DIR)/ir_Sharp.h $(USER_DIR)/ir_Sharp.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Sharp.cpp - -ir_RC5_RC6.o : $(USER_DIR)/ir_RC5_RC6.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_RC5_RC6.cpp - -ir_Panasonic.o : $(USER_DIR)/ir_Panasonic.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Panasonic.cpp - -ir_Dish.o : $(USER_DIR)/ir_Dish.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Dish.cpp - -ir_Whynter.o : $(USER_DIR)/ir_Whynter.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Whynter.cpp - -ir_Coolix.o : $(USER_DIR)/ir_Coolix.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Coolix.cpp - -ir_Aiwa.o : $(USER_DIR)/ir_Aiwa.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Aiwa.cpp - -ir_Denon.o : $(USER_DIR)/ir_Denon.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Denon.cpp - -ir_Sanyo.o : $(USER_DIR)/ir_Sanyo.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Sanyo.cpp - -ir_Daikin.o : $(USER_DIR)/ir_Daikin.cpp $(USER_DIR)/ir_Daikin.h $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Daikin.cpp - -ir_Gree.o : $(USER_DIR)/ir_Gree.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Gree.cpp - -ir_Pronto.o : $(USER_DIR)/ir_Pronto.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Pronto.cpp - -ir_Nikai.o : $(USER_DIR)/ir_Nikai.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Nikai.cpp - -ir_Toshiba.o : $(USER_DIR)/ir_Toshiba.h $(USER_DIR)/ir_Toshiba.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Toshiba.cpp - -ir_Midea.o : $(USER_DIR)/ir_Midea.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Midea.cpp - -ir_Magiquest.o : $(USER_DIR)/ir_Magiquest.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Magiquest.cpp - -ir_Lasertag.o : $(USER_DIR)/ir_Lasertag.cpp $(USER_DIR)/ir_RC5_RC6.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Lasertag.cpp - -ir_Carrier.o : $(USER_DIR)/ir_Carrier.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Carrier.cpp - -ir_Haier.o : $(USER_DIR)/ir_Haier.cpp $(USER_DIR)/ir_Haier.h $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Haier.cpp - -ir_Hitachi.o : $(USER_DIR)/ir_Hitachi.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Hitachi.cpp - -ir_GICable.o : $(USER_DIR)/ir_GICable.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_GICable.cpp - -ir_Whirlpool.o : $(USER_DIR)/ir_Whirlpool.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Whirlpool.cpp - -ir_Lutron.o : $(USER_DIR)/ir_Lutron.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Lutron.cpp - -ir_Electra.o : $(USER_DIR)/ir_Electra.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Electra.cpp - -ir_Pioneer.o : $(USER_DIR)/ir_Pioneer.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Pioneer.cpp - -ir_MWM.o : $(USER_DIR)/ir_MWM.cpp $(USER_DIR)/ir_RC5_RC6.cpp $(COMMON_DEPS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_MWM.cpp - -ir_Vestel.o : $(USER_DIR)/ir_Vestel.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Vestel.cpp - -ir_Teco.o : $(USER_DIR)/ir_Teco.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Teco.cpp - -ir_Tcl.o : $(USER_DIR)/ir_Tcl.cpp $(USER_DIR)/ir_Tcl.h $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Tcl.cpp - -ir_Trotec.o : $(USER_DIR)/ir_Trotec.cpp $(USER_DIR)/ir_Trotec.h $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Trotec.cpp - -ir_Lego.o : $(USER_DIR)/ir_Lego.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Lego.cpp - -ir_Argo.o : $(USER_DIR)/ir_Argo.cpp $(USER_DIR)/ir_Argo.h $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Argo.cpp - -ir_Goodweather.o : $(USER_DIR)/ir_Goodweather.cpp $(USER_DIR)/ir_Goodweather.h $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Goodweather.cpp - -ir_Neoclima.o : $(USER_DIR)/ir_Neoclima.cpp $(USER_DIR)/ir_Neoclima.h $(COMMON_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Neoclima.cpp - -ir_Amcor.o : $(USER_DIR)/ir_Amcor.cpp $(USER_DIR)/ir_Amcor.h $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Amcor.cpp - -ir_Epson.o : $(USER_DIR)/ir_Epson.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Epson.cpp - -ir_Symphony.o : $(USER_DIR)/ir_Symphony.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Symphony.cpp - -ir_Airwell.o : $(USER_DIR)/ir_Airwell.cpp $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_Airwell.cpp - -IRac.o : $(USER_DIR)/IRac.cpp $(USER_DIR)/IRac.h $(COMMON_DEPS) $(GTEST_HEADERS) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/IRac.cpp diff --git a/lib/IRremoteESP8266-2.7.6/CPPLINT.cfg b/lib/IRremoteESP8266-2.7.7/CPPLINT.cfg similarity index 100% rename from lib/IRremoteESP8266-2.7.6/CPPLINT.cfg rename to lib/IRremoteESP8266-2.7.7/CPPLINT.cfg diff --git a/lib/IRremoteESP8266-2.7.6/LICENSE.txt b/lib/IRremoteESP8266-2.7.7/LICENSE.txt similarity index 100% rename from lib/IRremoteESP8266-2.7.6/LICENSE.txt rename to lib/IRremoteESP8266-2.7.7/LICENSE.txt diff --git a/lib/IRremoteESP8266-2.7.6/README.md b/lib/IRremoteESP8266-2.7.7/README.md similarity index 98% rename from lib/IRremoteESP8266-2.7.6/README.md rename to lib/IRremoteESP8266-2.7.7/README.md index 83859d6b6..b3fa60ece 100644 --- a/lib/IRremoteESP8266-2.7.6/README.md +++ b/lib/IRremoteESP8266-2.7.7/README.md @@ -9,8 +9,8 @@ This library enables you to **send _and_ receive** infra-red signals on an [ESP8266](https://github.com/esp8266/Arduino) or an [ESP32](https://github.com/espressif/arduino-esp32) using the [Arduino framework](https://www.arduino.cc/) using common 940nm IR LEDs and common IR receiver modules. e.g. TSOP{17,22,24,36,38,44,48}* demodulators etc. -## v2.7.6 Now Available -Version 2.7.6 of the library is now [available](https://github.com/crankyoldgit/IRremoteESP8266/releases/latest). You can view the [Release Notes](ReleaseNotes.md) for all the significant changes. +## v2.7.7 Now Available +Version 2.7.7 of the library is now [available](https://github.com/crankyoldgit/IRremoteESP8266/releases/latest). You can view the [Release Notes](ReleaseNotes.md) for all the significant changes. #### Upgrading from pre-v2.0 Usage of the library has been slightly changed in v2.0. You will need to change your usage to work with v2.0 and beyond. You can read more about the changes required on our [Upgrade to v2.0](https://github.com/crankyoldgit/IRremoteESP8266/wiki/Upgrading-to-v2.0) page. diff --git a/lib/IRremoteESP8266-2.7.6/README_fr.md b/lib/IRremoteESP8266-2.7.7/README_fr.md similarity index 98% rename from lib/IRremoteESP8266-2.7.6/README_fr.md rename to lib/IRremoteESP8266-2.7.7/README_fr.md index 6b6c6e7d0..9ff560fe8 100644 --- a/lib/IRremoteESP8266-2.7.6/README_fr.md +++ b/lib/IRremoteESP8266-2.7.7/README_fr.md @@ -9,8 +9,8 @@ Cette librairie vous permetra de **recevoir et d'envoyer des signaux** infrarouge sur le protocole [ESP8266](https://github.com/esp8266/Arduino) ou sur le protocole [ESP32](https://github.com/espressif/arduino-esp32) en utilisant le [Arduino framework](https://www.arduino.cc/) qui utilise la norme 940nm IR LEDs et le module basique de reception d'onde IR. Exemple : TSOP{17,22,24,36,38,44,48}* modules etc. -## v2.7.6 disponible -Version 2.7.6 de la libraire est maintenant [disponible](https://github.com/crankyoldgit/IRremoteESP8266/releases/latest). Vous pouvez voir le [Release Notes](ReleaseNotes.md) pour tous les changements importants. +## v2.7.7 disponible +Version 2.7.7 de la libraire est maintenant [disponible](https://github.com/crankyoldgit/IRremoteESP8266/releases/latest). Vous pouvez voir le [Release Notes](ReleaseNotes.md) pour tous les changements importants. #### mise à jour depuis pre-v2.0 L'utilisation de la librairie à un peu changer depuis la version in v2.0. Si vous voulez l'utiliser vous devrez changer votre utilisation aussi. Vous pouvez vous renseigner sur les précondition d'utilisation ici : [Upgrade to v2.0](https://github.com/crankyoldgit/IRremoteESP8266/wiki/Upgrading-to-v2.0) page. diff --git a/lib/IRremoteESP8266-2.7.6/ReleaseNotes.md b/lib/IRremoteESP8266-2.7.7/ReleaseNotes.md similarity index 94% rename from lib/IRremoteESP8266-2.7.6/ReleaseNotes.md rename to lib/IRremoteESP8266-2.7.7/ReleaseNotes.md index 69cc753cd..0e7bc7bc5 100644 --- a/lib/IRremoteESP8266-2.7.6/ReleaseNotes.md +++ b/lib/IRremoteESP8266-2.7.7/ReleaseNotes.md @@ -1,5 +1,36 @@ # Release Notes +## _v2.7.7 (20200519)_ + +**[BREAKING CHANGES]** +- Fix Symphony protocol. (#1107, #1105) + * Now 12 bits and bits are inverted. All previous codes will no longer work. +- IRMQTTServer: Better handle power & mode operations for Home Assistant. (#1099, #1092) + * When `MQTT_CLIMATE_HA_MODE` is enabled (default) this will break previous operation mode resumption when power is changed. + +**[Bug Fixes]** +- Set correct return type for `.calibrate()` (#1095, #1093) + +**[Features]** +- Add basic support for Carrier 40 & 64 bit protocols. (#1125, #1112, #1127) +- Gree: Enable native support for Fahrenheit (#1124, #1121) +- Gree: Add option to control display temp source. (#1120, #1118) +- Add support for Multibrackets protocol. (#1106, #1103) +- Add RawToPronto.py tool & improve `sendPronto()` precision (#1104, #1103) +- Add support for `Doshisha` LED light protocol (#1115) +- Introduce IRrecvDumpV3 with basic OTA update support (#1111) +- Add detailed support for Delonghi A/C (#1098, #1096) +- Improved support for SharpAc. (#1094, #1091) +- Update auto_analyse to use new decode call structure. (#1102, #1097) +- Added Blynk app example (#1090) + +**[Misc]** +- update auto_analyse script to use new param documentation (#1126) +- Improve `raw_to_pronto_code.py` (#1122, #1103) +- Use pattern rules in Makefiles to reduce specific rule (#1110) +- Update list of supported Daikin models. (#1101) + + ## _v2.7.6 (20200425)_ **[Features]** diff --git a/lib/IRremoteESP8266-2.7.6/SupportedProtocols.md b/lib/IRremoteESP8266-2.7.7/SupportedProtocols.md similarity index 88% rename from lib/IRremoteESP8266-2.7.6/SupportedProtocols.md rename to lib/IRremoteESP8266-2.7.7/SupportedProtocols.md index ed4699de2..457da38bb 100644 --- a/lib/IRremoteESP8266-2.7.6/SupportedProtocols.md +++ b/lib/IRremoteESP8266-2.7.7/SupportedProtocols.md @@ -1,6 +1,6 @@ + Last generated: Tue 19 May 2020 11:48:47 +0000 ---> # IR Protocols supported by this library | Protocol | Brand | Model | A/C Model | Detailed A/C Support | @@ -14,9 +14,11 @@ | [Coolix](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Coolix.cpp) | **[Beko](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Coolix.h)** | BINR 070/071 split-type A/C
BINR 070/071 split-type A/C
RG57K7(B)/BGEF Remote
RG57K7(B)/BGEF Remote | | Yes | | [Coolix](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Coolix.cpp) | **[Midea](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Coolix.h)** | MS12FU-10HRDN1-QRD0GW(B) A/C
MS12FU-10HRDN1-QRD0GW(B) A/C
MSABAU-07HRFN1-QRD0GW A/C (circa 2016)
MSABAU-07HRFN1-QRD0GW A/C (circa 2016)
RG52D/BGE Remote
RG52D/BGE Remote | | Yes | | [Coolix](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Coolix.cpp) | **[Tokio](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Coolix.h)** | AATOEMF17-12CHR1SW split-type RG51\|50/BGE Remote
AATOEMF17-12CHR1SW split-type RG51\|50/BGE Remote | | Yes | -| [Daikin](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Daikin.cpp) | **[Daikin](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Daikin.h)** | 17 Series A/C (DAIKIN128)
ARC423A5 remote
ARC433** remote
ARC433B69 remote
ARC477A1 remote
ARC480A5 remote (DAIKIN152)
BRC4C153 remote
BRC52B63 remote (DAIKIN128)
DGS01 remote (DAIKIN64)
FFN-C/FCN-F Series A/C (DAIKIN64)
FTE12HV2S A/C
FTXB09AXVJU A/C (DAIKIN128)
FTXB12AXVJU A/C (DAIKIN128)
FTXZ25NV1B A/C
FTXZ35NV1B A/C
FTXZ50NV1B A/C | | Yes | +| [Daikin](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Daikin.cpp) | **[Daikin](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Daikin.h)** | 17 Series A/C (DAIKIN128)
ARC423A5 remote
ARC433** remote
ARC433B69 remote
ARC466A33 remote (DAIKIN)
ARC477A1 remote
ARC480A5 remote (DAIKIN152)
BRC4C153 remote
BRC52B63 remote (DAIKIN128)
DGS01 remote (DAIKIN64)
FFN-C/FCN-F Series A/C (DAIKIN64)
FTE12HV2S A/C
FTXB09AXVJU A/C (DAIKIN128)
FTXB12AXVJU A/C (DAIKIN128)
FTXM-M A/C (DAIKIN)
FTXZ25NV1B A/C
FTXZ35NV1B A/C
FTXZ50NV1B A/C
M Series A/C (DAIKIN) | | Yes | +| [Delonghi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Delonghi.cpp) | **[Delonghi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Delonghi.h)** | PAC A95 | | Yes | | [Denon](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Denon.cpp) | **Unknown** | | | - | | [Dish](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Dish.cpp) | **DISH NETWORK** | echostar 301 | | - | +| [Doshisha](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Doshisha.cpp) | **Doshisha** | CZ-S32D LED Light
CZ-S38D LED Light
CZ-S50D LED Light
RCZ01 remote | | - | | [Electra](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Electra.cpp) | **[AUX](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Electra.h)** | KFR-35GW/BpNFW=3 A/C
YKR-T/011 remote | | Yes | | [Electra](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Electra.cpp) | **[Electra](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Electra.h)** | Classic INV 17 / AXW12DCS A/C
YKR-M/003E remote | | Yes | | [Epson](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Epson.cpp) | **Unknown** | | | - | @@ -26,6 +28,7 @@ | [GlobalCache](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_GlobalCache.cpp) | **Unknown** | | | - | | [Goodweather](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Goodweather.cpp) | **[Goodweather](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Goodweather.h)** | ZH/JT-03 remote | | Yes | | [Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.cpp) | **[EKOKAI](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.h)** | A/C | YAW1F
YBOFB | Yes | +| [Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.cpp) | **[Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.h)** | YAA1FBF remote
YB1F2F remote | YAW1F
YBOFB | Yes | | [Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.cpp) | **[Green](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.h)** | YBOFB remote
YBOFB2 remote | YAW1F
YBOFB | Yes | | [Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.cpp) | **[RusClimate](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.h)** | EACS/I-09HAR_X/N3 A/C
YAW1F remote | YAW1F
YBOFB | Yes | | [Gree](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.cpp) | **[Ultimate](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Gree.h)** | Heat Pump | YAW1F
YBOFB | Yes | @@ -48,6 +51,7 @@ | [Mitsubishi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.cpp) | **[Mitsubishi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.h)** | HC3000 Projector
KM14A 0179213 remote
MS-GK24VA A/C
TV | | Yes | | [Mitsubishi](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.cpp) | **[Mitsubishi Electric](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Mitsubishi.h)** | 001CP T7WE10714 remote
KPOA remote
MSH-A24WV / MUH-A24WV A/C
PEAD-RP71JAA Ducted A/C | | Yes | | [MitsubishiHeavy](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_MitsubishiHeavy.cpp) | **[Mitsubishi Heavy Industries](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_MitsubishiHeavy.h)** | RKX502A001C remote
RLA502A700B remote
SRKxxZJ-S A/C
SRKxxZM-S A/C
SRKxxZMXA-S A/C | | Yes | +| [Multibrackets](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Multibrackets.cpp) | **Multibrackets** | Motorized Swing mount large - 4500 | | - | | [NEC](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_NEC.cpp) | **[Aloka](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_NEC.h)** | SleepyLights LED Lamp | | - | | [NEC](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_NEC.cpp) | **[Toshiba](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_NEC.h)** | 42TL838 LCD TV | | - | | [NEC](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_NEC.cpp) | **[Yamaha](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_NEC.h)** | RAV561 remote
RXV585B A/V Receiver | | - | @@ -60,10 +64,14 @@ | [RCMM](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_RCMM.cpp) | **Microsoft** | XBOX 360 | | - | | [Samsung](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Samsung.cpp) | **[Samsung](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Samsung.h)** | AR09FSSDAWKNFA A/C
AR12HSSDBWKNEU A/C
AR12KSFPEWQNET A/C
AR12NXCXAWKXEU A/C
DB63-03556X003 remote
DB93-16761C remote
IEC-R03 remote
UA55H6300 TV | | Yes | | [Sanyo](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Sanyo.cpp) | **Unknown** | | | - | -| [Sharp](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Sharp.cpp) | **[Sharp](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Sharp.h)** | AH-AxSAY A/C
AY-ZP40KR A/C
LC-52D62U TV | | Yes | +| [Sharp](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Sharp.cpp) | **[Sharp](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Sharp.h)** | AH-AxSAY A/C
AH-XP10NRY A/C
AY-ZP40KR A/C
CRMC-820JBEZ remote
LC-52D62U TV | | Yes | | [Sherwood](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Sherwood.cpp) | **Sherwood** | RC-138 remote
RD6505(B) Receiver | | - | | [Sony](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Sony.cpp) | **Sony** | HT-CT380 Soundbar (Uses 38kHz & 3 repeats) | | - | +| [Symphony](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Symphony.cpp) | **Blyss** | Owen-SW-5 3 Fan
WP-YK8 090218 remote | | - | +| [Symphony](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Symphony.cpp) | **SamHop** | SM3015 Fan Remote Control
SM5021 Encoder chip
SM5032 Decoder chip | | - | +| [Symphony](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Symphony.cpp) | **Satellite Electronic** | ID6 Remote
JY199I Fan driver
JY199I-L Fan driver | | - | | [Symphony](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Symphony.cpp) | **Symphony** | Air Cooler 3Di | | - | +| [Symphony](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Symphony.cpp) | **Westinghouse** | 78095 Remote
Ceiling fan | | - | | [Tcl](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Tcl.cpp) | **[Leberg](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Tcl.h)** | LBS-TOR07 A/C | | Yes | | [Teco](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Teco.cpp) | **[Alaska](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Teco.h)** | SAC9010QC A/C
SAC9010QC remote | | Yes | | [Toshiba](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Toshiba.cpp) | **[Toshiba](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/ir_Toshiba.h)** | Akita EVO II
RAS 18SKP-ES
RAS-B13N3KV2
RAS-B13N3KVP-E
WC-L03SE
WH-TA04NE | | Yes | @@ -89,6 +97,8 @@ - AMCOR - ARGO - CARRIER_AC +- CARRIER_AC40 +- CARRIER_AC64 - COOLIX - DAIKIN - DAIKIN128 @@ -98,8 +108,10 @@ - DAIKIN2 - DAIKIN216 - DAIKIN64 +- DELONGHI_AC - DENON - DISH +- DOSHISHA - ELECTRA_AC - EPSON - FUJITSU_AC @@ -130,6 +142,7 @@ - MITSUBISHI_AC - MITSUBISHI_HEAVY_152 - MITSUBISHI_HEAVY_88 +- MULTIBRACKETS - MWM - NEC - NEC_LIKE diff --git a/lib/IRremoteESP8266-2.7.7/docs/README.md b/lib/IRremoteESP8266-2.7.7/docs/README.md new file mode 100644 index 000000000..fea1f636f --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/docs/README.md @@ -0,0 +1 @@ +Documentation goes here. diff --git a/lib/IRremoteESP8266-2.7.7/docs/_config.yml b/lib/IRremoteESP8266-2.7.7/docs/_config.yml new file mode 100644 index 000000000..c74188174 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/docs/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-slate \ No newline at end of file diff --git a/lib/IRremoteESP8266-2.7.7/examples/BlynkIrRemote/BlynkIrRemote.ino b/lib/IRremoteESP8266-2.7.7/examples/BlynkIrRemote/BlynkIrRemote.ino new file mode 100644 index 000000000..6e659bd64 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/examples/BlynkIrRemote/BlynkIrRemote.ino @@ -0,0 +1,196 @@ +/************************************************************* + Emulate a physical remote via an iOS and Android App. + Copyright Gaurav Barwalia 2020 + + Download latest Blynk library here: + https://github.com/blynkkk/blynk-library/releases/latest + + Blynk is a platform with iOS and Android apps to control + Arduino, Raspberry Pi and the likes over the Internet. + You can easily build graphic interfaces for all your + projects by simply dragging and dropping widgets. + + Downloads, docs, tutorials: http://www.blynk.cc + Sketch generator: http://examples.blynk.cc + Blynk community: http://community.blynk.cc + Follow us: http://www.fb.com/blynkapp + http://twitter.com/blynk_app + + Blynk library is licensed under MIT license + This example code is in public domain. + + ************************************************************* + This example runs directly on ESP8266 chip. + + Note: This requires ESP8266 support package: + https://github.com/esp8266/Arduino + + Please be sure to select the right ESP8266 module + in the Tools -> Board menu! + + Change WiFi ssid, pass, and Blynk auth token to run :) + Feel free to apply it to any other example. It's simple! + *************************************************************/ + + /* + // After decoding received below codes + + // Power button + +18:12:33.993 -> Protocol : NEC +18:12:33.993 -> Code : 0x1FE50AF (32 Bits) +18:12:33.993 -> uint16_t rawData[71] = {9040, 4452, 606, 532, 606, 534, 630, 508, 604, 534, 604, 534, 604, 534, 630, 506, 606, 1646, 632, 1620, 606, 1646, 632, 1620, 630, 1620, 632, 1620, 630, 1620, 606, 1646, 632, 506, 632, 506, 632, 1620, 632, 506, 632, 1620, 632, 506, 632, 508, 632, 506, 632, 506, 632, 1620, 632, 506, 632, 1624, 628, 506, 632, 1620, 632, 1618, 632, 1620, 632, 1620, 632, 39016, 9040, 2216, 630}; // NEC 1FE50AF +18:12:34.027 -> uint32_t address = 0x80; +18:12:34.027 -> uint32_t command = 0xA; +18:12:34.027 -> uint64_t data = 0x1FE50AF; + +//mute button + +18:13:27.215 -> Protocol : NEC +18:13:27.215 -> Code : 0x1FE30CF (32 Bits) +18:13:27.215 -> uint16_t rawData[71] = {9094, 4398, 660, 478, 658, 480, 658, 480, 658, 480, 658, 480, 658, 480, 660, 480, 658, 1594, 658, 1594, 658, 1594, 658, 1594, 658, 1592, 658, 1594, 658, 1592, 658, 1594, 660, 480, 658, 480, 658, 480, 658, 1592, 658, 1592, 658, 480, 658, 480, 660, 478, 660, 478, 658, 1594, 658, 1592, 658, 480, 658, 480, 658, 1594, 658, 1592, 658, 1594, 658, 1594, 658, 38986, 9094, 2162, 658}; // NEC 1FE30CF +18:13:27.285 -> uint32_t address = 0x80; +18:13:27.285 -> uint32_t command = 0xC; +18:13:27.285 -> uint64_t data = 0x1FE30CF; + +//Vol. low + +18:14:44.427 -> Protocol : NEC +18:14:44.427 -> Code : 0x1FEC03F (32 Bits) +18:14:44.427 -> uint16_t rawData[71] = {9120, 4374, 658, 478, 658, 480, 658, 480, 658, 480, 658, 482, 658, 478, 658, 480, 658, 1594, 658, 1594, 658, 1592, 660, 1594, 658, 1592, 658, 1594, 658, 1594, 658, 1592, 660, 480, 658, 1594, 658, 1594, 658, 480, 658, 480, 660, 480, 658, 480, 658, 480, 658, 480, 658, 480, 658, 480, 658, 1594, 660, 1592, 658, 1594, 658, 1594, 658, 1592, 658, 1594, 658, 39002, 9094, 2162, 658}; // NEC 1FEC03F +18:14:44.497 -> uint32_t address = 0x80; +18:14:44.497 -> uint32_t command = 0x3; +18:14:44.497 -> uint64_t data = 0x1FEC03F; + +//VOl. High + +18:15:11.677 -> Protocol : NEC +18:15:11.677 -> Code : 0x1FE40BF (32 Bits) +18:15:11.677 -> uint16_t rawData[67] = {9068, 4426, 630, 506, 632, 508, 630, 508, 630, 508, 630, 508, 630, 508, 630, 508, 630, 1622, 630, 1622, 630, 1622, 630, 1622, 656, 1594, 630, 1622, 632, 1620, 630, 1622, 630, 508, 630, 508, 630, 1622, 630, 508, 630, 508, 630, 508, 630, 508, 630, 508, 630, 508, 630, 1622, 656, 482, 630, 1622, 630, 1622, 630, 1622, 630, 1622, 630, 1622, 632, 1620, 630}; // NEC 1FE40BF +18:15:11.747 -> uint32_t address = 0x80; +18:15:11.747 -> uint32_t command = 0x2; +18:15:11.747 -> uint64_t data = 0x1FE40BF; + +//Play/Pause + +18:15:38.529 -> Protocol : NEC +18:15:38.529 -> Code : 0x1FE32CD (32 Bits) +18:15:38.529 -> uint16_t rawData[71] = {9092, 4400, 632, 504, 658, 480, 658, 480, 632, 506, 658, 480, 658, 480, 658, 482, 632, 1620, 658, 1594, 658, 1594, 632, 1618, 658, 1594, 658, 1594, 632, 1620, 632, 1618, 634, 506, 658, 480, 658, 480, 632, 1620, 658, 1598, 656, 478, 658, 478, 658, 1594, 658, 482, 632, 1618, 632, 1618, 634, 506, 632, 506, 658, 1594, 632, 1620, 658, 480, 632, 1620, 658, 38998, 9094, 2162, 660}; // NEC 1FE32CD +18:15:38.564 -> uint32_t address = 0x80; +18:15:38.564 -> uint32_t command = 0x4C; +18:15:38.564 -> uint64_t data = 0x1FE32CD; + +//Song Back + +18:16:07.527 -> Protocol : NEC +18:16:07.527 -> Code : 0x1FEA05F (32 Bits) +18:16:07.562 -> uint16_t rawData[71] = {9590, 3902, 684, 452, 686, 456, 652, 480, 660, 480, 684, 456, 656, 480, 658, 480, 684, 1568, 658, 1594, 658, 1594, 686, 1566, 658, 1594, 684, 1568, 658, 1594, 658, 1594, 686, 454, 684, 1568, 686, 454, 658, 1594, 684, 454, 686, 454, 658, 480, 660, 480, 684, 454, 658, 482, 658, 1594, 682, 456, 658, 1596, 658, 1594, 686, 1568, 660, 1592, 684, 1568, 686, 38982, 9098, 2162, 684}; // NEC 1FEA05F +18:16:07.597 -> uint32_t address = 0x80; +18:16:07.597 -> uint32_t command = 0x5; +18:16:07.597 -> uint64_t data = 0x1FEA05F; + +//Song Forward + +18:17:20.541 -> Protocol : NEC +18:17:20.541 -> Code : 0x1FEE01F (32 Bits) +18:17:20.575 -> uint16_t rawData[71] = {9068, 4424, 632, 506, 630, 506, 632, 508, 606, 532, 632, 506, 630, 508, 630, 508, 632, 1620, 632, 1620, 632, 1620, 604, 1646, 606, 1646, 630, 1622, 604, 1646, 632, 1620, 606, 534, 630, 1622, 604, 1646, 630, 1622, 604, 534, 630, 508, 604, 534, 606, 534, 630, 508, 630, 508, 606, 534, 606, 532, 630, 1622, 604, 1646, 632, 1620, 604, 1648, 604, 1646, 604, 39040, 9040, 2216, 604}; // NEC 1FEE01F +18:17:20.610 -> uint32_t address = 0x80; +18:17:20.610 -> uint32_t command = 0x7; +18:17:20.610 -> uint64_t data = 0x1FEE01F; + + */ + +// check complete video tutorial here for program explanation https://www.youtube.com/watch?v=LqmkDKu54XY&t=17s + +/* Comment this out to disable prints and save space */ +#define BLYNK_PRINT Serial + +#if defined(ESP8266) +#include +#include +#else +#include +#endif // ESP8266 +#if defined(ESP32) +#include +#endif // ESP32 + +// IR library +#include +#include + +const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2). +IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message. + +// You should get Auth Token in the Blynk App. +// Go to the Project Settings (nut icon). +char auth[] = "YourAuthToken"; + +// Your WiFi credentials. +// Set password to "" for open networks. +char ssid[] = "YourNetworkName"; +char pass[] = "YourPassword"; + + BLYNK_WRITE(V51) { // Power button + if (param.asInt() == 0) { + // Serial.println("NEC"); + irsend.sendNEC(0x1FE50AF); + } + } + + BLYNK_WRITE(V52) { // Mute button + if (param.asInt() == 0) { + // Serial.println("NEC"); + irsend.sendNEC(0x1FE30CF); + } + } + + BLYNK_WRITE(V53) { // Song Forward + if (param.asInt() == 0) { + // Serial.println("NEC"); + irsend.sendNEC(0x1FEE01F); + } + } + + BLYNK_WRITE(V54) { // Song Backward + if (param.asInt() == 0) { + // Serial.println("NEC"); + irsend.sendNEC(0x1FEA05F); + delay(10); // double tap back button to back one song + irsend.sendNEC(0x1FEA05F); + } + } + + BLYNK_WRITE(V55) { // Volume -- + if (param.asInt() == 0) { + // Serial.println("NEC"); + irsend.sendNEC(0x1FEC03F); + } + } + + BLYNK_WRITE(V56) { // Volume ++ + if (param.asInt() == 0) { + // Serial.println("NEC"); + irsend.sendNEC(0x1FE40BF); + } + } + + BLYNK_WRITE(V57) { // Play/Pause + if (param.asInt() == 0) { + // Serial.println("NEC"); + irsend.sendNEC(0x1FE32CD); + } + } + +void setup() { +#if defined(BLYNK_PRINT) + // Debug console + Serial.begin(115200); +#endif // BLYNK_PRINT + + Blynk.begin(auth, ssid, pass); +} + +void loop() { + Blynk.run(); +} diff --git a/lib/IRremoteESP8266-2.7.7/examples/BlynkIrRemote/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/BlynkIrRemote/platformio.ini new file mode 100644 index 000000000..58f6b0f30 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/examples/BlynkIrRemote/platformio.ini @@ -0,0 +1,34 @@ +[platformio] +src_dir = . + +[env] +lib_extra_dirs = ../../ +lib_ldf_mode = deep+ +lib_ignore = examples +framework = arduino +platform = espressif8266 +build_flags = ; -D_IR_LOCALE_=en-AU + +[common] +lib_deps_builtin = +lib_deps_external = + Blynk + +[common_esp8266] +lib_deps_external = + ${common.lib_deps_builtin} + ${common.lib_deps_external} + +[common_esp32] +lib_deps_external = + ${common.lib_deps_builtin} + ${common.lib_deps_external} + +[env:nodemcuv2] +board = nodemcuv2 +lib_deps = ${common_esp8266.lib_deps_external} + +[env:esp32dev] +platform = espressif32 +board = esp32dev +lib_deps = ${common_esp32.lib_deps_external} diff --git a/lib/IRremoteESP8266-2.7.6/examples/CommonAcControl/CommonAcControl.ino b/lib/IRremoteESP8266-2.7.7/examples/CommonAcControl/CommonAcControl.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/CommonAcControl/CommonAcControl.ino rename to lib/IRremoteESP8266-2.7.7/examples/CommonAcControl/CommonAcControl.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/CommonAcControl/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/CommonAcControl/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/CommonAcControl/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/CommonAcControl/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/ControlSamsungAC/ControlSamsungAC.ino b/lib/IRremoteESP8266-2.7.7/examples/ControlSamsungAC/ControlSamsungAC.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/ControlSamsungAC/ControlSamsungAC.ino rename to lib/IRremoteESP8266-2.7.7/examples/ControlSamsungAC/ControlSamsungAC.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/ControlSamsungAC/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/ControlSamsungAC/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/ControlSamsungAC/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/ControlSamsungAC/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/DumbIRRepeater/DumbIRRepeater.ino b/lib/IRremoteESP8266-2.7.7/examples/DumbIRRepeater/DumbIRRepeater.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/DumbIRRepeater/DumbIRRepeater.ino rename to lib/IRremoteESP8266-2.7.7/examples/DumbIRRepeater/DumbIRRepeater.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/DumbIRRepeater/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/DumbIRRepeater/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/DumbIRRepeater/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/DumbIRRepeater/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRGCSendDemo/IRGCSendDemo.ino b/lib/IRremoteESP8266-2.7.7/examples/IRGCSendDemo/IRGCSendDemo.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRGCSendDemo/IRGCSendDemo.ino rename to lib/IRremoteESP8266-2.7.7/examples/IRGCSendDemo/IRGCSendDemo.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRGCSendDemo/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/IRGCSendDemo/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRGCSendDemo/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/IRGCSendDemo/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRGCTCPServer/IRGCTCPServer.ino b/lib/IRremoteESP8266-2.7.7/examples/IRGCTCPServer/IRGCTCPServer.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRGCTCPServer/IRGCTCPServer.ino rename to lib/IRremoteESP8266-2.7.7/examples/IRGCTCPServer/IRGCTCPServer.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRGCTCPServer/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/IRGCTCPServer/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRGCTCPServer/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/IRGCTCPServer/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRMQTTServer/IRMQTTServer.h b/lib/IRremoteESP8266-2.7.7/examples/IRMQTTServer/IRMQTTServer.h similarity index 96% rename from lib/IRremoteESP8266-2.7.6/examples/IRMQTTServer/IRMQTTServer.h rename to lib/IRremoteESP8266-2.7.7/examples/IRMQTTServer/IRMQTTServer.h index c886b705b..b283e330f 100644 --- a/lib/IRremoteESP8266-2.7.6/examples/IRMQTTServer/IRMQTTServer.h +++ b/lib/IRremoteESP8266-2.7.7/examples/IRMQTTServer/IRMQTTServer.h @@ -102,11 +102,23 @@ const uint32_t kMqttReconnectTime = 5000; // Delay(ms) between reconnect tries. #define MQTT_CLIMATE_STAT "stat" // Sub-topic for the climate stat topics. // Enable sending/receiving climate via JSON. `true` cost ~5k of program space. #define MQTT_CLIMATE_JSON false + // Use Home Assistant-style operation modes. -// i.e. Change the climate mode to "off" when turning the power "off". +// TL;DR: Power and Mode are linked together. One changes the other. +// i.e. +// - When power is set to "off", the mode is set to "off". +// - When the mode changes from "off" to something else, power is set to "on". // See: https://www.home-assistant.io/components/climate.mqtt/#modes -// Change to false, if your home automation system doesn't like this. +// *** WARNING *** +// This setting will cause IRMQTTServer to forget what the previous operation +// mode was. e.g. a power "on" -> "off" -> "on" will cause it to use the +// default mode for your A/C, not the previous mode. +// Typically this is "Auto" or "Cool" mode. +// Change to false, if your home automation system doesn't like this, or if +// you want IRMQTTServer to be the authoritative source for controling your +// A/C. #define MQTT_CLIMATE_HA_MODE true + // Do we send an IR message when we reboot and recover the existing A/C state? // If set to `false` you may miss requested state changes while the ESP was // down. If set to `true`, it will resend the previous desired state sent to the @@ -239,7 +251,7 @@ const uint16_t kJsonAcStateMaxSize = 1024; // Bytes // ----------------- End of User Configuration Section ------------------------- // Constants -#define _MY_VERSION_ "v1.4.9" +#define _MY_VERSION_ "v1.5.0" const uint8_t kRebootTime = 15; // Seconds const uint8_t kQuickDisplayTime = 2; // Seconds diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRMQTTServer/IRMQTTServer.ino b/lib/IRremoteESP8266-2.7.7/examples/IRMQTTServer/IRMQTTServer.ino similarity index 99% rename from lib/IRremoteESP8266-2.7.6/examples/IRMQTTServer/IRMQTTServer.ino rename to lib/IRremoteESP8266-2.7.7/examples/IRMQTTServer/IRMQTTServer.ino index c04c1e23b..6bf504b0e 100644 --- a/lib/IRremoteESP8266-2.7.6/examples/IRMQTTServer/IRMQTTServer.ino +++ b/lib/IRremoteESP8266-2.7.7/examples/IRMQTTServer/IRMQTTServer.ino @@ -2964,40 +2964,47 @@ void updateClimate(stdAc::state_t *state, const String str, *state = jsonToState(*state, payload.c_str()); else #endif // MQTT_CLIMATE_JSON - if (str.equals(prefix + KEY_PROTOCOL)) + if (str.equals(prefix + KEY_PROTOCOL)) { state->protocol = strToDecodeType(payload.c_str()); - else if (str.equals(prefix + KEY_MODEL)) + } else if (str.equals(prefix + KEY_MODEL)) { state->model = IRac::strToModel(payload.c_str()); - else if (str.equals(prefix + KEY_POWER)) + } else if (str.equals(prefix + KEY_POWER)) { state->power = IRac::strToBool(payload.c_str()); - else if (str.equals(prefix + KEY_MODE)) +#if MQTT_CLIMATE_HA_MODE + if (!state->power) state->mode = stdAc::opmode_t::kOff; +#endif // MQTT_CLIMATE_HA_MODE + } else if (str.equals(prefix + KEY_MODE)) { state->mode = IRac::strToOpmode(payload.c_str()); - else if (str.equals(prefix + KEY_TEMP)) +#if MQTT_CLIMATE_HA_MODE + state->power = (state->mode != stdAc::opmode_t::kOff); +#endif // MQTT_CLIMATE_HA_MODE + } else if (str.equals(prefix + KEY_TEMP)) { state->degrees = payload.toFloat(); - else if (str.equals(prefix + KEY_FANSPEED)) + } else if (str.equals(prefix + KEY_FANSPEED)) { state->fanspeed = IRac::strToFanspeed(payload.c_str()); - else if (str.equals(prefix + KEY_SWINGV)) + } else if (str.equals(prefix + KEY_SWINGV)) { state->swingv = IRac::strToSwingV(payload.c_str()); - else if (str.equals(prefix + KEY_SWINGH)) + } else if (str.equals(prefix + KEY_SWINGH)) { state->swingh = IRac::strToSwingH(payload.c_str()); - else if (str.equals(prefix + KEY_QUIET)) + } else if (str.equals(prefix + KEY_QUIET)) { state->quiet = IRac::strToBool(payload.c_str()); - else if (str.equals(prefix + KEY_TURBO)) + } else if (str.equals(prefix + KEY_TURBO)) { state->turbo = IRac::strToBool(payload.c_str()); - else if (str.equals(prefix + KEY_ECONO)) + } else if (str.equals(prefix + KEY_ECONO)) { state->econo = IRac::strToBool(payload.c_str()); - else if (str.equals(prefix + KEY_LIGHT)) + } else if (str.equals(prefix + KEY_LIGHT)) { state->light = IRac::strToBool(payload.c_str()); - else if (str.equals(prefix + KEY_BEEP)) + } else if (str.equals(prefix + KEY_BEEP)) { state->beep = IRac::strToBool(payload.c_str()); - else if (str.equals(prefix + KEY_FILTER)) + } else if (str.equals(prefix + KEY_FILTER)) { state->filter = IRac::strToBool(payload.c_str()); - else if (str.equals(prefix + KEY_CLEAN)) + } else if (str.equals(prefix + KEY_CLEAN)) { state->clean = IRac::strToBool(payload.c_str()); - else if (str.equals(prefix + KEY_CELSIUS)) + } else if (str.equals(prefix + KEY_CELSIUS)) { state->celsius = IRac::strToBool(payload.c_str()); - else if (str.equals(prefix + KEY_SLEEP)) + } else if (str.equals(prefix + KEY_SLEEP)) { state->sleep = payload.toInt(); + } } bool sendClimate(const String topic_prefix, const bool retain, diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRMQTTServer/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/IRMQTTServer/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRMQTTServer/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/IRMQTTServer/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRServer/IRServer.ino b/lib/IRremoteESP8266-2.7.7/examples/IRServer/IRServer.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRServer/IRServer.ino rename to lib/IRremoteESP8266-2.7.7/examples/IRServer/IRServer.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRServer/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/IRServer/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRServer/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/IRServer/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRrecvDemo/IRrecvDemo.ino b/lib/IRremoteESP8266-2.7.7/examples/IRrecvDemo/IRrecvDemo.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRrecvDemo/IRrecvDemo.ino rename to lib/IRremoteESP8266-2.7.7/examples/IRrecvDemo/IRrecvDemo.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRrecvDemo/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/IRrecvDemo/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRrecvDemo/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/IRrecvDemo/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRrecvDump/IRrecvDump.ino b/lib/IRremoteESP8266-2.7.7/examples/IRrecvDump/IRrecvDump.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRrecvDump/IRrecvDump.ino rename to lib/IRremoteESP8266-2.7.7/examples/IRrecvDump/IRrecvDump.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRrecvDump/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/IRrecvDump/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRrecvDump/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/IRrecvDump/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRrecvDumpV2/IRrecvDumpV2.ino b/lib/IRremoteESP8266-2.7.7/examples/IRrecvDumpV2/IRrecvDumpV2.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRrecvDumpV2/IRrecvDumpV2.ino rename to lib/IRremoteESP8266-2.7.7/examples/IRrecvDumpV2/IRrecvDumpV2.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRrecvDumpV2/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/IRrecvDumpV2/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRrecvDumpV2/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/IRrecvDumpV2/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.7/examples/IRrecvDumpV3/BaseOTA.h b/lib/IRremoteESP8266-2.7.7/examples/IRrecvDumpV3/BaseOTA.h new file mode 100644 index 000000000..5dd8db541 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/examples/IRrecvDumpV3/BaseOTA.h @@ -0,0 +1,71 @@ +// Copyright 2020 Christian Nilsson (@nikize) +// Based on public Arduino BasicOTA example + +#ifndef EXAMPLES_IRRECVDUMPV3_BASEOTA_H_ +#define EXAMPLES_IRRECVDUMPV3_BASEOTA_H_ + +#ifndef OTA_ENABLE +#define OTA_ENABLE false +#endif // OTA_ENABLE + +#if OTA_ENABLE + +#include +#include +#include +#include + +void OTAwifi() { + // start default wifi (previously saved on the ESP) for OTA + WiFi.mode(WIFI_STA); + WiFi.begin(); +} + +void OTAinit() { + // See BasicOTA ESP example for source and settings + + ArduinoOTA + .onStart([]() { + String type; + if (ArduinoOTA.getCommand() == U_FLASH) + type = "sketch"; + else + type = "filesystem"; + + Serial.println("Start updating " + type); + }) + .onEnd([]() { + Serial.println("\nEnd"); + }) + .onProgress([](unsigned int progress, unsigned int total) { + Serial.printf("Progress: %u%%\r", (progress / (total / 100))); + }) + .onError([](ota_error_t error) { + Serial.printf("Error[%u]: ", error); + if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed"); + else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed"); + else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed"); + else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed"); + else if (error == OTA_END_ERROR) Serial.println("End Failed"); + }); + + ArduinoOTA.begin(); + Serial.println(); + if (WiFi.waitForConnectResult() == WL_CONNECTED) { + Serial.print("IP address: "); + Serial.println(WiFi.localIP()); + } else { + Serial.println("Wifi Connection Failed."); + } +} + +void OTAloopHandler() { + ArduinoOTA.handle(); +} + +#else // OTA_ENABLE +void OTAwifi() {} +void OTAinit() {} +void OTAloopHandler() {} +#endif // OTA_ENABLE +#endif // EXAMPLES_IRRECVDUMPV3_BASEOTA_H_ diff --git a/lib/IRremoteESP8266-2.7.7/examples/IRrecvDumpV3/IRrecvDumpV3.ino b/lib/IRremoteESP8266-2.7.7/examples/IRrecvDumpV3/IRrecvDumpV3.ino new file mode 100644 index 000000000..419ca9b4c --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/examples/IRrecvDumpV3/IRrecvDumpV3.ino @@ -0,0 +1,166 @@ +/* + * IRremoteESP8266: IRrecvDumpV3 - dump details of IR codes with IRrecv + * An IR detector/demodulator must be connected to the input kRecvPin. + * + * Copyright 2009 Ken Shirriff, http://arcfn.com + * Copyright 2017-2019 David Conran + * + * Example circuit diagram: + * https://github.com/crankyoldgit/IRremoteESP8266/wiki#ir-receiving + * + * Changes: + * Version 1.1 May, 2020 + * - Create DumpV3 from DumpV2 + * - Add OTA Base + * Version 1.0 October, 2019 + * - Internationalisation (i18n) support. + * - Stop displaying the legacy raw timing info. + * Version 0.5 June, 2019 + * - Move A/C description to IRac.cpp. + * Version 0.4 July, 2018 + * - Minor improvements and more A/C unit support. + * Version 0.3 November, 2017 + * - Support for A/C decoding for some protocols. + * Version 0.2 April, 2017 + * - Decode from a copy of the data so we can start capturing faster thus + * reduce the likelihood of miscaptures. + * Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, + */ + +// Allow over air update +// #define OTA_ENABLE true +#include "BaseOTA.h" + +#include +#include +#include +#include +#include +#include + +// ==================== start of TUNEABLE PARAMETERS ==================== +// An IR detector/demodulator is connected to GPIO pin 14 +// e.g. D5 on a NodeMCU board. +// Note: GPIO 16 won't work on the ESP8266 as it does not have interrupts. +const uint16_t kRecvPin = 14; + +// The Serial connection baud rate. +// i.e. Status message will be sent to the PC at this baud rate. +// Try to avoid slow speeds like 9600, as you will miss messages and +// cause other problems. 115200 (or faster) is recommended. +// NOTE: Make sure you set your Serial Monitor to the same speed. +const uint32_t kBaudRate = 115200; + +// As this program is a special purpose capture/decoder, let us use a larger +// than normal buffer so we can handle Air Conditioner remote codes. +const uint16_t kCaptureBufferSize = 1024; + +// kTimeout is the Nr. of milli-Seconds of no-more-data before we consider a +// message ended. +// This parameter is an interesting trade-off. The longer the timeout, the more +// complex a message it can capture. e.g. Some device protocols will send +// multiple message packets in quick succession, like Air Conditioner remotes. +// Air Coniditioner protocols often have a considerable gap (20-40+ms) between +// packets. +// The downside of a large timeout value is a lot of less complex protocols +// send multiple messages when the remote's button is held down. The gap between +// them is often also around 20+ms. This can result in the raw data be 2-3+ +// times larger than needed as it has captured 2-3+ messages in a single +// capture. Setting a low timeout value can resolve this. +// So, choosing the best kTimeout value for your use particular case is +// quite nuanced. Good luck and happy hunting. +// NOTE: Don't exceed kMaxTimeoutMs. Typically 130ms. +#if DECODE_AC +// Some A/C units have gaps in their protocols of ~40ms. e.g. Kelvinator +// A value this large may swallow repeats of some protocols +const uint8_t kTimeout = 50; +#else // DECODE_AC +// Suits most messages, while not swallowing many repeats. +const uint8_t kTimeout = 15; +#endif // DECODE_AC +// Alternatives: +// const uint8_t kTimeout = 90; +// Suits messages with big gaps like XMP-1 & some aircon units, but can +// accidentally swallow repeated messages in the rawData[] output. +// +// const uint8_t kTimeout = kMaxTimeoutMs; +// This will set it to our currently allowed maximum. +// Values this high are problematic because it is roughly the typical boundary +// where most messages repeat. +// e.g. It will stop decoding a message and start sending it to serial at +// precisely the time when the next message is likely to be transmitted, +// and may miss it. + +// Set the smallest sized "UNKNOWN" message packets we actually care about. +// This value helps reduce the false-positive detection rate of IR background +// noise as real messages. The chances of background IR noise getting detected +// as a message increases with the length of the kTimeout value. (See above) +// The downside of setting this message too large is you can miss some valid +// short messages for protocols that this library doesn't yet decode. +// +// Set higher if you get lots of random short UNKNOWN messages when nothing +// should be sending a message. +// Set lower if you are sure your setup is working, but it doesn't see messages +// from your device. (e.g. Other IR remotes work.) +// NOTE: Set this value very high to effectively turn off UNKNOWN detection. +const uint16_t kMinUnknownSize = 12; + +// Legacy (No longer supported!) +// +// Change to `true` if you miss/need the old "Raw Timing[]" display. +#define LEGACY_TIMING_INFO false +// ==================== end of TUNEABLE PARAMETERS ==================== + +// Use turn on the save buffer feature for more complete capture coverage. +IRrecv irrecv(kRecvPin, kCaptureBufferSize, kTimeout, true); +decode_results results; // Somewhere to store the results + +// This section of code runs only once at start-up. +void setup() { + OTAwifi(); // start default wifi (previously saved on the ESP) for OTA +#if defined(ESP8266) + Serial.begin(kBaudRate, SERIAL_8N1, SERIAL_TX_ONLY); +#else // ESP8266 + Serial.begin(kBaudRate, SERIAL_8N1); +#endif // ESP8266 + while (!Serial) // Wait for the serial connection to be establised. + delay(50); + Serial.printf("\n" D_STR_IRRECVDUMP_STARTUP "\n", kRecvPin); + OTAinit(); // setup OTA handlers and show IP +#if DECODE_HASH + // Ignore messages with less than minimum on or off pulses. + irrecv.setUnknownThreshold(kMinUnknownSize); +#endif // DECODE_HASH + irrecv.enableIRIn(); // Start the receiver +} + +// The repeating section of the code +void loop() { + // Check if the IR code has been received. + if (irrecv.decode(&results)) { + // Display a crude timestamp. + uint32_t now = millis(); + Serial.printf(D_STR_TIMESTAMP " : %06u.%03u\n", now / 1000, now % 1000); + // Check if we got an IR message that was to big for our capture buffer. + if (results.overflow) + Serial.printf(D_WARN_BUFFERFULL "\n", kCaptureBufferSize); + // Display the library version the message was captured with. + Serial.println(D_STR_LIBRARY " : v" _IRREMOTEESP8266_VERSION_ "\n"); + // Display the basic output of what we found. + Serial.print(resultToHumanReadableBasic(&results)); + // Display any extra A/C info if we have it. + String description = IRAcUtils::resultAcToString(&results); + if (description.length()) Serial.println(D_STR_MESGDESC ": " + description); + yield(); // Feed the WDT as the text output can take a while to print. +#if LEGACY_TIMING_INFO + // Output legacy RAW timing info of the result. + Serial.println(resultToTimingInfo(&results)); + yield(); // Feed the WDT (again) +#endif // LEGACY_TIMING_INFO + // Output the results as source code + Serial.println(resultToSourceCode(&results)); + Serial.println(); // Blank line between entries + yield(); // Feed the WDT (again) + } + OTAloopHandler(); +} diff --git a/lib/IRremoteESP8266-2.7.7/examples/IRrecvDumpV3/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/IRrecvDumpV3/platformio.ini new file mode 100644 index 000000000..62fa06d3a --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/examples/IRrecvDumpV3/platformio.ini @@ -0,0 +1,52 @@ +[platformio] +src_dir = . + +[env] +; Default platform +platform = espressif8266 +; Default board +board = nodemcuv2 +framework = arduino +lib_extra_dirs = ../../ +lib_ldf_mode = deep+ +lib_ignore = examples +build_flags = ; -D_IR_LOCALE_=en-AU + +[env:nodemcuv2] +board = nodemcuv2 +; build_flags = -D_IR_LOCALE_=en-AU + +[env:esp32dev] +platform = espressif32 +board = esp32dev +; build_flags = -D_IR_LOCALE_=en-AU + +[env:de-CH] +build_flags = -D_IR_LOCALE_=de-CH ; German (Swiss) + +[env:de-DE] +build_flags = -D_IR_LOCALE_=de-DE ; German + +[env:en-AU] +build_flags = -D_IR_LOCALE_=en-AU ; English (Australian) (Default) + +[env:en-IE] +build_flags = -D_IR_LOCALE_=en-IE ; English (Irish) + +[env:en-UK] +build_flags = -D_IR_LOCALE_=en-UK ; English (UK) + +[env:en-US] +build_flags = -D_IR_LOCALE_=en-US ; English (Simplified) (USA) + +[env:es-ES] +build_flags = -D_IR_LOCALE_=es-ES ; Spanish + +[env:fr-FR] +build_flags = -D_IR_LOCALE_=fr-FR ; French + +[env:it-IT] +build_flags = -D_IR_LOCALE_=it-IT ; Italian + +[env:zh-CN] +build_flags = -D_IR_LOCALE_=zh-CN ; Chinese (Simplified) diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRsendDemo/IRsendDemo.ino b/lib/IRremoteESP8266-2.7.7/examples/IRsendDemo/IRsendDemo.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRsendDemo/IRsendDemo.ino rename to lib/IRremoteESP8266-2.7.7/examples/IRsendDemo/IRsendDemo.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRsendDemo/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/IRsendDemo/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRsendDemo/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/IRsendDemo/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRsendProntoDemo/IRsendProntoDemo.ino b/lib/IRremoteESP8266-2.7.7/examples/IRsendProntoDemo/IRsendProntoDemo.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRsendProntoDemo/IRsendProntoDemo.ino rename to lib/IRremoteESP8266-2.7.7/examples/IRsendProntoDemo/IRsendProntoDemo.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/IRsendProntoDemo/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/IRsendProntoDemo/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/IRsendProntoDemo/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/IRsendProntoDemo/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/JVCPanasonicSendDemo/JVCPanasonicSendDemo.ino b/lib/IRremoteESP8266-2.7.7/examples/JVCPanasonicSendDemo/JVCPanasonicSendDemo.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/JVCPanasonicSendDemo/JVCPanasonicSendDemo.ino rename to lib/IRremoteESP8266-2.7.7/examples/JVCPanasonicSendDemo/JVCPanasonicSendDemo.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/JVCPanasonicSendDemo/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/JVCPanasonicSendDemo/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/JVCPanasonicSendDemo/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/JVCPanasonicSendDemo/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/LGACSend/LGACSend.ino b/lib/IRremoteESP8266-2.7.7/examples/LGACSend/LGACSend.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/LGACSend/LGACSend.ino rename to lib/IRremoteESP8266-2.7.7/examples/LGACSend/LGACSend.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/LGACSend/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/LGACSend/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/LGACSend/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/LGACSend/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/SmartIRRepeater/SmartIRRepeater.ino b/lib/IRremoteESP8266-2.7.7/examples/SmartIRRepeater/SmartIRRepeater.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/SmartIRRepeater/SmartIRRepeater.ino rename to lib/IRremoteESP8266-2.7.7/examples/SmartIRRepeater/SmartIRRepeater.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/SmartIRRepeater/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/SmartIRRepeater/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/SmartIRRepeater/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/SmartIRRepeater/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnArgoAC/TurnOnArgoAC.ino b/lib/IRremoteESP8266-2.7.7/examples/TurnOnArgoAC/TurnOnArgoAC.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnArgoAC/TurnOnArgoAC.ino rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnArgoAC/TurnOnArgoAC.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnArgoAC/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/TurnOnArgoAC/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnArgoAC/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnArgoAC/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnDaikinAC/TurnOnDaikinAC.ino b/lib/IRremoteESP8266-2.7.7/examples/TurnOnDaikinAC/TurnOnDaikinAC.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnDaikinAC/TurnOnDaikinAC.ino rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnDaikinAC/TurnOnDaikinAC.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnDaikinAC/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/TurnOnDaikinAC/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnDaikinAC/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnDaikinAC/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnFujitsuAC/TurnOnFujitsuAC.ino b/lib/IRremoteESP8266-2.7.7/examples/TurnOnFujitsuAC/TurnOnFujitsuAC.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnFujitsuAC/TurnOnFujitsuAC.ino rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnFujitsuAC/TurnOnFujitsuAC.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnFujitsuAC/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/TurnOnFujitsuAC/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnFujitsuAC/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnFujitsuAC/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnGreeAC/TurnOnGreeAC.ino b/lib/IRremoteESP8266-2.7.7/examples/TurnOnGreeAC/TurnOnGreeAC.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnGreeAC/TurnOnGreeAC.ino rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnGreeAC/TurnOnGreeAC.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnGreeAC/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/TurnOnGreeAC/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnGreeAC/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnGreeAC/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnKelvinatorAC/TurnOnKelvinatorAC.ino b/lib/IRremoteESP8266-2.7.7/examples/TurnOnKelvinatorAC/TurnOnKelvinatorAC.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnKelvinatorAC/TurnOnKelvinatorAC.ino rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnKelvinatorAC/TurnOnKelvinatorAC.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnKelvinatorAC/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/TurnOnKelvinatorAC/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnKelvinatorAC/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnKelvinatorAC/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnMitsubishiAC/TurnOnMitsubishiAC.ino b/lib/IRremoteESP8266-2.7.7/examples/TurnOnMitsubishiAC/TurnOnMitsubishiAC.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnMitsubishiAC/TurnOnMitsubishiAC.ino rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnMitsubishiAC/TurnOnMitsubishiAC.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnMitsubishiAC/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/TurnOnMitsubishiAC/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnMitsubishiAC/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnMitsubishiAC/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnMitsubishiHeavyAc/TurnOnMitsubishiHeavyAc.ino b/lib/IRremoteESP8266-2.7.7/examples/TurnOnMitsubishiHeavyAc/TurnOnMitsubishiHeavyAc.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnMitsubishiHeavyAc/TurnOnMitsubishiHeavyAc.ino rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnMitsubishiHeavyAc/TurnOnMitsubishiHeavyAc.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnMitsubishiHeavyAc/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/TurnOnMitsubishiHeavyAc/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnMitsubishiHeavyAc/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnMitsubishiHeavyAc/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnPanasonicAC/TurnOnPanasonicAC.ino b/lib/IRremoteESP8266-2.7.7/examples/TurnOnPanasonicAC/TurnOnPanasonicAC.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnPanasonicAC/TurnOnPanasonicAC.ino rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnPanasonicAC/TurnOnPanasonicAC.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnPanasonicAC/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/TurnOnPanasonicAC/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnPanasonicAC/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnPanasonicAC/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnToshibaAC/TurnOnToshibaAC.ino b/lib/IRremoteESP8266-2.7.7/examples/TurnOnToshibaAC/TurnOnToshibaAC.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnToshibaAC/TurnOnToshibaAC.ino rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnToshibaAC/TurnOnToshibaAC.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnToshibaAC/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/TurnOnToshibaAC/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnToshibaAC/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnToshibaAC/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnTrotecAC/TurnOnTrotecAC.ino b/lib/IRremoteESP8266-2.7.7/examples/TurnOnTrotecAC/TurnOnTrotecAC.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnTrotecAC/TurnOnTrotecAC.ino rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnTrotecAC/TurnOnTrotecAC.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/TurnOnTrotecAC/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/TurnOnTrotecAC/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/TurnOnTrotecAC/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/TurnOnTrotecAC/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/README.md b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/README.md similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/README.md rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/README.md diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/Web-AC-control.ino b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/Web-AC-control.ino similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/Web-AC-control.ino rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/Web-AC-control.ino diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/platformio.ini b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/platformio.ini rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/printscreen.png b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/printscreen.png similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/printscreen.png rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/printscreen.png diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/favicon.ico b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/favicon.ico similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/favicon.ico rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/favicon.ico diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_1_off.svg b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_1_off.svg similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_1_off.svg rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_1_off.svg diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_1_on.svg b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_1_on.svg similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_1_on.svg rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_1_on.svg diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_2_off.svg b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_2_off.svg similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_2_off.svg rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_2_off.svg diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_2_on.svg b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_2_on.svg similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_2_on.svg rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_2_on.svg diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_3_off.svg b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_3_off.svg similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_3_off.svg rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_3_off.svg diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_3_on.svg b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_3_on.svg similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_3_on.svg rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_3_on.svg diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_4_off.svg b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_4_off.svg similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_4_off.svg rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_4_off.svg diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_4_on.svg b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_4_on.svg similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/level_4_on.svg rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/level_4_on.svg diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/ui.html b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/ui.html similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/ui.html rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/ui.html diff --git a/lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/ui.js b/lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/ui.js similarity index 100% rename from lib/IRremoteESP8266-2.7.6/examples/Web-AC-control/upload/ui.js rename to lib/IRremoteESP8266-2.7.7/examples/Web-AC-control/upload/ui.js diff --git a/lib/IRremoteESP8266-2.7.6/keywords.txt b/lib/IRremoteESP8266-2.7.7/keywords.txt similarity index 94% rename from lib/IRremoteESP8266-2.7.6/keywords.txt rename to lib/IRremoteESP8266-2.7.7/keywords.txt index 7b9e356af..907cba220 100644 --- a/lib/IRremoteESP8266-2.7.6/keywords.txt +++ b/lib/IRremoteESP8266-2.7.7/keywords.txt @@ -31,6 +31,7 @@ IRDaikin2 KEYWORD1 IRDaikin216 KEYWORD1 IRDaikin64 KEYWORD1 IRDaikinESP KEYWORD1 +IRDelonghiAc KEYWORD1 IRElectraAc KEYWORD1 IRFujitsuAC KEYWORD1 IRGoodweatherAc KEYWORD1 @@ -126,6 +127,7 @@ checkZjsSig KEYWORD2 checkZmsSig KEYWORD2 checksum KEYWORD2 clearOnTimerFlag KEYWORD2 +clearPowerSpecial KEYWORD2 clearSensorTemp KEYWORD2 clearSleepTimerFlag KEYWORD2 cmpStates KEYWORD2 @@ -153,6 +155,8 @@ decodeAmcor KEYWORD2 decodeArgo KEYWORD2 decodeCOOLIX KEYWORD2 decodeCarrierAC KEYWORD2 +decodeCarrierAC40 KEYWORD2 +decodeCarrierAC64 KEYWORD2 decodeDISH KEYWORD2 decodeDaikin KEYWORD2 decodeDaikin128 KEYWORD2 @@ -162,7 +166,9 @@ decodeDaikin176 KEYWORD2 decodeDaikin2 KEYWORD2 decodeDaikin216 KEYWORD2 decodeDaikin64 KEYWORD2 +decodeDelonghiAc KEYWORD2 decodeDenon KEYWORD2 +decodeDoshisha KEYWORD2 decodeElectraAC KEYWORD2 decodeEpson KEYWORD2 decodeFujitsuAC KEYWORD2 @@ -191,6 +197,7 @@ decodeMitsubishi136 KEYWORD2 decodeMitsubishi2 KEYWORD2 decodeMitsubishiAC KEYWORD2 decodeMitsubishiHeavy KEYWORD2 +decodeMultibrackets KEYWORD2 decodeNEC KEYWORD2 decodeNeoclima KEYWORD2 decodeNikai KEYWORD2 @@ -217,6 +224,7 @@ decodeVestelAc KEYWORD2 decodeWhirlpoolAC KEYWORD2 decodeWhynter KEYWORD2 defaultBits KEYWORD2 +delonghiac KEYWORD2 disableIRIn KEYWORD2 disableOffTimer KEYWORD2 disableOnTimer KEYWORD2 @@ -229,6 +237,7 @@ enableOffTimer KEYWORD2 enableOnTimer KEYWORD2 enableSleepTimer KEYWORD2 enableTimer KEYWORD2 +encodeDoshisha KEYWORD2 encodeJVC KEYWORD2 encodeLG KEYWORD2 encodeMagiQuest KEYWORD2 @@ -252,6 +261,7 @@ get3D KEYWORD2 get8CHeat KEYWORD2 getBeep KEYWORD2 getBit KEYWORD2 +getBoost KEYWORD2 getBreeze KEYWORD2 getBufSize KEYWORD2 getButton KEYWORD2 @@ -265,7 +275,9 @@ getCurrTime KEYWORD2 getCurrentDay KEYWORD2 getCurrentTime KEYWORD2 getDisplay KEYWORD2 +getDisplayTempSource KEYWORD2 getEcono KEYWORD2 +getEconoToggle KEYWORD2 getEye KEYWORD2 getEyeAuto KEYWORD2 getFan KEYWORD2 @@ -299,9 +311,9 @@ getOnTimer KEYWORD2 getOnTimerEnabled KEYWORD2 getOutsideQuiet KEYWORD2 getPower KEYWORD2 +getPowerSpecial KEYWORD2 getPowerToggle KEYWORD2 getPowerful KEYWORD2 -getPreviousPower KEYWORD2 getPurify KEYWORD2 getQuiet KEYWORD2 getRClevel KEYWORD2 @@ -314,6 +326,7 @@ getSilent KEYWORD2 getSleep KEYWORD2 getSleepTime KEYWORD2 getSleepTimerEnabled KEYWORD2 +getSpecial KEYWORD2 getSpeed KEYWORD2 getStartClock KEYWORD2 getStateLength KEYWORD2 @@ -331,12 +344,16 @@ getSwingVerticalPosition KEYWORD2 getTemp KEYWORD2 getTempOffset KEYWORD2 getTempRaw KEYWORD2 +getTempUnit KEYWORD2 getTime KEYWORD2 getTimer KEYWORD2 getTimerEnabled KEYWORD2 +getTimerTime KEYWORD2 +getTimerType KEYWORD2 getTolerance KEYWORD2 getTurbo KEYWORD2 getUseCelsius KEYWORD2 +getUseFahrenheit KEYWORD2 getVane KEYWORD2 getWeeklyTimerEnable KEYWORD2 getWiFi KEYWORD2 @@ -362,6 +379,7 @@ isOffTimerActive KEYWORD2 isOffTimerEnabled KEYWORD2 isOnTimerActive KEYWORD2 isOnTimerEnabled KEYWORD2 +isPowerSpecial KEYWORD2 isProtocolSupported KEYWORD2 isSpecialState KEYWORD2 isSwingVToggle KEYWORD2 @@ -380,6 +398,7 @@ matchAtLeast KEYWORD2 matchBytes KEYWORD2 matchData KEYWORD2 matchGeneric KEYWORD2 +matchGenericConstBitTime KEYWORD2 matchManchester KEYWORD2 matchMark KEYWORD2 matchSpace KEYWORD2 @@ -417,6 +436,8 @@ sendAmcor KEYWORD2 sendArgo KEYWORD2 sendCOOLIX KEYWORD2 sendCarrierAC KEYWORD2 +sendCarrierAC40 KEYWORD2 +sendCarrierAC64 KEYWORD2 sendDISH KEYWORD2 sendDaikin KEYWORD2 sendDaikin128 KEYWORD2 @@ -427,7 +448,9 @@ sendDaikin2 KEYWORD2 sendDaikin216 KEYWORD2 sendDaikin64 KEYWORD2 sendData KEYWORD2 +sendDelonghiAc KEYWORD2 sendDenon KEYWORD2 +sendDoshisha KEYWORD2 sendElectraAC KEYWORD2 sendEpson KEYWORD2 sendExtended KEYWORD2 @@ -464,6 +487,7 @@ sendMitsubishi2 KEYWORD2 sendMitsubishiAC KEYWORD2 sendMitsubishiHeavy152 KEYWORD2 sendMitsubishiHeavy88 KEYWORD2 +sendMultibrackets KEYWORD2 sendNEC KEYWORD2 sendNeoclima KEYWORD2 sendNikai KEYWORD2 @@ -503,6 +527,7 @@ setAuto KEYWORD2 setBeep KEYWORD2 setBit KEYWORD2 setBits KEYWORD2 +setBoost KEYWORD2 setBreeze KEYWORD2 setButton KEYWORD2 setClean KEYWORD2 @@ -514,7 +539,9 @@ setCurrTime KEYWORD2 setCurrentDay KEYWORD2 setCurrentTime KEYWORD2 setDisplay KEYWORD2 +setDisplayTempSource KEYWORD2 setEcono KEYWORD2 +setEconoToggle KEYWORD2 setEye KEYWORD2 setEyeAuto KEYWORD2 setFan KEYWORD2 @@ -552,9 +579,9 @@ setOnTimerActive KEYWORD2 setOnTimerEnabled KEYWORD2 setOutsideQuiet KEYWORD2 setPower KEYWORD2 +setPowerSpecial KEYWORD2 setPowerToggle KEYWORD2 setPowerful KEYWORD2 -setPreviousPower KEYWORD2 setPurify KEYWORD2 setQuiet KEYWORD2 setRaw KEYWORD2 @@ -565,6 +592,7 @@ setSensorTemp KEYWORD2 setSensorTempRaw KEYWORD2 setSilent KEYWORD2 setSleep KEYWORD2 +setSpecial KEYWORD2 setSpeed KEYWORD2 setStartClock KEYWORD2 setStopClock KEYWORD2 @@ -578,6 +606,7 @@ setSwingVToggle KEYWORD2 setSwingVertical KEYWORD2 setTemp KEYWORD2 setTempRaw KEYWORD2 +setTempUnit KEYWORD2 setTime KEYWORD2 setTimer KEYWORD2 setTimerActive KEYWORD2 @@ -586,6 +615,7 @@ setTolerance KEYWORD2 setTurbo KEYWORD2 setUnknownThreshold KEYWORD2 setUseCelsius KEYWORD2 +setUseFahrenheit KEYWORD2 setVane KEYWORD2 setWeeklyTimerEnable KEYWORD2 setWiFi KEYWORD2 @@ -666,6 +696,8 @@ ARRAH2E LITERAL1 ARREB1E LITERAL1 ARRY4 LITERAL1 CARRIER_AC LITERAL1 +CARRIER_AC40 LITERAL1 +CARRIER_AC64 LITERAL1 CARRIER_AC_BITS LITERAL1 COOLIX LITERAL1 COOLIX_BITS LITERAL1 @@ -695,6 +727,8 @@ DECODE_AIWA_RC_T501 LITERAL1 DECODE_AMCOR LITERAL1 DECODE_ARGO LITERAL1 DECODE_CARRIER_AC LITERAL1 +DECODE_CARRIER_AC40 LITERAL1 +DECODE_CARRIER_AC64 LITERAL1 DECODE_COOLIX LITERAL1 DECODE_DAIKIN LITERAL1 DECODE_DAIKIN128 LITERAL1 @@ -704,8 +738,10 @@ DECODE_DAIKIN176 LITERAL1 DECODE_DAIKIN2 LITERAL1 DECODE_DAIKIN216 LITERAL1 DECODE_DAIKIN64 LITERAL1 +DECODE_DELONGHI_AC LITERAL1 DECODE_DENON LITERAL1 DECODE_DISH LITERAL1 +DECODE_DOSHISHA LITERAL1 DECODE_ELECTRA_AC LITERAL1 DECODE_EPSON LITERAL1 DECODE_FUJITSU_AC LITERAL1 @@ -736,6 +772,7 @@ DECODE_MITSUBISHI136 LITERAL1 DECODE_MITSUBISHI2 LITERAL1 DECODE_MITSUBISHIHEAVY LITERAL1 DECODE_MITSUBISHI_AC LITERAL1 +DECODE_MULTIBRACKETS LITERAL1 DECODE_MWM LITERAL1 DECODE_NEC LITERAL1 DECODE_NEOCLIMA LITERAL1 @@ -763,6 +800,7 @@ DECODE_TROTEC LITERAL1 DECODE_VESTEL_AC LITERAL1 DECODE_WHIRLPOOL_AC LITERAL1 DECODE_WHYNTER LITERAL1 +DELONGHI_AC LITERAL1 DENON LITERAL1 DENON_48_BITS LITERAL1 DENON_BITS LITERAL1 @@ -771,6 +809,7 @@ DG11J13A LITERAL1 DG11J191 LITERAL1 DISH LITERAL1 DISH_BITS LITERAL1 +DOSHISHA LITERAL1 ELECTRA_AC LITERAL1 ENABLE_NOISE_FILTER_OPTION LITERAL1 EPSON LITERAL1 @@ -963,6 +1002,7 @@ MITSUBISHI_AC_VANE_AUTO_MOVE LITERAL1 MITSUBISHI_BITS LITERAL1 MITSUBISHI_HEAVY_152 LITERAL1 MITSUBISHI_HEAVY_88 LITERAL1 +MULTIBRACKETS LITERAL1 MWM LITERAL1 NEC LITERAL1 NEC_BITS LITERAL1 @@ -1003,6 +1043,8 @@ SEND_AIWA_RC_T501 LITERAL1 SEND_AMCOR LITERAL1 SEND_ARGO LITERAL1 SEND_CARRIER_AC LITERAL1 +SEND_CARRIER_AC40 LITERAL1 +SEND_CARRIER_AC64 LITERAL1 SEND_COOLIX LITERAL1 SEND_DAIKIN LITERAL1 SEND_DAIKIN128 LITERAL1 @@ -1012,8 +1054,10 @@ SEND_DAIKIN176 LITERAL1 SEND_DAIKIN2 LITERAL1 SEND_DAIKIN216 LITERAL1 SEND_DAIKIN64 LITERAL1 +SEND_DELONGHI_AC LITERAL1 SEND_DENON LITERAL1 SEND_DISH LITERAL1 +SEND_DOSHISHA LITERAL1 SEND_ELECTRA_AC LITERAL1 SEND_EPSON LITERAL1 SEND_FUJITSU_AC LITERAL1 @@ -1043,6 +1087,7 @@ SEND_MITSUBISHI136 LITERAL1 SEND_MITSUBISHI2 LITERAL1 SEND_MITSUBISHIHEAVY LITERAL1 SEND_MITSUBISHI_AC LITERAL1 +SEND_MULTIBRACKETS LITERAL1 SEND_MWM LITERAL1 SEND_NEC LITERAL1 SEND_NEOCLIMA LITERAL1 @@ -1252,8 +1297,24 @@ kBottomStr LITERAL1 kBreezeStr LITERAL1 kButtonStr LITERAL1 kCancelStr LITERAL1 +kCarrierAc40BitMark LITERAL1 +kCarrierAc40Bits LITERAL1 +kCarrierAc40HdrMark LITERAL1 +kCarrierAc40HdrSpace LITERAL1 +kCarrierAc40MinRepeat LITERAL1 +kCarrierAc40OneSpace LITERAL1 +kCarrierAc40ZeroSpace LITERAL1 +kCarrierAc64BitMark LITERAL1 +kCarrierAc64Bits LITERAL1 +kCarrierAc64Gap LITERAL1 +kCarrierAc64HdrMark LITERAL1 +kCarrierAc64HdrSpace LITERAL1 +kCarrierAc64MinRepeat LITERAL1 +kCarrierAc64OneSpace LITERAL1 +kCarrierAc64ZeroSpace LITERAL1 kCarrierAcBitMark LITERAL1 kCarrierAcBits LITERAL1 +kCarrierAcFreq LITERAL1 kCarrierAcGap LITERAL1 kCarrierAcHdrMark LITERAL1 kCarrierAcHdrSpace LITERAL1 @@ -1596,6 +1657,7 @@ kDaikin64SleepBit LITERAL1 kDaikin64SwingVBit LITERAL1 kDaikin64TempOffset LITERAL1 kDaikin64TempSize LITERAL1 +kDaikin64ToleranceDelta LITERAL1 kDaikin64ZeroSpace LITERAL1 kDaikinAuto LITERAL1 kDaikinBeepLoud LITERAL1 @@ -1701,6 +1763,51 @@ kDayStr LITERAL1 kDaysStr LITERAL1 kDefaultESP32Timer LITERAL1 kDefaultMessageGap LITERAL1 +kDelonghiAcAuto LITERAL1 +kDelonghiAcBitMark LITERAL1 +kDelonghiAcBits LITERAL1 +kDelonghiAcBoostBit LITERAL1 +kDelonghiAcChecksumOffset LITERAL1 +kDelonghiAcChecksumSize LITERAL1 +kDelonghiAcCool LITERAL1 +kDelonghiAcDefaultRepeat LITERAL1 +kDelonghiAcDry LITERAL1 +kDelonghiAcFan LITERAL1 +kDelonghiAcFanAuto LITERAL1 +kDelonghiAcFanHigh LITERAL1 +kDelonghiAcFanLow LITERAL1 +kDelonghiAcFanMedium LITERAL1 +kDelonghiAcFanOffset LITERAL1 +kDelonghiAcFanSize LITERAL1 +kDelonghiAcFreq LITERAL1 +kDelonghiAcGap LITERAL1 +kDelonghiAcHdrMark LITERAL1 +kDelonghiAcHdrSpace LITERAL1 +kDelonghiAcHoursSize LITERAL1 +kDelonghiAcMinsSize LITERAL1 +kDelonghiAcModeOffset LITERAL1 +kDelonghiAcModeSize LITERAL1 +kDelonghiAcOffTimerEnableBit LITERAL1 +kDelonghiAcOffTimerHoursOffset LITERAL1 +kDelonghiAcOffTimerMinsOffset LITERAL1 +kDelonghiAcOnTimerEnableBit LITERAL1 +kDelonghiAcOnTimerHoursOffset LITERAL1 +kDelonghiAcOnTimerMinsOffset LITERAL1 +kDelonghiAcOneSpace LITERAL1 +kDelonghiAcOverhead LITERAL1 +kDelonghiAcPowerBit LITERAL1 +kDelonghiAcSleepBit LITERAL1 +kDelonghiAcTempAutoDryMode LITERAL1 +kDelonghiAcTempFanMode LITERAL1 +kDelonghiAcTempMaxC LITERAL1 +kDelonghiAcTempMaxF LITERAL1 +kDelonghiAcTempMinC LITERAL1 +kDelonghiAcTempMinF LITERAL1 +kDelonghiAcTempOffset LITERAL1 +kDelonghiAcTempSize LITERAL1 +kDelonghiAcTempUnitBit LITERAL1 +kDelonghiAcTimerMax LITERAL1 +kDelonghiAcZeroSpace LITERAL1 kDenon48Bits LITERAL1 kDenonBitMark LITERAL1 kDenonBitMarkTicks LITERAL1 @@ -1734,6 +1841,15 @@ kDishRptSpaceTicks LITERAL1 kDishTick LITERAL1 kDishZeroSpace LITERAL1 kDishZeroSpaceTicks LITERAL1 +kDisplayTempStr LITERAL1 +kDoshishaBitMark LITERAL1 +kDoshishaBits LITERAL1 +kDoshishaFreq LITERAL1 +kDoshishaHdrMark LITERAL1 +kDoshishaHdrSpace LITERAL1 +kDoshishaOneSpace LITERAL1 +kDoshishaOverhead LITERAL1 +kDoshishaZeroSpace LITERAL1 kDownStr LITERAL1 kDry LITERAL1 kDryStr LITERAL1 @@ -1909,6 +2025,12 @@ kGreeBlockFooter LITERAL1 kGreeBlockFooterBits LITERAL1 kGreeCool LITERAL1 kGreeDefaultRepeat LITERAL1 +kGreeDisplayTempInside LITERAL1 +kGreeDisplayTempOff LITERAL1 +kGreeDisplayTempOffset LITERAL1 +kGreeDisplayTempOutside LITERAL1 +kGreeDisplayTempSet LITERAL1 +kGreeDisplayTempSize LITERAL1 kGreeDry LITERAL1 kGreeFan LITERAL1 kGreeFanAuto LITERAL1 @@ -1922,8 +2044,10 @@ kGreeHdrSpace LITERAL1 kGreeHeat LITERAL1 kGreeIFeelOffset LITERAL1 kGreeLightOffset LITERAL1 -kGreeMaxTemp LITERAL1 -kGreeMinTemp LITERAL1 +kGreeMaxTempC LITERAL1 +kGreeMaxTempF LITERAL1 +kGreeMinTempC LITERAL1 +kGreeMinTempF LITERAL1 kGreeMsgSpace LITERAL1 kGreeOneSpace LITERAL1 kGreePower1Offset LITERAL1 @@ -1942,6 +2066,8 @@ kGreeSwingMiddleUp LITERAL1 kGreeSwingSize LITERAL1 kGreeSwingUp LITERAL1 kGreeSwingUpAuto LITERAL1 +kGreeTempExtraDegreeFOffset LITERAL1 +kGreeTempOffset LITERAL1 kGreeTempSize LITERAL1 kGreeTimerEnabledOffset LITERAL1 kGreeTimerHalfHrOffset LITERAL1 @@ -1951,6 +2077,7 @@ kGreeTimerMax LITERAL1 kGreeTimerTensHrOffset LITERAL1 kGreeTimerTensHrSize LITERAL1 kGreeTurboOffset LITERAL1 +kGreeUseFahrenheitOffset LITERAL1 kGreeWiFiOffset LITERAL1 kGreeXfanOffset LITERAL1 kGreeZeroSpace LITERAL1 @@ -2191,6 +2318,7 @@ kInaxMinRepeat LITERAL1 kInaxOneSpace LITERAL1 kInaxTick LITERAL1 kInaxZeroSpace LITERAL1 +kInsideStr LITERAL1 kIonStr LITERAL1 kJvcBitMark LITERAL1 kJvcBitMarkTicks LITERAL1 @@ -2661,6 +2789,13 @@ kModeStr LITERAL1 kModelStr LITERAL1 kMouldStr LITERAL1 kMoveStr LITERAL1 +kMultibracketsBits LITERAL1 +kMultibracketsDefaultRepeat LITERAL1 +kMultibracketsFooterSpace LITERAL1 +kMultibracketsFreq LITERAL1 +kMultibracketsHdrMark LITERAL1 +kMultibracketsTick LITERAL1 +kMultibracketsTolerance LITERAL1 kNAStr LITERAL1 kNECBits LITERAL1 kNecBitMark LITERAL1 @@ -2917,6 +3052,22 @@ kRcmmRptLength LITERAL1 kRcmmRptLengthTicks LITERAL1 kRcmmTick LITERAL1 kRcmmTolerance LITERAL1 +kRcz01ChannelMask LITERAL1 +kRcz01CheckExpected LITERAL1 +kRcz01CheckMask LITERAL1 +kRcz01CommandLevel1 LITERAL1 +kRcz01CommandLevel2 LITERAL1 +kRcz01CommandLevel3 LITERAL1 +kRcz01CommandLevel4 LITERAL1 +kRcz01CommandLevelDown LITERAL1 +kRcz01CommandLevelUp LITERAL1 +kRcz01CommandMask LITERAL1 +kRcz01CommandNightLight LITERAL1 +kRcz01CommandOff LITERAL1 +kRcz01CommandOn LITERAL1 +kRcz01CommandSwitchChannel LITERAL1 +kRcz01CommandTimmer30 LITERAL1 +kRcz01CommandTimmer60 LITERAL1 kRepeat LITERAL1 kRepeatStr LITERAL1 kRight LITERAL1 @@ -3023,20 +3174,21 @@ kSensorStr LITERAL1 kSensorTempStr LITERAL1 kSetStr LITERAL1 kSharpAcAuto LITERAL1 +kSharpAcBitCleanOffset LITERAL1 +kSharpAcBitIonOffset LITERAL1 kSharpAcBitMark LITERAL1 -kSharpAcBitPowerOffset LITERAL1 -kSharpAcBitPreviousPowerOffset LITERAL1 +kSharpAcBitTimerEnabled LITERAL1 +kSharpAcBitTimerType LITERAL1 kSharpAcBits LITERAL1 -kSharpAcButtonFan LITERAL1 -kSharpAcButtonOffset LITERAL1 -kSharpAcButtonPowerMode LITERAL1 -kSharpAcButtonSize LITERAL1 -kSharpAcButtonTemp LITERAL1 -kSharpAcByteButton LITERAL1 +kSharpAcByteClean LITERAL1 kSharpAcByteFan LITERAL1 +kSharpAcByteIon LITERAL1 kSharpAcByteMode LITERAL1 -kSharpAcBytePower LITERAL1 +kSharpAcBytePowerSpecial LITERAL1 +kSharpAcByteSpecial LITERAL1 +kSharpAcByteSwing LITERAL1 kSharpAcByteTemp LITERAL1 +kSharpAcByteTimer LITERAL1 kSharpAcCool LITERAL1 kSharpAcDefaultRepeat LITERAL1 kSharpAcDry LITERAL1 @@ -3054,8 +3206,35 @@ kSharpAcHeat LITERAL1 kSharpAcMaxTemp LITERAL1 kSharpAcMinTemp LITERAL1 kSharpAcModeSize LITERAL1 +kSharpAcOffTimerType LITERAL1 +kSharpAcOnTimerType LITERAL1 kSharpAcOneSpace LITERAL1 +kSharpAcPowerOff LITERAL1 +kSharpAcPowerOn LITERAL1 +kSharpAcPowerOnFromOff LITERAL1 +kSharpAcPowerSetSpecialOff LITERAL1 +kSharpAcPowerSetSpecialOffset LITERAL1 +kSharpAcPowerSetSpecialOn LITERAL1 +kSharpAcPowerSpecialSize LITERAL1 +kSharpAcPowerTimerSetting LITERAL1 +kSharpAcPowerUnknown LITERAL1 +kSharpAcSpecialFan LITERAL1 +kSharpAcSpecialPower LITERAL1 +kSharpAcSpecialSwing LITERAL1 +kSharpAcSpecialTempEcono LITERAL1 +kSharpAcSpecialTimer LITERAL1 +kSharpAcSpecialTimerHalfHour LITERAL1 +kSharpAcSpecialTurbo LITERAL1 kSharpAcStateLength LITERAL1 +kSharpAcSwingNoToggle LITERAL1 +kSharpAcSwingOffset LITERAL1 +kSharpAcSwingSize LITERAL1 +kSharpAcSwingToggle LITERAL1 +kSharpAcTimerHoursMax LITERAL1 +kSharpAcTimerHoursOff LITERAL1 +kSharpAcTimerHoursOffset LITERAL1 +kSharpAcTimerHoursSize LITERAL1 +kSharpAcTimerIncrement LITERAL1 kSharpAcZeroSpace LITERAL1 kSharpAddressBits LITERAL1 kSharpAddressMask LITERAL1 @@ -3117,7 +3296,6 @@ kSwingVToggleStr LITERAL1 kSymphonyBits LITERAL1 kSymphonyDefaultRepeat LITERAL1 kSymphonyFooterGap LITERAL1 -kSymphonyFooterMark LITERAL1 kSymphonyOneMark LITERAL1 kSymphonyOneSpace LITERAL1 kSymphonyZeroMark LITERAL1 diff --git a/lib/IRremoteESP8266-2.7.6/library.json b/lib/IRremoteESP8266-2.7.7/library.json similarity index 88% rename from lib/IRremoteESP8266-2.7.6/library.json rename to lib/IRremoteESP8266-2.7.7/library.json index c2780ac6c..abf2f8070 100644 --- a/lib/IRremoteESP8266-2.7.6/library.json +++ b/lib/IRremoteESP8266-2.7.7/library.json @@ -1,6 +1,6 @@ { "name": "IRremoteESP8266", - "version": "2.7.6", + "version": "2.7.7", "keywords": "infrared, ir, remote, esp8266, esp32", "description": "Send and receive infrared signals with multiple protocols (ESP8266/ESP32)", "repository": @@ -37,6 +37,11 @@ "name": "Massimiliano Pinto", "url": "https://github.com/pintomax/", "maintainer": true + }, + { + "name": "Christian Nilsson", + "url": "https://github.com/NiKiZe", + "maintainer": true } ], "frameworks": "arduino", diff --git a/lib/IRremoteESP8266-2.7.6/library.properties b/lib/IRremoteESP8266-2.7.7/library.properties similarity index 89% rename from lib/IRremoteESP8266-2.7.6/library.properties rename to lib/IRremoteESP8266-2.7.7/library.properties index b67edbce0..16c4f3bc6 100644 --- a/lib/IRremoteESP8266-2.7.6/library.properties +++ b/lib/IRremoteESP8266-2.7.7/library.properties @@ -1,7 +1,7 @@ name=IRremoteESP8266 -version=2.7.6 +version=2.7.7 author=David Conran, Sebastien Warin, Mark Szabo, Ken Shirriff -maintainer=David Conran, Mark Szabo, Sebastien Warin, Roi Dayan, Massimiliano Pinto +maintainer=David Conran, Mark Szabo, Sebastien Warin, Roi Dayan, Massimiliano Pinto, Christian Nilsson sentence=Send and receive infrared signals with multiple protocols (ESP8266/ESP32) paragraph=This library enables you to send and receive infra-red signals on an ESP8266 or an ESP32. category=Device Control diff --git a/lib/IRremoteESP8266-2.7.6/platformio.ini b/lib/IRremoteESP8266-2.7.7/platformio.ini similarity index 100% rename from lib/IRremoteESP8266-2.7.6/platformio.ini rename to lib/IRremoteESP8266-2.7.7/platformio.ini diff --git a/lib/IRremoteESP8266-2.7.6/pylintrc b/lib/IRremoteESP8266-2.7.7/pylintrc similarity index 100% rename from lib/IRremoteESP8266-2.7.6/pylintrc rename to lib/IRremoteESP8266-2.7.7/pylintrc diff --git a/lib/IRremoteESP8266-2.7.6/src/CPPLINT.cfg b/lib/IRremoteESP8266-2.7.7/src/CPPLINT.cfg similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/CPPLINT.cfg rename to lib/IRremoteESP8266-2.7.7/src/CPPLINT.cfg diff --git a/lib/IRremoteESP8266-2.7.6/src/IRac.cpp b/lib/IRremoteESP8266-2.7.7/src/IRac.cpp similarity index 97% rename from lib/IRremoteESP8266-2.7.6/src/IRac.cpp rename to lib/IRremoteESP8266-2.7.7/src/IRac.cpp index abf450df9..3e56b0a46 100644 --- a/lib/IRremoteESP8266-2.7.6/src/IRac.cpp +++ b/lib/IRremoteESP8266-2.7.7/src/IRac.cpp @@ -126,6 +126,9 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) { #if SEND_DAIKIN64 case decode_type_t::DAIKIN64: #endif +#if SEND_DELONGHI_AC + case decode_type_t::DELONGHI_AC: +#endif #if SEND_ELECTRA_AC case decode_type_t::ELECTRA_AC: #endif @@ -488,6 +491,22 @@ void IRac::daikin64(IRDaikin64 *ac, } #endif // SEND_DAIKIN64 +#if SEND_DELONGHI_AC +void IRac::delonghiac(IRDelonghiAc *ac, + const bool on, const stdAc::opmode_t mode, const bool celsius, + const float degrees, const stdAc::fanspeed_t fan, + const bool turbo, const int16_t sleep) { + ac->begin(); + ac->setPower(on); + ac->setMode(ac->convertMode(mode)); + ac->setTemp(degrees, !celsius); + ac->setFan(ac->convertFan(fan)); + ac->setBoost(turbo); + ac->setSleep(sleep >= 0); + ac->send(); +} +#endif // SEND_DELONGHI_AC + #if SEND_ELECTRA_AC void IRac::electra(IRElectraAc *ac, const bool on, const stdAc::opmode_t mode, @@ -600,15 +619,15 @@ void IRac::goodweather(IRGoodweatherAc *ac, #if SEND_GREE void IRac::gree(IRGreeAC *ac, const gree_ac_remote_model_t model, - const bool on, const stdAc::opmode_t mode, const float degrees, - const stdAc::fanspeed_t fan, const stdAc::swingv_t swingv, - const bool turbo, const bool light, const bool clean, - const int16_t sleep) { + const bool on, const stdAc::opmode_t mode, const bool celsius, + const float degrees, const stdAc::fanspeed_t fan, + const stdAc::swingv_t swingv, const bool turbo, + const bool light, const bool clean, const int16_t sleep) { ac->begin(); ac->setModel(model); ac->setPower(on); ac->setMode(ac->convertMode(mode)); - ac->setTemp(degrees); + ac->setTemp(degrees, !celsius); ac->setFan(ac->convertFan(fan)); ac->setSwingVertical(swingv == stdAc::swingv_t::kAuto, // Set auto flag. ac->convertSwingV(swingv)); @@ -1059,25 +1078,38 @@ void IRac::samsung(IRSamsungAc *ac, void IRac::sharp(IRSharpAc *ac, const bool on, const bool prev_power, const stdAc::opmode_t mode, - const float degrees, const stdAc::fanspeed_t fan) { + const float degrees, const stdAc::fanspeed_t fan, + const stdAc::swingv_t swingv, const bool turbo, + const bool filter, const bool clean) { ac->begin(); ac->setPower(on, prev_power); ac->setMode(ac->convertMode(mode)); ac->setTemp(degrees); ac->setFan(ac->convertFan(fan)); - // No Vertical swing setting available. + ac->setSwingToggle(swingv != stdAc::swingv_t::kOff); + // Econo deliberately not used as it cycles through 3 modes uncontrolably. + // ac->setEconoToggle(econo); + ac->setIon(filter); // No Horizontal swing setting available. // No Quiet setting available. - // No Turbo setting available. // No Light setting available. - // No Econo setting available. - // No Filter setting available. - // No Clean setting available. // No Beep setting available. // No Sleep setting available. // No Clock setting available. // Do setMode() again as it can affect fan speed and temp. ac->setMode(ac->convertMode(mode)); + // Clean after mode, as it can affect the mode, temp & fan speed. + if (clean) { + // A/C needs to be off before we can enter clean mode. + ac->setPower(false, prev_power); + ac->send(); + } + ac->setClean(clean); + if (turbo) { + ac->send(); // Send the current state. + // Set up turbo mode as it needs to be sent after everything else. + ac->setTurbo(true); + } ac->send(); } #endif // SEND_SHARP_AC @@ -1284,8 +1316,9 @@ stdAc::state_t IRac::handleToggles(const stdAc::state_t desired, case decode_type_t::ELECTRA_AC: result.light = desired.light ^ prev->light; break; - case decode_type_t::MIDEA: case decode_type_t::HITACHI_AC424: + case decode_type_t::MIDEA: + case decode_type_t::SHARP_AC: if ((desired.swingv == stdAc::swingv_t::kOff) ^ (prev->swingv == stdAc::swingv_t::kOff)) // It changed, so toggle. result.swingv = stdAc::swingv_t::kAuto; @@ -1459,6 +1492,15 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) { break; } #endif // SEND_DAIKIN64 +#if SEND_DELONGHI_AC + case DELONGHI_AC: + { + IRDelonghiAc ac(_pin, _inverted, _modulation); + delonghiac(&ac, send.power, send.mode, send.celsius, degC, send.fanspeed, + send.turbo, send.sleep); + break; + } +#endif // SEND_DELONGHI_AC #if SEND_ELECTRA_AC case ELECTRA_AC: { @@ -1493,9 +1535,9 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) { { IRGreeAC ac(_pin, (gree_ac_remote_model_t)send.model, _inverted, _modulation); - gree(&ac, (gree_ac_remote_model_t)send.model, send.power, send.mode, degC, - send.fanspeed, send.swingv, send.turbo, send.light, send.clean, - send.sleep); + gree(&ac, (gree_ac_remote_model_t)send.model, send.power, send.mode, + send.celsius, send.degrees, send.fanspeed, send.swingv, send.turbo, + send.light, send.clean, send.sleep); break; } #endif // SEND_GREE @@ -1660,7 +1702,8 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) { IRSharpAc ac(_pin, _inverted, _modulation); bool prev_power = !send.power; if (prev != NULL) prev_power = prev->power; - sharp(&ac, send.power, prev_power, send.mode, degC, send.fanspeed); + sharp(&ac, send.power, prev_power, send.mode, degC, send.fanspeed, + send.swingv, send.turbo, send.filter, send.clean); break; } #endif // SEND_SHARP_AC @@ -2107,7 +2150,14 @@ namespace IRAcUtils { ac.setRaw(result->value); // Daikin64 uses value instead of state. return ac.toString(); } -#endif // DECODE_DAIKIN216 +#endif // DECODE_DAIKIN64 +#if DECODE_DELONGHI_AC + case decode_type_t::DELONGHI_AC: { + IRDelonghiAc ac(kGpioUnused); + ac.setRaw(result->value); // DelonghiAc uses value instead of state. + return ac.toString(); + } +#endif // DECODE_DELONGHI_AC #if DECODE_ELECTRA_AC case decode_type_t::ELECTRA_AC: { IRElectraAc ac(0); @@ -2420,6 +2470,14 @@ namespace IRAcUtils { break; } #endif // DECODE_DAIKIN64 +#if DECODE_DELONGHI_AC + case decode_type_t::DELONGHI_AC: { + IRDelonghiAc ac(kGpioUnused); + ac.setRaw(decode->value); // Uses value instead of state. + *result = ac.toCommon(); + break; + } +#endif // DECODE_DELONGHI_AC #if DECODE_ELECTRA_AC case decode_type_t::ELECTRA_AC: { IRElectraAc ac(kGpioUnused); diff --git a/lib/IRremoteESP8266-2.7.6/src/IRac.h b/lib/IRremoteESP8266-2.7.7/src/IRac.h similarity index 95% rename from lib/IRremoteESP8266-2.7.6/src/IRac.h rename to lib/IRremoteESP8266-2.7.7/src/IRac.h index 02faba36a..42c59321c 100644 --- a/lib/IRremoteESP8266-2.7.6/src/IRac.h +++ b/lib/IRremoteESP8266-2.7.7/src/IRac.h @@ -11,6 +11,7 @@ #include "ir_Argo.h" #include "ir_Coolix.h" #include "ir_Daikin.h" +#include "ir_Delonghi.h" #include "ir_Fujitsu.h" #include "ir_Electra.h" #include "ir_Goodweather.h" @@ -174,6 +175,12 @@ void daikin216(IRDaikin216 *ac, const bool quiet, const bool turbo, const int16_t sleep = -1, const int16_t clock = -1); #endif // SEND_DAIKIN64 +#if SEND_DELONGHI_AC + void delonghiac(IRDelonghiAc *ac, + const bool on, const stdAc::opmode_t mode, const bool celsius, + const float degrees, const stdAc::fanspeed_t fan, + const bool turbo, const int16_t sleep = -1); +#endif // SEND_DELONGHI_AC #if SEND_ELECTRA_AC void electra(IRElectraAc *ac, const bool on, const stdAc::opmode_t mode, @@ -201,10 +208,10 @@ void electra(IRElectraAc *ac, #endif // SEND_GOODWEATHER #if SEND_GREE void gree(IRGreeAC *ac, const gree_ac_remote_model_t model, - const bool on, const stdAc::opmode_t mode, const float degrees, - const stdAc::fanspeed_t fan, const stdAc::swingv_t swingv, - const bool turbo, const bool light, const bool clean, - const int16_t sleep = -1); + const bool on, const stdAc::opmode_t mode, const bool celsius, + const float degrees, const stdAc::fanspeed_t fan, + const stdAc::swingv_t swingv, const bool turbo, const bool light, + const bool clean, const int16_t sleep = -1); #endif // SEND_GREE #if SEND_HAIER_AC void haier(IRHaierAC *ac, @@ -325,7 +332,9 @@ void electra(IRElectraAc *ac, #if SEND_SHARP_AC void sharp(IRSharpAc *ac, const bool on, const bool prev_power, const stdAc::opmode_t mode, - const float degrees, const stdAc::fanspeed_t fan); + const float degrees, const stdAc::fanspeed_t fan, + const stdAc::swingv_t swingv, const bool turbo, const bool filter, + const bool clean); #endif // SEND_SHARP_AC #if SEND_TCL112AC void tcl112(IRTcl112Ac *ac, diff --git a/lib/IRremoteESP8266-2.7.6/src/IRrecv.cpp b/lib/IRremoteESP8266-2.7.7/src/IRrecv.cpp similarity index 92% rename from lib/IRremoteESP8266-2.7.6/src/IRrecv.cpp rename to lib/IRremoteESP8266-2.7.7/src/IRrecv.cpp index f59c1248c..316cf59c6 100644 --- a/lib/IRremoteESP8266-2.7.6/src/IRrecv.cpp +++ b/lib/IRremoteESP8266-2.7.7/src/IRrecv.cpp @@ -789,6 +789,26 @@ bool IRrecv::decode(decode_results *results, irparams_t *save, DPRINTLN("Attempting Airwell decode"); if (decodeAirwell(results, offset)) return true; #endif // DECODE_AIRWELL +#if DECODE_DELONGHI_AC + DPRINTLN("Attempting Delonghi AC decode"); + if (decodeDelonghiAc(results, offset)) return true; +#endif // DECODE_DELONGHI_AC +#if DECODE_DOSHISHA + DPRINTLN("Attempting Doshisha decode"); + if (decodeDoshisha(results, offset)) return true; +#endif // DECODE_DOSHISHA +#if DECODE_MULTIBRACKETS + DPRINTLN("Attempting Multibrackets decode"); + if (decodeMultibrackets(results, offset)) return true; +#endif // DECODE_MULTIBRACKETS +#if DECODE_CARRIER_AC40 + DPRINTLN("Attempting Carrier 40bit decode"); + if (decodeCarrierAC40(results, offset)) return true; +#endif // DECODE_CARRIER_AC40 +#if DECODE_CARRIER_AC64 + DPRINTLN("Attempting Carrier 64bit decode"); + if (decodeCarrierAC64(results, offset)) return true; +#endif // DECODE_CARRIER_AC64 // Typically new protocols are added above this line. } #if DECODE_HASH @@ -1297,6 +1317,92 @@ uint16_t IRrecv::matchGeneric(volatile uint16_t *data_ptr, tolerance, excess, MSBfirst); } +// Match & decode a generic/typical constant bit time <= 64bit IR message. +// The data is stored at result_ptr. +// Values of 0 for hdrmark, hdrspace, footermark, or footerspace mean skip +// that requirement. +// +// Args: +// data_ptr: A pointer to where we are at in the capture buffer. +// result_ptr: A pointer to where to start storing the bits we decoded. +// remaining: The size of the capture buffer are remaining. +// nbits: Nr. of data bits we expect. +// hdrmark: Nr. of uSeconds for the expected header mark signal. +// hdrspace: Nr. of uSeconds for the expected header space signal. +// one: Nr. of uSeconds in an expected mark signal for a '1' bit. +// zero: Nr. of uSeconds in an expected mark signal for a '0' bit. +// footermark: Nr. of uSeconds for the expected footer mark signal. +// footerspace: Nr. of uSeconds for the expected footer space/gap signal. +// atleast: Is the match on the footerspace a matchAtLeast or matchSpace? +// tolerance: Percentage error margin to allow. (Def: kUseDefTol) +// excess: Nr. of useconds. (Def: kMarkExcess) +// MSBfirst: Bit order to save the data in. (Def: true) +// Returns: +// A uint16_t: If successful, how many buffer entries were used. Otherwise 0. +// +// Note: one + zero add up to the total time for a bit. +// e.g. mark(one) + space(zero) is a `1`, mark(zero) + space(one) is a `0`. +uint16_t IRrecv::matchGenericConstBitTime(volatile uint16_t *data_ptr, + uint64_t *result_ptr, + const uint16_t remaining, + const uint16_t nbits, + const uint16_t hdrmark, + const uint32_t hdrspace, + const uint16_t one, + const uint32_t zero, + const uint16_t footermark, + const uint32_t footerspace, + const bool atleast, + const uint8_t tolerance, + const int16_t excess, + const bool MSBfirst) { + uint16_t offset = 0; + uint64_t result = 0; + // If we expect a footermark, then this can be processed like normal. + if (footermark) + return _matchGeneric(data_ptr, result_ptr, NULL, true, remaining, nbits, + hdrmark, hdrspace, one, zero, zero, one, + footermark, footerspace, atleast, + tolerance, excess, MSBfirst); + // Overwise handle like normal, except for the last bit. and no footer. + uint16_t bits = (nbits > 0) ? nbits - 1 : 0; // Make sure we don't underflow. + offset = _matchGeneric(data_ptr, &result, NULL, true, remaining, bits, + hdrmark, hdrspace, one, zero, zero, one, 0, 0, false, + tolerance, excess, true); + if (!offset) return 0; // Didn't match. + // Now for the last bit. + if (remaining <= offset) return 0; // Not enough buffer. + result <<= 1; + bool last_bit = 0; + // Is the mark a '1' or a `0`? + if (matchMark(*(data_ptr + offset), one, tolerance, excess)) { // 1 + last_bit = 1; + result |= 1; + } else if (matchMark(*(data_ptr + offset), zero, tolerance, excess)) { // 0 + last_bit = 0; + } else { + return 0; // It's neither, so fail. + } + offset++; + uint32_t expected_space = (last_bit ? zero : one) + footerspace; + // If we are not at the end of the buffer, check for at least the expected + // space value. + if (remaining > offset) { + if (atleast) { + if (!matchAtLeast(*(data_ptr + offset), expected_space, tolerance, + excess)) + return false; + } else { + if (!matchSpace(*(data_ptr + offset), expected_space, tolerance)) + return false; + } + offset++; + } + if (!MSBfirst) result = reverseBits(result, nbits); + *result_ptr = result; + return offset; +} + // Match & decode a Manchester Code <= 64bit IR message. // The data is stored at result_ptr. // Values of 0 for hdrmark, hdrspace, footermark, or footerspace mean skip diff --git a/lib/IRremoteESP8266-2.7.6/src/IRrecv.h b/lib/IRremoteESP8266-2.7.7/src/IRrecv.h similarity index 92% rename from lib/IRremoteESP8266-2.7.6/src/IRrecv.h rename to lib/IRremoteESP8266-2.7.7/src/IRrecv.h index aeea5b32d..2894683ac 100644 --- a/lib/IRremoteESP8266-2.7.6/src/IRrecv.h +++ b/lib/IRremoteESP8266-2.7.7/src/IRrecv.h @@ -221,6 +221,20 @@ class IRrecv { const uint8_t tolerance = kUseDefTol, const int16_t excess = kMarkExcess, const bool MSBfirst = true); + uint16_t matchGenericConstBitTime(volatile uint16_t *data_ptr, + uint64_t *result_ptr, + const uint16_t remaining, + const uint16_t nbits, + const uint16_t hdrmark, + const uint32_t hdrspace, + const uint16_t one, + const uint32_t zero, + const uint16_t footermark, + const uint32_t footerspace, + const bool atleast = false, + const uint8_t tolerance = kUseDefTol, + const int16_t excess = kMarkExcess, + const bool MSBfirst = true); uint16_t matchManchester(volatile const uint16_t *data_ptr, uint64_t *result_ptr, const uint16_t remaining, @@ -471,7 +485,19 @@ class IRrecv { bool decodeCarrierAC(decode_results *results, uint16_t offset = kStartOffset, const uint16_t nbits = kCarrierAcBits, const bool strict = true); -#endif +#endif // DECODE_CARRIER_AC +#if DECODE_CARRIER_AC40 + bool decodeCarrierAC40(decode_results *results, + uint16_t offset = kStartOffset, + const uint16_t nbits = kCarrierAc40Bits, + const bool strict = true); +#endif // DECODE_CARRIER_AC40 +#if DECODE_CARRIER_AC64 + bool decodeCarrierAC64(decode_results *results, + uint16_t offset = kStartOffset, + const uint16_t nbits = kCarrierAc64Bits, + const bool strict = true); +#endif // DECODE_CARRIER_AC64 #if DECODE_GOODWEATHER bool decodeGoodweather(decode_results *results, uint16_t offset = kStartOffset, @@ -593,6 +619,22 @@ class IRrecv { const uint16_t nbits = kAirwellBits, const bool strict = true); #endif // DECODE_AIRWELL +#if DECODE_DELONGHI_AC + bool decodeDelonghiAc(decode_results *results, uint16_t offset = kStartOffset, + const uint16_t nbits = kDelonghiAcBits, + const bool strict = true); +#endif // DECODE_DELONGHI_AC +#if DECODE_DOSHISHA + bool decodeDoshisha(decode_results *results, uint16_t offset = kStartOffset, + const uint16_t nbits = kDoshishaBits, + const bool strict = true); +#endif // DECODE_DOSHISHA +#if DECODE_MULTIBRACKETS + bool decodeMultibrackets(decode_results *results, + uint16_t offset = kStartOffset, + const uint16_t nbits = kMultibracketsBits, + const bool strict = true); +#endif // DECODE_MULTIBRACKETS }; #endif // IRRECV_H_ diff --git a/lib/IRremoteESP8266-2.7.6/src/IRremoteESP8266.h b/lib/IRremoteESP8266-2.7.7/src/IRremoteESP8266.h similarity index 93% rename from lib/IRremoteESP8266-2.7.6/src/IRremoteESP8266.h rename to lib/IRremoteESP8266-2.7.7/src/IRremoteESP8266.h index 2bf906697..deef5e5e5 100644 --- a/lib/IRremoteESP8266-2.7.6/src/IRremoteESP8266.h +++ b/lib/IRremoteESP8266-2.7.7/src/IRremoteESP8266.h @@ -52,7 +52,7 @@ #endif // UNIT_TEST // Library Version -#define _IRREMOTEESP8266_VERSION_ "2.7.6" +#define _IRREMOTEESP8266_VERSION_ "2.7.7" // Set the language & locale for the library. See the `locale` dir for options. #ifndef _IR_LOCALE_ @@ -383,6 +383,20 @@ #define SEND_CARRIER_AC _IR_ENABLE_DEFAULT_ #endif // SEND_CARRIER_AC +#ifndef DECODE_CARRIER_AC40 +#define DECODE_CARRIER_AC40 _IR_ENABLE_DEFAULT_ +#endif // DECODE_CARRIER_AC40 +#ifndef SEND_CARRIER_AC40 +#define SEND_CARRIER_AC40 _IR_ENABLE_DEFAULT_ +#endif // SEND_CARRIER_AC40 + +#ifndef DECODE_CARRIER_AC64 +#define DECODE_CARRIER_AC64 _IR_ENABLE_DEFAULT_ +#endif // DECODE_CARRIER_AC64 +#ifndef SEND_CARRIER_AC64 +#define SEND_CARRIER_AC64 _IR_ENABLE_DEFAULT_ +#endif // SEND_CARRIER_AC64 + #ifndef DECODE_HAIER_AC #define DECODE_HAIER_AC _IR_ENABLE_DEFAULT_ #endif // DECODE_HAIER_AC @@ -412,10 +426,10 @@ #endif // SEND_HITACHI_AC2 #ifndef DECODE_HITACHI_AC3 -#define DECODE_HITACHI_AC3 _IR_ENABLE_DEFAULT_ +#define DECODE_HITACHI_AC3 _IR_ENABLE_DEFAULT_ #endif // DECODE_HITACHI_AC3 #ifndef SEND_HITACHI_AC3 -#define SEND_HITACHI_AC3 _IR_ENABLE_DEFAULT_ +#define SEND_HITACHI_AC3 _IR_ENABLE_DEFAULT_ #endif // SEND_HITACHI_AC3 #ifndef DECODE_HITACHI_AC424 @@ -573,33 +587,54 @@ #endif // SEND_DAIKIN152 #ifndef DECODE_EPSON -#define DECODE_EPSON _IR_ENABLE_DEFAULT_ +#define DECODE_EPSON _IR_ENABLE_DEFAULT_ #endif // DECODE_EPSON #ifndef SEND_EPSON -#define SEND_EPSON _IR_ENABLE_DEFAULT_ +#define SEND_EPSON _IR_ENABLE_DEFAULT_ #endif // SEND_EPSON #ifndef DECODE_SYMPHONY -#define DECODE_SYMPHONY _IR_ENABLE_DEFAULT_ +#define DECODE_SYMPHONY _IR_ENABLE_DEFAULT_ #endif // DECODE_SYMPHONY #ifndef SEND_SYMPHONY -#define SEND_SYMPHONY _IR_ENABLE_DEFAULT_ +#define SEND_SYMPHONY _IR_ENABLE_DEFAULT_ #endif // SEND_SYMPHONY #ifndef DECODE_DAIKIN64 -#define DECODE_DAIKIN64 _IR_ENABLE_DEFAULT_ +#define DECODE_DAIKIN64 _IR_ENABLE_DEFAULT_ #endif // DECODE_DAIKIN64 #ifndef SEND_DAIKIN64 -#define SEND_DAIKIN64 _IR_ENABLE_DEFAULT_ +#define SEND_DAIKIN64 _IR_ENABLE_DEFAULT_ #endif // SEND_DAIKIN64 #ifndef DECODE_AIRWELL -#define DECODE_AIRWELL _IR_ENABLE_DEFAULT_ +#define DECODE_AIRWELL _IR_ENABLE_DEFAULT_ #endif // DECODE_AIRWELL #ifndef SEND_AIRWELL -#define SEND_AIRWELL _IR_ENABLE_DEFAULT_ +#define SEND_AIRWELL _IR_ENABLE_DEFAULT_ #endif // SEND_AIRWELL +#ifndef DECODE_DELONGHI_AC +#define DECODE_DELONGHI_AC _IR_ENABLE_DEFAULT_ +#endif // DECODE_DELONGHI_AC +#ifndef SEND_DELONGHI_AC +#define SEND_DELONGHI_AC _IR_ENABLE_DEFAULT_ +#endif // SEND_DELONGHI_AC + +#ifndef DECODE_DOSHISHA +#define DECODE_DOSHISHA _IR_ENABLE_DEFAULT_ +#endif // DECODE_DOSHISHA +#ifndef SEND_DOSHISHA +#define SEND_DOSHISHA _IR_ENABLE_DEFAULT_ +#endif // SEND_DOSHISHA + +#ifndef DECODE_MULTIBRACKETS +#define DECODE_MULTIBRACKETS _IR_ENABLE_DEFAULT_ +#endif // DECODE_MULTIBRACKETS +#ifndef SEND_MULTIBRACKETS +#define SEND_MULTIBRACKETS _IR_ENABLE_DEFAULT_ +#endif // SEND_MULTIBRACKETS + #if (DECODE_ARGO || DECODE_DAIKIN || DECODE_FUJITSU_AC || DECODE_GREE || \ DECODE_KELVINATOR || DECODE_MITSUBISHI_AC || DECODE_TOSHIBA_AC || \ DECODE_TROTEC || DECODE_HAIER_AC || DECODE_HITACHI_AC || \ @@ -727,8 +762,13 @@ enum decode_type_t { HITACHI_AC3, DAIKIN64, AIRWELL, + DELONGHI_AC, // 80 + DOSHISHA, + MULTIBRACKETS, + CARRIER_AC40, + CARRIER_AC64, // Add new entries before this one, and update it to point to the last entry. - kLastDecodeType = AIRWELL, + kLastDecodeType = CARRIER_AC64, }; // Message lengths & required repeat values @@ -750,6 +790,10 @@ const uint16_t kCoolixBits = 24; const uint16_t kCoolixDefaultRepeat = kSingleRepeat; const uint16_t kCarrierAcBits = 32; const uint16_t kCarrierAcMinRepeat = kNoRepeat; +const uint16_t kCarrierAc40Bits = 40; +const uint16_t kCarrierAc40MinRepeat = 2; +const uint16_t kCarrierAc64Bits = 64; +const uint16_t kCarrierAc64MinRepeat = kNoRepeat; const uint16_t kDaikinStateLength = 35; const uint16_t kDaikinBits = kDaikinStateLength * 8; const uint16_t kDaikinStateLengthShort = kDaikinStateLength - 8; @@ -775,11 +819,14 @@ const uint16_t kDaikin176DefaultRepeat = kNoRepeat; const uint16_t kDaikin216StateLength = 27; const uint16_t kDaikin216Bits = kDaikin216StateLength * 8; const uint16_t kDaikin216DefaultRepeat = kNoRepeat; +const uint16_t kDelonghiAcBits = 64; +const uint16_t kDelonghiAcDefaultRepeat = kNoRepeat; const uint16_t kDenonBits = 15; const uint16_t kDenon48Bits = 48; const uint16_t kDenonLegacyBits = 14; const uint16_t kDishBits = 16; const uint16_t kDishMinRepeat = 3; +const uint16_t kDoshishaBits = 40; const uint16_t kEpsonBits = 32; const uint16_t kEpsonMinRepeat = 2; const uint16_t kElectraAcStateLength = 13; @@ -852,6 +899,8 @@ const uint16_t kMitsubishiHeavy88MinRepeat = kNoRepeat; const uint16_t kMitsubishiHeavy152StateLength = 19; const uint16_t kMitsubishiHeavy152Bits = kMitsubishiHeavy152StateLength * 8; const uint16_t kMitsubishiHeavy152MinRepeat = kNoRepeat; +const uint16_t kMultibracketsBits = 8; +const uint16_t kMultibracketsDefaultRepeat = kSingleRepeat; const uint16_t kNikaiBits = 24; const uint16_t kNECBits = 32; const uint16_t kNeoclimaStateLength = 12; @@ -897,8 +946,8 @@ const uint16_t kSony15Bits = 15; const uint16_t kSony20Bits = 20; const uint16_t kSonyMinBits = 12; const uint16_t kSonyMinRepeat = 2; -const uint16_t kSymphonyBits = 11; -const uint16_t kSymphonyDefaultRepeat = kSingleRepeat; +const uint16_t kSymphonyBits = 12; +const uint16_t kSymphonyDefaultRepeat = 3; const uint16_t kTcl112AcStateLength = 14; const uint16_t kTcl112AcBits = kTcl112AcStateLength * 8; const uint16_t kTcl112AcDefaultRepeat = kNoRepeat; diff --git a/lib/IRremoteESP8266-2.7.6/src/IRsend.cpp b/lib/IRremoteESP8266-2.7.7/src/IRsend.cpp similarity index 97% rename from lib/IRremoteESP8266-2.7.6/src/IRsend.cpp rename to lib/IRremoteESP8266-2.7.7/src/IRsend.cpp index bb5f55407..8995e2d33 100644 --- a/lib/IRremoteESP8266-2.7.6/src/IRsend.cpp +++ b/lib/IRremoteESP8266-2.7.7/src/IRsend.cpp @@ -607,13 +607,15 @@ uint16_t IRsend::minRepeats(const decode_type_t protocol) { case MITSUBISHI: case MITSUBISHI2: case MITSUBISHI_AC: + case MULTIBRACKETS: case SHERWOOD: - case SYMPHONY: case TOSHIBA_AC: return kSingleRepeat; // Special case AIRWELL: return kAirwellMinRepeats; + case CARRIER_AC40: + return kCarrierAc40MinRepeat; case DISH: return kDishMinRepeat; case EPSON: @@ -622,6 +624,8 @@ uint16_t IRsend::minRepeats(const decode_type_t protocol) { return kSonyMinRepeat; case SONY_38K: return kSonyMinRepeat + 1; + case SYMPHONY: + return kSymphonyDefaultRepeat; default: return kNoRepeat; } @@ -634,9 +638,10 @@ uint16_t IRsend::minRepeats(const decode_type_t protocol) { // int16_t: The number of bits. uint16_t IRsend::defaultBits(const decode_type_t protocol) { switch (protocol) { - case SYMPHONY: - return 11; + case MULTIBRACKETS: + return 8; case RC5: + case SYMPHONY: return 12; case LASERTAG: case RC5X: @@ -678,6 +683,10 @@ uint16_t IRsend::defaultBits(const decode_type_t protocol) { return 35; case SAMSUNG36: return 36; + case CARRIER_AC40: + return kCarrierAc40Bits; // 40 + case DOSHISHA: + return kDoshishaBits; // 40 case SANYO_LC7461: return kSanyoLC7461Bits; // 42 case GOODWEATHER: @@ -688,6 +697,8 @@ uint16_t IRsend::defaultBits(const decode_type_t protocol) { case VESTEL_AC: return 56; case AMCOR: + case CARRIER_AC64: + case DELONGHI_AC: case PIONEER: return 64; case ARGO: @@ -722,8 +733,8 @@ uint16_t IRsend::defaultBits(const decode_type_t protocol) { return kHitachiAc1Bits; case HITACHI_AC2: return kHitachiAc2Bits; - case HITACHI_AC3: - return kHitachiAc3Bits; + case HITACHI_AC3: + return kHitachiAc3Bits; case HITACHI_AC424: return kHitachiAc424Bits; case KELVINATOR: @@ -790,6 +801,16 @@ bool IRsend::send(const decode_type_t type, const uint64_t data, sendCarrierAC(data, nbits, min_repeat); break; #endif +#if SEND_CARRIER_AC40 + case CARRIER_AC40: + sendCarrierAC40(data, nbits, min_repeat); + break; +#endif // SEND_CARRIER_AC40 +#if SEND_CARRIER_AC64 + case CARRIER_AC64: + sendCarrierAC64(data, nbits, min_repeat); + break; +#endif // SEND_CARRIER_AC64 #if SEND_COOLIX case COOLIX: sendCOOLIX(data, nbits, min_repeat); @@ -800,6 +821,11 @@ bool IRsend::send(const decode_type_t type, const uint64_t data, sendDaikin64(data, nbits, min_repeat); break; #endif +#if SEND_DELONGHI_AC + case DELONGHI_AC: + sendDelonghiAc(data, nbits, min_repeat); + break; +#endif #if SEND_DENON case DENON: sendDenon(data, nbits, min_repeat); @@ -810,6 +836,11 @@ bool IRsend::send(const decode_type_t type, const uint64_t data, sendDISH(data, nbits, min_repeat); break; #endif +#if SEND_DOSHISHA + case DOSHISHA: + sendDoshisha(data, nbits, min_repeat); + break; +#endif #if SEND_EPSON case EPSON: sendEpson(data, nbits, min_repeat); @@ -883,6 +914,11 @@ bool IRsend::send(const decode_type_t type, const uint64_t data, sendMitsubishi2(data, nbits, min_repeat); break; #endif +#if SEND_MULTIBRACKETS + case MULTIBRACKETS: + sendMultibrackets(data, nbits, min_repeat); + break; +#endif #if SEND_NIKAI case NIKAI: sendNikai(data, nbits, min_repeat); diff --git a/lib/IRremoteESP8266-2.7.6/src/IRsend.h b/lib/IRremoteESP8266-2.7.7/src/IRsend.h similarity index 96% rename from lib/IRremoteESP8266-2.7.6/src/IRsend.h rename to lib/IRremoteESP8266-2.7.7/src/IRsend.h index 8d5e6a862..85a3dde62 100644 --- a/lib/IRremoteESP8266-2.7.6/src/IRsend.h +++ b/lib/IRremoteESP8266-2.7.7/src/IRsend.h @@ -466,6 +466,14 @@ class IRsend { void sendCarrierAC(uint64_t data, uint16_t nbits = kCarrierAcBits, uint16_t repeat = kCarrierAcMinRepeat); #endif +#if SEND_CARRIER_AC40 + void sendCarrierAC40(uint64_t data, uint16_t nbits = kCarrierAc40Bits, + uint16_t repeat = kCarrierAc40MinRepeat); +#endif +#if SEND_CARRIER_AC64 + void sendCarrierAC64(uint64_t data, uint16_t nbits = kCarrierAc64Bits, + uint16_t repeat = kCarrierAc64MinRepeat); +#endif #if (SEND_HAIER_AC || SEND_HAIER_AC_YRW02) void sendHaierAC(const unsigned char data[], const uint16_t nbytes = kHaierACStateLength, @@ -573,6 +581,20 @@ class IRsend { void sendAirwell(uint64_t data, uint16_t nbits = kAirwellBits, uint16_t repeat = kAirwellMinRepeats); #endif +#if SEND_DELONGHI_AC + void sendDelonghiAc(uint64_t data, uint16_t nbits = kDelonghiAcBits, + uint16_t repeat = kDelonghiAcDefaultRepeat); +#endif +#if SEND_DOSHISHA + void sendDoshisha(const uint64_t data, uint16_t nbits = kDoshishaBits, + const uint16_t repeat = kNoRepeat); + uint64_t encodeDoshisha(const uint8_t command, const uint8_t channel = 0); +#endif // SEND_DOSHISHA +#if SEND_MULTIBRACKETS + void sendMultibrackets(const uint64_t data, + const uint16_t nbits = kMultibracketsBits, + const uint16_t repeat = kMultibracketsDefaultRepeat); +#endif protected: #ifdef UNIT_TEST diff --git a/lib/IRremoteESP8266-2.7.6/src/IRtext.cpp b/lib/IRremoteESP8266-2.7.7/src/IRtext.cpp similarity index 94% rename from lib/IRremoteESP8266-2.7.6/src/IRtext.cpp rename to lib/IRremoteESP8266-2.7.7/src/IRtext.cpp index cb9ccd722..f612ed8d1 100644 --- a/lib/IRremoteESP8266-2.7.6/src/IRtext.cpp +++ b/lib/IRremoteESP8266-2.7.7/src/IRtext.cpp @@ -1,4 +1,7 @@ -// Copyright 2019 - David Conran (@crankyoldgit) +// Copyright 2019-2020 - David Conran (@crankyoldgit) + +/// @warn If you add or remove an entry in this file, you should run: +/// '../tools/generate_irtext_h.sh' to rebuild the `IRtext.h` file. #ifndef UNIT_TEST #include @@ -79,6 +82,7 @@ const PROGMEM char* kSlowStr = D_STR_SLOW; const PROGMEM char* kAirFlowStr = D_STR_AIRFLOW; const PROGMEM char* kStepStr = D_STR_STEP; const PROGMEM char* kNAStr = D_STR_NA; +const PROGMEM char* kInsideStr = D_STR_INSIDE; const PROGMEM char* kOutsideStr = D_STR_OUTSIDE; const PROGMEM char* kLoudStr = D_STR_LOUD; const PROGMEM char* kLowerStr = D_STR_LOWER; @@ -131,6 +135,7 @@ const PROGMEM char* kLightToggleStr = D_STR_LIGHTTOGGLE; const PROGMEM char* kOutsideQuietStr = D_STR_OUTSIDEQUIET; const PROGMEM char* kPowerToggleStr = D_STR_POWERTOGGLE; const PROGMEM char* kPreviousPowerStr = D_STR_PREVIOUSPOWER; +const PROGMEM char* kDisplayTempStr = D_STR_DISPLAYTEMP; const PROGMEM char* kSensorTempStr = D_STR_SENSORTEMP; const PROGMEM char* kSleepTimerStr = D_STR_SLEEP_TIMER; const PROGMEM char* kSwingVModeStr = D_STR_SWINGVMODE; @@ -247,4 +252,10 @@ const PROGMEM char *kAllProtocolNamesStr = D_STR_HITACHI_AC3 "\x0" D_STR_DAIKIN64 "\x0" D_STR_AIRWELL "\x0" + D_STR_DELONGHI_AC "\x0" + D_STR_DOSHISHA "\x0" + D_STR_MULTIBRACKETS "\x0" + D_STR_CARRIER_AC40 "\x0" + D_STR_CARRIER_AC64 "\x0" + // New protocol strings should be added just above this line. "\x0"; // This string requires double null termination. diff --git a/lib/IRremoteESP8266-2.7.6/src/IRtext.h b/lib/IRremoteESP8266-2.7.7/src/IRtext.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/IRtext.h rename to lib/IRremoteESP8266-2.7.7/src/IRtext.h index cbce59747..112162f65 100644 --- a/lib/IRremoteESP8266-2.7.6/src/IRtext.h +++ b/lib/IRremoteESP8266-2.7.7/src/IRtext.h @@ -41,6 +41,7 @@ extern const char* kCommaSpaceStr; extern const char* kCoolStr; extern const char* kDaysStr; extern const char* kDayStr; +extern const char* kDisplayTempStr; extern const char* kDownStr; extern const char* kDryStr; extern const char* kEconoStr; @@ -64,6 +65,7 @@ extern const char* kHoursStr; extern const char* kHourStr; extern const char* kHumidStr; extern const char* kIFeelStr; +extern const char* kInsideStr; extern const char* kIonStr; extern const char* kLastStr; extern const char* kLeftMaxStr; diff --git a/lib/IRremoteESP8266-2.7.6/src/IRtimer.cpp b/lib/IRremoteESP8266-2.7.7/src/IRtimer.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/IRtimer.cpp rename to lib/IRremoteESP8266-2.7.7/src/IRtimer.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/IRtimer.h b/lib/IRremoteESP8266-2.7.7/src/IRtimer.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/IRtimer.h rename to lib/IRremoteESP8266-2.7.7/src/IRtimer.h diff --git a/lib/IRremoteESP8266-2.7.6/src/IRutils.cpp b/lib/IRremoteESP8266-2.7.7/src/IRutils.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/IRutils.cpp rename to lib/IRremoteESP8266-2.7.7/src/IRutils.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/IRutils.h b/lib/IRremoteESP8266-2.7.7/src/IRutils.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/IRutils.h rename to lib/IRremoteESP8266-2.7.7/src/IRutils.h diff --git a/lib/IRremoteESP8266-2.7.6/src/i18n.h b/lib/IRremoteESP8266-2.7.7/src/i18n.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/i18n.h rename to lib/IRremoteESP8266-2.7.7/src/i18n.h diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Airwell.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Airwell.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Airwell.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Airwell.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Aiwa.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Aiwa.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Aiwa.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Aiwa.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Amcor.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Amcor.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Amcor.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Amcor.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Amcor.h b/lib/IRremoteESP8266-2.7.7/src/ir_Amcor.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_Amcor.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Amcor.h index fa8aa1edd..401bb787c 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Amcor.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Amcor.h @@ -86,7 +86,7 @@ class IRAmcorAc { void stateReset(); #if SEND_AMCOR void send(const uint16_t repeat = kAmcorDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_AMCOR void begin(); static uint8_t calcChecksum(const uint8_t state[], diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Argo.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Argo.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Argo.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Argo.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Argo.h b/lib/IRremoteESP8266-2.7.7/src/ir_Argo.h similarity index 99% rename from lib/IRremoteESP8266-2.7.6/src/ir_Argo.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Argo.h index 3c1281ea3..af674d46f 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Argo.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Argo.h @@ -131,7 +131,7 @@ class IRArgoAC { #if SEND_ARGO void send(const uint16_t repeat = kArgoDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_ARGO void begin(void); void on(void); diff --git a/lib/IRremoteESP8266-2.7.7/src/ir_Carrier.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Carrier.cpp new file mode 100644 index 000000000..f0d7f4317 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Carrier.cpp @@ -0,0 +1,217 @@ +// Copyright 2018, 2020 David Conran + +// Supports: +// Brand: Carrier/Surrey, Model: 42QG5A55970 remote +// Brand: Carrier/Surrey, Model: 619EGX0090E0 A/C +// Brand: Carrier/Surrey, Model: 619EGX0120E0 A/C +// Brand: Carrier/Surrey, Model: 619EGX0180E0 A/C +// Brand: Carrier/Surrey, Model: 619EGX0220E0 A/C +// Brand: Carrier/Surrey, Model: 53NGK009/012 Inverter + +#include "IRrecv.h" +#include "IRsend.h" +#include "IRutils.h" + +// Constants +// Ref: +// https://github.com/crankyoldgit/IRremoteESP8266/issues/385 +const uint16_t kCarrierAcHdrMark = 8532; +const uint16_t kCarrierAcHdrSpace = 4228; +const uint16_t kCarrierAcBitMark = 628; +const uint16_t kCarrierAcOneSpace = 1320; +const uint16_t kCarrierAcZeroSpace = 532; +const uint16_t kCarrierAcGap = 20000; +const uint16_t kCarrierAcFreq = 38; // kHz. (An educated guess) + +const uint16_t kCarrierAc40HdrMark = 8402; +const uint16_t kCarrierAc40HdrSpace = 4166; +const uint16_t kCarrierAc40BitMark = 547; +const uint16_t kCarrierAc40OneSpace = 1540; +const uint16_t kCarrierAc40ZeroSpace = 497; + +// Ref: https://github.com/crankyoldgit/IRremoteESP8266/issues/1127 +const uint16_t kCarrierAc64HdrMark = 8940; +const uint16_t kCarrierAc64HdrSpace = 4556; +const uint16_t kCarrierAc64BitMark = 503; +const uint16_t kCarrierAc64OneSpace = 1736; +const uint16_t kCarrierAc64ZeroSpace = 615; +const uint32_t kCarrierAc64Gap = kDefaultMessageGap; // A guess. + + +#if SEND_CARRIER_AC +// Send a Carrier HVAC formatted message. +// +// Args: +// data: The message to be sent. +// nbits: The bit size of the message being sent. typically kCarrierAcBits. +// repeat: The number of times the message is to be repeated. +// +// Status: STABLE / Work on real devices. +// +void IRsend::sendCarrierAC(uint64_t data, uint16_t nbits, uint16_t repeat) { + for (uint16_t r = 0; r <= repeat; r++) { + uint64_t temp_data = data; + // Carrier sends the data block three times. normal + inverted + normal. + for (uint16_t i = 0; i < 3; i++) { + sendGeneric(kCarrierAcHdrMark, kCarrierAcHdrSpace, kCarrierAcBitMark, + kCarrierAcOneSpace, kCarrierAcBitMark, kCarrierAcZeroSpace, + kCarrierAcBitMark, kCarrierAcGap, temp_data, nbits, 38, true, + 0, kDutyDefault); + temp_data = invertBits(temp_data, nbits); + } + } +} +#endif + +#if DECODE_CARRIER_AC +// Decode the supplied Carrier HVAC message. +// Carrier HVAC messages contain only 32 bits, but it is sent three(3) times. +// i.e. normal + inverted + normal +// Args: +// results: Ptr to the data to decode and where to store the decode result. +// offset: The starting index to use when attempting to decode the raw data. +// Typically/Defaults to kStartOffset. +// nbits: Nr. of bits to expect in the data portion. +// Typically kCarrierAcBits. +// strict: Flag to indicate if we strictly adhere to the specification. +// Returns: +// boolean: True if it can decode it, false if it can't. +// +// Status: BETA / Probably works. +// +bool IRrecv::decodeCarrierAC(decode_results *results, uint16_t offset, + const uint16_t nbits, const bool strict) { + if (results->rawlen < ((2 * nbits + kHeader + kFooter) * 3) - 1 + offset) + return false; // Can't possibly be a valid Carrier message. + if (strict && nbits != kCarrierAcBits) + return false; // We expect Carrier to be 32 bits of message. + + uint64_t data = 0; + uint64_t prev_data = 0; + + for (uint8_t i = 0; i < 3; i++) { + prev_data = data; + // Match Header + Data + Footer + uint16_t used; + used = matchGeneric(results->rawbuf + offset, &data, + results->rawlen - offset, nbits, + kCarrierAcHdrMark, kCarrierAcHdrSpace, + kCarrierAcBitMark, kCarrierAcOneSpace, + kCarrierAcBitMark, kCarrierAcZeroSpace, + kCarrierAcBitMark, kCarrierAcGap, true); + if (!used) return false; + offset += used; + // Compliance. + if (strict) { + // Check if the data is an inverted copy of the previous data. + if (i > 0 && prev_data != invertBits(data, nbits)) return false; + } + } + + // Success + results->bits = nbits; + results->value = data; + results->decode_type = CARRIER_AC; + results->address = data >> 16; + results->command = data & 0xFFFF; + return true; +} +#endif // DECODE_CARRIER_AC + +#if SEND_CARRIER_AC40 +/// Send a Carrier 40bit HVAC formatted message. +/// Status: Alpha / Yet to be tested against a real device. +/// @param[in] data The message to be sent. +/// @param[in] nbits The bit size of the message being sent. +/// @param[in] repeat The number of times the message is to be repeated. +void IRsend::sendCarrierAC40(const uint64_t data, const uint16_t nbits, + const uint16_t repeat) { + sendGeneric(kCarrierAc40HdrMark, kCarrierAc40HdrSpace, kCarrierAc40BitMark, + kCarrierAc40OneSpace, kCarrierAc40BitMark, kCarrierAc40ZeroSpace, + kCarrierAc40BitMark, kCarrierAcGap, + data, nbits, kCarrierAcFreq, true, repeat, kDutyDefault); +} +#endif // SEND_CARRIER_AC40 + +#if DECODE_CARRIER_AC40 +/// Decode the supplied Carrier 40-bit HVAC message. +/// Carrier HVAC messages contain only 40 bits, but it is sent three(3) times. +/// Status: BETA / Probably works. +/// @param[in,out] results Ptr to the data to decode & where to store the decode +/// result. +/// @param[in] offset The starting index to use when attempting to decode the +/// raw data. Typically/Defaults to kStartOffset. +/// @param[in] nbits The number of data bits to expect. +/// @param[in] strict Flag indicating if we should perform strict matching. +/// @return A boolean. True if it can decode it, false if it can't. +bool IRrecv::decodeCarrierAC40(decode_results *results, uint16_t offset, + const uint16_t nbits, const bool strict) { + if (results->rawlen < 2 * nbits + kHeader + kFooter - 1 + offset) + return false; // Can't possibly be a valid Carrier message. + if (strict && nbits != kCarrierAc40Bits) + return false; // We expect Carrier to be 40 bits of message. + + if (!matchGeneric(results->rawbuf + offset, &(results->value), + results->rawlen - offset, nbits, + kCarrierAc40HdrMark, kCarrierAc40HdrSpace, + kCarrierAc40BitMark, kCarrierAc40OneSpace, + kCarrierAc40BitMark, kCarrierAc40ZeroSpace, + kCarrierAc40BitMark, kCarrierAcGap, true)) return false; + + // Success + results->bits = nbits; + results->decode_type = CARRIER_AC40; + results->address = 0; + results->command = 0; + return true; +} +#endif // DECODE_CARRIER_AC40 + +#if SEND_CARRIER_AC64 +/// Send a Carrier 64bit HVAC formatted message. +/// Status: Alpha / Yet to be tested against a real device. +/// @param[in] data The message to be sent. +/// @param[in] nbits The bit size of the message being sent. +/// @param[in] repeat The number of times the message is to be repeated. +void IRsend::sendCarrierAC64(const uint64_t data, const uint16_t nbits, + const uint16_t repeat) { + sendGeneric(kCarrierAc64HdrMark, kCarrierAc64HdrSpace, kCarrierAc64BitMark, + kCarrierAc64OneSpace, kCarrierAc64BitMark, kCarrierAc64ZeroSpace, + kCarrierAc64BitMark, kCarrierAc64Gap, + data, nbits, kCarrierAcFreq, false, repeat, kDutyDefault); +} +#endif // SEND_CARRIER_AC64 + +#if DECODE_CARRIER_AC64 +/// Decode the supplied Carrier 64-bit HVAC message. +/// Status: BETA / Probably works. +/// @param[in,out] results Ptr to the data to decode & where to store the decode +/// result. +/// @param[in] offset The starting index to use when attempting to decode the +/// raw data. Typically/Defaults to kStartOffset. +/// @param[in] nbits The number of data bits to expect. +/// @param[in] strict Flag indicating if we should perform strict matching. +/// @return A boolean. True if it can decode it, false if it can't. +bool IRrecv::decodeCarrierAC64(decode_results *results, uint16_t offset, + const uint16_t nbits, const bool strict) { + if (results->rawlen < 2 * nbits + kHeader + kFooter - 1 + offset) + return false; // Can't possibly be a valid Carrier message. + if (strict && nbits != kCarrierAc64Bits) + return false; // We expect Carrier to be 64 bits of message. + + if (!matchGeneric(results->rawbuf + offset, &(results->value), + results->rawlen - offset, nbits, + kCarrierAc64HdrMark, kCarrierAc64HdrSpace, + kCarrierAc64BitMark, kCarrierAc64OneSpace, + kCarrierAc64BitMark, kCarrierAc64ZeroSpace, + kCarrierAc64BitMark, kCarrierAc64Gap, true, + kUseDefTol, kMarkExcess, false)) return false; + + // Success + results->bits = nbits; + results->decode_type = CARRIER_AC64; + results->address = 0; + results->command = 0; + return true; +} +#endif // DECODE_CARRIER_AC64 diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Coolix.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Coolix.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Coolix.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Coolix.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Coolix.h b/lib/IRremoteESP8266-2.7.7/src/ir_Coolix.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_Coolix.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Coolix.h index 6f7778416..7ffcf01a9 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Coolix.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Coolix.h @@ -106,7 +106,7 @@ class IRCoolixAC { void stateReset(); #if SEND_COOLIX void send(const uint16_t repeat = kCoolixDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_COOLIX void begin(); void on(); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Daikin.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Daikin.cpp similarity index 99% rename from lib/IRremoteESP8266-2.7.6/src/ir_Daikin.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Daikin.cpp index c18e77569..2bc0518ec 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Daikin.cpp +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Daikin.cpp @@ -3261,7 +3261,8 @@ bool IRrecv::decodeDaikin64(decode_results *results, uint16_t offset, kDaikin64BitMark, kDaikin64OneSpace, kDaikin64BitMark, kDaikin64ZeroSpace, kDaikin64BitMark, kDaikin64Gap, - false, _tolerance, kMarkExcess, false); + false, _tolerance + kDaikin64ToleranceDelta, + kMarkExcess, false); if (used == 0) return false; offset += used; // Footer #2 diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Daikin.h b/lib/IRremoteESP8266-2.7.7/src/ir_Daikin.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_Daikin.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Daikin.h index 3630aa77b..3c6f542ff 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Daikin.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Daikin.h @@ -19,6 +19,9 @@ // Brand: Daikin, Model: ARC480A5 remote (DAIKIN152) // Brand: Daikin, Model: FFN-C/FCN-F Series A/C (DAIKIN64) // Brand: Daikin, Model: DGS01 remote (DAIKIN64) +// Brand: Daikin, Model: M Series A/C (DAIKIN) +// Brand: Daikin, Model: FTXM-M A/C (DAIKIN) +// Brand: Daikin, Model: ARC466A33 remote (DAIKIN) #ifndef IR_DAIKIN_H_ #define IR_DAIKIN_H_ @@ -441,7 +444,8 @@ const uint16_t kDaikin64LdrMark = kDaikin128LeaderMark; const uint16_t kDaikin64Gap = kDaikin128Gap; const uint16_t kDaikin64LdrSpace = kDaikin128LeaderSpace; const uint16_t kDaikin64Freq = kDaikin128Freq; // Hz. -const uint16_t kDaikin64Overhead = 9; +const uint8_t kDaikin64Overhead = 9; +const int8_t kDaikin64ToleranceDelta = 5; // +5% const uint64_t kDaikin64KnownGoodState = 0x7C16161607204216; const uint8_t kDaikin64ModeOffset = 8; @@ -503,7 +507,7 @@ class IRDaikinESP { #if SEND_DAIKIN void send(const uint16_t repeat = kDaikinDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif void begin(void); void on(void); @@ -578,7 +582,7 @@ class IRDaikin2 { #if SEND_DAIKIN2 void send(const uint16_t repeat = kDaikin2DefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif void begin(); void on(); @@ -672,7 +676,7 @@ class IRDaikin216 { #if SEND_DAIKIN216 void send(const uint16_t repeat = kDaikin216DefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif void begin(); uint8_t* getRaw(); @@ -722,7 +726,7 @@ class IRDaikin160 { #if SEND_DAIKIN160 void send(const uint16_t repeat = kDaikin160DefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif void begin(); uint8_t* getRaw(); @@ -768,7 +772,7 @@ class IRDaikin176 { #if SEND_DAIKIN176 void send(const uint16_t repeat = kDaikin176DefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif void begin(); uint8_t* getRaw(); @@ -817,7 +821,7 @@ class IRDaikin128 { const bool use_modulation = true); #if SEND_DAIKIN128 void send(const uint16_t repeat = kDaikin128DefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_DAIKIN128 void begin(); void setPowerToggle(const bool toggle); @@ -886,7 +890,7 @@ class IRDaikin152 { #if SEND_DAIKIN152 void send(const uint16_t repeat = kDaikin152DefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif void begin(); uint8_t* getRaw(); @@ -942,7 +946,7 @@ class IRDaikin64 { #if SEND_DAIKIN64 void send(const uint16_t repeat = kDaikin64DefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_DAIKIN64 void begin(); uint64_t getRaw(); diff --git a/lib/IRremoteESP8266-2.7.7/src/ir_Delonghi.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Delonghi.cpp new file mode 100644 index 000000000..7f6c3158a --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Delonghi.cpp @@ -0,0 +1,429 @@ +// Copyright 2020 David Conran +// Delonghi based protocol. + +#include "ir_Delonghi.h" +#include "IRrecv.h" +#include "IRsend.h" +#include "IRtext.h" +#include "IRutils.h" +#include + +using irutils::addBoolToString; +using irutils::addModeToString; +using irutils::addFanToString; +using irutils::addLabeledString; +using irutils::addTempToString; +using irutils::minsToString; +using irutils::setBit; +using irutils::setBits; + +const uint16_t kDelonghiAcHdrMark = 8984; +const uint16_t kDelonghiAcBitMark = 572; +const uint16_t kDelonghiAcHdrSpace = 4200; +const uint16_t kDelonghiAcOneSpace = 1558; +const uint16_t kDelonghiAcZeroSpace = 510; +const uint32_t kDelonghiAcGap = kDefaultMessageGap; // A totally made-up guess. +const uint16_t kDelonghiAcFreq = 38000; // Hz. (Guess: most common frequency.) +const uint16_t kDelonghiAcOverhead = 3; + + +#if SEND_DELONGHI_AC +// Send an Delonghi AC formatted message. +// +// Args: +// data: The message to be sent. +// nbits: The number of bits of the message to be sent. +// Typically kDelonghiAcBits. +// repeat: The number of times the command is to be repeated. +// +// Status: STABLE / Reported as working on a real device. +// +// Ref: +// https://github.com/crankyoldgit/IRremoteESP8266/issues/1096 +void IRsend::sendDelonghiAc(const uint64_t data, const uint16_t nbits, + const uint16_t repeat) { + sendGeneric(kDelonghiAcHdrMark, kDelonghiAcHdrSpace, + kDelonghiAcBitMark, kDelonghiAcOneSpace, + kDelonghiAcBitMark, kDelonghiAcZeroSpace, + kDelonghiAcBitMark, kDelonghiAcGap, + data, nbits, kDelonghiAcFreq, false, // LSB First. + repeat, kDutyDefault); +} +#endif // SEND_DELONGHI_AC + +#if DECODE_DELONGHI_AC +// Decode the supplied DELONGHI_AC message. +// +// Args: +// results: Ptr to the data to decode and where to store the decode result. +// offset: The starting index to use when attempting to decode the raw data. +// Typically/Defaults to kStartOffset. +// nbits: The number of data bits to expect. Typically kDelonghiAcBits. +// strict: Flag indicating if we should perform strict matching. +// Returns: +// boolean: True if it can decode it, false if it can't. +// +// Status: STABLE / Expected to be working. +// +// Ref: +// https://github.com/crankyoldgit/IRremoteESP8266/issues/1096 +bool IRrecv::decodeDelonghiAc(decode_results *results, uint16_t offset, + const uint16_t nbits, const bool strict) { + if (results->rawlen < 2 * nbits + kDelonghiAcOverhead - offset) + return false; // Too short a message to match. + if (strict && nbits != kDelonghiAcBits) + return false; + + uint64_t data = 0; + + // Header + Data + Footer + if (!matchGeneric(results->rawbuf + offset, &data, + results->rawlen - offset, nbits, + kDelonghiAcHdrMark, kDelonghiAcHdrSpace, + kDelonghiAcBitMark, kDelonghiAcOneSpace, + kDelonghiAcBitMark, kDelonghiAcZeroSpace, + kDelonghiAcBitMark, kDelonghiAcGap, true, + _tolerance, kMarkExcess, false)) return false; + + // Compliance + if (strict && !IRDelonghiAc::validChecksum(data)) return false; + + // Success + results->decode_type = decode_type_t::DELONGHI_AC; + results->bits = nbits; + results->value = data; + results->command = 0; + results->address = 0; + return true; +} +#endif // DECODE_DELONGHI_AC + + +// Class for controlling the settings of a Delonghi A/C + +IRDelonghiAc::IRDelonghiAc(const uint16_t pin, const bool inverted, + const bool use_modulation) + : _irsend(pin, inverted, use_modulation) { this->stateReset(); } + +void IRDelonghiAc::begin(void) { _irsend.begin(); } + +#if SEND_DELONGHI_AC +void IRDelonghiAc::send(const uint16_t repeat) { + _irsend.sendDelonghiAc(getRaw(), kDelonghiAcBits, repeat); +} +#endif // SEND_DELONGHI_AC + +uint8_t IRDelonghiAc::calcChecksum(const uint64_t state) { + uint8_t sum = 0; + // Add up all the 8 bit chunks except for Most-significant 8 bits. + for (uint8_t offset = 0; offset < kDelonghiAcChecksumOffset; offset += 8) { + sum += GETBITS64(state, offset, 8); + } + return sum; +} + +bool IRDelonghiAc::validChecksum(const uint64_t state) { + return (GETBITS64(state, kDelonghiAcChecksumOffset, + kDelonghiAcChecksumSize) == + IRDelonghiAc::calcChecksum(state)); +} + +void IRDelonghiAc::checksum(void) { + setBits(&remote_state, kDelonghiAcChecksumOffset, kDelonghiAcChecksumSize, + calcChecksum(remote_state)); +} + +void IRDelonghiAc::stateReset(void) { + remote_state = 0x5400000000000153; + _saved_temp = 23; // DegC (Random reasonable default value) + _saved_temp_units = 0; // Celsius +} + +uint64_t IRDelonghiAc::getRaw(void) { + checksum(); // Ensure correct bit array before returning + return remote_state; +} + +void IRDelonghiAc::setRaw(const uint64_t state) { remote_state = state; } + +void IRDelonghiAc::on(void) { setPower(true); } + +void IRDelonghiAc::off(void) { setPower(false); } + +void IRDelonghiAc::setPower(const bool on) { + setBit(&remote_state, kDelonghiAcPowerBit, on); +} + +bool IRDelonghiAc::getPower(void) { + return GETBIT64(remote_state, kDelonghiAcPowerBit); +} + +void IRDelonghiAc::setTempUnit(const bool fahrenheit) { + setBit(&remote_state, kDelonghiAcTempUnitBit, fahrenheit); +} + +bool IRDelonghiAc::getTempUnit(void) { + return GETBIT64(remote_state, kDelonghiAcTempUnitBit); +} + +// Set the temp in deg C +void IRDelonghiAc::setTemp(const uint8_t degrees, const bool fahrenheit, + const bool force) { + uint8_t temp; + if (force) { + temp = degrees; // We've been asked to force set this value. + } else { + uint8_t temp_min = kDelonghiAcTempMinC; + uint8_t temp_max = kDelonghiAcTempMaxC; + setTempUnit(fahrenheit); + if (fahrenheit) { + temp_min = kDelonghiAcTempMinF; + temp_max = kDelonghiAcTempMaxF; + } + temp = std::max(temp_min, degrees); + temp = std::min(temp_max, temp); + _saved_temp = temp; + _saved_temp_units = fahrenheit; + temp = temp - temp_min + 1; + } + setBits(&remote_state, kDelonghiAcTempOffset, kDelonghiAcTempSize, + temp); +} + +uint8_t IRDelonghiAc::getTemp(void) { + return GETBITS64(remote_state, kDelonghiAcTempOffset, kDelonghiAcTempSize) + + (getTempUnit() ? kDelonghiAcTempMinF : kDelonghiAcTempMinC) - 1; +} + +// Set the speed of the fan +void IRDelonghiAc::setFan(const uint8_t speed) { + // Mode fan speed rules. + switch (getMode()) { + case kDelonghiAcFan: + // Fan mode can't have auto fan speed. + if (speed == kDelonghiAcFanAuto) { + if (getFan() == kDelonghiAcFanAuto) setFan(kDelonghiAcFanHigh); + return; + } + break; + case kDelonghiAcAuto: + case kDelonghiAcDry: + // Auto & Dry modes only allows auto fan speed. + if (speed != kDelonghiAcFanAuto) { + setFan(kDelonghiAcFanAuto); + return; + } + break; + } + // Bounds check enforcement + if (speed > kDelonghiAcFanLow) + setFan(kDelonghiAcFanAuto); + else + setBits(&remote_state, kDelonghiAcFanOffset, kDelonghiAcFanSize, speed); +} + +uint8_t IRDelonghiAc::getFan(void) { + return GETBITS64(remote_state, kDelonghiAcFanOffset, kDelonghiAcFanSize); +} + +// Convert a standard A/C Fan speed into its native fan speed. +uint8_t IRDelonghiAc::convertFan(const stdAc::fanspeed_t speed) { + switch (speed) { + case stdAc::fanspeed_t::kMin: + case stdAc::fanspeed_t::kLow: + return kDelonghiAcFanLow; + case stdAc::fanspeed_t::kMedium: + return kDelonghiAcFanMedium; + case stdAc::fanspeed_t::kHigh: + case stdAc::fanspeed_t::kMax: + return kDelonghiAcFanHigh; + default: + return kDelonghiAcFanAuto; + } +} + +// Convert a native fan speed to it's common equivalent. +stdAc::fanspeed_t IRDelonghiAc::toCommonFanSpeed(const uint8_t speed) { + switch (speed) { + case kDelonghiAcFanHigh: return stdAc::fanspeed_t::kMax; + case kDelonghiAcFanMedium: return stdAc::fanspeed_t::kMedium; + case kDelonghiAcFanLow: return stdAc::fanspeed_t::kMin; + default: return stdAc::fanspeed_t::kAuto; + } +} + +uint8_t IRDelonghiAc::getMode(void) { + return GETBITS64(remote_state, kDelonghiAcModeOffset, kDelonghiAcModeSize); +} + +void IRDelonghiAc::setMode(const uint8_t mode) { + switch (mode) { + case kDelonghiAcAuto: + case kDelonghiAcDry: + // Set special temp for these modes. + setTemp(kDelonghiAcTempAutoDryMode, getTempUnit(), true); + break; + case kDelonghiAcFan: + // Set special temp for this mode. + setTemp(kDelonghiAcTempFanMode, getTempUnit(), true); + break; + case kDelonghiAcCool: + break; + default: + this->setMode(kDelonghiAcAuto); + return; + } + setBits(&remote_state, kDelonghiAcModeOffset, kDelonghiAcModeSize, mode); + setFan(getFan()); // Re-force any fan speed constraints. + // Restore previous temp settings for cool mode. + if (mode == kDelonghiAcCool) setTemp(_saved_temp, _saved_temp_units); +} + +// Convert a standard A/C mode into its native mode. +uint8_t IRDelonghiAc::convertMode(const stdAc::opmode_t mode) { + switch (mode) { + case stdAc::opmode_t::kCool: + return kDelonghiAcCool; + case stdAc::opmode_t::kDry: + return kDelonghiAcDry; + case stdAc::opmode_t::kFan: + return kDelonghiAcFan; + default: + return kDelonghiAcAuto; + } +} + +// Convert a native mode to it's common equivalent. +stdAc::opmode_t IRDelonghiAc::toCommonMode(const uint8_t mode) { + switch (mode) { + case kDelonghiAcCool: return stdAc::opmode_t::kCool; + case kDelonghiAcDry: return stdAc::opmode_t::kDry; + case kDelonghiAcFan: return stdAc::opmode_t::kFan; + default: return stdAc::opmode_t::kAuto; + } +} + +// Aka Turbo. +void IRDelonghiAc::setBoost(const bool on) { + setBit(&remote_state, kDelonghiAcBoostBit, on); +} + +// Aka Turbo. +bool IRDelonghiAc::getBoost(void) { + return GETBIT64(remote_state, kDelonghiAcBoostBit); +} + +void IRDelonghiAc::setSleep(const bool on) { + setBit(&remote_state, kDelonghiAcSleepBit, on); +} + +bool IRDelonghiAc::getSleep(void) { + return GETBIT64(remote_state, kDelonghiAcSleepBit); +} + +void IRDelonghiAc::setOnTimerEnabled(const bool on) { + setBit(&remote_state, kDelonghiAcOnTimerEnableBit, on); +} + +bool IRDelonghiAc::getOnTimerEnabled(void) { + return GETBIT64(remote_state, kDelonghiAcOnTimerEnableBit); +} + +// Set the On timer to activate in nr of minutes. +// Args: +// nr_of_mins: Total nr of mins to wait before waking the device. +// (Max 23 hrs and 59 minutes. i.e. 1439 mins) +void IRDelonghiAc::setOnTimer(const uint16_t nr_of_mins) { + uint16_t value = std::min(kDelonghiAcTimerMax, nr_of_mins); + setBits(&remote_state, kDelonghiAcOnTimerMinsOffset, kDelonghiAcMinsSize, + value % 60); // Minutes. + setBits(&remote_state, kDelonghiAcOnTimerHoursOffset, kDelonghiAcHoursSize, + value / 60); // Hours. + // Enable or not? + setOnTimerEnabled(value > 0); +} + +uint16_t IRDelonghiAc::getOnTimer(void) { + return GETBITS64(remote_state, kDelonghiAcOnTimerHoursOffset, + kDelonghiAcHoursSize) * 60 + + GETBITS64(remote_state, kDelonghiAcOnTimerMinsOffset, + kDelonghiAcMinsSize); +} + +void IRDelonghiAc::setOffTimerEnabled(const bool on) { + setBit(&remote_state, kDelonghiAcOffTimerEnableBit, on); +} + +bool IRDelonghiAc::getOffTimerEnabled(void) { + return GETBIT64(remote_state, kDelonghiAcOffTimerEnableBit); +} + +// Set the Off timer to activate in nr of minutes. +// Args: +// nr_of_mins: Total nr of mins to wait before waking the device. +// (Max 23 hrs and 59 minutes. i.e. 1439 mins) +void IRDelonghiAc::setOffTimer(const uint16_t nr_of_mins) { + uint16_t value = std::min(kDelonghiAcTimerMax, nr_of_mins); + setBits(&remote_state, kDelonghiAcOffTimerMinsOffset, kDelonghiAcMinsSize, + value % 60); // Minutes. + setBits(&remote_state, kDelonghiAcOffTimerHoursOffset, kDelonghiAcHoursSize, + value / 60); // Hours. + // Enable or not? + setOffTimerEnabled(value > 0); +} + +uint16_t IRDelonghiAc::getOffTimer(void) { + return GETBITS64(remote_state, kDelonghiAcOffTimerHoursOffset, + kDelonghiAcHoursSize) * 60 + + GETBITS64(remote_state, kDelonghiAcOffTimerMinsOffset, + kDelonghiAcMinsSize); +} + +// Convert the A/C state to it's common equivalent. +stdAc::state_t IRDelonghiAc::toCommon(void) { + stdAc::state_t result; + result.protocol = decode_type_t::DELONGHI_AC; + result.power = getPower(); + // result.mode = this->toCommonMode(this->getMode()); + result.celsius = getTempUnit(); + result.degrees = getTemp(); + result.fanspeed = toCommonFanSpeed(this->getFan()); + result.turbo = getBoost(); + result.sleep = getSleep() ? 0 : -1; + // Not supported. + result.model = -1; + result.swingv = stdAc::swingv_t::kOff; + result.swingh = stdAc::swingh_t::kOff; + result.light = false; + result.filter = false; + result.econo = false; + result.quiet = false; + result.clean = false; + result.beep = false; + result.clock = -1; + return result; +} + +// Convert the internal state into a human readable string. +String IRDelonghiAc::toString(void) { + String result = ""; + result.reserve(80); // Reserve some heap for the string to reduce fragging. + result += addBoolToString(getPower(), kPowerStr, false); + result += addModeToString(getMode(), kDelonghiAcAuto, kDelonghiAcCool, + kDelonghiAcAuto, kDelonghiAcDry, kDelonghiAcFan); + result += addFanToString(getFan(), kDelonghiAcFanHigh, kDelonghiAcFanLow, + kDelonghiAcFanAuto, kDelonghiAcFanAuto, + kDelonghiAcFanMedium); + result += addTempToString(getTemp(), !getTempUnit()); + result += addBoolToString(getBoost(), kTurboStr); + result += addBoolToString(getSleep(), kSleepStr); + uint16_t mins = getOnTimer(); + result += addLabeledString((mins && getOnTimerEnabled()) ? minsToString(mins) + : kOffStr, + kOnTimerStr); + mins = getOffTimer(); + result += addLabeledString((mins && getOffTimerEnabled()) ? minsToString(mins) + : kOffStr, + kOffTimerStr); + return result; +} diff --git a/lib/IRremoteESP8266-2.7.7/src/ir_Delonghi.h b/lib/IRremoteESP8266-2.7.7/src/ir_Delonghi.h new file mode 100644 index 000000000..8ba8e90f4 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Delonghi.h @@ -0,0 +1,161 @@ +// Delonghi A/C +// +// Copyright 2020 David Conran + +#ifndef IR_DELONGHI_H_ +#define IR_DELONGHI_H_ + +#define __STDC_LIMIT_MACROS +#include +#ifndef UNIT_TEST +#include +#endif +#include "IRremoteESP8266.h" +#include "IRsend.h" +#ifdef UNIT_TEST +#include "IRsend_test.h" +#endif + +// Supports: +// Brand: Delonghi, Model: PAC A95 + +// Ref: +// https://github.com/crankyoldgit/IRremoteESP8266/issues/1096 + +// Kudos: +// TheMaxxz: For the breakdown and mapping of the bit values. + +/* State bit map: + ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+------+ +| FIXED HEADER | TEMPERATURE | FAN |F or C| ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+------+ + 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + ++--+--+--+--+-----+-----+ +|ON| MODE |Boost|Sleep| ++--+--+--+--+-----+-----+ +16 17 18 19 20 21 + ++--+--+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| 0| 0|Timer Enable| ON TIME HOUR | 0 0| ON TIME MIN | ++--+--+------------+--+--+--+--+--+--+--+--+--+--+--+--+--+ + 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 + ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| 0 0| OFF TIMER | CHECKSUM | ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 + +*/ + +// Constants +const uint8_t kDelonghiAcTempOffset = 8; +const uint8_t kDelonghiAcTempSize = 5; +const uint8_t kDelonghiAcTempMinC = 18; // Deg C +const uint8_t kDelonghiAcTempMaxC = 32; // Deg C +const uint8_t kDelonghiAcTempMinF = 64; // Deg F +const uint8_t kDelonghiAcTempMaxF = 90; // Deg F +const uint8_t kDelonghiAcTempAutoDryMode = 0; +const uint8_t kDelonghiAcTempFanMode = 0b00110; +const uint8_t kDelonghiAcFanOffset = kDelonghiAcTempOffset + + kDelonghiAcTempSize; // 13 +const uint8_t kDelonghiAcFanSize = 2; +const uint8_t kDelonghiAcFanAuto = 0b00; +const uint8_t kDelonghiAcFanHigh = 0b01; +const uint8_t kDelonghiAcFanMedium = 0b10; +const uint8_t kDelonghiAcFanLow = 0b11; +const uint8_t kDelonghiAcTempUnitBit = kDelonghiAcFanOffset + + kDelonghiAcFanSize; // 15 (1 = Celsius, 0 = Fahrenheit) +const uint8_t kDelonghiAcPowerBit = kDelonghiAcTempUnitBit + 1; // 16 +const uint8_t kDelonghiAcModeOffset = kDelonghiAcPowerBit + 1; // 17 +const uint8_t kDelonghiAcModeSize = 3; +const uint8_t kDelonghiAcCool = 0b000; +const uint8_t kDelonghiAcDry = 0b001; +const uint8_t kDelonghiAcFan = 0b010; +const uint8_t kDelonghiAcAuto = 0b100; +const uint8_t kDelonghiAcBoostBit = kDelonghiAcModeOffset + + kDelonghiAcModeSize; // 20 (Aka Turbo) +const uint8_t kDelonghiAcSleepBit = kDelonghiAcBoostBit + 1; // 21 +// Two zero bits +const uint8_t kDelonghiAcOnTimerEnableBit = kDelonghiAcSleepBit + 3; // 24 +const uint8_t kDelonghiAcHoursSize = 5; // Max 23 hrs +const uint8_t kDelonghiAcMinsSize = 6; // Max 59 mins +const uint16_t kDelonghiAcTimerMax = 23 * 60 + 59; +const uint8_t kDelonghiAcOnTimerHoursOffset = kDelonghiAcOnTimerEnableBit + + 1; // 25 +const uint8_t kDelonghiAcOnTimerMinsOffset = kDelonghiAcOnTimerHoursOffset + + kDelonghiAcHoursSize + 2; // 32 (inc another two zero bits) +// Two zero bits +const uint8_t kDelonghiAcOffTimerEnableBit = kDelonghiAcOnTimerMinsOffset + + kDelonghiAcMinsSize + 2; // 40 +const uint8_t kDelonghiAcOffTimerHoursOffset = kDelonghiAcOffTimerEnableBit + + 1; // 41 +const uint8_t kDelonghiAcOffTimerMinsOffset = kDelonghiAcOffTimerHoursOffset + + kDelonghiAcHoursSize + 2; // 48 (inc another two zero bits) +// Two zero bits +const uint8_t kDelonghiAcChecksumOffset = kDelonghiAcOffTimerMinsOffset + + kDelonghiAcMinsSize + 2; // 56 +const uint8_t kDelonghiAcChecksumSize = 8; + + +// Classes +class IRDelonghiAc { + public: + explicit IRDelonghiAc(const uint16_t pin, const bool inverted = false, + const bool use_modulation = true); + + void stateReset(); +#if SEND_DELONGHI_AC + void send(const uint16_t repeat = kDelonghiAcDefaultRepeat); + int8_t calibrate(void) { return _irsend.calibrate(); } +#endif // SEND_DELONGHI_AC + void begin(); + static uint8_t calcChecksum(const uint64_t state); + static bool validChecksum(const uint64_t state); + void setPower(const bool on); + bool getPower(); + void on(); + void off(); + void setTempUnit(const bool celsius); + bool getTempUnit(void); + void setTemp(const uint8_t temp, const bool fahrenheit = false, + const bool force = false); + uint8_t getTemp(); + void setFan(const uint8_t speed); + uint8_t getFan(); + void setMode(const uint8_t mode); + uint8_t getMode(); + void setBoost(const bool on); // Aka Turbo + bool getBoost(); // Aka Turbo + void setSleep(const bool on); + bool getSleep(); + void setOnTimerEnabled(const bool on); + bool getOnTimerEnabled(void); + void setOnTimer(const uint16_t nr_of_mins); + uint16_t getOnTimer(void); + void setOffTimerEnabled(const bool on); + bool getOffTimerEnabled(void); + void setOffTimer(const uint16_t nr_of_mins); + uint16_t getOffTimer(void); + uint64_t getRaw(); + void setRaw(const uint64_t state); + uint8_t convertMode(const stdAc::opmode_t mode); + uint8_t convertFan(const stdAc::fanspeed_t speed); + static stdAc::opmode_t toCommonMode(const uint8_t mode); + static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed); + stdAc::state_t toCommon(void); + String toString(); +#ifndef UNIT_TEST + + private: + IRsend _irsend; +#else + IRsendTest _irsend; +#endif + uint64_t remote_state; // The state of the IR remote. + uint8_t _saved_temp; // The previously user requested temp value. + uint8_t _saved_temp_units; // The previously user requested temp units. + void checksum(void); +}; +#endif // IR_DELONGHI_H_ diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Denon.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Denon.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Denon.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Denon.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Dish.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Dish.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Dish.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Dish.cpp diff --git a/lib/IRremoteESP8266-2.7.7/src/ir_Doshisha.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Doshisha.cpp new file mode 100644 index 000000000..7352c2c84 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Doshisha.cpp @@ -0,0 +1,132 @@ +// Copyright 2020 Christian (nikize) +// Support for Doshisha protocol + +#include "IRrecv.h" +#include "IRsend.h" +#include "IRutils.h" + +// Supports: +// Brand: Doshisha, Model: CZ-S32D LED Light +// Brand: Doshisha, Model: CZ-S38D LED Light +// Brand: Doshisha, Model: CZ-S50D LED Light +// Brand: Doshisha, Model: RCZ01 remote +// +// Ref: https://www.doshisha-led.com/ + +const uint16_t kDoshishaHdrMark = 3412; +const uint16_t kDoshishaHdrSpace = 1722; +const uint16_t kDoshishaBitMark = 420; +const uint16_t kDoshishaOneSpace = 1310; +const uint16_t kDoshishaZeroSpace = 452; +const uint16_t kDoshishaFreq = 38000; +const uint16_t kDoshishaOverhead = 3; + +// basic structure of bits, and mask +const uint64_t kRcz01CheckMask = 0xffffffff00; +const uint64_t kRcz01CheckExpected = 0x800B304800; +const uint8_t kRcz01CommandMask = 0xFE; +const uint8_t kRcz01ChannelMask = 0x01; + +// Known commands - Here for documentation rather than actual usage +const uint8_t kRcz01CommandSwitchChannel = 0xD2; +const uint8_t kRcz01CommandTimmer60 = 0x52; +const uint8_t kRcz01CommandTimmer30 = 0x92; +const uint8_t kRcz01CommandOff = 0xA0; + +const uint8_t kRcz01CommandLevelDown = 0x2C; +const uint8_t kRcz01CommandLevelUp = 0xCC; +// below are the only ones that turns it on +const uint8_t kRcz01CommandLevel1 = 0xA4; +const uint8_t kRcz01CommandLevel2 = 0x24; +const uint8_t kRcz01CommandLevel3 = 0xC4; +const uint8_t kRcz01CommandLevel4 = 0xD0; + +const uint8_t kRcz01CommandOn = 0xC0; +const uint8_t kRcz01CommandNightLight = 0xC8; +// end Known commands + +#if SEND_DOSHISHA +// Send an Doshisha formatted message. +// +// Args: +// data: The message to be sent. +// nbits: The number of bits of the message to be sent. +// Typically kDelonghiAcBits. +// repeat: The number of times the command is to be repeated. +// +// Status: STABLE / working on a real device. +void IRsend::sendDoshisha(const uint64_t data, const uint16_t nbits, + const uint16_t repeat) { + sendGeneric(kDoshishaHdrMark, kDoshishaHdrSpace, + kDoshishaBitMark, kDoshishaOneSpace, + kDoshishaBitMark, kDoshishaZeroSpace, + kDoshishaBitMark, kDefaultMessageGap, + data, nbits, kDoshishaFreq, true, repeat, kDutyDefault); +} + +// Encode Doshisha combining constant values with command and channel. +// +// Args: +// command: The commandcode to be sent. +// channel: The one bit channel 0 for CH1 and 1 for CH2 +// +// Status: STABLE / Working. +uint64_t IRsend::encodeDoshisha(const uint8_t command, const uint8_t channel) { + uint64_t data = kRcz01CheckExpected | + (command & kRcz01CommandMask) | + (channel & kRcz01ChannelMask); + return data; +} +#endif // SEND_DOSHISHA + +#if DECODE_DOSHISHA +// Decode the supplied Doshisha message. +// +// Args: +// results: Ptr to the data to decode and where to store the decode result. +// offset: The starting index to use when attempting to decode the raw data. +// Typically/Defaults to kStartOffset. +// nbits: The number of data bits to expect. Typically kDelonghiAcBits. +// strict: Flag indicating if we should perform strict matching. +// Returns: +// boolean: True if it can decode it, false if it can't. +// +// Status: STABLE / Expected to be working. +bool IRrecv::decodeDoshisha(decode_results *results, uint16_t offset, + const uint16_t nbits, const bool strict) { + if (strict && nbits != kDoshishaBits) + return false; + + uint64_t data = 0; + // Match Header + Data + if (!matchGeneric(results->rawbuf + offset, &data, + results->rawlen - offset, nbits, + kDoshishaHdrMark, kDoshishaHdrSpace, + kDoshishaBitMark, kDoshishaOneSpace, + kDoshishaBitMark, kDoshishaZeroSpace, + kDoshishaBitMark, 0, + true, kTolerance, kMarkExcess, true)) return false; + + // e.g. data = 0x800B3048C0, nbits = 40 + + // RCZ01 remote commands starts with a lead bit set + if ((data & kRcz01CheckMask) != kRcz01CheckExpected) { + DPRINT(" decodeDoshisha data "); + DPRINT(uint64ToString(data, 16)); + DPRINT(" masked "); + DPRINT(uint64ToString(data & kRcz01CheckMask, 16)); + DPRINT(" not matching "); + DPRINT(uint64ToString(kRcz01CheckExpected, 16)); + DPRINTLN(" ."); + return false; // expected lead bits not matching + } + + // Success + results->decode_type = decode_type_t::DOSHISHA; + results->bits = nbits; + results->value = data; + results->command = data & kRcz01CommandMask; + results->address = data & kRcz01ChannelMask; + return true; +} +#endif // DECODE_DOSHISHA diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Electra.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Electra.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Electra.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Electra.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Electra.h b/lib/IRremoteESP8266-2.7.7/src/ir_Electra.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_Electra.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Electra.h index 2d5fe09f5..0f0e119f7 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Electra.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Electra.h @@ -86,7 +86,7 @@ class IRElectraAc { void stateReset(void); #if SEND_ELECTRA_AC void send(const uint16_t repeat = kElectraAcMinRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_ELECTRA_AC void begin(void); void on(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Epson.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Epson.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Epson.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Epson.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Fujitsu.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Fujitsu.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Fujitsu.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Fujitsu.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Fujitsu.h b/lib/IRremoteESP8266-2.7.7/src/ir_Fujitsu.h similarity index 99% rename from lib/IRremoteESP8266-2.7.6/src/ir_Fujitsu.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Fujitsu.h index eae0edb8f..17e791ac8 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Fujitsu.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Fujitsu.h @@ -107,7 +107,7 @@ class IRFujitsuAC { void stateReset(void); #if SEND_FUJITSU_AC void send(const uint16_t repeat = kFujitsuAcMinRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_FUJITSU_AC void begin(void); void stepHoriz(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_GICable.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_GICable.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_GICable.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_GICable.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_GlobalCache.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_GlobalCache.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_GlobalCache.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_GlobalCache.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Goodweather.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Goodweather.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Goodweather.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Goodweather.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Goodweather.h b/lib/IRremoteESP8266-2.7.7/src/ir_Goodweather.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_Goodweather.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Goodweather.h index 8f1953581..7e1d6115d 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Goodweather.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Goodweather.h @@ -95,7 +95,7 @@ class IRGoodweatherAc { void stateReset(void); #if SEND_GOODWEATHER void send(const uint16_t repeat = kGoodweatherMinRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_GOODWEATHER void begin(void); void on(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Gree.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Gree.cpp similarity index 82% rename from lib/IRremoteESP8266-2.7.6/src/ir_Gree.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Gree.cpp index 81062d650..66eb3a2f0 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Gree.cpp +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Gree.cpp @@ -210,17 +210,60 @@ bool IRGreeAC::getPower(void) { return GETBIT8(remote_state[0], kGreePower1Offset); } -// Set the temp. in deg C -void IRGreeAC::setTemp(const uint8_t temp) { - uint8_t new_temp = std::max((uint8_t)kGreeMinTemp, temp); - new_temp = std::min((uint8_t)kGreeMaxTemp, new_temp); - if (getMode() == kGreeAuto) new_temp = 25; - setBits(&remote_state[1], kLowNibble, kGreeTempSize, new_temp - kGreeMinTemp); +/// Set the default temperature units to use. +/// @param[in] on Use Fahrenheit as the units. +/// true is Fahrenheit, false is Celsius. +void IRGreeAC::setUseFahrenheit(const bool on) { + setBit(&remote_state[3], kGreeUseFahrenheitOffset, on); } -// Return the set temp. in deg C +/// Get the default temperature units in use. +/// @return true is Fahrenheit, false is Celsius. +bool IRGreeAC::getUseFahrenheit(void) { + return GETBIT8(remote_state[3], kGreeUseFahrenheitOffset); +} + +/// Set the temp. in degrees +/// @param[in] temp Desired temperature in Degrees. +/// @param[in] fahrenheit Use units of Fahrenheit and set that as units used. +/// false is Celsius (Default), true is Fahrenheit. +/// @note The unit actually works in Celsius with a special optional +/// "extra degree" when sing Fahrenheit. +void IRGreeAC::setTemp(const uint8_t temp, const bool fahrenheit) { + float safecelsius = temp; + if (fahrenheit) + // Covert to F, and add a fudge factor to round to the expected degree. + // Why 0.6 you ask?! Because it works. Ya'd thing 0.5 would be good for + // rounding, but Noooooo! + safecelsius = fahrenheitToCelsius(temp + 0.6); + setUseFahrenheit(fahrenheit); // Set the correct Temp units. + + // Make sure we have desired temp in the correct range. + safecelsius = std::max(static_cast(kGreeMinTempC), safecelsius); + safecelsius = std::min(static_cast(kGreeMaxTempC), safecelsius); + // An operating mode of Auto locks the temp to a specific value. Do so. + if (getMode() == kGreeAuto) safecelsius = 25; + + // Set the "main" Celsius degrees. + setBits(&remote_state[1], kGreeTempOffset, kGreeTempSize, + safecelsius - kGreeMinTempC); + // Deal with the extra degree fahrenheit difference. + setBit(&remote_state[3], kGreeTempExtraDegreeFOffset, + (uint8_t)(safecelsius * 2) & 1); +} + +/// Return the set temperature +/// @return The temperature in degrees in the current units (C/F) set. uint8_t IRGreeAC::getTemp(void) { - return GETBITS8(remote_state[1], kLowNibble, kGreeTempSize) + kGreeMinTemp; + uint8_t deg = kGreeMinTempC + GETBITS8(remote_state[1], kGreeTempOffset, + kGreeTempSize); + if (getUseFahrenheit()) { + deg = celsiusToFahrenheit(deg); + // Retreive the "extra" fahrenheit from elsewhere in the code. + if (GETBIT8(remote_state[3], kGreeTempExtraDegreeFOffset)) deg++; + deg = std::max(deg, kGreeMinTempF); // Cover the fact that 61F is < 16C + } + return deg; } // Set the speed of the fan, 0-3, 0 is auto, 1-3 is the speed @@ -376,6 +419,28 @@ void IRGreeAC::setTimer(const uint16_t minutes) { hours % 10); } +/// Set temperature display mode. +/// i.e. Internal, External temperature sensing. +/// @param[in] mode The desired temp source to display. +/// @note In order for the A/C unit properly accept these settings. You must +/// cycle (send) in the following order: +/// kGreeDisplayTempOff(0) -> kGreeDisplayTempSet(1) -> +/// kGreeDisplayTempInside(2) ->kGreeDisplayTempOutside(3) -> +/// kGreeDisplayTempOff(0). +/// The unit will no behave correctly if the changes of this setting are sent +/// out of order. +/// Ref: https://github.com/crankyoldgit/IRremoteESP8266/issues/1118#issuecomment-628242152 +void IRGreeAC::setDisplayTempSource(const uint8_t mode) { + setBits(&remote_state[5], kGreeDisplayTempOffset, kGreeDisplayTempSize, mode); +} +/// Get the temperature display mode. +/// i.e. Internal, External temperature sensing. +/// @return The current temp source being displayed. +uint8_t IRGreeAC::getDisplayTempSource(void) { + return GETBITS8(remote_state[5], kGreeDisplayTempOffset, + kGreeDisplayTempSize); +} + // Convert a standard A/C mode into its native mode. uint8_t IRGreeAC::convertMode(const stdAc::opmode_t mode) { switch (mode) { @@ -451,7 +516,7 @@ stdAc::state_t IRGreeAC::toCommon(void) { result.model = this->getModel(); result.power = this->getPower(); result.mode = this->toCommonMode(this->getMode()); - result.celsius = true; + result.celsius = !this->getUseFahrenheit(); result.degrees = this->getTemp(); result.fanspeed = this->toCommonFanSpeed(this->getFan()); if (this->getSwingVerticalAuto()) @@ -475,12 +540,12 @@ stdAc::state_t IRGreeAC::toCommon(void) { // Convert the internal state into a human readable string. String IRGreeAC::toString(void) { String result = ""; - result.reserve(150); // Reserve some heap for the string to reduce fragging. + result.reserve(220); // Reserve some heap for the string to reduce fragging. result += addModelToString(decode_type_t::GREE, getModel(), false); result += addBoolToString(getPower(), kPowerStr); result += addModeToString(getMode(), kGreeAuto, kGreeCool, kGreeHeat, kGreeDry, kGreeFan); - result += addTempToString(getTemp()); + result += addTempToString(getTemp(), !getUseFahrenheit()); result += addFanToString(getFan(), kGreeFanMax, kGreeFanMin, kGreeFanAuto, kGreeFanAuto, kGreeFanMed); result += addBoolToString(getTurbo(), kTurboStr); @@ -505,6 +570,25 @@ String IRGreeAC::toString(void) { result += ')'; result += addLabeledString( getTimerEnabled() ? minsToString(getTimer()) : kOffStr, kTimerStr); + uint8_t src = getDisplayTempSource(); + result += addIntToString(src, kDisplayTempStr); + result += kSpaceLBraceStr; + switch (src) { + case kGreeDisplayTempOff: + result += kOffStr; + break; + case kGreeDisplayTempSet: + result += kSetStr; + break; + case kGreeDisplayTempInside: + result += kInsideStr; + break; + case kGreeDisplayTempOutside: + result += kOutsideStr; + break; + default: result += kUnknownStr; + } + result += ')'; return result; } diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Gree.h b/lib/IRremoteESP8266-2.7.7/src/ir_Gree.h similarity index 74% rename from lib/IRremoteESP8266-2.7.6/src/ir_Gree.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Gree.h index 14cd7b84a..4748c4769 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Gree.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Gree.h @@ -8,6 +8,8 @@ // Brand: RusClimate, Model: YAW1F remote // Brand: Green, Model: YBOFB remote // Brand: Green, Model: YBOFB2 remote +// Brand: Gree, Model: YAA1FBF remote +// Brand: Gree, Model: YB1F2F remote #ifndef IR_GREE_H_ #define IR_GREE_H_ @@ -31,7 +33,7 @@ const uint8_t kGreeDry = 2; const uint8_t kGreeFan = 3; const uint8_t kGreeHeat = 4; -// Byte 0 +// Byte[0] const uint8_t kGreePower1Offset = 3; const uint8_t kGreeFanOffset = 4; const uint8_t kGreeFanSize = 2; // Bits @@ -41,17 +43,19 @@ const uint8_t kGreeFanMed = 2; const uint8_t kGreeFanMax = 3; const uint8_t kGreeSwingAutoOffset = 6; const uint8_t kGreeSleepOffset = 7; -// Byte 1 -const uint8_t kGreeTempSize = 4; -const uint8_t kGreeMinTemp = 16; // Celsius -const uint8_t kGreeMaxTemp = 30; // Celsius -const uint8_t kGreeTimerHalfHrOffset = 4; +// Byte[1] +const uint8_t kGreeTempOffset = 0; +const uint8_t kGreeTempSize = 4; // Mask 0b0000xxxx +const uint8_t kGreeMinTempC = 16; // Celsius +const uint8_t kGreeMaxTempC = 30; // Celsius +const uint8_t kGreeMinTempF = 61; // Fahrenheit +const uint8_t kGreeMaxTempF = 86; // Fahrenheit +const uint8_t kGreeTimerHalfHrOffset = 4; // Mask 0b000x0000 const uint8_t kGreeTimerTensHrOffset = 5; -const uint8_t kGreeTimerTensHrSize = 2; // Bits +const uint8_t kGreeTimerTensHrSize = 2; // Mask 0b0xx00000 const uint16_t kGreeTimerMax = 24 * 60; -const uint8_t kGreeTimerEnabledOffset = 7; - -// Byte 2 +const uint8_t kGreeTimerEnabledOffset = 7; // Mask 0bx0000000 +// Byte[2] const uint8_t kGreeTimerHoursOffset = 0; const uint8_t kGreeTimerHoursSize = 4; // Bits const uint8_t kGreeTurboOffset = 4; @@ -59,7 +63,10 @@ const uint8_t kGreeLightOffset = 5; // This might not be used. See #814 const uint8_t kGreePower2Offset = 6; const uint8_t kGreeXfanOffset = 7; -// Byte 4 +// Byte[3] +const uint8_t kGreeTempExtraDegreeFOffset = 2; // Mask 0b00000x00 +const uint8_t kGreeUseFahrenheitOffset = 3; // Mask 0b0000x000 +// Byte[4] const uint8_t kGreeSwingSize = 4; // Bits const uint8_t kGreeSwingLastPos = 0b0000; const uint8_t kGreeSwingAuto = 0b0001; @@ -71,9 +78,16 @@ const uint8_t kGreeSwingDown = 0b0110; const uint8_t kGreeSwingDownAuto = 0b0111; const uint8_t kGreeSwingMiddleAuto = 0b1001; const uint8_t kGreeSwingUpAuto = 0b1011; -// byte 5 -const uint8_t kGreeIFeelOffset = 2; -const uint8_t kGreeWiFiOffset = 6; +// Byte[5] +const uint8_t kGreeWiFiOffset = 6; // Mask 0b0x000000 +const uint8_t kGreeIFeelOffset = 2; // Mask 0b00000x00 +const uint8_t kGreeDisplayTempOffset = 0; +const uint8_t kGreeDisplayTempSize = 2; // Mask 0b000000xx +const uint8_t kGreeDisplayTempOff = 0b00; // 0 +const uint8_t kGreeDisplayTempSet = 0b01; // 1 +const uint8_t kGreeDisplayTempInside = 0b10; // 2 +const uint8_t kGreeDisplayTempOutside = 0b11; // 3 + // Legacy defines. #define GREE_AUTO kGreeAuto @@ -81,8 +95,8 @@ const uint8_t kGreeWiFiOffset = 6; #define GREE_DRY kGreeDry #define GREE_FAN kGreeFan #define GREE_HEAT kGreeHeat -#define GREE_MIN_TEMP kGreeMinTemp -#define GREE_MAX_TEMP kGreeMaxTemp +#define GREE_MIN_TEMP kGreeMinTempC +#define GREE_MAX_TEMP kGreeMaxTempC #define GREE_FAN_MAX kGreeFanMax #define GREE_SWING_LAST_POS kGreeSwingLastPos #define GREE_SWING_AUTO kGreeSwingAuto @@ -106,7 +120,7 @@ class IRGreeAC { void stateReset(void); #if SEND_GREE void send(const uint16_t repeat = kGreeDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_GREE void begin(void); void on(void); @@ -115,8 +129,10 @@ class IRGreeAC { gree_ac_remote_model_t getModel(void); void setPower(const bool on); bool getPower(void); - void setTemp(const uint8_t temp); + void setTemp(const uint8_t temp, const bool fahrenheit = false); uint8_t getTemp(void); + void setUseFahrenheit(const bool on); + bool getUseFahrenheit(void); void setFan(const uint8_t speed); uint8_t getFan(void); void setMode(const uint8_t new_mode); @@ -138,6 +154,8 @@ class IRGreeAC { uint8_t getSwingVerticalPosition(void); uint16_t getTimer(void); void setTimer(const uint16_t minutes); + void setDisplayTempSource(const uint8_t mode); + uint8_t getDisplayTempSource(void); uint8_t convertMode(const stdAc::opmode_t mode); uint8_t convertFan(const stdAc::fanspeed_t speed); uint8_t convertSwingV(const stdAc::swingv_t swingv); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Haier.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Haier.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Haier.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Haier.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Haier.h b/lib/IRremoteESP8266-2.7.7/src/ir_Haier.h similarity index 99% rename from lib/IRremoteESP8266-2.7.6/src/ir_Haier.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Haier.h index 587c4c560..92eb3b05c 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Haier.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Haier.h @@ -217,7 +217,7 @@ class IRHaierAC { #if SEND_HAIER_AC void send(const uint16_t repeat = kHaierAcDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_HAIER_AC void begin(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Hitachi.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Hitachi.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Hitachi.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Hitachi.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Hitachi.h b/lib/IRremoteESP8266-2.7.7/src/ir_Hitachi.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_Hitachi.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Hitachi.h index 0db3552ff..47fbb9b02 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Hitachi.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Hitachi.h @@ -147,7 +147,7 @@ class IRHitachiAc { void stateReset(void); #if SEND_HITACHI_AC void send(const uint16_t repeat = kHitachiAcDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_HITACHI_AC void begin(void); void on(void); @@ -198,7 +198,7 @@ class IRHitachiAc1 { void stateReset(void); #if SEND_HITACHI_AC1 void send(const uint16_t repeat = kHitachiAcDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_HITACHI_AC1 void begin(void); void on(void); @@ -260,7 +260,7 @@ class IRHitachiAc424 { void stateReset(void); #if SEND_HITACHI_AC424 void send(const uint16_t repeat = kHitachiAcDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_HITACHI_AC424 void begin(void); void on(void); @@ -307,7 +307,7 @@ class IRHitachiAc3 { void stateReset(void); #if SEND_HITACHI_AC3 void send(const uint16_t repeat = kHitachiAcDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_HITACHI_AC3 void begin(void); uint8_t getMode(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Inax.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Inax.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Inax.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Inax.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_JVC.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_JVC.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_JVC.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_JVC.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Kelvinator.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Kelvinator.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Kelvinator.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Kelvinator.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Kelvinator.h b/lib/IRremoteESP8266-2.7.7/src/ir_Kelvinator.h similarity index 99% rename from lib/IRremoteESP8266-2.7.6/src/ir_Kelvinator.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Kelvinator.h index fac26bf2e..cd3a000dd 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Kelvinator.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Kelvinator.h @@ -141,7 +141,7 @@ class IRKelvinatorAC { void stateReset(void); #if SEND_KELVINATOR void send(const uint16_t repeat = kKelvinatorDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_KELVINATOR void begin(void); void on(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_LG.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_LG.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_LG.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_LG.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_LG.h b/lib/IRremoteESP8266-2.7.7/src/ir_LG.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_LG.h rename to lib/IRremoteESP8266-2.7.7/src/ir_LG.h index 1147b30b7..64b6a0b7c 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_LG.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_LG.h @@ -67,7 +67,7 @@ class IRLgAc { bool isValidLgAc(void); #if SEND_LG void send(const uint16_t repeat = kLgDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_LG void begin(void); void on(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Lasertag.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Lasertag.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Lasertag.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Lasertag.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Lego.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Lego.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Lego.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Lego.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Lutron.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Lutron.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Lutron.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Lutron.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_MWM.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_MWM.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_MWM.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_MWM.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Magiquest.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Magiquest.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Magiquest.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Magiquest.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Magiquest.h b/lib/IRremoteESP8266-2.7.7/src/ir_Magiquest.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Magiquest.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Magiquest.h diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Midea.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Midea.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Midea.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Midea.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Midea.h b/lib/IRremoteESP8266-2.7.7/src/ir_Midea.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_Midea.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Midea.h index af005d729..be43a4df6 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Midea.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Midea.h @@ -74,7 +74,7 @@ class IRMideaAC { void stateReset(void); #if SEND_MIDEA void send(const uint16_t repeat = kMideaMinRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_MIDEA void begin(void); void on(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Mitsubishi.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Mitsubishi.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Mitsubishi.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Mitsubishi.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Mitsubishi.h b/lib/IRremoteESP8266-2.7.7/src/ir_Mitsubishi.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_Mitsubishi.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Mitsubishi.h index 31021514f..b9cc7b349 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Mitsubishi.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Mitsubishi.h @@ -159,7 +159,7 @@ class IRMitsubishiAC { static bool validChecksum(const uint8_t* data); #if SEND_MITSUBISHI_AC void send(const uint16_t repeat = kMitsubishiACMinRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_MITSUBISHI_AC void begin(void); void on(void); @@ -217,7 +217,7 @@ class IRMitsubishi136 { void stateReset(void); #if SEND_MITSUBISHI136 void send(const uint16_t repeat = kMitsubishi136MinRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_MITSUBISHI136 void begin(void); static bool validChecksum(const uint8_t* data, @@ -267,7 +267,7 @@ class IRMitsubishi112 { void stateReset(void); #if SEND_MITSUBISHI112 void send(const uint16_t repeat = kMitsubishi112MinRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_MITSUBISHI112 void begin(void); void on(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_MitsubishiHeavy.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_MitsubishiHeavy.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_MitsubishiHeavy.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_MitsubishiHeavy.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_MitsubishiHeavy.h b/lib/IRremoteESP8266-2.7.7/src/ir_MitsubishiHeavy.h similarity index 99% rename from lib/IRremoteESP8266-2.7.6/src/ir_MitsubishiHeavy.h rename to lib/IRremoteESP8266-2.7.7/src/ir_MitsubishiHeavy.h index 2c2097d03..39c30e0ac 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_MitsubishiHeavy.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_MitsubishiHeavy.h @@ -133,7 +133,7 @@ class IRMitsubishiHeavy152Ac { void stateReset(void); #if SEND_MITSUBISHIHEAVY void send(const uint16_t repeat = kMitsubishiHeavy152MinRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_MITSUBISHIHEAVY void begin(void); void on(void); diff --git a/lib/IRremoteESP8266-2.7.7/src/ir_Multibrackets.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Multibrackets.cpp new file mode 100644 index 000000000..0a0dfbe71 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Multibrackets.cpp @@ -0,0 +1,128 @@ +// Copyright 2020 David Conran + +#include "IRrecv.h" +#include "IRsend.h" + +// Multibrackets protocol. +// +// Supports: +// Brand: Multibrackets, Model: Motorized Swing mount large - 4500 + +const uint16_t kMultibracketsTick = 5000; // uSeconds +const uint16_t kMultibracketsHdrMark = 3 * kMultibracketsTick; // uSeconds +const uint16_t kMultibracketsFooterSpace = 6 * kMultibracketsTick; // uSeconds +const uint8_t kMultibracketsTolerance = 5; // Percent +const uint16_t kMultibracketsFreq = 38000; // Hertz + +#if SEND_MULTIBRACKETS +// Send a Miltibrackets formatted message. +// +// Args: +// data: The message to be sent. +// nbits: The number of bits of the message to be sent. +// Typically kMultibracketsBits. +// repeat: The number of times the command is to be repeated. +// +// Status: BETA / Appears to be working. +// +// Ref: +// https://github.com/crankyoldgit/IRremoteESP8266/issues/1103 +// http://info.multibrackets.com/data/common/manuals/4500_code.pdf +void IRsend::sendMultibrackets(uint64_t data, uint16_t nbits, uint16_t repeat) { + enableIROut(kMultibracketsFreq); + for (uint16_t r = 0; r <= repeat; r++) { + uint16_t bits = nbits; + // Header + mark(kMultibracketsHdrMark); + // Data + // Send 0's until we get down to a bit size we can actually manage. + while (bits > sizeof(data) * 8) { + space(kMultibracketsTick); + bits--; + } + // Send the supplied data. + for (uint64_t mask = 1ULL << (bits - 1); mask; mask >>= 1) + if (data & mask) // Send a 1 + mark(kMultibracketsTick); + else // Send a 0 + space(kMultibracketsTick); + // Footer + space(kMultibracketsFooterSpace); + } +} +#endif // SEND_MULTIBRACKETS + +#if DECODE_MULTIBRACKETS +// Decode the Multibrackets message. +// +// Args: +// results: Ptr to the data to decode and where to store the decode result. +// offset: The starting index to use when attempting to decode the raw data. +// Typically/Defaults to kStartOffset. +// nbits: The number of data bits to expect. Typically kMultibracketsBits. +// strict: Flag indicating if we should perform strict matching. +// Returns: +// boolean: True if it can decode it, false if it can't. +// +// Status: BETA / Appears to be working. +// +// Ref: +// https://github.com/crankyoldgit/IRremoteESP8266/issues/1103 +// http://info.multibrackets.com/data/common/manuals/4500_code.pdf +bool IRrecv::decodeMultibrackets(decode_results *results, uint16_t offset, + const uint16_t nbits, const bool strict) { + // Compliance + if (strict && nbits != kMultibracketsBits) + return false; // Doesn't match our protocol defn. + + // Check there is enough unprocessed buffer left. + if (results->rawlen < offset) return false; + + // Header + int32_t remaining = *(results->rawbuf + offset); + if (!matchAtLeast(remaining, kMultibracketsHdrMark, kMultibracketsTolerance)) + return false; + remaining -= (kMultibracketsHdrMark / kRawTick); // Remove the header. + + // We are done with the header. Onto the data. + bool bit = true; + uint16_t bitsSoFar = 0; + uint64_t data = 0; + // Keep going till we run out of message or expected bits. + while (offset <= results->rawlen && bitsSoFar < nbits) { + // Have we finished processing this rawbuf value yet? + if (remaining <= 0) { // No more possible "bits" left in this value. + // Invert the bit for next time, and move along the rawbuf. + bit = !bit; + offset++; + // Load the next data point if there is one. + if (offset <= results->rawlen) remaining = *(results->rawbuf + offset); + } else { // Look for more bits in this entry. + if (matchAtLeast(remaining, kMultibracketsTick, + kMultibracketsTolerance)) { // There is! + data <<= 1; + data += bit; + bitsSoFar++; + } + remaining -= (kMultibracketsTick / kRawTick); // Remove the "bit". + } + } + + // Compliance + if (bitsSoFar != nbits) return false; + + // Footer + if (results->rawlen <= offset && !matchAtLeast(*(results->rawbuf + offset), + kMultibracketsFooterSpace, + kMultibracketsTolerance)) + return false; + + // Success + results->decode_type = decode_type_t::MULTIBRACKETS; + results->value = data; + results->bits = nbits; + results->address = 0; + results->command = 0; + return true; +} +#endif // DECODE_MULTIBRACKETS diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_NEC.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_NEC.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_NEC.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_NEC.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_NEC.h b/lib/IRremoteESP8266-2.7.7/src/ir_NEC.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_NEC.h rename to lib/IRremoteESP8266-2.7.7/src/ir_NEC.h diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Neoclima.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Neoclima.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Neoclima.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Neoclima.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Neoclima.h b/lib/IRremoteESP8266-2.7.7/src/ir_Neoclima.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_Neoclima.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Neoclima.h index 360c665d6..e1555e917 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Neoclima.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Neoclima.h @@ -92,7 +92,7 @@ class IRNeoclimaAc { void stateReset(void); #if SEND_NEOCLIMA void send(const uint16_t repeat = kNeoclimaMinRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_NEOCLIMA void begin(void); void setButton(const uint8_t button); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Nikai.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Nikai.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Nikai.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Nikai.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Panasonic.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Panasonic.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Panasonic.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Panasonic.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Panasonic.h b/lib/IRremoteESP8266-2.7.7/src/ir_Panasonic.h similarity index 99% rename from lib/IRremoteESP8266-2.7.6/src/ir_Panasonic.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Panasonic.h index 42e771fb3..c97f69fde 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Panasonic.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Panasonic.h @@ -102,7 +102,7 @@ class IRPanasonicAc { void stateReset(void); #if SEND_PANASONIC void send(const uint16_t repeat = kPanasonicAcDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_PANASONIC void begin(void); void on(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Pioneer.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Pioneer.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Pioneer.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Pioneer.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Pronto.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Pronto.cpp similarity index 93% rename from lib/IRremoteESP8266-2.7.6/src/ir_Pronto.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Pronto.cpp index 6b7a779de..4a9a45d97 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Pronto.cpp +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Pronto.cpp @@ -69,7 +69,7 @@ void IRsend::sendPronto(uint16_t data[], uint16_t len, uint16_t repeat) { uint16_t seq_1_start = kProntoDataOffset; uint16_t seq_2_start = kProntoDataOffset + seq_1_len; - uint32_t periodic_time = calcUSecPeriod(hz, false); + uint32_t periodic_time_x10 = calcUSecPeriod(hz / 10, false); // Normal (1st sequence) case. // Is there a first (normal) sequence to send? @@ -78,8 +78,8 @@ void IRsend::sendPronto(uint16_t data[], uint16_t len, uint16_t repeat) { if (seq_1_len + seq_1_start > len) return; // Send the contents of the 1st sequence. for (uint16_t i = seq_1_start; i < seq_1_start + seq_1_len; i += 2) { - mark(data[i] * periodic_time); - space(data[i + 1] * periodic_time); + mark((data[i] * periodic_time_x10) / 10); + space((data[i + 1] * periodic_time_x10) / 10); } } else { // There was no first sequence to send, it is implied that we have to send @@ -96,8 +96,8 @@ void IRsend::sendPronto(uint16_t data[], uint16_t len, uint16_t repeat) { // Send the contents of the 2nd sequence. for (uint16_t r = 0; r < repeat; r++) for (uint16_t i = seq_2_start; i < seq_2_start + seq_2_len; i += 2) { - mark(data[i] * periodic_time); - space(data[i + 1] * periodic_time); + mark((data[i] * periodic_time_x10) / 10); + space((data[i + 1] * periodic_time_x10) / 10); } } } diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_RC5_RC6.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_RC5_RC6.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_RC5_RC6.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_RC5_RC6.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_RCMM.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_RCMM.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_RCMM.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_RCMM.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Samsung.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Samsung.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Samsung.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Samsung.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Samsung.h b/lib/IRremoteESP8266-2.7.7/src/ir_Samsung.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_Samsung.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Samsung.h index 31b5ea181..9c9e6ab8e 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Samsung.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Samsung.h @@ -99,7 +99,7 @@ class IRSamsungAc { const bool calcchecksum = true); void sendOn(const uint16_t repeat = kSamsungAcDefaultRepeat); void sendOff(const uint16_t repeat = kSamsungAcDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_SAMSUNG_AC void begin(void); void on(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Sanyo.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Sanyo.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Sanyo.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Sanyo.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Sharp.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Sharp.cpp similarity index 71% rename from lib/IRremoteESP8266-2.7.6/src/ir_Sharp.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Sharp.cpp index 363271012..95a3de5cc 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Sharp.cpp +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Sharp.cpp @@ -46,6 +46,7 @@ using irutils::addIntToString; using irutils::addLabeledString; using irutils::addModeToString; using irutils::addTempToString; +using irutils::minsToString; using irutils::setBit; using irutils::setBits; @@ -324,6 +325,9 @@ void IRSharpAc::stateReset(void) { 0xAA, 0x5A, 0xCF, 0x10, 0x00, 0x01, 0x00, 0x00, 0x08, 0x80, 0x00, 0xE0, 0x01}; memcpy(remote, reset, kSharpAcStateLength); + _temp = getTemp(); + _mode = getMode(); + _fan = getFan(); } uint8_t *IRSharpAc::getRaw(void) { @@ -335,53 +339,74 @@ void IRSharpAc::setRaw(const uint8_t new_code[], const uint16_t length) { memcpy(remote, new_code, std::min(length, kSharpAcStateLength)); } -void IRSharpAc::setPreviousPower(const bool on) { - setBit(&remote[kSharpAcBytePower], kSharpAcBitPreviousPowerOffset, on); +void IRSharpAc::setPowerSpecial(const uint8_t value) { + setBits(&remote[kSharpAcBytePowerSpecial], kSharpAcPowerSetSpecialOffset, + kSharpAcPowerSpecialSize, value); } -bool IRSharpAc::getPreviousPower(void) { - return GETBIT8(remote[kSharpAcBytePower], kSharpAcBitPreviousPowerOffset); +uint8_t IRSharpAc::getPowerSpecial(void) { + return GETBITS8(remote[kSharpAcBytePowerSpecial], + kSharpAcPowerSetSpecialOffset, kSharpAcPowerSpecialSize); +} + +// Clear the "special"/non-normal bits in the power section. +// e.g. for normal/common command modes. +void IRSharpAc::clearPowerSpecial(void) { + setPowerSpecial(getPowerSpecial() & kSharpAcPowerOn); +} + +bool IRSharpAc::isPowerSpecial(void) { + switch (getPowerSpecial()) { + case kSharpAcPowerSetSpecialOff: + case kSharpAcPowerSetSpecialOn: + case kSharpAcPowerTimerSetting: return true; + default: return false; + } } void IRSharpAc::on(void) { setPower(true); } void IRSharpAc::off(void) { setPower(false); } -void IRSharpAc::setPower(const bool on) { - setPreviousPower(getPower()); - setBit(&remote[kSharpAcBytePower], kSharpAcBitPowerOffset, on); - setButton(kSharpAcButtonPowerMode); -} - -void IRSharpAc::setPower(const bool on, const bool prev) { - setPower(on); - setPreviousPower(prev); +void IRSharpAc::setPower(const bool on, const bool prev_on) { + setPowerSpecial(on ? (prev_on ? kSharpAcPowerOn : kSharpAcPowerOnFromOff) + : kSharpAcPowerOff); + // Power operations are incompatible with clean mode. + if (getClean()) setClean(false); + setSpecial(kSharpAcSpecialPower); } bool IRSharpAc::getPower(void) { - return GETBIT8(remote[kSharpAcBytePower], kSharpAcBitPowerOffset); -} - -void IRSharpAc::setButton(const uint8_t button) { - switch (button) { - case kSharpAcButtonPowerMode: - case kSharpAcButtonTemp: - case kSharpAcButtonFan: - setBits(&remote[kSharpAcByteButton], kSharpAcButtonOffset, - kSharpAcButtonSize, button); - break; - default: - setButton(kSharpAcButtonPowerMode); + switch (getPowerSpecial()) { + case kSharpAcPowerUnknown: + case kSharpAcPowerOff: return false; + default: return true; // Everything else is "probably" on. } } -uint8_t IRSharpAc::getButton(void) { - return GETBITS8(remote[kSharpAcByteButton], kSharpAcButtonOffset, - kSharpAcButtonSize); +void IRSharpAc::setSpecial(const uint8_t mode) { + switch (mode) { + case kSharpAcSpecialPower: + case kSharpAcSpecialTurbo: + case kSharpAcSpecialTempEcono: + case kSharpAcSpecialFan: + case kSharpAcSpecialSwing: + case kSharpAcSpecialTimer: + case kSharpAcSpecialTimerHalfHour: + remote[kSharpAcByteSpecial] = mode; + break; + default: + setSpecial(kSharpAcSpecialPower); + } } +uint8_t IRSharpAc::getSpecial(void) { return remote[kSharpAcByteSpecial]; } + // Set the temp in deg C -void IRSharpAc::setTemp(const uint8_t temp) { +// Args: +// temp: Desired Temperature (Celsius) +// save: Do we save this Temperature as a user set temp? (Default: true) +void IRSharpAc::setTemp(const uint8_t temp, const bool save) { switch (this->getMode()) { // Auto & Dry don't allow temp changes and have a special temp. case kSharpAcAuto: @@ -393,9 +418,11 @@ void IRSharpAc::setTemp(const uint8_t temp) { } uint8_t degrees = std::max(temp, kSharpAcMinTemp); degrees = std::min(degrees, kSharpAcMaxTemp); + if (save) _temp = degrees; setBits(&remote[kSharpAcByteTemp], kLowNibble, kNibbleSize, degrees - kSharpAcMinTemp); - setButton(kSharpAcButtonTemp); + setSpecial(kSharpAcSpecialTempEcono); + clearPowerSpecial(); } uint8_t IRSharpAc::getTemp(void) { @@ -407,25 +434,32 @@ uint8_t IRSharpAc::getMode(void) { return GETBITS8(remote[kSharpAcByteMode], kLowNibble, kSharpAcModeSize); } -void IRSharpAc::setMode(const uint8_t mode) { +void IRSharpAc::setMode(const uint8_t mode, const bool save) { switch (mode) { case kSharpAcAuto: case kSharpAcDry: - this->setFan(2); // When Dry or Auto, Fan always 2(Auto) - this->setTemp(0); // Dry/Auto have no temp setting. + // When Dry or Auto, Fan always 2(Auto) + this->setFan(kSharpAcFanAuto, false); // FALLTHRU case kSharpAcCool: case kSharpAcHeat: setBits(&remote[kSharpAcByteMode], kLowNibble, kSharpAcModeSize, mode); break; default: - this->setMode(kSharpAcAuto); + this->setMode(kSharpAcAuto, save); + return; } - setButton(kSharpAcButtonPowerMode); + // Dry/Auto have no temp setting. This step will enforce it. + this->setTemp(_temp, false); + // Save the mode in case we need to revert to it. eg. Clean + if (save) _mode = mode; + + setSpecial(kSharpAcSpecialPower); + clearPowerSpecial(); } // Set the speed of the fan -void IRSharpAc::setFan(const uint8_t speed) { +void IRSharpAc::setFan(const uint8_t speed, const bool save) { switch (speed) { case kSharpAcFanAuto: case kSharpAcFanMin: @@ -437,14 +471,123 @@ void IRSharpAc::setFan(const uint8_t speed) { break; default: this->setFan(kSharpAcFanAuto); + return; } - setButton(kSharpAcButtonFan); + if (save) _fan = speed; + setSpecial(kSharpAcSpecialFan); + clearPowerSpecial(); } uint8_t IRSharpAc::getFan(void) { return GETBITS8(remote[kSharpAcByteFan], kSharpAcFanOffset, kSharpAcFanSize); } +bool IRSharpAc::getTurbo(void) { + return (getPowerSpecial() == kSharpAcPowerSetSpecialOn) && + (getSpecial() == kSharpAcSpecialTurbo); +} + +// Note: If you use this method, you will need to send it before making +// other changes to the settings, as they may overwrite some of the bits +// used by this setting. +void IRSharpAc::setTurbo(const bool on) { + if (on) setFan(kSharpAcFanMax); + setPowerSpecial(on ? kSharpAcPowerSetSpecialOn : kSharpAcPowerSetSpecialOff); + setSpecial(kSharpAcSpecialTurbo); +} + +bool IRSharpAc::getSwingToggle(void) { + return GETBITS8(remote[kSharpAcByteSwing], kSharpAcSwingOffset, + kSharpAcSwingSize) == kSharpAcSwingToggle; +} + +void IRSharpAc::setSwingToggle(const bool on) { + setBits(&remote[kSharpAcByteSwing], kSharpAcSwingOffset, kSharpAcSwingSize, + on ? kSharpAcSwingToggle : kSharpAcSwingNoToggle); + if (on) setSpecial(kSharpAcSpecialSwing); +} + +bool IRSharpAc::getIon(void) { + return GETBIT8(remote[kSharpAcByteIon], kSharpAcBitIonOffset); +} + +void IRSharpAc::setIon(const bool on) { + setBit(&remote[kSharpAcByteIon], kSharpAcBitIonOffset, on); + clearPowerSpecial(); + if (on) setSpecial(kSharpAcSpecialSwing); +} + +bool IRSharpAc::getEconoToggle(void) { + return (getPowerSpecial() == kSharpAcPowerSetSpecialOn) && + (getSpecial() == kSharpAcSpecialTempEcono); +} + +// Warning: Probably incompatible with `setTurbo()` +void IRSharpAc::setEconoToggle(const bool on) { + if (on) setSpecial(kSharpAcSpecialTempEcono); + setPowerSpecial(on ? kSharpAcPowerSetSpecialOn : kSharpAcPowerSetSpecialOff); +} + +// Returns how long the timer is set for, in minutes. +uint16_t IRSharpAc::getTimerTime(void) { + return GETBITS8(remote[kSharpAcByteTimer], kSharpAcTimerHoursOffset, + kSharpAcTimerHoursSize) * kSharpAcTimerIncrement * 2 + + ((getSpecial() == kSharpAcSpecialTimerHalfHour) ? kSharpAcTimerIncrement + : 0); +} + +bool IRSharpAc::getTimerEnabled(void) { + return GETBIT8(remote[kSharpAcByteTimer], kSharpAcBitTimerEnabled); +} + +bool IRSharpAc::getTimerType(void) { + return GETBIT8(remote[kSharpAcByteTimer], kSharpAcBitTimerType); +} + +// Set or cancel the timer function. +// Args: +// enable: Is the timer to be enabled (true) or canceled(false)? +// timer_type: An On (true) or an Off (false). Ignored if canceled. +// mins: Nr. of minutes the timer is to be set to. +// Rounds down to 30 min increments. +// (max: 720 mins (12h), 0 is Off) +void IRSharpAc::setTimer(bool enable, bool timer_type, uint16_t mins) { + uint8_t half_hours = std::min(mins / kSharpAcTimerIncrement, + kSharpAcTimerHoursMax * 2); + if (half_hours == 0) enable = false; + if (!enable) { + half_hours = 0; + timer_type = kSharpAcOffTimerType; + } + setBit(&remote[kSharpAcByteTimer], kSharpAcBitTimerEnabled, enable); + setBit(&remote[kSharpAcByteTimer], kSharpAcBitTimerType, timer_type); + setBits(&remote[kSharpAcByteTimer], kSharpAcTimerHoursOffset, + kSharpAcTimerHoursSize, half_hours / 2); + // Handle non-round hours. + setSpecial((half_hours % 2) ? kSharpAcSpecialTimerHalfHour + : kSharpAcSpecialTimer); + setPowerSpecial(kSharpAcPowerTimerSetting); +} + +bool IRSharpAc::getClean(void) { + return GETBIT8(remote[kSharpAcByteClean], kSharpAcBitCleanOffset); +} + +// Note: Officially A/C unit needs to be "Off" before clean mode can be entered. +void IRSharpAc::setClean(const bool on) { + // Clean mode appears to be just default dry mode, with an extra bit set. + if (on) { + setMode(kSharpAcDry, false); + setPower(true, false); + } else { + // Restore the previous operation mode & fan speed. + setMode(_mode, false); + setFan(_fan, false); + } + setBit(&remote[kSharpAcByteClean], kSharpAcBitCleanOffset, on); + clearPowerSpecial(); +} + // Convert a standard A/C mode into its native mode. uint8_t IRSharpAc::convertMode(const stdAc::opmode_t mode) { switch (mode) { @@ -499,15 +642,16 @@ stdAc::state_t IRSharpAc::toCommon(void) { result.celsius = true; result.degrees = this->getTemp(); result.fanspeed = this->toCommonFanSpeed(this->getFan()); + result.turbo = this->getTurbo(); + result.swingv = this->getSwingToggle() ? stdAc::swingv_t::kAuto + : stdAc::swingv_t::kOff; + result.filter = this->getIon(); + result.econo = this->getEconoToggle(); + result.clean = this->getClean(); // Not supported. - result.swingv = stdAc::swingv_t::kOff; result.swingh = stdAc::swingh_t::kOff; result.quiet = false; - result.turbo = false; - result.clean = false; result.beep = false; - result.econo = false; - result.filter = false; result.light = false; result.sleep = -1; result.clock = -1; @@ -517,14 +661,23 @@ stdAc::state_t IRSharpAc::toCommon(void) { // Convert the internal state into a human readable string. String IRSharpAc::toString(void) { String result = ""; - result.reserve(80); // Reserve some heap for the string to reduce fragging. - result += addBoolToString(getPower(), kPowerStr, false); - result += addBoolToString(getPreviousPower(), kPreviousPowerStr); + result.reserve(135); // Reserve some heap for the string to reduce fragging. + result += addLabeledString(isPowerSpecial() ? "-" + : (getPower() ? kOnStr : kOffStr), + kPowerStr, false); result += addModeToString(getMode(), kSharpAcAuto, kSharpAcCool, kSharpAcHeat, kSharpAcDry, kSharpAcAuto); result += addTempToString(getTemp()); result += addFanToString(getFan(), kSharpAcFanMax, kSharpAcFanMin, kSharpAcFanAuto, kSharpAcFanAuto, kSharpAcFanMed); + result += addBoolToString(getTurbo(), kTurboStr); + result += addBoolToString(getSwingToggle(), kSwingVToggleStr); + result += addBoolToString(getIon(), kIonStr); + result += addLabeledString(getEconoToggle() ? kToggleStr : "-", kEconoStr); + result += addBoolToString(getClean(), kCleanStr); + if (getTimerEnabled()) + result += addLabeledString(minsToString(getTimerTime()), + getTimerType() ? kOnTimerStr : kOffTimerStr); return result; } diff --git a/lib/IRremoteESP8266-2.7.7/src/ir_Sharp.h b/lib/IRremoteESP8266-2.7.7/src/ir_Sharp.h new file mode 100644 index 000000000..31f340817 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Sharp.h @@ -0,0 +1,165 @@ +// Copyright 2019 crankyoldgit + +// Supports: +// Brand: Sharp, Model: LC-52D62U TV +// Brand: Sharp, Model: AY-ZP40KR A/C +// Brand: Sharp, Model: AH-AxSAY A/C +// Brand: Sharp, Model: AH-XP10NRY A/C +// Brand: Sharp, Model: CRMC-820JBEZ remote + +#ifndef IR_SHARP_H_ +#define IR_SHARP_H_ + +#ifndef UNIT_TEST +#include +#endif +#include "IRrecv.h" +#include "IRremoteESP8266.h" +#include "IRsend.h" +#ifdef UNIT_TEST +#include "IRsend_test.h" +#endif +#include "IRutils.h" + +// Constants +const uint16_t kSharpAcHdrMark = 3800; +const uint16_t kSharpAcHdrSpace = 1900; +const uint16_t kSharpAcBitMark = 470; +const uint16_t kSharpAcZeroSpace = 500; +const uint16_t kSharpAcOneSpace = 1400; +const uint32_t kSharpAcGap = kDefaultMessageGap; + +// Byte[4] +const uint8_t kSharpAcByteTemp = 4; +const uint8_t kSharpAcMinTemp = 15; // Celsius +const uint8_t kSharpAcMaxTemp = 30; // Celsius +// Byte[5] +const uint8_t kSharpAcBytePowerSpecial = 5; +const uint8_t kSharpAcPowerSetSpecialOffset = kHighNibble; // 0bxxxx0000 +const uint8_t kSharpAcPowerSpecialSize = kNibbleSize; // 0bxxxx0000 +const uint8_t kSharpAcPowerUnknown = 0; // 0b0000 +const uint8_t kSharpAcPowerOnFromOff = 1; // 0b0001 +const uint8_t kSharpAcPowerOff = 2; // 0b0010 +const uint8_t kSharpAcPowerOn = 3; // 0b0011 (Normal) +const uint8_t kSharpAcPowerSetSpecialOn = 6; // 0b0110 +const uint8_t kSharpAcPowerSetSpecialOff = 7; // 0b0111 +const uint8_t kSharpAcPowerTimerSetting = 8; // 0b1000 +// Byte[6] +const uint8_t kSharpAcByteMode = 6; +const uint8_t kSharpAcModeSize = 2; // Mask 0b000000xx; +const uint8_t kSharpAcAuto = 0b00; +const uint8_t kSharpAcDry = 0b11; +const uint8_t kSharpAcCool = 0b10; +const uint8_t kSharpAcHeat = 0b01; +const uint8_t kSharpAcByteClean = kSharpAcByteMode; +const uint8_t kSharpAcBitCleanOffset = 3; // Mask 0b0000x000 +const uint8_t kSharpAcByteFan = kSharpAcByteMode; +const uint8_t kSharpAcFanOffset = 4; // Mask 0b0xxx0000 +const uint8_t kSharpAcFanSize = 3; // Nr. of Bits +const uint8_t kSharpAcFanAuto = 0b010; // 2 +const uint8_t kSharpAcFanMin = 0b100; // 4 (FAN1) +const uint8_t kSharpAcFanMed = 0b011; // 3 (FAN2) +const uint8_t kSharpAcFanHigh = 0b101; // 5 (FAN3) +const uint8_t kSharpAcFanMax = 0b111; // 7 (FAN4) +// Byte[7] +const uint8_t kSharpAcByteTimer = 7; +const uint8_t kSharpAcTimerIncrement = 30; // Mins +const uint8_t kSharpAcTimerHoursOffset = kLowNibble; +const uint8_t kSharpAcTimerHoursSize = kNibbleSize; // Mask 0b0000xxxx +const uint8_t kSharpAcTimerHoursOff = 0b0000; +const uint8_t kSharpAcTimerHoursMax = 0b1100; // 12 +const uint8_t kSharpAcBitTimerType = 6; // Mask 0b0x000000 +const uint8_t kSharpAcOffTimerType = 0b0; +const uint8_t kSharpAcOnTimerType = 0b1; +const uint8_t kSharpAcBitTimerEnabled = 7; // Mask 0bx0000000 +// Byte[8] +const uint8_t kSharpAcByteSwing = 8; +const uint8_t kSharpAcSwingOffset = 0; +const uint8_t kSharpAcSwingSize = 3; // Mask 0b00000xxx +const uint8_t kSharpAcSwingToggle = 0b111; +const uint8_t kSharpAcSwingNoToggle = 0b000; +// Byte[10] +const uint8_t kSharpAcByteSpecial = 10; // Mask 0bxxxxxxxx +const uint8_t kSharpAcSpecialPower = 0x00; +const uint8_t kSharpAcSpecialTurbo = 0x01; +const uint8_t kSharpAcSpecialTempEcono = 0x04; +const uint8_t kSharpAcSpecialFan = 0x05; +const uint8_t kSharpAcSpecialSwing = 0x06; +const uint8_t kSharpAcSpecialTimer = 0xC0; +const uint8_t kSharpAcSpecialTimerHalfHour = 0xDE; +// Byte[11] +const uint8_t kSharpAcByteIon = 11; +const uint8_t kSharpAcBitIonOffset = 2; // Mask 0b00000x00 +// Byte[12] (Checksum) + + +class IRSharpAc { + public: + explicit IRSharpAc(const uint16_t pin, const bool inverted = false, + const bool use_modulation = true); + +#if SEND_SHARP_AC + void send(const uint16_t repeat = kSharpAcDefaultRepeat); + int8_t calibrate(void) { return _irsend.calibrate(); } +#endif // SEND_SHARP_AC + void begin(void); + void on(void); + void off(void); + void setPower(const bool on, const bool prev_on = true); + bool getPower(void); + bool isPowerSpecial(void); + void setTemp(const uint8_t temp, const bool save = true); + uint8_t getTemp(void); + void setFan(const uint8_t fan, const bool save = true); + uint8_t getFan(void); + void setMode(const uint8_t mode, const bool save = true); + uint8_t getMode(void); + void setSpecial(const uint8_t mode); + uint8_t getSpecial(void); + bool getTurbo(void); + void setTurbo(const bool on); + bool getSwingToggle(void); + void setSwingToggle(const bool on); + bool getIon(void); + void setIon(const bool on); + bool getEconoToggle(void); + void setEconoToggle(const bool on); + uint16_t getTimerTime(void); + bool getTimerEnabled(void); + bool getTimerType(void); + void setTimer(bool enable, bool timer_type, uint16_t mins); + bool getClean(void); + void setClean(const bool on); + uint8_t* getRaw(void); + void setRaw(const uint8_t new_code[], + const uint16_t length = kSharpAcStateLength); + static bool validChecksum(uint8_t state[], + const uint16_t length = kSharpAcStateLength); + static uint8_t convertMode(const stdAc::opmode_t mode); + static uint8_t convertFan(const stdAc::fanspeed_t speed); + static stdAc::opmode_t toCommonMode(const uint8_t mode); + static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed); + stdAc::state_t toCommon(void); + String toString(void); +#ifndef UNIT_TEST + + private: + IRsend _irsend; +#else + IRsendTest _irsend; +#endif + // # of bytes per command + uint8_t remote[kSharpAcStateLength]; + uint8_t _temp; // Saved copy of the desired temp. + uint8_t _mode; // Saved copy of the desired mode. + uint8_t _fan; // Saved copy of the desired fan speed. + void stateReset(void); + void checksum(void); + static uint8_t calcChecksum(uint8_t state[], + const uint16_t length = kSharpAcStateLength); + void setPowerSpecial(const uint8_t value); + uint8_t getPowerSpecial(void); + void clearPowerSpecial(void); +}; + +#endif // IR_SHARP_H_ diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Sherwood.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Sherwood.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Sherwood.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Sherwood.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Sony.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Sony.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Sony.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Sony.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Symphony.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Symphony.cpp similarity index 58% rename from lib/IRremoteESP8266-2.7.6/src/ir_Symphony.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Symphony.cpp index f0194fdb8..a65821c33 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Symphony.cpp +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Symphony.cpp @@ -4,6 +4,16 @@ // Supports: // Brand: Symphony, Model: Air Cooler 3Di +// Brand: SamHop, Model: SM3015 Fan Remote Control +// Brand: SamHop, Model: SM5021 Encoder chip +// Brand: SamHop, Model: SM5032 Decoder chip +// Brand: Blyss, Model: Owen-SW-5 3 Fan +// Brand: Blyss, Model: WP-YK8 090218 remote +// Brand: Westinghouse, Model: Ceiling fan +// Brand: Westinghouse, Model: 78095 Remote +// Brand: Satellite Electronic, Model: ID6 Remote +// Brand: Satellite Electronic, Model: JY199I Fan driver +// Brand: Satellite Electronic, Model: JY199I-L Fan driver #include #include "IRrecv.h" @@ -14,12 +24,12 @@ // Constants // Ref: // https://github.com/crankyoldgit/IRremoteESP8266/issues/1057 -const uint16_t kSymphonyZeroMark = 1250; -const uint16_t kSymphonyZeroSpace = 400; +const uint16_t kSymphonyZeroMark = 400; +const uint16_t kSymphonyZeroSpace = 1250; const uint16_t kSymphonyOneMark = kSymphonyZeroSpace; const uint16_t kSymphonyOneSpace = kSymphonyZeroMark; -const uint16_t kSymphonyFooterMark = kSymphonyOneMark; -const uint32_t kSymphonyFooterGap = 8000; +const uint32_t kSymphonyFooterGap = 4 * (kSymphonyZeroMark + + kSymphonyZeroSpace); #if SEND_SYMPHONY // Send a Symphony packet. @@ -33,11 +43,13 @@ const uint32_t kSymphonyFooterGap = 8000; // // Ref: // https://github.com/crankyoldgit/IRremoteESP8266/issues/1057 +// https://github.com/crankyoldgit/IRremoteESP8266/issues/1105 +// https://www.alldatasheet.com/datasheet-pdf/pdf/124369/ANALOGICTECH/SM5021B.html void IRsend::sendSymphony(uint64_t data, uint16_t nbits, uint16_t repeat) { sendGeneric(0, 0, kSymphonyOneMark, kSymphonyOneSpace, kSymphonyZeroMark, kSymphonyZeroSpace, - kSymphonyFooterMark, kSymphonyFooterGap, + 0, kSymphonyFooterGap, data, nbits, 38000, true, repeat, kDutyDefault); } #endif // SEND_SYMPHONY @@ -57,23 +69,25 @@ void IRsend::sendSymphony(uint64_t data, uint16_t nbits, uint16_t repeat) { // Status: STABLE / Should be working. // // Ref: -// +// https://github.com/crankyoldgit/IRremoteESP8266/issues/1057 +// https://github.com/crankyoldgit/IRremoteESP8266/issues/1105 +// https://www.alldatasheet.com/datasheet-pdf/pdf/124369/ANALOGICTECH/SM5021B.html bool IRrecv::decodeSymphony(decode_results *results, uint16_t offset, const uint16_t nbits, const bool strict) { uint64_t data = 0; - if (results->rawlen < 2 * nbits + kFooter + offset - 1) + if (results->rawlen < 2 * nbits + offset - 1) return false; // Not enough entries to ever be SYMPHONY. // Compliance if (strict && nbits != kSymphonyBits) return false; - if (!matchGeneric(results->rawbuf + offset, &data, results->rawlen - offset, - nbits, - 0, 0, // No Header - kSymphonyOneMark, kSymphonyOneSpace, - kSymphonyZeroMark, kSymphonyZeroSpace, - kSymphonyFooterMark, kSymphonyFooterGap, true, - _tolerance, 0)) + if (!matchGenericConstBitTime(results->rawbuf + offset, &data, + results->rawlen - offset, + nbits, + 0, 0, // No Header + kSymphonyOneMark, kSymphonyZeroMark, + 0, kSymphonyFooterGap, true, + _tolerance, 0)) return false; // Success diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Tcl.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Tcl.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Tcl.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Tcl.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Tcl.h b/lib/IRremoteESP8266-2.7.7/src/ir_Tcl.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_Tcl.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Tcl.h index 21e64a55a..3eef6838a 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Tcl.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Tcl.h @@ -63,7 +63,7 @@ class IRTcl112Ac { #if SEND_TCL112AC void send(const uint16_t repeat = kTcl112AcDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_TCL void begin(void); uint8_t* getRaw(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Teco.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Teco.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Teco.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Teco.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Teco.h b/lib/IRremoteESP8266-2.7.7/src/ir_Teco.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Teco.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Teco.h diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Toshiba.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Toshiba.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Toshiba.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Toshiba.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Toshiba.h b/lib/IRremoteESP8266-2.7.7/src/ir_Toshiba.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_Toshiba.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Toshiba.h index 7a679ceda..22fbd7240 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Toshiba.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Toshiba.h @@ -62,7 +62,7 @@ class IRToshibaAC { void stateReset(void); #if SEND_TOSHIBA_AC void send(const uint16_t repeat = kToshibaACMinRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_TOSHIBA_AC void begin(void); void on(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Trotec.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Trotec.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Trotec.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Trotec.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Trotec.h b/lib/IRremoteESP8266-2.7.7/src/ir_Trotec.h similarity index 98% rename from lib/IRremoteESP8266-2.7.6/src/ir_Trotec.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Trotec.h index f836b2e5e..cc7f0b2fd 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Trotec.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Trotec.h @@ -69,7 +69,7 @@ class IRTrotecESP { #if SEND_TROTEC void send(const uint16_t repeat = kTrotecDefaultRepeat); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_TROTEC void begin(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Vestel.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Vestel.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Vestel.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Vestel.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Vestel.h b/lib/IRremoteESP8266-2.7.7/src/ir_Vestel.h similarity index 99% rename from lib/IRremoteESP8266-2.7.6/src/ir_Vestel.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Vestel.h index 38727b805..5facdc278 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Vestel.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Vestel.h @@ -116,7 +116,7 @@ class IRVestelAc { void stateReset(void); #if SEND_VESTEL_AC void send(void); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_VESTEL_AC void begin(void); void on(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Whirlpool.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Whirlpool.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Whirlpool.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Whirlpool.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Whirlpool.h b/lib/IRremoteESP8266-2.7.7/src/ir_Whirlpool.h similarity index 99% rename from lib/IRremoteESP8266-2.7.6/src/ir_Whirlpool.h rename to lib/IRremoteESP8266-2.7.7/src/ir_Whirlpool.h index 11fd6949e..d0cf95bef 100644 --- a/lib/IRremoteESP8266-2.7.6/src/ir_Whirlpool.h +++ b/lib/IRremoteESP8266-2.7.7/src/ir_Whirlpool.h @@ -93,7 +93,7 @@ class IRWhirlpoolAc { #if SEND_WHIRLPOOL_AC void send(const uint16_t repeat = kWhirlpoolAcDefaultRepeat, const bool calcchecksum = true); - uint8_t calibrate(void) { return _irsend.calibrate(); } + int8_t calibrate(void) { return _irsend.calibrate(); } #endif // SEND_WHIRLPOOL_AC void begin(void); void on(void); diff --git a/lib/IRremoteESP8266-2.7.6/src/ir_Whynter.cpp b/lib/IRremoteESP8266-2.7.7/src/ir_Whynter.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/ir_Whynter.cpp rename to lib/IRremoteESP8266-2.7.7/src/ir_Whynter.cpp diff --git a/lib/IRremoteESP8266-2.7.6/src/locale/README.md b/lib/IRremoteESP8266-2.7.7/src/locale/README.md similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/locale/README.md rename to lib/IRremoteESP8266-2.7.7/src/locale/README.md diff --git a/lib/IRremoteESP8266-2.7.6/src/locale/de-CH.h b/lib/IRremoteESP8266-2.7.7/src/locale/de-CH.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/locale/de-CH.h rename to lib/IRremoteESP8266-2.7.7/src/locale/de-CH.h diff --git a/lib/IRremoteESP8266-2.7.6/src/locale/de-DE.h b/lib/IRremoteESP8266-2.7.7/src/locale/de-DE.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/locale/de-DE.h rename to lib/IRremoteESP8266-2.7.7/src/locale/de-DE.h diff --git a/lib/IRremoteESP8266-2.7.6/src/locale/defaults.h b/lib/IRremoteESP8266-2.7.7/src/locale/defaults.h similarity index 96% rename from lib/IRremoteESP8266-2.7.6/src/locale/defaults.h rename to lib/IRremoteESP8266-2.7.7/src/locale/defaults.h index f96595616..5df78f7b9 100644 --- a/lib/IRremoteESP8266-2.7.6/src/locale/defaults.h +++ b/lib/IRremoteESP8266-2.7.7/src/locale/defaults.h @@ -189,6 +189,9 @@ #ifndef D_STR_SENSOR #define D_STR_SENSOR "Sensor" #endif // D_STR_SENSOR +#ifndef D_STR_DISPLAY +#define D_STR_DISPLAY "Display" +#endif // D_STR_DISPLAY #ifndef D_STR_WEEKLY #define D_STR_WEEKLY "Weekly" #endif // D_STR_WEEKLY @@ -216,6 +219,9 @@ #ifndef D_STR_NA #define D_STR_NA "N/A" #endif // D_STR_NA +#ifndef D_STR_INSIDE +#define D_STR_INSIDE "Inside" +#endif // D_STR_INSIDE #ifndef D_STR_OUTSIDE #define D_STR_OUTSIDE "Outside" #endif // D_STR_OUTSIDE @@ -369,6 +375,9 @@ #ifndef D_STR_PREVIOUSPOWER #define D_STR_PREVIOUSPOWER D_STR_PREVIOUS " " D_STR_POWER #endif // D_STR_PREVIOUSPOWER +#ifndef D_STR_DISPLAYTEMP +#define D_STR_DISPLAYTEMP D_STR_DISPLAY " " D_STR_TEMP +#endif // D_STR_DISPLAYTEMP #ifndef D_STR_SENSORTEMP #define D_STR_SENSORTEMP D_STR_SENSOR " " D_STR_TEMP #endif // D_STR_SENSORTEMP @@ -466,6 +475,12 @@ #ifndef D_STR_CARRIER_AC #define D_STR_CARRIER_AC "CARRIER_AC" #endif // D_STR_CARRIER_AC +#ifndef D_STR_CARRIER_AC40 +#define D_STR_CARRIER_AC40 D_STR_CARRIER_AC "40" +#endif // D_STR_CARRIER_AC40 +#ifndef D_STR_CARRIER_AC64 +#define D_STR_CARRIER_AC64 D_STR_CARRIER_AC "64" +#endif // D_STR_CARRIER_AC64 #ifndef D_STR_COOLIX #define D_STR_COOLIX "COOLIX" #endif // D_STR_COOLIX @@ -493,12 +508,18 @@ #ifndef D_STR_DAIKIN64 #define D_STR_DAIKIN64 "DAIKIN64" #endif // D_STR_DAIKIN64 +#ifndef D_STR_DELONGHI_AC +#define D_STR_DELONGHI_AC "DELONGHI_AC" +#endif // D_STR_DELONGHI_AC #ifndef D_STR_DENON #define D_STR_DENON "DENON" #endif // D_STR_DENON #ifndef D_STR_DISH #define D_STR_DISH "DISH" #endif // D_STR_DISH +#ifndef D_STR_DOSHISHA +#define D_STR_DOSHISHA "DOSHISHA" +#endif // D_STR_DOSHISHA #ifndef D_STR_ELECTRA_AC #define D_STR_ELECTRA_AC "ELECTRA_AC" #endif // D_STR_ELECTRA_AC @@ -592,6 +613,9 @@ #ifndef D_STR_MITSUBISHI_HEAVY_88 #define D_STR_MITSUBISHI_HEAVY_88 "MITSUBISHI_HEAVY_88" #endif // D_STR_MITSUBISHI_HEAVY_88 +#ifndef D_STR_MULTIBRACKETS +#define D_STR_MULTIBRACKETS "MULTIBRACKETS" +#endif // D_STR_MULTIBRACKETS #ifndef D_STR_MWM #define D_STR_MWM "MWM" #endif // D_STR_MWM diff --git a/lib/IRremoteESP8266-2.7.6/src/locale/en-AU.h b/lib/IRremoteESP8266-2.7.7/src/locale/en-AU.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/locale/en-AU.h rename to lib/IRremoteESP8266-2.7.7/src/locale/en-AU.h diff --git a/lib/IRremoteESP8266-2.7.6/src/locale/en-IE.h b/lib/IRremoteESP8266-2.7.7/src/locale/en-IE.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/locale/en-IE.h rename to lib/IRremoteESP8266-2.7.7/src/locale/en-IE.h diff --git a/lib/IRremoteESP8266-2.7.6/src/locale/en-UK.h b/lib/IRremoteESP8266-2.7.7/src/locale/en-UK.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/locale/en-UK.h rename to lib/IRremoteESP8266-2.7.7/src/locale/en-UK.h diff --git a/lib/IRremoteESP8266-2.7.6/src/locale/en-US.h b/lib/IRremoteESP8266-2.7.7/src/locale/en-US.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/locale/en-US.h rename to lib/IRremoteESP8266-2.7.7/src/locale/en-US.h diff --git a/lib/IRremoteESP8266-2.7.6/src/locale/es-ES.h b/lib/IRremoteESP8266-2.7.7/src/locale/es-ES.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/locale/es-ES.h rename to lib/IRremoteESP8266-2.7.7/src/locale/es-ES.h diff --git a/lib/IRremoteESP8266-2.7.6/src/locale/fr-FR.h b/lib/IRremoteESP8266-2.7.7/src/locale/fr-FR.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/locale/fr-FR.h rename to lib/IRremoteESP8266-2.7.7/src/locale/fr-FR.h diff --git a/lib/IRremoteESP8266-2.7.6/src/locale/it-IT.h b/lib/IRremoteESP8266-2.7.7/src/locale/it-IT.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/locale/it-IT.h rename to lib/IRremoteESP8266-2.7.7/src/locale/it-IT.h diff --git a/lib/IRremoteESP8266-2.7.6/src/locale/zh-CN.h b/lib/IRremoteESP8266-2.7.7/src/locale/zh-CN.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/src/locale/zh-CN.h rename to lib/IRremoteESP8266-2.7.7/src/locale/zh-CN.h diff --git a/lib/IRremoteESP8266-2.7.6/test/IRac_test.cpp b/lib/IRremoteESP8266-2.7.7/test/IRac_test.cpp similarity index 97% rename from lib/IRremoteESP8266-2.7.6/test/IRac_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/IRac_test.cpp index 8ddf98b59..93b8a73cb 100644 --- a/lib/IRremoteESP8266-2.7.6/test/IRac_test.cpp +++ b/lib/IRremoteESP8266-2.7.7/test/IRac_test.cpp @@ -4,6 +4,7 @@ #include "ir_Amcor.h" #include "ir_Argo.h" #include "ir_Daikin.h" +#include "ir_Delonghi.h" #include "ir_Electra.h" #include "ir_Fujitsu.h" #include "ir_Goodweather.h" @@ -377,6 +378,31 @@ TEST(TestIRac, Daikin64) { ASSERT_EQ(expected, IRAcUtils::resultAcToString(&ac._irsend.capture)); } +TEST(TestIRac, DelonghiAc) { + IRDelonghiAc ac(kGpioUnused); + IRac irac(kGpioUnused); + IRrecv capture(kGpioUnused); + char expected[] = + "Power: On, Mode: 0 (Cool), Fan: 2 (Medium), Temp: 77F, " + "Turbo: On, Sleep: On, On Timer: Off, Off Timer: Off"; + + ac.begin(); + irac.delonghiac(&ac, + true, // Power + stdAc::opmode_t::kCool, // Mode + false, // Celsius (i.e. Fahrenheit) + 77, // Degrees (F) + stdAc::fanspeed_t::kMedium, // Fan Speed + true, // Turbo + 360); // Sleep + ASSERT_EQ(expected, ac.toString()); + ac._irsend.makeDecodeResult(); + EXPECT_TRUE(capture.decode(&ac._irsend.capture)); + ASSERT_EQ(decode_type_t::DELONGHI_AC, ac._irsend.capture.decode_type); + ASSERT_EQ(kDelonghiAcBits, ac._irsend.capture.bits); + ASSERT_EQ(expected, IRAcUtils::resultAcToString(&ac._irsend.capture)); +} + TEST(TestIRac, Electra) { IRElectraAc ac(kGpioUnused); IRac irac(kGpioUnused); @@ -518,17 +544,18 @@ TEST(TestIRac, Gree) { IRac irac(0); IRrecv capture(0); char expected[] = - "Model: 1 (YAW1F), Power: On, Mode: 1 (Cool), Temp: 22C, " + "Model: 1 (YAW1F), Power: On, Mode: 1 (Cool), Temp: 71F, " "Fan: 2 (Medium), Turbo: Off, IFeel: Off, WiFi: Off, XFan: On, " "Light: On, Sleep: On, Swing(V) Mode: Manual, " - "Swing(V): 3 (UNKNOWN), Timer: Off"; + "Swing(V): 3 (UNKNOWN), Timer: Off, Display Temp: 0 (Off)"; ac.begin(); irac.gree(&ac, gree_ac_remote_model_t::YAW1F, // Model true, // Power stdAc::opmode_t::kCool, // Mode - 22, // Celsius + false, // Celsius + 71, // Degrees (F) stdAc::fanspeed_t::kMedium, // Fan speed stdAc::swingv_t::kHigh, // Veritcal swing false, // Turbo @@ -1071,8 +1098,8 @@ TEST(TestIRac, Sharp) { IRac irac(0); IRrecv capture(0); char expected[] = - "Power: On, Previous Power: On, Mode: 2 (Cool), Temp: 28C, " - "Fan: 3 (Medium)"; + "Power: On, Mode: 2 (Cool), Temp: 28C, Fan: 3 (Medium), " + "Turbo: Off, Swing(V) Toggle: On, Ion: On, Econo: -, Clean: Off"; ac.begin(); irac.sharp(&ac, @@ -1080,7 +1107,11 @@ TEST(TestIRac, Sharp) { true, // Previous Power stdAc::opmode_t::kCool, // Mode 28, // Celsius - stdAc::fanspeed_t::kMedium); // Fan speed + stdAc::fanspeed_t::kMedium, // Fan speed + stdAc::swingv_t::kAuto, // Veritcal swing + false, // Turbo + true, // Filter (Ion) + false); // Clean ASSERT_EQ(expected, ac.toString()); ac._irsend.makeDecodeResult(); EXPECT_TRUE(capture.decode(&ac._irsend.capture)); diff --git a/lib/IRremoteESP8266-2.7.6/test/IRrecv_test.cpp b/lib/IRremoteESP8266-2.7.7/test/IRrecv_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/IRrecv_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/IRrecv_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/IRrecv_test.h b/lib/IRremoteESP8266-2.7.7/test/IRrecv_test.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/IRrecv_test.h rename to lib/IRremoteESP8266-2.7.7/test/IRrecv_test.h diff --git a/lib/IRremoteESP8266-2.7.6/test/IRsend_test.cpp b/lib/IRremoteESP8266-2.7.7/test/IRsend_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/IRsend_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/IRsend_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/IRsend_test.h b/lib/IRremoteESP8266-2.7.7/test/IRsend_test.h similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/IRsend_test.h rename to lib/IRremoteESP8266-2.7.7/test/IRsend_test.h diff --git a/lib/IRremoteESP8266-2.7.6/test/IRutils_test.cpp b/lib/IRremoteESP8266-2.7.7/test/IRutils_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/IRutils_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/IRutils_test.cpp diff --git a/lib/IRremoteESP8266-2.7.7/test/Makefile b/lib/IRremoteESP8266-2.7.7/test/Makefile new file mode 100644 index 000000000..7b36c5743 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/test/Makefile @@ -0,0 +1,159 @@ +# SYNOPSIS: +# +# make [all] - makes everything. +# make TARGET - makes the given target. +# make run - makes everything and runs all the tests. +# make clean - removes all files generated by make. +# make install-googletest - install the googletest code suite + +# Please tweak the following variable definitions as needed by your +# project, except GTEST_HEADERS, which you can use in your own targets +# but shouldn't modify. + +# Points to the root of Google Test, relative to where this file is. +# Remember to tweak this if you move this file. +GTEST_DIR = ../lib/googletest/googletest + +# Where to find user code. +USER_DIR = ../src +INCLUDES = -I$(USER_DIR) -I. + +# Flags passed to the preprocessor. +# Set Google Test's header directory as a system directory, such that +# the compiler doesn't generate warnings in Google Test headers. +CPPFLAGS += -isystem $(GTEST_DIR)/include -DUNIT_TEST -D_IR_LOCALE_=en-AU + +# Flags passed to the C++ compiler. +CXXFLAGS += -g -Wall -Wextra -pthread -std=gnu++11 + +# All tests produced by this Makefile. generated from all *_test.cpp files +TESTS = $(patsubst %.cpp,%,$(wildcard *_test.cpp)) + +# All Google Test headers. Usually you shouldn't change this +# definition. +GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \ + $(GTEST_DIR)/include/gtest/internal/*.h + +# House-keeping build targets. + +all : $(TESTS) + +clean : + rm -f $(TESTS) gtest.a gtest_main.a *.o + +# Build and run all the tests. +run : all + failed=""; \ + for unittest in $(TESTS); do \ + ./$${unittest} || failed="$${failed} $${unittest}"; \ + done; \ + if [ -n "$${failed}" ]; then \ + echo "FAIL: :-( :-( Unit test(s)$${failed} failed! :-( :-("; exit 1; \ + else \ + echo "PASS: \o/ \o/ All unit tests passed. \o/ \o/"; \ + fi + +run_tests : run + +install-googletest : + git clone -b v1.8.x https://github.com/google/googletest.git ../lib/googletest + +# Builds gtest.a and gtest_main.a. + +# Usually you shouldn't tweak such internal variables, indicated by a +# trailing _. +GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS) + +# All the IR protocol object files. +PROTOCOL_OBJS = $(patsubst %.cpp,%.o,$(wildcard $(USER_DIR)/ir_*.cpp)) +PROTOCOLS = $(patsubst $(USER_DIR)/%,%,$(PROTOCOL_OBJS)) + +# All the IR Protocol header files. +PROTOCOLS_H = $(wildcard $(USER_DIR)/ir_*.h) + +# Common object files +COMMON_OBJ = IRutils.o IRtimer.o IRsend.o IRrecv.o IRac.o ir_GlobalCache.o \ + IRtext.o $(PROTOCOLS) gtest_main.a +# Common dependencies +COMMON_DEPS = $(USER_DIR)/IRrecv.h $(USER_DIR)/IRsend.h $(USER_DIR)/IRtimer.h \ + $(USER_DIR)/IRutils.h $(USER_DIR)/IRremoteESP8266.h \ + $(USER_DIR)/IRac.h $(USER_DIR)/i18n.h $(USER_DIR)/IRtext.h \ + $(PROTOCOLS_H) + +# Common test dependencies +COMMON_TEST_DEPS = $(COMMON_DEPS) IRrecv_test.h IRsend_test.h + +# For simplicity and to avoid depending on Google Test's +# implementation details, the dependencies specified below are +# conservative and not optimized. This is fine as Google Test +# compiles fast and for ordinary users its source rarely changes. +gtest-all.o : $(GTEST_SRCS_) + $(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \ + $(GTEST_DIR)/src/gtest-all.cc + +gtest_main.o : $(GTEST_SRCS_) + $(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \ + $(GTEST_DIR)/src/gtest_main.cc + +gtest.a : gtest-all.o + $(AR) $(ARFLAGS) $@ $^ + +gtest_main.a : gtest-all.o gtest_main.o + $(AR) $(ARFLAGS) $@ $^ + +# Keep all intermediate files. +.SECONDARY: + +# Builds our test. A test should link with either gtest.a or +# gtest_main.a, depending on whether it defines its own main() +# function. + +IRtext.o : $(USER_DIR)/IRtext.cpp $(USER_DIR)/IRtext.h $(USER_DIR)/IRremoteESP8266.h $(USER_DIR)/i18n.h $(USER_DIR)/locale/*.h + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/IRtext.cpp + +IRutils.o : $(USER_DIR)/IRutils.cpp $(USER_DIR)/IRutils.h $(USER_DIR)/IRremoteESP8266.h $(USER_DIR)/i18n.h $(USER_DIR)/IRtext.cpp $(USER_DIR)/IRtext.h $(USER_DIR)/locale/*.h + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/IRutils.cpp + +IRutils_test.o : IRutils_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c IRutils_test.cpp + +IRutils_test : IRutils_test.o ir_NEC.o ir_Nikai.o ir_Toshiba.o IRtext.o $(COMMON_OBJ) gtest_main.a + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ + +IRtimer.o : $(USER_DIR)/IRtimer.cpp $(USER_DIR)/IRtimer.h + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/IRtimer.cpp + +IRsend.o : $(USER_DIR)/IRsend.cpp $(USER_DIR)/IRsend.h $(USER_DIR)/IRremoteESP8266.h + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/IRsend.cpp + +IRsend_test.o : IRsend_test.cpp $(USER_DIR)/IRsend.h $(USER_DIR)/IRrecv.h IRsend_test.h $(GTEST_HEADERS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c IRsend_test.cpp + +IRrecv.o : $(USER_DIR)/IRrecv.cpp $(USER_DIR)/IRrecv.h $(USER_DIR)/IRremoteESP8266.h $(GTEST_HEADERS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/IRrecv.cpp + +IRrecv_test.o : IRrecv_test.cpp $(USER_DIR)/IRsend.h $(USER_DIR)/IRrecv.h IRsend_test.h $(GTEST_HEADERS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c IRrecv_test.cpp + +IRac.o : $(USER_DIR)/IRac.cpp $(USER_DIR)/IRac.h $(COMMON_DEPS) $(GTEST_HEADERS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/IRac.cpp + +IRac_test.o : IRac_test.cpp $(USER_DIR)/IRac.h $(COMMON_DEPS) $(GTEST_HEADERS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c IRac_test.cpp + +# new specific targets goes above this line + +ir_%.o : $(USER_DIR)/ir_%.h $(USER_DIR)/ir_%.cpp $(COMMON_DEPS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_$*.cpp + +ir_%.o : $(USER_DIR)/ir_%.cpp $(COMMON_DEPS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_$*.cpp + +ir_%_test.o : ir_%_test.cpp $(USER_DIR)/ir_$%.h $(COMMON_TEST_DEPS) $(GTEST_HEADERS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_$*_test.cpp + +ir_%_test.o : ir_%_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c ir_$*_test.cpp + +%_test : $(COMMON_OBJ) %_test.o + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Airwell_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Airwell_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Airwell_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Airwell_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Aiwa_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Aiwa_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Aiwa_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Aiwa_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Amcor_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Amcor_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Amcor_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Amcor_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Argo_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Argo_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Argo_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Argo_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Carrier_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Carrier_test.cpp similarity index 58% rename from lib/IRremoteESP8266-2.7.6/test/ir_Carrier_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Carrier_test.cpp index f62a9d0f5..5e7a53220 100644 --- a/lib/IRremoteESP8266-2.7.6/test/ir_Carrier_test.cpp +++ b/lib/IRremoteESP8266-2.7.7/test/ir_Carrier_test.cpp @@ -1,5 +1,6 @@ -// Copyright 2018 David Conran +// Copyright 2018, 2020 David Conran +#include "IRac.h" #include "IRrecv.h" #include "IRsend.h" #include "IRsend_test.h" @@ -229,3 +230,176 @@ TEST(TestDecodeCarrierAC, RealExamples) { EXPECT_EQ(0xABE2, irsend.capture.command); EXPECT_FALSE(irsend.capture.repeat); } + +TEST(TestUtils, Housekeeping) { + // CARRIER_AC + ASSERT_EQ("CARRIER_AC", typeToString(decode_type_t::CARRIER_AC)); + ASSERT_EQ(decode_type_t::CARRIER_AC, strToDecodeType("CARRIER_AC")); + ASSERT_FALSE(hasACState(decode_type_t::CARRIER_AC)); + ASSERT_FALSE(IRac::isProtocolSupported(decode_type_t::CARRIER_AC)); + ASSERT_EQ(kCarrierAcBits, + IRsend::defaultBits(decode_type_t::CARRIER_AC)); + ASSERT_EQ(kCarrierAcMinRepeat, + IRsend::minRepeats(decode_type_t::CARRIER_AC)); + + // CARRIER_AC40 + ASSERT_EQ("CARRIER_AC40", typeToString(decode_type_t::CARRIER_AC40)); + ASSERT_EQ(decode_type_t::CARRIER_AC40, strToDecodeType("CARRIER_AC40")); + ASSERT_FALSE(hasACState(decode_type_t::CARRIER_AC40)); + ASSERT_FALSE(IRac::isProtocolSupported(decode_type_t::CARRIER_AC40)); + ASSERT_EQ(kCarrierAc40Bits, + IRsend::defaultBits(decode_type_t::CARRIER_AC40)); + ASSERT_EQ(kCarrierAc40MinRepeat, + IRsend::minRepeats(decode_type_t::CARRIER_AC40)); + + // CARRIER_AC64 + ASSERT_EQ("CARRIER_AC64", typeToString(decode_type_t::CARRIER_AC64)); + ASSERT_EQ(decode_type_t::CARRIER_AC64, strToDecodeType("CARRIER_AC64")); + ASSERT_FALSE(hasACState(decode_type_t::CARRIER_AC64)); + ASSERT_FALSE(IRac::isProtocolSupported(decode_type_t::CARRIER_AC64)); + ASSERT_EQ(kCarrierAc64Bits, + IRsend::defaultBits(decode_type_t::CARRIER_AC64)); + ASSERT_EQ(kCarrierAc64MinRepeat, + IRsend::minRepeats(decode_type_t::CARRIER_AC64)); +} + +/// Decode a "real" example message. +TEST(TestDecodeCarrierAC40, RealExample) { + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + irsend.begin(); + + irsend.reset(); + // Data from: + // https://github.com/crankyoldgit/IRremoteESP8266/issues/1112#issuecomment-627961192 + const uint16_t rawData[83] = { + 8402, 4166, + 562, 1550, 538, 1526, 562, 1552, 538, 1524, 566, 504, 538, 504, 540, 480, + 564, 506, 538, 506, 538, 506, 538, 1550, 538, 1550, 540, 506, 538, 506, + 538, 1550, 538, 506, 540, 478, 564, 480, 564, 506, 540, 1550, 538, 506, + 540, 506, 538, 1524, 564, 506, 538, 1550, 538, 1550, 538, 482, 562, 482, + 562, 506, 540, 504, 540, 482, 562, 506, 538, 1550, 538, 1550, 540, 1524, + 564, 1526, 564, 480, 564, 1528, 562, 504, 540, 480, + 564}; // UNKNOWN BCF4730D + + irsend.sendRaw(rawData, 83, 38000); + irsend.makeDecodeResult(); + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + EXPECT_EQ(CARRIER_AC40, irsend.capture.decode_type); + EXPECT_EQ(kCarrierAc40Bits, irsend.capture.bits); + EXPECT_EQ(0xF03212C0F4, irsend.capture.value); + EXPECT_EQ(0, irsend.capture.address); + EXPECT_EQ(0, irsend.capture.command); +} + +/// Send & Decode a synthetic message. +TEST(TestDecodeCarrierAC40, SyntheticExample) { + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + irsend.begin(); + + irsend.reset(); + + irsend.sendCarrierAC40(0xF03212C0F4); + irsend.makeDecodeResult(); + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + EXPECT_EQ(CARRIER_AC40, irsend.capture.decode_type); + EXPECT_EQ(kCarrierAc40Bits, irsend.capture.bits); + EXPECT_EQ(0xF03212C0F4, irsend.capture.value); + EXPECT_EQ(0, irsend.capture.address); + EXPECT_EQ(0, irsend.capture.command); + // Payload is sent a total of three times. + EXPECT_EQ( + "f38000d50" + // Initial + "m8402s4166" + "m547s1540m547s1540m547s1540m547s1540m547s497m547s497m547s497m547s497" + "m547s497m547s497m547s1540m547s1540m547s497m547s497m547s1540m547s497" + "m547s497m547s497m547s497m547s1540m547s497m547s497m547s1540m547s497" + "m547s1540m547s1540m547s497m547s497m547s497m547s497m547s497m547s497" + "m547s1540m547s1540m547s1540m547s1540m547s497m547s1540m547s497m547s497" + "m547s20000" + // Repeat #1 + "m8402s4166" + "m547s1540m547s1540m547s1540m547s1540m547s497m547s497m547s497m547s497" + "m547s497m547s497m547s1540m547s1540m547s497m547s497m547s1540m547s497" + "m547s497m547s497m547s497m547s1540m547s497m547s497m547s1540m547s497" + "m547s1540m547s1540m547s497m547s497m547s497m547s497m547s497m547s497" + "m547s1540m547s1540m547s1540m547s1540m547s497m547s1540m547s497m547s497" + "m547s20000" + // Repeat #2 + "m8402s4166" + "m547s1540m547s1540m547s1540m547s1540m547s497m547s497m547s497m547s497" + "m547s497m547s497m547s1540m547s1540m547s497m547s497m547s1540m547s497" + "m547s497m547s497m547s497m547s1540m547s497m547s497m547s1540m547s497" + "m547s1540m547s1540m547s497m547s497m547s497m547s497m547s497m547s497" + "m547s1540m547s1540m547s1540m547s1540m547s497m547s1540m547s497m547s497" + "m547s20000", + irsend.outputStr()); +} + +/// Decode a "real" example message. +TEST(TestDecodeCarrierAC64, RealExample) { + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + irsend.begin(); + + irsend.reset(); + // Data from: + // https://github.com/crankyoldgit/IRremoteESP8266/issues/1127#issuecomment-629713855 + const uint16_t rawData[131] = { + 8940, 4556, + 504, 616, 504, 616, 502, 1736, 504, 616, 504, 616, 504, 616, 502, 616, + 502, 1736, 504, 1736, 502, 616, 504, 1736, 504, 616, 502, 1736, 504, 616, + 502, 1736, 502, 616, 504, 616, 504, 1736, 502, 1736, 504, 1736, 502, 1736, + 504, 616, 502, 1736, 502, 616, 504, 616, 504, 1736, 504, 1736, 504, 1736, + 504, 616, 504, 1736, 502, 616, 502, 616, 504, 616, 504, 616, 502, 616, + 502, 616, 504, 1736, 504, 616, 504, 616, 502, 616, 504, 616, 504, 616, + 502, 616, 502, 616, 504, 616, 504, 616, 504, 616, 502, 616, 504, 616, + 504, 616, 502, 616, 502, 616, 504, 616, 504, 616, 504, 1736, 504, 616, + 504, 616, 504, 616, 504, 616, 504, 616, 504, 616, 504, 616, 502, 1736, + 504, 586, 502}; + + irsend.sendRaw(rawData, 131, 38000); + irsend.makeDecodeResult(); + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + EXPECT_EQ(CARRIER_AC64, irsend.capture.decode_type); + EXPECT_EQ(kCarrierAc64Bits, irsend.capture.bits); + EXPECT_EQ(0x404000102E5E5584, irsend.capture.value); + EXPECT_EQ(0, irsend.capture.address); + EXPECT_EQ(0, irsend.capture.command); +} + +/// Send & Decode a synthetic message. +TEST(TestDecodeCarrierAC64, SyntheticExample) { + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + irsend.begin(); + + irsend.reset(); + + irsend.sendCarrierAC64(0x404000102E5E5584); + irsend.makeDecodeResult(); + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + EXPECT_EQ(CARRIER_AC64, irsend.capture.decode_type); + EXPECT_EQ(kCarrierAc64Bits, irsend.capture.bits); + EXPECT_EQ(0x404000102E5E5584, irsend.capture.value); + EXPECT_EQ(0, irsend.capture.address); + EXPECT_EQ(0, irsend.capture.command); + EXPECT_EQ( + "f38000d50m" + // Header + "8940s4556" + // Data + "m503s615m503s615m503s1736m503s615m503s615m503s615m503s615m503s1736" + "m503s1736m503s615m503s1736m503s615m503s1736m503s615m503s1736m503s615" + "m503s615m503s1736m503s1736m503s1736m503s1736m503s615m503s1736m503s615" + "m503s615m503s1736m503s1736m503s1736m503s615m503s1736m503s615m503s615" + "m503s615m503s615m503s615m503s615m503s1736m503s615m503s615m503s615" + "m503s615m503s615m503s615m503s615m503s615m503s615m503s615m503s615" + "m503s615m503s615m503s615m503s615m503s615m503s615m503s1736m503s615" + "m503s615m503s615m503s615m503s615m503s615m503s615m503s1736m503s615" + // Footer + "m503s100000", + irsend.outputStr()); +} diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Coolix_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Coolix_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Coolix_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Coolix_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Daikin_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Daikin_test.cpp similarity index 98% rename from lib/IRremoteESP8266-2.7.6/test/ir_Daikin_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Daikin_test.cpp index e37c6b00a..f57888c23 100644 --- a/lib/IRremoteESP8266-2.7.6/test/ir_Daikin_test.cpp +++ b/lib/IRremoteESP8266-2.7.7/test/ir_Daikin_test.cpp @@ -3690,3 +3690,36 @@ TEST(TestDaikin64Class, HumanReadable) { "Clock: 12:31, On Timer: 08:30, Off Timer: Off", ac.toString()); } + +TEST(TestDecodeDaikin64, Issue1092) { + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + + uint16_t rawData[137] = { + 9792, 9786, 9818, 9860, 4600, 2532, 338, 422, 332, 950, 362, 950, 360, + 378, 354, 954, 386, 378, 334, 376, 356, 382, 360, 380, 364, 946, 354, 410, + 334, 380, 364, 972, 328, 386, 358, 380, 364, 374, 358, 380, 362, 376, 356, + 382, 360, 378, 354, 410, 334, 404, 326, 412, 332, 408, 336, 376, 356, 382, + 362, 378, 354, 384, 360, 378, 354, 384, 358, 380, 354, 384, 358, 382, 362, + 976, 336, 974, 338, 374, 358, 980, 332, 380, 362, 376, 356, 382, 362, 376, + 356, 956, 356, 980, 330, 382, 360, 976, 334, 376, 356, 382, 360, 378, 354, + 384, 358, 952, 360, 950, 360, 378, 354, 384, 360, 952, 360, 378, 354, 384, + 358, 380, 364, 374, 358, 952, 360, 380, 362, 376, 356, 382, 382, 928, 362, + 376, 356, 20348, 4628}; // UNKNOWN C508A32A + + irsend.begin(); + irsend.reset(); + irsend.sendRaw(rawData, 137, kDaikin64Freq); + irsend.makeDecodeResult(); + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + ASSERT_EQ(decode_type_t::DAIKIN64, irsend.capture.decode_type); + ASSERT_EQ(kDaikin64Bits, irsend.capture.bits); + EXPECT_EQ(0x4426161600001216, irsend.capture.value); + EXPECT_EQ( + "Power Toggle: Off, Mode: 2 (Cool), Temp: 26C, Fan: 1 (Auto), " + "Turbo: Off, Quiet: Off, Swing(V): Off, Sleep: Off, " + "Clock: 00:00, On Timer: Off, Off Timer: Off", + IRAcUtils::resultAcToString(&irsend.capture)); + stdAc::state_t result, prev; + ASSERT_TRUE(IRAcUtils::decodeToState(&irsend.capture, &result, &prev)); +} diff --git a/lib/IRremoteESP8266-2.7.7/test/ir_Delonghi_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Delonghi_test.cpp new file mode 100644 index 000000000..9f069e40e --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/test/ir_Delonghi_test.cpp @@ -0,0 +1,362 @@ +// Copyright 2020 David Conran + +#include "IRac.h" +#include "ir_Delonghi.h" +#include "IRrecv.h" +#include "IRrecv_test.h" +#include "IRsend.h" +#include "IRsend_test.h" +#include "IRutils.h" +#include "gtest/gtest.h" + +TEST(TestUtils, Housekeeping) { + ASSERT_EQ("DELONGHI_AC", typeToString(decode_type_t::DELONGHI_AC)); + ASSERT_EQ(decode_type_t::DELONGHI_AC, strToDecodeType("DELONGHI_AC")); + ASSERT_FALSE(hasACState(decode_type_t::DELONGHI_AC)); + ASSERT_TRUE(IRac::isProtocolSupported(decode_type_t::DELONGHI_AC)); + ASSERT_EQ(kDelonghiAcBits, IRsend::defaultBits(decode_type_t::DELONGHI_AC)); + ASSERT_EQ(kDelonghiAcDefaultRepeat, + IRsend::minRepeats(decode_type_t::DELONGHI_AC)); +} + +TEST(TestDecodeDelonghiAc, SyntheticSelfDecode) { + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + + irsend.begin(); + irsend.reset(); + irsend.sendDelonghiAc(0x6900000D0D01FB53); + irsend.makeDecodeResult(); + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + EXPECT_EQ(DELONGHI_AC, irsend.capture.decode_type); + EXPECT_EQ(kDelonghiAcBits, irsend.capture.bits); + EXPECT_EQ(0x6900000D0D01FB53, irsend.capture.value); + EXPECT_EQ(0, irsend.capture.command); + EXPECT_EQ(0, irsend.capture.address); +} + +TEST(TestDecodeDelonghiAc, RealExample) { + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + irsend.begin(); + + // Data from: + // https://github.com/crankyoldgit/IRremoteESP8266/issues/1096#issue-610665633 + uint16_t rawData[131] = { + 8984, 4200, + 608, 1516, 608, 1516, 612, 472, 556, 528, 560, 1564, 556, 528, 560, 1564, + 564, 528, 552, 1572, 556, 1568, 556, 528, 552, 1572, 556, 1568, 560, 1564, + 552, 1572, 556, 1576, 552, 1568, 560, 528, 560, 524, 556, 528, 552, 532, + 560, 528, 552, 532, 556, 532, 560, 1564, 560, 528, 552, 1568, 560, 1564, + 564, 524, 556, 528, 560, 524, 556, 536, 556, 1568, 560, 524, 556, 1568, + 560, 1564, 584, 500, 588, 496, 584, 500, 592, 500, 588, 496, 584, 500, + 592, 496, 584, 500, 588, 496, 584, 500, 592, 492, 584, 508, 584, 500, + 588, 496, 584, 500, 592, 496, 584, 500, 580, 504, 584, 500, 580, 508, + 584, 1544, 584, 500, 588, 496, 584, 1540, 588, 500, 580, 1540, 588, 1536, + 588, 500, + 592}; + + irsend.reset(); + irsend.sendRaw(rawData, 263, 38000); + irsend.makeDecodeResult(); + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + EXPECT_EQ(DELONGHI_AC, irsend.capture.decode_type); + EXPECT_EQ(kDelonghiAcBits, irsend.capture.bits); + EXPECT_EQ(0x6900000D0D01FB53, irsend.capture.value); + EXPECT_EQ(0, irsend.capture.command); + EXPECT_EQ(0, irsend.capture.address); + EXPECT_EQ( + "Power: On, Mode: 0 (Cool), Fan: 3 (Low), Temp: 90F, " + "Turbo: Off, Sleep: Off, On Timer: 06:13, Off Timer: Off", + IRAcUtils::resultAcToString(&irsend.capture)); + stdAc::state_t r, p; + ASSERT_TRUE(IRAcUtils::decodeToState(&irsend.capture, &r, &p)); +} + +// Tests for IRDelonghiAc class. + +TEST(TestIRDelonghiAcClass, Power) { + IRDelonghiAc ac(kGpioUnused); + ac.begin(); + + ac.on(); + EXPECT_TRUE(ac.getPower()); + + ac.off(); + EXPECT_FALSE(ac.getPower()); + + ac.setPower(true); + EXPECT_TRUE(ac.getPower()); + + ac.setPower(false); + EXPECT_FALSE(ac.getPower()); + + // Ref: + // https://github.com/crankyoldgit/IRremoteESP8266/issues/1096#issuecomment-622521726 + ac.setRaw(0x5500000000010153); // Power on + EXPECT_TRUE(ac.getPower()); + ac.setRaw(0x5400000000000153); // Power off + EXPECT_FALSE(ac.getPower()); +} + +TEST(TestIRDelonghiAcClass, Temperature) { + IRDelonghiAc ac(kGpioUnused); + ac.begin(); + + // Celsius + ac.setTemp(0); + EXPECT_EQ(kDelonghiAcTempMinC, ac.getTemp()); + EXPECT_FALSE(ac.getTempUnit()); + + ac.setTemp(255); + EXPECT_EQ(kDelonghiAcTempMaxC, ac.getTemp()); + EXPECT_FALSE(ac.getTempUnit()); + + ac.setTemp(kDelonghiAcTempMinC); + EXPECT_EQ(kDelonghiAcTempMinC, ac.getTemp()); + EXPECT_FALSE(ac.getTempUnit()); + + ac.setTemp(kDelonghiAcTempMaxC); + EXPECT_EQ(kDelonghiAcTempMaxC, ac.getTemp()); + EXPECT_FALSE(ac.getTempUnit()); + + ac.setTemp(kDelonghiAcTempMinC - 1); + EXPECT_EQ(kDelonghiAcTempMinC, ac.getTemp()); + EXPECT_FALSE(ac.getTempUnit()); + + ac.setTemp(kDelonghiAcTempMaxC + 1); + EXPECT_EQ(kDelonghiAcTempMaxC, ac.getTemp()); + EXPECT_FALSE(ac.getTempUnit()); + + ac.setTemp(19); + EXPECT_EQ(19, ac.getTemp()); + EXPECT_FALSE(ac.getTempUnit()); + + ac.setTemp(21); + EXPECT_EQ(21, ac.getTemp()); + EXPECT_FALSE(ac.getTempUnit()); + + ac.setTemp(25); + EXPECT_EQ(25, ac.getTemp()); + EXPECT_FALSE(ac.getTempUnit()); + + ac.setTemp(29, false); + EXPECT_EQ(29, ac.getTemp()); + EXPECT_FALSE(ac.getTempUnit()); + + // Fahrenheit + ac.setTemp(0, true); + EXPECT_EQ(kDelonghiAcTempMinF, ac.getTemp()); + EXPECT_TRUE(ac.getTempUnit()); + + ac.setTemp(255, true); + EXPECT_EQ(kDelonghiAcTempMaxF, ac.getTemp()); + EXPECT_TRUE(ac.getTempUnit()); + + ac.setTemp(kDelonghiAcTempMinF, true); + EXPECT_EQ(kDelonghiAcTempMinF, ac.getTemp()); + EXPECT_TRUE(ac.getTempUnit()); + + ac.setTemp(kDelonghiAcTempMaxF, true); + EXPECT_EQ(kDelonghiAcTempMaxF, ac.getTemp()); + EXPECT_TRUE(ac.getTempUnit()); + + ac.setTemp(kDelonghiAcTempMinF - 1, true); + EXPECT_EQ(kDelonghiAcTempMinF, ac.getTemp()); + EXPECT_TRUE(ac.getTempUnit()); + + ac.setTemp(kDelonghiAcTempMaxF + 1, true); + EXPECT_EQ(kDelonghiAcTempMaxF, ac.getTemp()); + EXPECT_TRUE(ac.getTempUnit()); + + ac.setTemp(66, true); + EXPECT_EQ(66, ac.getTemp()); + EXPECT_TRUE(ac.getTempUnit()); + + ac.setTemp(75, true); + EXPECT_EQ(75, ac.getTemp()); + EXPECT_TRUE(ac.getTempUnit()); + + ac.setTemp(80, true); + EXPECT_EQ(80, ac.getTemp()); + EXPECT_TRUE(ac.getTempUnit()); + + ac.setTemp(88, true); + EXPECT_EQ(88, ac.getTemp()); + EXPECT_TRUE(ac.getTempUnit()); +} + +TEST(TestIRDelonghiAcClass, OperatingMode) { + IRDelonghiAc ac(kGpioUnused); + ac.begin(); + + ac.setMode(kDelonghiAcAuto); + EXPECT_EQ(kDelonghiAcAuto, ac.getMode()); + EXPECT_EQ(17, ac.getTemp()); // Check for special temp + EXPECT_EQ(kDelonghiAcFanAuto, ac.getFan()); // Look for fan speed enforcement + + ac.setMode(kDelonghiAcCool); + EXPECT_EQ(kDelonghiAcCool, ac.getMode()); + // Check changing to another mode that has a fixed temp and back keeps the + // existing temp. Only for Cool mode. + ac.setTemp(22); + EXPECT_EQ(22, ac.getTemp()); + ac.setMode(kDelonghiAcAuto); + EXPECT_NE(22, ac.getTemp()); + ac.setMode(kDelonghiAcCool); + EXPECT_EQ(22, ac.getTemp()); + + ac.setMode(kDelonghiAcDry); + EXPECT_EQ(kDelonghiAcDry, ac.getMode()); + EXPECT_EQ(17, ac.getTemp()); // Check for special temp + EXPECT_EQ(kDelonghiAcFanAuto, ac.getFan()); // Look for fan speed enforcement + + ac.setMode(kDelonghiAcFan); + EXPECT_EQ(kDelonghiAcFan, ac.getMode()); + EXPECT_EQ(23, ac.getTemp()); // Check for special temp + EXPECT_NE(kDelonghiAcFanAuto, ac.getFan()); // Look for fan speed enforcement + + ac.setMode(kDelonghiAcAuto + 1); + EXPECT_EQ(kDelonghiAcAuto, ac.getMode()); + + ac.setMode(255); + EXPECT_EQ(kDelonghiAcAuto, ac.getMode()); +} + +TEST(TestIRDelonghiAcClass, FanSpeed) { + IRDelonghiAc ac(kGpioUnused); + ac.begin(); + ac.setMode(kDelonghiAcCool); // All fan speeds available in this mode. + + ac.setFan(0); + EXPECT_EQ(kDelonghiAcFanAuto, ac.getFan()); + + ac.setFan(255); + EXPECT_EQ(kDelonghiAcFanAuto, ac.getFan()); + + ac.setFan(kDelonghiAcFanHigh); + EXPECT_EQ(kDelonghiAcFanHigh, ac.getFan()); + + ac.setFan(kDelonghiAcFanLow + 1); + EXPECT_EQ(kDelonghiAcFanAuto, ac.getFan()); + + ac.setFan(1); + EXPECT_EQ(1, ac.getFan()); + + ac.setFan(2); + EXPECT_EQ(2, ac.getFan()); + + ac.setFan(3); + EXPECT_EQ(3, ac.getFan()); + + // Confirm changing to fan mode handles speed behaviour correctly. + ac.setFan(kDelonghiAcFanLow); + ac.setMode(kDelonghiAcFan); + EXPECT_EQ(kDelonghiAcFanLow, ac.getFan()); + ac.setMode(kDelonghiAcAuto); + EXPECT_EQ(kDelonghiAcFanAuto, ac.getFan()); + ac.setMode(kDelonghiAcFan); + EXPECT_NE(kDelonghiAcFanAuto, ac.getFan()); +} + +TEST(TestIRDelonghiAcClass, Boost) { + IRDelonghiAc ac(kGpioUnused); + ac.begin(); + + ac.setBoost(false); + EXPECT_FALSE(ac.getBoost()); + ac.setBoost(true); + EXPECT_TRUE(ac.getBoost()); + ac.setBoost(false); + EXPECT_FALSE(ac.getBoost()); +} + +TEST(TestIRDelonghiAcClass, Sleep) { + IRDelonghiAc ac(kGpioUnused); + ac.begin(); + + ac.setSleep(false); + EXPECT_FALSE(ac.getSleep()); + ac.setSleep(true); + EXPECT_TRUE(ac.getSleep()); + ac.setSleep(false); + EXPECT_FALSE(ac.getSleep()); +} + +TEST(TestIRDelonghiAcClass, OnTimer) { + IRDelonghiAc ac(kGpioUnused); + ac.begin(); + + ac.setOnTimerEnabled(false); + EXPECT_FALSE(ac.getOnTimerEnabled()); + ac.setOnTimerEnabled(true); + EXPECT_TRUE(ac.getOnTimerEnabled()); + ac.setOnTimerEnabled(false); + EXPECT_FALSE(ac.getOnTimerEnabled()); + + ac.setOnTimer(0); + EXPECT_FALSE(ac.getOnTimerEnabled()); + EXPECT_EQ(0, ac.getOnTimer()); + + ac.setOnTimer(1); + EXPECT_TRUE(ac.getOnTimerEnabled()); + EXPECT_EQ(1, ac.getOnTimer()); + + ac.setOnTimer(61); + EXPECT_TRUE(ac.getOnTimerEnabled()); + EXPECT_EQ(61, ac.getOnTimer()); + + ac.setOnTimerEnabled(false); + ac.setOnTimer(23 * 60 + 59); + EXPECT_TRUE(ac.getOnTimerEnabled()); + EXPECT_EQ(23 * 60 + 59, ac.getOnTimer()); + + ac.setOnTimerEnabled(false); + ac.setOnTimer(24 * 60); + EXPECT_TRUE(ac.getOnTimerEnabled()); + EXPECT_EQ(23 * 60 + 59, ac.getOnTimer()); +} + +TEST(TestIRDelonghiAcClass, OffTimer) { + IRDelonghiAc ac(kGpioUnused); + ac.begin(); + + ac.setOffTimerEnabled(false); + EXPECT_FALSE(ac.getOffTimerEnabled()); + ac.setOffTimerEnabled(true); + EXPECT_TRUE(ac.getOffTimerEnabled()); + ac.setOffTimerEnabled(false); + EXPECT_FALSE(ac.getOffTimerEnabled()); + + ac.setOffTimer(0); + EXPECT_FALSE(ac.getOffTimerEnabled()); + EXPECT_EQ(0, ac.getOffTimer()); + + ac.setOffTimer(1); + EXPECT_TRUE(ac.getOffTimerEnabled()); + EXPECT_EQ(1, ac.getOffTimer()); + + ac.setOffTimer(61); + EXPECT_TRUE(ac.getOffTimerEnabled()); + EXPECT_EQ(61, ac.getOffTimer()); + + ac.setOffTimerEnabled(false); + ac.setOffTimer(23 * 60 + 59); + EXPECT_TRUE(ac.getOffTimerEnabled()); + EXPECT_EQ(23 * 60 + 59, ac.getOffTimer()); + + ac.setOffTimerEnabled(false); + ac.setOffTimer(24 * 60); + EXPECT_TRUE(ac.getOffTimerEnabled()); + EXPECT_EQ(23 * 60 + 59, ac.getOffTimer()); + + // Real Data + // From: https://github.com/crankyoldgit/IRremoteESP8266/issues/1096#issuecomment-623115619 + // Setting off timer to 8:51 when the time on the remote displayed 16:05. + // (8:51 + 24:00 - 16:05 == 32:51 - 16:05 == 16:46) i.e. Turn off in 16h46m. + ac.setRaw(0xB12E210000000F53); + EXPECT_TRUE(ac.getOffTimerEnabled()); + EXPECT_EQ(16 * 60 + 46, ac.getOffTimer()); + EXPECT_FALSE(ac.getOnTimerEnabled()); + EXPECT_EQ(0, ac.getOnTimer()); +} diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Denon_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Denon_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Denon_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Denon_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Dish_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Dish_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Dish_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Dish_test.cpp diff --git a/lib/IRremoteESP8266-2.7.7/test/ir_Doshisha_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Doshisha_test.cpp new file mode 100644 index 000000000..8c69bfbb3 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/test/ir_Doshisha_test.cpp @@ -0,0 +1,152 @@ +// Copyright 2020 Christian Nilsson + +#include "IRac.h" +#include "IRrecv.h" +#include "IRrecv_test.h" +#include "IRsend.h" +#include "IRsend_test.h" +#include "gtest/gtest.h" + +// Tests for decodeDoshisha(). + +TEST(TestDecodeDoshisha, RealExample) { + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + // CH2 Light Level 1 + const uint16_t rawData_1[83] = { + 3404, 1718, + 416, 1306, 416, 460, 438, 432, 412, 460, 464, 396, 488, 394, 488, 394, + 488, 398, 460, 430, 468, 398, 484, 416, 468, 396, 488, 1264, 414, 460, + 436, 1286, 524, 1210, 470, 390, 434, 456, 414, 1288, 458, 1290, 438, 434, + 412, 458, 440, 434, 438, 418, 456, 432, 466, 1270, 438, 442, 438, 430, + 414, 1316, 412, 460, 440, 432, 412, 460, 440, 1264, 458, 434, 436, 1268, + 458, 436, 438, 412, 456, 1290, 438, 442, 436, 1290, + 464}; // DOSHISHA 800B3048A5 + irsend.begin(); + irsend.reset(); + irsend.sendRaw(rawData_1, 83, 38); + irsend.makeDecodeResult(); + + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + ASSERT_EQ(decode_type_t::DOSHISHA, irsend.capture.decode_type); + ASSERT_EQ(kDoshishaBits, irsend.capture.bits); + EXPECT_EQ(0x800B3048A5, irsend.capture.value); + EXPECT_EQ(0b1, irsend.capture.address); + EXPECT_EQ(0xA4, irsend.capture.command); + + // CH2 OFF + const uint16_t rawData_2[83] = { + 3434, 1700, + 446, 1284, 442, 440, 442, 428, 444, 432, 440, 430, 442, 432, 472, 438, + 444, 446, 416, 430, 470, 416, 470, 438, 444, 442, 470, 1242, 440, 430, + 442, 1314, 390, 1344, 444, 440, 414, 432, 442, 1310, 412, 1318, 416, 458, + 416, 434, 438, 432, 418, 484, 416, 458, 442, 1298, 416, 466, 420, 428, + 442, 1316, 418, 432, 442, 430, 442, 434, 444, 1286, 440, 430, 444, 1288, + 444, 430, 444, 430, 442, 432, 498, 386, 498, 1242, + 474}; // DOSHISHA 800B3048A1 + + irsend.begin(); + irsend.reset(); + irsend.sendRaw(rawData_2, 175, 38); + irsend.makeDecodeResult(); + + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + ASSERT_EQ(decode_type_t::DOSHISHA, irsend.capture.decode_type); + ASSERT_EQ(kDoshishaBits, irsend.capture.bits); + EXPECT_EQ(0x800B3048A1, irsend.capture.value); + EXPECT_EQ(0b1, irsend.capture.address); + EXPECT_EQ(0xA0, irsend.capture.command); + + // CH1 OFF + const uint16_t rawData_4[83] = { + 3470, 1670, + 444, 1294, 470, 408, 442, 430, 444, 412, 464, 440, 498, 386, 498, 388, + 474, 418, 440, 430, 472, 414, 474, 412, 472, 414, 470, 1268, 444, 428, + 448, 1284, 444, 1294, 472, 412, 446, 428, 442, 1284, 444, 1290, 444, 430, + 446, 430, 442, 410, 490, 406, 446, 428, 472, 1270, 472, 414, 442, 410, + 460, 1292, 444, 430, 442, 430, 444, 434, 444, 1286, 442, 432, 442, 1288, + 446, 430, 442, 414, 486, 386, 516, 388, 446, 438, + 446}; // DOSHISHA 800B3048A0 + irsend.begin(); + irsend.reset(); + irsend.sendRaw(rawData_4, 175, 38); + irsend.makeDecodeResult(); + + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + ASSERT_EQ(decode_type_t::DOSHISHA, irsend.capture.decode_type); + ASSERT_EQ(kDoshishaBits, irsend.capture.bits); + EXPECT_EQ(0x800B3048A0, irsend.capture.value); + EXPECT_EQ(0b0, irsend.capture.address); + EXPECT_EQ(0xA0, irsend.capture.command); +} + +TEST(TestDecodeDoshisha, SyntheticExample) { + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + irsend.begin(); + irsend.reset(); + irsend.sendDoshisha(0x800B3048A5); + irsend.makeDecodeResult(); + + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + EXPECT_EQ(decode_type_t::DOSHISHA, irsend.capture.decode_type); + EXPECT_EQ(kDoshishaBits, irsend.capture.bits); + EXPECT_EQ(0x800B3048A5, irsend.capture.value); + EXPECT_EQ(0b1, irsend.capture.address); + EXPECT_EQ(0xA4, irsend.capture.command); + + EXPECT_EQ( + "f38000d50" + "m3412s1722" + "m420s1310m420s452m420s452m420s452m420s452m420s452m420s452" + "m420s452m420s452m420s452m420s452m420s452m420s1310m420s452" + "m420s1310m420s1310m420s452m420s452m420s1310m420s1310m420s452" + "m420s452m420s452m420s452m420s452m420s1310m420s452m420s452" + "m420s1310m420s452m420s452m420s452m420s1310m420s452m420s1310" + "m420s452m420s452m420s1310m420s452m420s1310" + "m420s100000", + irsend.outputStr()); + + irsend.reset(); + irsend.sendDoshisha(0x800B3048D0); + irsend.makeDecodeResult(); + + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + EXPECT_EQ(decode_type_t::DOSHISHA, irsend.capture.decode_type); + EXPECT_EQ(kDoshishaBits, irsend.capture.bits); + EXPECT_EQ(0x800B3048D0, irsend.capture.value); + EXPECT_EQ(irsend.encodeDoshisha(0xD0, 0b0), irsend.capture.value); + EXPECT_EQ(0b0, irsend.capture.address); + EXPECT_EQ(0xD0, irsend.capture.command); + EXPECT_EQ( + "f38000d50" + "m3412s1722" + "m420s1310m420s452m420s452m420s452m420s452m420s452m420s452" + "m420s452m420s452m420s452m420s452m420s452m420s1310m420s452" + "m420s1310m420s1310m420s452m420s452m420s1310m420s1310m420s452" + "m420s452m420s452m420s452m420s452m420s1310m420s452m420s452m420" + "s1310m420s452m420s452m420s452m420s1310m420s1310m420s452m420s1310" + "m420s452m420s452m420s452m420s452" + "m420s100000", + irsend.outputStr()); +} + +TEST(TestEncodeDoshisha, SyntheticExample) { + IRsendTest irsend(kGpioUnused); + // kRcz01CheckExpected + EXPECT_EQ(0x800B304800, irsend.encodeDoshisha(0x00, 0b0)); + // kRcz01CommandTimmer30 + EXPECT_EQ(0x800B304892, irsend.encodeDoshisha(0x92, 0b0)); + // kRcz01CommandLevel1 + EXPECT_EQ(0x800B3048A5, irsend.encodeDoshisha(0xA4, 0b1)); + EXPECT_EQ(0x800B3048A4, irsend.encodeDoshisha(0xA4, 0b0)); +} + +TEST(TestUtils, Housekeeping) { + ASSERT_EQ("DOSHISHA", typeToString(decode_type_t::DOSHISHA)); + ASSERT_EQ(decode_type_t::DOSHISHA, strToDecodeType("DOSHISHA")); + ASSERT_FALSE(hasACState(decode_type_t::DOSHISHA)); + ASSERT_FALSE(IRac::isProtocolSupported(decode_type_t::DOSHISHA)); + ASSERT_EQ(kDoshishaBits, IRsend::defaultBits(decode_type_t::DOSHISHA)); + ASSERT_EQ(kNoRepeat, IRsend::minRepeats(decode_type_t::DOSHISHA)); +} diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Electra_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Electra_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Electra_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Electra_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Epson_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Epson_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Epson_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Epson_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Fujitsu_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Fujitsu_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Fujitsu_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Fujitsu_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_GICable_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_GICable_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_GICable_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_GICable_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_GlobalCache_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_GlobalCache_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_GlobalCache_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_GlobalCache_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Goodweather_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Goodweather_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Goodweather_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Goodweather_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Gree_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Gree_test.cpp similarity index 65% rename from lib/IRremoteESP8266-2.7.6/test/ir_Gree_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Gree_test.cpp index a824cd10a..46b1b17b4 100644 --- a/lib/IRremoteESP8266-2.7.6/test/ir_Gree_test.cpp +++ b/lib/IRremoteESP8266-2.7.7/test/ir_Gree_test.cpp @@ -13,7 +13,7 @@ // Test sending typical data only. TEST(TestSendGreeChars, SendData) { - IRsendTest irsend(4); + IRsendTest irsend(kGpioUnused); irsend.begin(); uint8_t gree_code[kGreeStateLength] = {0x12, 0x34, 0x56, 0x78, @@ -38,7 +38,7 @@ TEST(TestSendGreeChars, SendData) { } TEST(TestSendGreeUint64, SendData) { - IRsendTest irsend(4); + IRsendTest irsend(kGpioUnused); irsend.begin(); irsend.reset(); @@ -62,7 +62,7 @@ TEST(TestSendGreeUint64, SendData) { // Test sending with repeats. TEST(TestSendGreeChars, SendWithRepeats) { - IRsendTest irsend(4); + IRsendTest irsend(kGpioUnused); irsend.begin(); irsend.reset(); @@ -101,7 +101,7 @@ TEST(TestSendGreeChars, SendWithRepeats) { } TEST(TestSendGreeUint64, SendWithRepeats) { - IRsendTest irsend(4); + IRsendTest irsend(kGpioUnused); irsend.begin(); irsend.reset(); @@ -137,7 +137,7 @@ TEST(TestSendGreeUint64, SendWithRepeats) { // Test sending atypical sizes. TEST(TestSendGreeChars, SendUnexpectedSizes) { - IRsendTest irsend(4); + IRsendTest irsend(kGpioUnused); irsend.begin(); uint8_t gree_short_code[kGreeStateLength - 1] = {0x12, 0x34, 0x56, 0x78, @@ -169,7 +169,7 @@ TEST(TestSendGreeChars, SendUnexpectedSizes) { } TEST(TestSendGreeUint64, SendUnexpectedSizes) { - IRsendTest irsend(4); + IRsendTest irsend(kGpioUnused); irsend.begin(); irsend.reset(); @@ -209,138 +209,184 @@ TEST(TestSendGree, CompareUint64ToCharResults) { // Tests for IRGreeAC class. TEST(TestGreeClass, Power) { - IRGreeAC irgree(0); - irgree.begin(); + IRGreeAC ac(kGpioUnused); + ac.begin(); - irgree.on(); - EXPECT_TRUE(irgree.getPower()); + ac.on(); + EXPECT_TRUE(ac.getPower()); - irgree.off(); - EXPECT_FALSE(irgree.getPower()); + ac.off(); + EXPECT_FALSE(ac.getPower()); - irgree.setPower(true); - EXPECT_TRUE(irgree.getPower()); + ac.setPower(true); + EXPECT_TRUE(ac.getPower()); - irgree.setPower(false); - EXPECT_FALSE(irgree.getPower()); + ac.setPower(false); + EXPECT_FALSE(ac.getPower()); } TEST(TestGreeClass, Temperature) { - IRGreeAC irgree(0); - irgree.begin(); + IRGreeAC ac(kGpioUnused); + ac.begin(); - irgree.setMode(kGreeCool); + ac.setMode(kGreeCool); - irgree.setTemp(0); - EXPECT_EQ(kGreeMinTemp, irgree.getTemp()); + ac.setTemp(0); + EXPECT_EQ(kGreeMinTempC, ac.getTemp()); - irgree.setTemp(255); - EXPECT_EQ(kGreeMaxTemp, irgree.getTemp()); + ac.setTemp(255); + EXPECT_EQ(kGreeMaxTempC, ac.getTemp()); - irgree.setTemp(kGreeMinTemp); - EXPECT_EQ(kGreeMinTemp, irgree.getTemp()); + ac.setTemp(kGreeMinTempC); + EXPECT_EQ(kGreeMinTempC, ac.getTemp()); + EXPECT_FALSE(ac.getUseFahrenheit()); - irgree.setTemp(kGreeMaxTemp); - EXPECT_EQ(kGreeMaxTemp, irgree.getTemp()); + ac.setTemp(kGreeMaxTempC); + EXPECT_EQ(kGreeMaxTempC, ac.getTemp()); - irgree.setTemp(kGreeMinTemp - 1); - EXPECT_EQ(kGreeMinTemp, irgree.getTemp()); + ac.setTemp(kGreeMinTempC - 1); + EXPECT_EQ(kGreeMinTempC, ac.getTemp()); - irgree.setTemp(kGreeMaxTemp + 1); - EXPECT_EQ(kGreeMaxTemp, irgree.getTemp()); + ac.setTemp(kGreeMaxTempC + 1); + EXPECT_EQ(kGreeMaxTempC, ac.getTemp()); - irgree.setTemp(17); - EXPECT_EQ(17, irgree.getTemp()); + ac.setTemp(17); + EXPECT_EQ(17, ac.getTemp()); - irgree.setTemp(21); - EXPECT_EQ(21, irgree.getTemp()); + ac.setTemp(21); + EXPECT_EQ(21, ac.getTemp()); - irgree.setTemp(25); - EXPECT_EQ(25, irgree.getTemp()); + ac.setTemp(25); + EXPECT_EQ(25, ac.getTemp()); - irgree.setTemp(29); - EXPECT_EQ(29, irgree.getTemp()); + ac.setTemp(29); + EXPECT_EQ(29, ac.getTemp()); + + // Fahrenheit tests. + ac.setTemp(kGreeMinTempF, true); + ASSERT_TRUE(ac.getUseFahrenheit()); + EXPECT_EQ(kGreeMinTempF, ac.getTemp()); + + ac.setTemp(kGreeMaxTempF, true); + ASSERT_TRUE(ac.getUseFahrenheit()); + EXPECT_EQ(kGreeMaxTempF, ac.getTemp()); + + ac.setTemp(kGreeMaxTempF + 1, true); + ASSERT_TRUE(ac.getUseFahrenheit()); + EXPECT_EQ(kGreeMaxTempF, ac.getTemp()); + + ac.setTemp(kGreeMaxTempF - 1, true); + ASSERT_TRUE(ac.getUseFahrenheit()); + EXPECT_EQ(kGreeMaxTempF - 1, ac.getTemp()); + + ac.setTemp(kGreeMaxTempF - 2, true); + ASSERT_TRUE(ac.getUseFahrenheit()); + EXPECT_EQ(kGreeMaxTempF - 2, ac.getTemp()); + + ac.setTemp(kGreeMinTempF - 1, true); + ASSERT_TRUE(ac.getUseFahrenheit()); + EXPECT_EQ(kGreeMinTempF, ac.getTemp()); + + ac.setTemp(kGreeMinTempF + 1, true); + ASSERT_TRUE(ac.getUseFahrenheit()); + EXPECT_EQ(kGreeMinTempF + 1, ac.getTemp()); + + ac.setTemp(kGreeMinTempF + 2, true); + ASSERT_TRUE(ac.getUseFahrenheit()); + EXPECT_EQ(kGreeMinTempF + 2, ac.getTemp()); + + // Ref: https://github.com/crankyoldgit/IRremoteESP8266/issues/1121#issuecomment-628946040 + ac.setUseFahrenheit(false); + const uint8_t state[] = {0x09, 0x01, 0x20, 0x5C, 0x00, 0x20, 0x00, 0x20}; + ac.setRaw(state); + EXPECT_TRUE(ac.getUseFahrenheit()); + EXPECT_EQ(63, ac.getTemp()); + EXPECT_EQ( + "Model: 2 (YBOFB), Power: On, Mode: 1 (Cool), Temp: 63F, Fan: 0 (Auto), " + "Turbo: Off, IFeel: Off, WiFi: Off, XFan: Off, Light: On, Sleep: Off, " + "Swing(V) Mode: Manual, Swing(V): 0 (Last), Timer: Off, " + "Display Temp: 0 (Off)", ac.toString()); } TEST(TestGreeClass, OperatingMode) { - IRGreeAC irgree(0); - irgree.begin(); + IRGreeAC ac(kGpioUnused); + ac.begin(); - irgree.setTemp(17); - irgree.setMode(kGreeAuto); // Auto should lock the temp to 25C. - EXPECT_EQ(kGreeAuto, irgree.getMode()); - EXPECT_EQ(25, irgree.getTemp()); - irgree.setTemp(17); - EXPECT_EQ(25, irgree.getTemp()); + ac.setTemp(17); + ac.setMode(kGreeAuto); // Auto should lock the temp to 25C. + EXPECT_EQ(kGreeAuto, ac.getMode()); + EXPECT_EQ(25, ac.getTemp()); + ac.setTemp(17); + EXPECT_EQ(25, ac.getTemp()); - irgree.setMode(kGreeCool); - EXPECT_EQ(kGreeCool, irgree.getMode()); + ac.setMode(kGreeCool); + EXPECT_EQ(kGreeCool, ac.getMode()); - irgree.setMode(kGreeHeat); - EXPECT_EQ(kGreeHeat, irgree.getMode()); + ac.setMode(kGreeHeat); + EXPECT_EQ(kGreeHeat, ac.getMode()); ASSERT_NE(kGreeFanMax, 1); - irgree.setFan(kGreeFanMax); - irgree.setMode(kGreeDry); // Dry should lock the fan to speed 1. - EXPECT_EQ(kGreeDry, irgree.getMode()); - EXPECT_EQ(1, irgree.getFan()); - irgree.setFan(kGreeFanMax); - EXPECT_EQ(1, irgree.getFan()); + ac.setFan(kGreeFanMax); + ac.setMode(kGreeDry); // Dry should lock the fan to speed 1. + EXPECT_EQ(kGreeDry, ac.getMode()); + EXPECT_EQ(1, ac.getFan()); + ac.setFan(kGreeFanMax); + EXPECT_EQ(1, ac.getFan()); - irgree.setMode(kGreeFan); - EXPECT_EQ(kGreeFan, irgree.getMode()); + ac.setMode(kGreeFan); + EXPECT_EQ(kGreeFan, ac.getMode()); - irgree.setMode(kGreeHeat + 1); - EXPECT_EQ(kGreeAuto, irgree.getMode()); + ac.setMode(kGreeHeat + 1); + EXPECT_EQ(kGreeAuto, ac.getMode()); - irgree.setMode(255); - EXPECT_EQ(kGreeAuto, irgree.getMode()); + ac.setMode(255); + EXPECT_EQ(kGreeAuto, ac.getMode()); } TEST(TestGreeClass, Light) { - IRGreeAC irgree(0); - irgree.begin(); + IRGreeAC ac(kGpioUnused); + ac.begin(); - irgree.setLight(true); - EXPECT_TRUE(irgree.getLight()); + ac.setLight(true); + EXPECT_TRUE(ac.getLight()); - irgree.setLight(false); - EXPECT_FALSE(irgree.getLight()); + ac.setLight(false); + EXPECT_FALSE(ac.getLight()); - irgree.setLight(true); - EXPECT_TRUE(irgree.getLight()); + ac.setLight(true); + EXPECT_TRUE(ac.getLight()); } TEST(TestGreeClass, XFan) { - IRGreeAC irgree(0); - irgree.begin(); + IRGreeAC ac(kGpioUnused); + ac.begin(); - irgree.setXFan(true); - EXPECT_TRUE(irgree.getXFan()); + ac.setXFan(true); + EXPECT_TRUE(ac.getXFan()); - irgree.setXFan(false); - EXPECT_FALSE(irgree.getXFan()); + ac.setXFan(false); + EXPECT_FALSE(ac.getXFan()); - irgree.setXFan(true); - EXPECT_TRUE(irgree.getXFan()); + ac.setXFan(true); + EXPECT_TRUE(ac.getXFan()); } TEST(TestGreeClass, Turbo) { - IRGreeAC irgree(0); - irgree.begin(); + IRGreeAC ac(kGpioUnused); + ac.begin(); - irgree.setTurbo(true); - EXPECT_TRUE(irgree.getTurbo()); + ac.setTurbo(true); + EXPECT_TRUE(ac.getTurbo()); - irgree.setTurbo(false); - EXPECT_FALSE(irgree.getTurbo()); + ac.setTurbo(false); + EXPECT_FALSE(ac.getTurbo()); - irgree.setTurbo(true); - EXPECT_TRUE(irgree.getTurbo()); + ac.setTurbo(true); + EXPECT_TRUE(ac.getTurbo()); } TEST(TestGreeClass, IFeel) { - IRGreeAC ac(0); + IRGreeAC ac(kGpioUnused); ac.begin(); ac.setIFeel(true); @@ -362,7 +408,7 @@ TEST(TestGreeClass, IFeel) { } TEST(TestGreeClass, WiFi) { - IRGreeAC ac(0); + IRGreeAC ac(kGpioUnused); ac.begin(); ac.setWiFi(true); @@ -384,148 +430,150 @@ TEST(TestGreeClass, WiFi) { } TEST(TestGreeClass, Sleep) { - IRGreeAC irgree(0); - irgree.begin(); + IRGreeAC ac(kGpioUnused); + ac.begin(); - irgree.setSleep(true); - EXPECT_TRUE(irgree.getSleep()); + ac.setSleep(true); + EXPECT_TRUE(ac.getSleep()); - irgree.setSleep(false); - EXPECT_FALSE(irgree.getSleep()); + ac.setSleep(false); + EXPECT_FALSE(ac.getSleep()); - irgree.setSleep(true); - EXPECT_TRUE(irgree.getSleep()); + ac.setSleep(true); + EXPECT_TRUE(ac.getSleep()); } TEST(TestGreeClass, FanSpeed) { - IRGreeAC irgree(0); - irgree.begin(); + IRGreeAC ac(kGpioUnused); + ac.begin(); - irgree.setFan(0); - EXPECT_EQ(0, irgree.getFan()); + ac.setFan(0); + EXPECT_EQ(0, ac.getFan()); - irgree.setFan(255); - EXPECT_EQ(kGreeFanMax, irgree.getFan()); + ac.setFan(255); + EXPECT_EQ(kGreeFanMax, ac.getFan()); - irgree.setFan(kGreeFanMax); - EXPECT_EQ(kGreeFanMax, irgree.getFan()); + ac.setFan(kGreeFanMax); + EXPECT_EQ(kGreeFanMax, ac.getFan()); - irgree.setFan(kGreeFanMax + 1); - EXPECT_EQ(kGreeFanMax, irgree.getFan()); + ac.setFan(kGreeFanMax + 1); + EXPECT_EQ(kGreeFanMax, ac.getFan()); - irgree.setFan(kGreeFanMax - 1); - EXPECT_EQ(kGreeFanMax - 1, irgree.getFan()); + ac.setFan(kGreeFanMax - 1); + EXPECT_EQ(kGreeFanMax - 1, ac.getFan()); - irgree.setFan(1); - EXPECT_EQ(1, irgree.getFan()); + ac.setFan(1); + EXPECT_EQ(1, ac.getFan()); - irgree.setFan(1); - EXPECT_EQ(1, irgree.getFan()); + ac.setFan(1); + EXPECT_EQ(1, ac.getFan()); - irgree.setFan(3); - EXPECT_EQ(3, irgree.getFan()); + ac.setFan(3); + EXPECT_EQ(3, ac.getFan()); } TEST(TestGreeClass, VerticalSwing) { - IRGreeAC irgree(0); - irgree.begin(); - EXPECT_FALSE(irgree.getSwingVerticalAuto()); - EXPECT_EQ(kGreeSwingLastPos, irgree.getSwingVerticalPosition()); + IRGreeAC ac(kGpioUnused); + ac.begin(); + EXPECT_FALSE(ac.getSwingVerticalAuto()); + EXPECT_EQ(kGreeSwingLastPos, ac.getSwingVerticalPosition()); - irgree.setSwingVertical(true, kGreeSwingAuto); - EXPECT_TRUE(irgree.getSwingVerticalAuto()); - EXPECT_EQ(kGreeSwingAuto, irgree.getSwingVerticalPosition()); + ac.setSwingVertical(true, kGreeSwingAuto); + EXPECT_TRUE(ac.getSwingVerticalAuto()); + EXPECT_EQ(kGreeSwingAuto, ac.getSwingVerticalPosition()); - irgree.setSwingVertical(false, kGreeSwingMiddle); - EXPECT_FALSE(irgree.getSwingVerticalAuto()); - EXPECT_EQ(kGreeSwingMiddle, irgree.getSwingVerticalPosition()); + ac.setSwingVertical(false, kGreeSwingMiddle); + EXPECT_FALSE(ac.getSwingVerticalAuto()); + EXPECT_EQ(kGreeSwingMiddle, ac.getSwingVerticalPosition()); - irgree.setSwingVertical(true, kGreeSwingDownAuto); - EXPECT_TRUE(irgree.getSwingVerticalAuto()); - EXPECT_EQ(kGreeSwingDownAuto, irgree.getSwingVerticalPosition()); + ac.setSwingVertical(true, kGreeSwingDownAuto); + EXPECT_TRUE(ac.getSwingVerticalAuto()); + EXPECT_EQ(kGreeSwingDownAuto, ac.getSwingVerticalPosition()); // Out of bounds. - irgree.setSwingVertical(false, 255); - EXPECT_FALSE(irgree.getSwingVerticalAuto()); - EXPECT_EQ(kGreeSwingLastPos, irgree.getSwingVerticalPosition()); - irgree.setSwingVertical(false, kGreeSwingAuto); - EXPECT_FALSE(irgree.getSwingVerticalAuto()); - EXPECT_EQ(kGreeSwingLastPos, irgree.getSwingVerticalPosition()); + ac.setSwingVertical(false, 255); + EXPECT_FALSE(ac.getSwingVerticalAuto()); + EXPECT_EQ(kGreeSwingLastPos, ac.getSwingVerticalPosition()); + ac.setSwingVertical(false, kGreeSwingAuto); + EXPECT_FALSE(ac.getSwingVerticalAuto()); + EXPECT_EQ(kGreeSwingLastPos, ac.getSwingVerticalPosition()); - irgree.setSwingVertical(true, 255); - EXPECT_TRUE(irgree.getSwingVerticalAuto()); - EXPECT_EQ(kGreeSwingAuto, irgree.getSwingVerticalPosition()); - irgree.setSwingVertical(true, kGreeSwingDown); - EXPECT_TRUE(irgree.getSwingVerticalAuto()); - EXPECT_EQ(kGreeSwingAuto, irgree.getSwingVerticalPosition()); + ac.setSwingVertical(true, 255); + EXPECT_TRUE(ac.getSwingVerticalAuto()); + EXPECT_EQ(kGreeSwingAuto, ac.getSwingVerticalPosition()); + ac.setSwingVertical(true, kGreeSwingDown); + EXPECT_TRUE(ac.getSwingVerticalAuto()); + EXPECT_EQ(kGreeSwingAuto, ac.getSwingVerticalPosition()); } TEST(TestGreeClass, SetAndGetRaw) { - IRGreeAC irgree(0); + IRGreeAC ac(kGpioUnused); uint8_t initialState[kGreeStateLength] = {0x00, 0x09, 0x20, 0x50, 0x00, 0x20, 0x00, 0x50}; uint8_t expectedState[kGreeStateLength] = {0xA9, 0x05, 0xD0, 0x50, 0x00, 0x20, 0x00, 0xA0}; - EXPECT_STATE_EQ(initialState, irgree.getRaw(), kGreeBits); + EXPECT_STATE_EQ(initialState, ac.getRaw(), kGreeBits); // toggle the power state. - irgree.setPower(!irgree.getPower()); - irgree.setMode(kGreeCool); - irgree.setTemp(21); - irgree.setFan(2); - irgree.setLight(false); - irgree.setTurbo(true); - irgree.setSleep(true); - irgree.setXFan(true); + ac.setPower(!ac.getPower()); + ac.setMode(kGreeCool); + ac.setTemp(21); + ac.setFan(2); + ac.setLight(false); + ac.setTurbo(true); + ac.setSleep(true); + ac.setXFan(true); - EXPECT_EQ(kGreeCool, irgree.getMode()); - EXPECT_EQ(21, irgree.getTemp()); - EXPECT_EQ(2, irgree.getFan()); - EXPECT_FALSE(irgree.getLight()); - EXPECT_TRUE(irgree.getTurbo()); - EXPECT_TRUE(irgree.getSleep()); - EXPECT_TRUE(irgree.getXFan()); + EXPECT_EQ(kGreeCool, ac.getMode()); + EXPECT_EQ(21, ac.getTemp()); + EXPECT_EQ(2, ac.getFan()); + EXPECT_FALSE(ac.getLight()); + EXPECT_TRUE(ac.getTurbo()); + EXPECT_TRUE(ac.getSleep()); + EXPECT_TRUE(ac.getXFan()); - EXPECT_STATE_EQ(expectedState, irgree.getRaw(), kGreeBits); - irgree.setRaw(initialState); - EXPECT_STATE_EQ(initialState, irgree.getRaw(), kGreeBits); + EXPECT_STATE_EQ(expectedState, ac.getRaw(), kGreeBits); + ac.setRaw(initialState); + EXPECT_STATE_EQ(initialState, ac.getRaw(), kGreeBits); } TEST(TestGreeClass, HumanReadable) { - IRGreeAC irgree(0); + IRGreeAC ac(kGpioUnused); EXPECT_EQ( "Model: 1 (YAW1F), Power: Off, Mode: 0 (Auto), Temp: 25C, Fan: 0 (Auto), " "Turbo: Off, IFeel: Off, WiFi: Off, XFan: Off, Light: On, Sleep: Off, " "Swing(V) Mode: Manual, Swing(V): 0 (Last), " - "Timer: Off", - irgree.toString()); - irgree.on(); - irgree.setMode(kGreeCool); - irgree.setTemp(kGreeMinTemp); - irgree.setFan(kGreeFanMax); - irgree.setXFan(true); - irgree.setSleep(true); - irgree.setLight(false); - irgree.setTurbo(true); - irgree.setIFeel(true); - irgree.setWiFi(true); - irgree.setSwingVertical(true, kGreeSwingAuto); - irgree.setTimer(12 * 60 + 30); + "Timer: Off, Display Temp: 0 (Off)", + ac.toString()); + ac.on(); + ac.setMode(kGreeCool); + ac.setTemp(kGreeMinTempC); + ac.setFan(kGreeFanMax); + ac.setXFan(true); + ac.setSleep(true); + ac.setLight(false); + ac.setTurbo(true); + ac.setIFeel(true); + ac.setWiFi(true); + ac.setSwingVertical(true, kGreeSwingAuto); + ac.setTimer(12 * 60 + 30); + ac.setDisplayTempSource(3); EXPECT_EQ( "Model: 1 (YAW1F), Power: On, Mode: 1 (Cool), Temp: 16C, Fan: 3 (High), " "Turbo: On, IFeel: On, WiFi: On, XFan: On, Light: Off, Sleep: On, " - "Swing(V) Mode: Auto, Swing(V): 1 (Auto), Timer: 12:30", - irgree.toString()); + "Swing(V) Mode: Auto, Swing(V): 1 (Auto), Timer: 12:30, " + "Display Temp: 3 (Outside)", + ac.toString()); } // Tests for decodeGree(). // Decode a synthetic Gree message. TEST(TestDecodeGree, NormalSynthetic) { - IRsendTest irsend(4); - IRrecv irrecv(4); + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); irsend.begin(); uint8_t gree_code[kGreeStateLength] = {0x00, 0x09, 0x20, 0x50, @@ -542,9 +590,9 @@ TEST(TestDecodeGree, NormalSynthetic) { // Decode a real Gree message. TEST(TestDecodeGree, NormalRealExample) { - IRsendTest irsend(4); - IRrecv irrecv(4); - IRGreeAC irgree(4); + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + IRGreeAC ac(kGpioUnused); irsend.begin(); uint8_t gree_code[kGreeStateLength] = {0x19, 0x0A, 0x60, 0x50, @@ -572,18 +620,19 @@ TEST(TestDecodeGree, NormalRealExample) { EXPECT_EQ(GREE, irsend.capture.decode_type); ASSERT_EQ(kGreeBits, irsend.capture.bits); EXPECT_STATE_EQ(gree_code, irsend.capture.state, kGreeBits); - irgree.setRaw(irsend.capture.state); + ac.setRaw(irsend.capture.state); EXPECT_EQ( "Model: 1 (YAW1F), Power: On, Mode: 1 (Cool), Temp: 26C, Fan: 1 (Low), " "Turbo: Off, IFeel: Off, WiFi: Off, XFan: Off, Light: On, Sleep: Off, " - "Swing(V) Mode: Manual, Swing(V): 2 (UNKNOWN), Timer: Off", + "Swing(V) Mode: Manual, Swing(V): 2 (UNKNOWN), Timer: Off, " + "Display Temp: 3 (Outside)", IRAcUtils::resultAcToString(&irsend.capture)); stdAc::state_t r, p; ASSERT_TRUE(IRAcUtils::decodeToState(&irsend.capture, &r, &p)); } TEST(TestGreeClass, toCommon) { - IRGreeAC ac(0); + IRGreeAC ac(kGpioUnused); ac.setPower(true); ac.setMode(kGreeCool); ac.setTemp(20); @@ -616,7 +665,7 @@ TEST(TestGreeClass, toCommon) { } TEST(TestGreeClass, Issue814Power) { - IRGreeAC ac(0); + IRGreeAC ac(kGpioUnused); ac.begin(); // https://github.com/crankyoldgit/IRremoteESP8266/issues/814#issuecomment-511263921 @@ -633,7 +682,8 @@ TEST(TestGreeClass, Issue814Power) { EXPECT_EQ( "Model: 2 (YBOFB), Power: On, Mode: 1 (Cool), Temp: 23C, Fan: 1 (Low), " "Turbo: Off, IFeel: Off, WiFi: Off, XFan: Off, Light: On, Sleep: Off, " - "Swing(V) Mode: Auto, Swing(V): 1 (Auto), Timer: Off", + "Swing(V) Mode: Auto, Swing(V): 1 (Auto), Timer: Off, " + "Display Temp: 0 (Off)", ac.toString()); ac.off(); EXPECT_STATE_EQ(off, ac.getRaw(), kGreeBits); @@ -650,7 +700,7 @@ TEST(TestGreeClass, Issue814Power) { } TEST(TestGreeClass, Timer) { - IRGreeAC ac(0); + IRGreeAC ac(kGpioUnused); ac.begin(); ac.setTimer(0); @@ -689,3 +739,25 @@ TEST(TestGreeClass, Timer) { EXPECT_TRUE(ac.getTimerEnabled()); EXPECT_EQ(24 * 60, ac.getTimer()); } + +TEST(TestGreeClass, DisplayTempSource) { + IRGreeAC ac(kGpioUnused); + ac.begin(); + + ac.setDisplayTempSource(1); + EXPECT_EQ(1, ac.getDisplayTempSource()); + + ac.setDisplayTempSource(2); + EXPECT_EQ(2, ac.getDisplayTempSource()); + + ac.setDisplayTempSource(3); + EXPECT_EQ(3, ac.getDisplayTempSource()); + + ac.setDisplayTempSource(1); + EXPECT_EQ(1, ac.getDisplayTempSource()); + + // Ref: https://github.com/crankyoldgit/IRremoteESP8266/issues/1118#issuecomment-627674014 + const uint8_t state[8] = {0x4C, 0x04, 0x60, 0x50, 0x01, 0x02, 0x00, 0xA0}; + ac.setRaw(state); + EXPECT_EQ(2, ac.getDisplayTempSource()); +} diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Haier_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Haier_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Haier_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Haier_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Hitachi_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Hitachi_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Hitachi_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Hitachi_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Inax_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Inax_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Inax_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Inax_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_JVC_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_JVC_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_JVC_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_JVC_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Kelvinator_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Kelvinator_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Kelvinator_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Kelvinator_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_LG_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_LG_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_LG_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_LG_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Lasertag_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Lasertag_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Lasertag_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Lasertag_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Lego_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Lego_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Lego_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Lego_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Lutron_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Lutron_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Lutron_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Lutron_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_MWM_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_MWM_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_MWM_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_MWM_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Magiquest_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Magiquest_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Magiquest_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Magiquest_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Midea_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Midea_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Midea_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Midea_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_MitsubishiHeavy_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_MitsubishiHeavy_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_MitsubishiHeavy_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_MitsubishiHeavy_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Mitsubishi_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Mitsubishi_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Mitsubishi_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Mitsubishi_test.cpp diff --git a/lib/IRremoteESP8266-2.7.7/test/ir_Multibrackets_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Multibrackets_test.cpp new file mode 100644 index 000000000..7b58b3333 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/test/ir_Multibrackets_test.cpp @@ -0,0 +1,98 @@ +// Copyright 2020 David Conran + +#include "IRac.h" +#include "IRrecv.h" +#include "IRrecv_test.h" +#include "IRsend.h" +#include "IRsend_test.h" +#include "gtest/gtest.h" + +// Tests for decodeMultibrackets(). + +// Ref: https://github.com/crankyoldgit/IRremoteESP8266/issues/1103 + +TEST(TestDecodeMultibrackets, RealExample) { + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + // The 1 + ok keypress: + uint16_t rawData_1[7] = {20100, 20472, 15092, 30704, 20102, 20472, 15086}; + irsend.begin(); + irsend.reset(); + irsend.sendRaw(rawData_1, 7, 38); + irsend.makeDecodeResult(); + + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + ASSERT_EQ(decode_type_t::MULTIBRACKETS, irsend.capture.decode_type); + ASSERT_EQ(kMultibracketsBits, irsend.capture.bits); + EXPECT_EQ(0x87, irsend.capture.value); + EXPECT_EQ(0x0, irsend.capture.address); + EXPECT_EQ(0x0, irsend.capture.command); + + // ok keypress. + const uint16_t rawData_2[11] = { + 25124, 5108, 5038, 5110, 5034, 40940, 25132, 5108, 5036, 5110, 5036}; + + irsend.begin(); + irsend.reset(); + irsend.sendRaw(rawData_2, 11, 38); + irsend.makeDecodeResult(); + + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + ASSERT_EQ(decode_type_t::MULTIBRACKETS, irsend.capture.decode_type); + ASSERT_EQ(kMultibracketsBits, irsend.capture.bits); + EXPECT_EQ(0xD4, irsend.capture.value); + EXPECT_EQ(0x0, irsend.capture.address); + EXPECT_EQ(0x0, irsend.capture.command); +} + +TEST(TestDecodeMultibrackets, SyntheticExample) { + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + irsend.begin(); + irsend.reset(); + irsend.sendMultibrackets(0x87); + irsend.makeDecodeResult(); + + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + EXPECT_EQ(decode_type_t::MULTIBRACKETS, irsend.capture.decode_type); + EXPECT_EQ(kMultibracketsBits, irsend.capture.bits); + EXPECT_EQ(0x87, irsend.capture.value); + EXPECT_EQ(0x0, irsend.capture.address); + EXPECT_EQ(0x0, irsend.capture.command); + + // Real data is: + // uint16_t rawData[7] = {20100, 20472, 15092, 30704, 20102, 20472, 15086}; + + EXPECT_EQ( + "f38000d50m20000s20000m15000s30000m20000s20000m15000s30000", + irsend.outputStr()); +} + +TEST(TestUtils, Housekeeping) { + ASSERT_EQ("MULTIBRACKETS", typeToString(decode_type_t::MULTIBRACKETS)); + ASSERT_EQ(decode_type_t::MULTIBRACKETS, strToDecodeType("MULTIBRACKETS")); + ASSERT_FALSE(hasACState(decode_type_t::MULTIBRACKETS)); + ASSERT_FALSE(IRac::isProtocolSupported(decode_type_t::MULTIBRACKETS)); + ASSERT_EQ(kMultibracketsBits, + IRsend::defaultBits(decode_type_t::MULTIBRACKETS)); + ASSERT_EQ(kMultibracketsDefaultRepeat, + IRsend::minRepeats(decode_type_t::MULTIBRACKETS)); +} + +TEST(TestDecodeMultibrackets, ShortNoRepeatExample) { + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + // The 1 + ok keypress: (edited to be bare minimum) + uint16_t rawData[3] = {20100, 20472, 15092}; + irsend.begin(); + irsend.reset(); + irsend.sendRaw(rawData, 3, 38); + irsend.makeDecodeResult(); + + ASSERT_TRUE(irrecv.decode(&irsend.capture)); + ASSERT_EQ(decode_type_t::MULTIBRACKETS, irsend.capture.decode_type); + ASSERT_EQ(kMultibracketsBits, irsend.capture.bits); + EXPECT_EQ(0x87, irsend.capture.value); + EXPECT_EQ(0x0, irsend.capture.address); + EXPECT_EQ(0x0, irsend.capture.command); +} diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_NEC_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_NEC_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_NEC_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_NEC_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Neoclima_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Neoclima_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Neoclima_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Neoclima_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Nikai_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Nikai_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Nikai_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Nikai_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Panasonic_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Panasonic_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Panasonic_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Panasonic_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Pioneer_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Pioneer_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Pioneer_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Pioneer_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Pronto_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Pronto_test.cpp similarity index 69% rename from lib/IRremoteESP8266-2.7.6/test/ir_Pronto_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Pronto_test.cpp index b5020987f..8331192bc 100644 --- a/lib/IRremoteESP8266-2.7.6/test/ir_Pronto_test.cpp +++ b/lib/IRremoteESP8266-2.7.7/test/ir_Pronto_test.cpp @@ -58,7 +58,7 @@ TEST(TestSendPronto, MoreDataThanNeededInNormal) { uint16_t pronto_test[8] = {0x0000, 0x0067, 0x0001, 0x0000, 0x0001, 0x0002, 0x0003, 0x0004}; irsend.sendPronto(pronto_test, 8); - EXPECT_EQ("f40244d50m25s50", + EXPECT_EQ("f40244d50m24s49", irsend.outputStr()); // Only send the data required. } @@ -71,7 +71,7 @@ TEST(TestSendPronto, MoreDataThanNeededInRepeat) { uint16_t pronto_test[8] = {0x0000, 0x0067, 0x0000, 0x0001, 0x0001, 0x0002, 0x0003, 0x0004}; irsend.sendPronto(pronto_test, 8); - EXPECT_EQ("f40244d50m25s50", + EXPECT_EQ("f40244d50m24s49", irsend.outputStr()); // Only send the data required. } @@ -84,10 +84,10 @@ TEST(TestSendPronto, MoreDataThanNeededInBoth) { uint16_t pronto_test[10] = {0x0000, 0x0067, 0x0001, 0x0001, 0x0001, 0x0002, 0x0003, 0x0004, 0x5, 0x6}; irsend.sendPronto(pronto_test, 10); - EXPECT_EQ("f40244d50m25s50", + EXPECT_EQ("f40244d50m24s49", irsend.outputStr()); // Only send the data required. irsend.sendPronto(pronto_test, 10, 1); - EXPECT_EQ("f40244d50m25s50m75s100", + EXPECT_EQ("f40244d50m24s49m74s99", irsend.outputStr()); // Only the data required. } @@ -139,18 +139,18 @@ TEST(TestSendPronto, NonRepeatingCode) { EXPECT_EQ(0x0, irsend.capture.command); EXPECT_EQ( "f40244d50" - "m2400s600" - "m600s600m600s600m600s600m600s600m600s600m600s600m600s600m1200s600" - "m600s600m600s600m600s600m600s27650" - "m2400s600" - "m600s600m600s600m600s600m600s600m600s600m600s600m600s600m1200s600" - "m600s600m600s600m600s600m600s27650" - "m2400s600" - "m600s600m600s600m600s600m600s600m600s600m600s600m600s600m1200s600" - "m600s600m600s600m600s600m600s27650" - "m2400s600" - "m600s600m600s600m600s600m600s600m600s600m600s600m600s600m1200s600" - "m600s600m600s600m600s600m600s600", + "m2390s597" + "m597s597m597s597m597s597m597s597m597s597m597s597m597s597m1195s597" + "m597s597m597s597m597s597m597s27539" + "m2390s597" + "m597s597m597s597m597s597m597s597m597s597m597s597m597s597m1195s597" + "m597s597m597s597m597s597m597s27539" + "m2390s597" + "m597s597m597s597m597s597m597s597m597s597m597s597m597s597m1195s597" + "m597s597m597s597m597s597m597s27539" + "m2390s597" + "m597s597m597s597m597s597m597s597m597s597m597s597m597s597m1195s597" + "m597s597m597s597m597s597m597s597", irsend.outputStr()); // Now try repeating it. @@ -166,18 +166,18 @@ TEST(TestSendPronto, NonRepeatingCode) { EXPECT_EQ(0x0, irsend.capture.command); EXPECT_EQ( "f40244d50" - "m2400s600" - "m600s600m600s600m600s600m600s600m600s600m600s600m600s600m1200s600" - "m600s600m600s600m600s600m600s27650" - "m2400s600" - "m600s600m600s600m600s600m600s600m600s600m600s600m600s600m1200s600" - "m600s600m600s600m600s600m600s27650" - "m2400s600" - "m600s600m600s600m600s600m600s600m600s600m600s600m600s600m1200s600" - "m600s600m600s600m600s600m600s27650" - "m2400s600" - "m600s600m600s600m600s600m600s600m600s600m600s600m600s600m1200s600" - "m600s600m600s600m600s600m600s600", + "m2390s597" + "m597s597m597s597m597s597m597s597m597s597m597s597m597s597m1195s597" + "m597s597m597s597m597s597m597s27539" + "m2390s597" + "m597s597m597s597m597s597m597s597m597s597m597s597m597s597m1195s597" + "m597s597m597s597m597s597m597s27539" + "m2390s597" + "m597s597m597s597m597s597m597s597m597s597m597s597m597s597m1195s597" + "m597s597m597s597m597s597m597s27539" + "m2390s597" + "m597s597m597s597m597s597m597s597m597s597m597s597m597s597m1195s597" + "m597s597m597s597m597s597m597s597", irsend.outputStr()); } @@ -208,10 +208,10 @@ TEST(TestSendPronto, RepeatSequenceOnlyForSony) { EXPECT_EQ(0x24AE, irsend.capture.command); EXPECT_EQ( "f40244d50" - "m2400s600" - "m600s600m1200s600m1200s600m1200s600m600s600m1200s600m600s600m600s600" - "m1200s600m600s600m1200s600m1200s600m1200s600m600s600m600s600m1200s600" - "m600s600m600s600m1200s600m600s25350", + "m2390s597" + "m597s597m1195s597m1195s597m1195s597m597s597m1195s597m597s597m597s597" + "m1195s597m597s597m1195s597m1195s597m1195s597m597s597m597s597m1195s597" + "m597s597m597s597m1195s597m597s25248", irsend.outputStr()); // Send the Pronto code with 2 repeats. @@ -226,18 +226,18 @@ TEST(TestSendPronto, RepeatSequenceOnlyForSony) { EXPECT_EQ(0x24AE, irsend.capture.command); EXPECT_EQ( "f40244d50" - "m2400s600" - "m600s600m1200s600m1200s600m1200s600m600s600m1200s600m600s600m600s600" - "m1200s600m600s600m1200s600m1200s600m1200s600m600s600m600s600m1200s600" - "m600s600m600s600m1200s600m600s25350" - "m2400s600" - "m600s600m1200s600m1200s600m1200s600m600s600m1200s600m600s600m600s600" - "m1200s600m600s600m1200s600m1200s600m1200s600m600s600m600s600m1200s600" - "m600s600m600s600m1200s600m600s25350" - "m2400s600" - "m600s600m1200s600m1200s600m1200s600m600s600m1200s600m600s600m600s600" - "m1200s600m600s600m1200s600m1200s600m1200s600m600s600m600s600m1200s600" - "m600s600m600s600m1200s600m600s25350", + "m2390s597" + "m597s597m1195s597m1195s597m1195s597m597s597m1195s597m597s597m597s597" + "m1195s597m597s597m1195s597m1195s597m1195s597m597s597m597s597m1195s597" + "m597s597m597s597m1195s597m597s25248" + "m2390s597" + "m597s597m1195s597m1195s597m1195s597m597s597m1195s597m597s597m597s597" + "m1195s597m597s597m1195s597m1195s597m1195s597m597s597m597s597m1195s597" + "m597s597m597s597m1195s597m597s25248" + "m2390s597" + "m597s597m1195s597m1195s597m1195s597m597s597m1195s597m597s597m597s597" + "m1195s597m597s597m1195s597m1195s597m1195s597m597s597m597s597m1195s597" + "m597s597m597s597m1195s597m597s25248", irsend.outputStr()); } @@ -274,14 +274,14 @@ TEST(TestSendPronto, RepeatSequenceOnlyForPanasonic) { EXPECT_EQ(0x1007C7D, irsend.capture.command); EXPECT_EQ( "f36682d50" - "m3456s1701" - "m432s432m432s1296m432s432m432s432m432s432m432s432m432s432m432s432" - "m432s432m432s432m432s432m432s432m432s432m432s1296m432s432m432s432" - "m432s432m432s432m432s432m432s432m432s432m432s432m432s432m432s1296" - "m432s432m432s432m432s432m432s432m432s432m432s432m432s432m432s432" - "m432s432m432s1296m432s1296m432s1296m432s1296m432s1296m432s432m432s432" - "m432s432m432s1296m432s1296m432s1296m432s1296m432s1296m432s432m432s1296" - "m432s73224", + "m3494s1719" + "m436s436m436s1310m436s436m436s436m436s436m436s436m436s436m436s436" + "m436s436m436s436m436s436m436s436m436s436m436s1310m436s436m436s436" + "m436s436m436s436m436s436m436s436m436s436m436s436m436s436m436s1310" + "m436s436m436s436m436s436m436s436m436s436m436s436m436s436m436s436" + "m436s436m436s1310m436s1310m436s1310m436s1310m436s1310m436s436m436s436" + "m436s436m436s1310m436s1310m436s1310m436s1310m436s1310m436s436m436s1310" + "m436s74037", irsend.outputStr()); } @@ -315,12 +315,12 @@ TEST(TestSendPronto, NormalPlusRepeatSequence) { EXPECT_EQ(0x8, irsend.capture.command); EXPECT_EQ( "f38028d50" - "m8892s4446" - "m546s546m546s546m546s546m546s1664m546s1664m546s546m546s546m546s546" - "m546s1664m546s1664m546s1664m546s546m546s546m546s1664m546s1664m546s1664" - "m546s546m546s546m546s546m546s1664m546s546m546s546m546s546m546s546" - "m546s1664m546s1664m546s1664m546s546m546s1664m546s1664m546s1664m546s1664" - "m546s39858", + "m8994s4497" + "m552s552m552s552m552s552m552s1683m552s1683m552s552m552s552m552s552" + "m552s1683m552s1683m552s1683m552s552m552s552m552s1683m552s1683m552s1683" + "m552s552m552s552m552s552m552s1683m552s552m552s552m552s552m552s552" + "m552s1683m552s1683m552s1683m552s552m552s1683m552s1683m552s1683m552s1683" + "m552s40317", irsend.outputStr()); // Send it again with a single repeat. @@ -335,13 +335,13 @@ TEST(TestSendPronto, NormalPlusRepeatSequence) { EXPECT_EQ(0x8, irsend.capture.command); EXPECT_EQ( "f38028d50" - "m8892s4446" - "m546s546m546s546m546s546m546s1664m546s1664m546s546m546s546m546s546" - "m546s1664m546s1664m546s1664m546s546m546s546m546s1664m546s1664m546s1664" - "m546s546m546s546m546s546m546s1664m546s546m546s546m546s546m546s546" - "m546s1664m546s1664m546s1664m546s546m546s1664m546s1664m546s1664m546s1664" - "m546s39858" - "m8892s2210m546s95212", + "m8994s4497" + "m552s552m552s552m552s552m552s1683m552s1683m552s552m552s552m552s552" + "m552s1683m552s1683m552s1683m552s552m552s552m552s1683m552s1683m552s1683" + "m552s552m552s552m552s552m552s1683m552s552m552s552m552s552m552s552" + "m552s1683m552s1683m552s1683m552s552m552s1683m552s1683m552s1683m552s1683" + "m552s40317" + "m8994s2235m552s96310", irsend.outputStr()); // Send it again with a two repeats. @@ -356,14 +356,14 @@ TEST(TestSendPronto, NormalPlusRepeatSequence) { EXPECT_EQ(0x8, irsend.capture.command); EXPECT_EQ( "f38028d50" - "m8892s4446" - "m546s546m546s546m546s546m546s1664m546s1664m546s546m546s546m546s546" - "m546s1664m546s1664m546s1664m546s546m546s546m546s1664m546s1664m546s1664" - "m546s546m546s546m546s546m546s1664m546s546m546s546m546s546m546s546" - "m546s1664m546s1664m546s1664m546s546m546s1664m546s1664m546s1664m546s1664" - "m546s39858" - "m8892s2210m546s95212" - "m8892s2210m546s95212", + "m8994s4497" + "m552s552m552s552m552s552m552s1683m552s1683m552s552m552s552m552s552" + "m552s1683m552s1683m552s1683m552s552m552s552m552s1683m552s1683m552s1683" + "m552s552m552s552m552s552m552s1683m552s552m552s552m552s552m552s552" + "m552s1683m552s1683m552s1683m552s552m552s1683m552s1683m552s1683m552s1683" + "m552s40317" + "m8994s2235m552s96310" + "m8994s2235m552s96310", irsend.outputStr()); } @@ -391,3 +391,47 @@ TEST(TestSendPronto, Issue1034) { EXPECT_EQ(0xa3, irsend.capture.address); EXPECT_EQ(0x10, irsend.capture.command); } + +// Tests for #1103 +TEST(TestSendPronto, Issue1103) { + IRsendTest irsend(0); + IRrecv irrecv(0); + irsend.begin(); + // Based on raw data: + // uint16_t rawData[7] = {20100, 20472, 15092, 30704, 20102, 20472, 15086}; + // and output from `raw_to_pronto_code.py --hz 38000`: + // Pronto code = '0000 006D 0004 0000 02FB 0309 023D 048E 02FB 0309 023D 0ED8' + uint16_t pronto_test[12] = { + 0x0000, 0x006D, 0x0004, 0x0000, 0x02FB, 0x0309, 0x023D, 0x048E, + 0x02FB, 0x0309, 0x023D, 0x0ED8}; + irsend.reset(); + irsend.sendPronto(pronto_test, 12); + EXPECT_EQ( + "f38028d50m20066s20435m15069s30665m20066s20435m15069s99940", + irsend.outputStr()); + // Which pretty much matches the `rawData` above. + + // Shorter test. + // uint16_t rawData[4] = {20100, 20472, 15092, 30704}; + // and output from `raw_to_pronto_code.py --hz 38000`: + // Pronto code = '0000 006D 0002 0000 02FB 0309 023D 048E' + uint16_t pronto_test2[8] = { + 0x0000, 0x006D, 0x0002, 0x0000, 0x02FB, 0x0309, 0x023D, 0x048E}; + irsend.reset(); + irsend.sendPronto(pronto_test2, 8); + EXPECT_EQ( + "f38028d50m20066s20435m15069s30665", + irsend.outputStr()); + // Which pretty much matches the `rawData` above. + + // Ref: + // https://github.com/crankyoldgit/IRremoteESP8266/issues/1103#issuecomment-628946514 + uint16_t pronto_test_using_repeat[12] = { + 0x0000, 0x006D, 0x0000, 0x0004, 0x02fb, 0x0309, 0x023d, 0x048e, 0x02fb, + 0x0309, 0x023d, 0x0474}; + irsend.reset(); + irsend.sendPronto(pronto_test_using_repeat, 12); + EXPECT_EQ( + "f38028d50m20066s20435m15069s30665m20066s20435m15069s29982", + irsend.outputStr()); +} diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_RC5_RC6_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_RC5_RC6_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_RC5_RC6_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_RC5_RC6_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_RCMM_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_RCMM_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_RCMM_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_RCMM_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Samsung_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Samsung_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Samsung_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Samsung_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Sanyo_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Sanyo_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Sanyo_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Sanyo_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Sharp_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Sharp_test.cpp similarity index 69% rename from lib/IRremoteESP8266-2.7.6/test/ir_Sharp_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Sharp_test.cpp index 173c94f2a..c0c8bd5be 100644 --- a/lib/IRremoteESP8266-2.7.6/test/ir_Sharp_test.cpp +++ b/lib/IRremoteESP8266-2.7.7/test/ir_Sharp_test.cpp @@ -408,8 +408,8 @@ TEST(TestDecodeSharpAc, RealExample) { ASSERT_EQ(SHARP_AC, irsend.capture.decode_type); ASSERT_EQ(kSharpAcBits, irsend.capture.bits); EXPECT_STATE_EQ(expectedState, irsend.capture.state, irsend.capture.bits); - EXPECT_EQ("Power: On, Previous Power: On, Mode: 2 (Cool), Temp: 27C, " - "Fan: 2 (Auto)", + EXPECT_EQ("Power: On, Mode: 2 (Cool), Temp: 27C, Fan: 2 (Auto), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", IRAcUtils::resultAcToString(&irsend.capture)); stdAc::state_t r, p; ASSERT_TRUE(IRAcUtils::decodeToState(&irsend.capture, &r, &p)); @@ -448,23 +448,6 @@ TEST(TestIRUtils, SharpAc) { // Tests for IRSharpAc class. -TEST(TestSharpAcClass, Power) { - IRSharpAc ac(0); - ac.begin(); - - ac.on(); - EXPECT_TRUE(ac.getPower()); - - ac.off(); - EXPECT_FALSE(ac.getPower()); - - ac.setPower(true); - EXPECT_TRUE(ac.getPower()); - - ac.setPower(false); - EXPECT_FALSE(ac.getPower()); -} - TEST(TestSharpAcClass, Checksum) { uint8_t state[kSharpAcStateLength] = { 0xAA, 0x5A, 0xCF, 0x10, 0xCC, 0x31, 0x22, 0x00, 0x08, 0x80, 0x04, 0xE0, @@ -477,7 +460,7 @@ TEST(TestSharpAcClass, Checksum) { } TEST(TestSharpAcClass, Temperature) { - IRSharpAc ac(0); + IRSharpAc ac(kGpioUnused); ac.begin(); ac.setMode(kSharpAcCool); // Cool mode doesn't have temp restrictions. @@ -510,10 +493,20 @@ TEST(TestSharpAcClass, Temperature) { ac.setTemp(29); EXPECT_EQ(29, ac.getTemp()); + + // Auto & Dry have special temps. Per request, we should revert to the + // previous temp when we exit those modes. + + ac.setMode(kSharpAcAuto); + EXPECT_EQ(kSharpAcMinTemp, ac.getTemp()); + ac.setMode(kSharpAcDry); + EXPECT_EQ(kSharpAcMinTemp, ac.getTemp()); + ac.setMode(kSharpAcCool); + EXPECT_EQ(29, ac.getTemp()); } TEST(TestSharpAcClass, OperatingMode) { - IRSharpAc ac(0); + IRSharpAc ac(kGpioUnused); ac.begin(); ac.setTemp(25); @@ -547,7 +540,7 @@ TEST(TestSharpAcClass, OperatingMode) { TEST(TestSharpAcClass, FanSpeed) { - IRSharpAc ac(0); + IRSharpAc ac(kGpioUnused); ac.begin(); // Unexpected value should default to Auto. @@ -582,7 +575,7 @@ TEST(TestSharpAcClass, FanSpeed) { } TEST(TestSharpAcClass, ReconstructKnownState) { - IRSharpAc ac(0); + IRSharpAc ac(kGpioUnused); ac.begin(); uint8_t on_auto_auto[kSharpAcStateLength] = { @@ -593,8 +586,8 @@ TEST(TestSharpAcClass, ReconstructKnownState) { ac.setFan(kSharpAcFanAuto); ac.setMode(kSharpAcAuto); EXPECT_STATE_EQ(on_auto_auto, ac.getRaw(), kSharpAcBits); - EXPECT_EQ("Power: On, Previous Power: Off, Mode: 0 (Auto), Temp: 15C, " - "Fan: 2 (Auto)", + EXPECT_EQ("Power: On, Mode: 0 (Auto), Temp: 15C, Fan: 2 (Auto), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", ac.toString()); uint8_t cool_auto_28[kSharpAcStateLength] = { @@ -605,15 +598,15 @@ TEST(TestSharpAcClass, ReconstructKnownState) { ac.setMode(kSharpAcCool); ac.setFan(kSharpAcFanAuto); ac.setTemp(28); - EXPECT_EQ("Power: On, Previous Power: On, Mode: 2 (Cool), Temp: 28C, " - "Fan: 2 (Auto)", + EXPECT_EQ("Power: On, Mode: 2 (Cool), Temp: 28C, Fan: 2 (Auto), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", ac.toString()); EXPECT_STATE_EQ(cool_auto_28, ac.getRaw(), kSharpAcBits); } // https://github.com/crankyoldgit/IRremoteESP8266/issues/638#issue-421064165 TEST(TestSharpAcClass, KnownStates) { - IRSharpAc ac(0); + IRSharpAc ac(kGpioUnused); ac.begin(); uint8_t off_auto_auto[kSharpAcStateLength] = { @@ -621,65 +614,66 @@ TEST(TestSharpAcClass, KnownStates) { 0x31}; ASSERT_TRUE(ac.validChecksum(off_auto_auto)); ac.setRaw(off_auto_auto); - EXPECT_EQ("Power: Off, Previous Power: On, Mode: 0 (Auto), Temp: 15C, " - "Fan: 2 (Auto)", + EXPECT_EQ("Power: Off, Mode: 0 (Auto), Temp: 15C, Fan: 2 (Auto), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", ac.toString()); uint8_t on_auto_auto[kSharpAcStateLength] = { 0xAA, 0x5A, 0xCF, 0x10, 0x00, 0x11, 0x20, 0x00, 0x08, 0x80, 0x00, 0xE0, 0x01}; ASSERT_TRUE(ac.validChecksum(on_auto_auto)); ac.setRaw(on_auto_auto); - EXPECT_EQ("Power: On, Previous Power: Off, Mode: 0 (Auto), Temp: 15C, " - "Fan: 2 (Auto)", + EXPECT_EQ("Power: On, Mode: 0 (Auto), Temp: 15C, Fan: 2 (Auto), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", ac.toString()); uint8_t cool_auto_28[kSharpAcStateLength] = { 0xAA, 0x5A, 0xCF, 0x10, 0xCD, 0x31, 0x22, 0x00, 0x08, 0x80, 0x04, 0xE0, 0x51}; ASSERT_TRUE(ac.validChecksum(cool_auto_28)); ac.setRaw(cool_auto_28); - EXPECT_EQ("Power: On, Previous Power: On, Mode: 2 (Cool), Temp: 28C, " - "Fan: 2 (Auto)", + EXPECT_EQ("Power: On, Mode: 2 (Cool), Temp: 28C, Fan: 2 (Auto), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", ac.toString()); uint8_t cool_fan1_28[kSharpAcStateLength] = { 0xAA, 0x5A, 0xCF, 0x10, 0xCD, 0x31, 0x42, 0x00, 0x08, 0x80, 0x05, 0xE0, 0x21}; ASSERT_TRUE(ac.validChecksum(cool_fan1_28)); ac.setRaw(cool_fan1_28); - EXPECT_EQ("Power: On, Previous Power: On, Mode: 2 (Cool), Temp: 28C, " - "Fan: 4 (Low)", + EXPECT_EQ("Power: On, Mode: 2 (Cool), Temp: 28C, Fan: 4 (Low), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", ac.toString()); uint8_t cool_fan2_28[kSharpAcStateLength] = { 0xAA, 0x5A, 0xCF, 0x10, 0xCD, 0x31, 0x32, 0x00, 0x08, 0x80, 0x05, 0xE0, 0x51}; ASSERT_TRUE(ac.validChecksum(cool_fan2_28)); ac.setRaw(cool_fan2_28); - EXPECT_EQ("Power: On, Previous Power: On, Mode: 2 (Cool), Temp: 28C, " - "Fan: 3 (Medium)", + EXPECT_EQ("Power: On, Mode: 2 (Cool), Temp: 28C, Fan: 3 (Medium), " + "Turbo: Off, Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", ac.toString()); uint8_t cool_fan3_28[kSharpAcStateLength] = { 0xAA, 0x5A, 0xCF, 0x10, 0xCD, 0x31, 0x52, 0x00, 0x08, 0x80, 0x05, 0xE0, 0x31}; ASSERT_TRUE(ac.validChecksum(cool_fan3_28)); ac.setRaw(cool_fan3_28); - EXPECT_EQ("Power: On, Previous Power: On, Mode: 2 (Cool), Temp: 28C, " - "Fan: 5 (UNKNOWN)", + EXPECT_EQ("Power: On, Mode: 2 (Cool), Temp: 28C, Fan: 5 (UNKNOWN), " + "Turbo: Off, Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", ac.toString()); uint8_t cool_fan4_28[kSharpAcStateLength] = { 0xAA, 0x5A, 0xCF, 0x10, 0xCD, 0x31, 0x72, 0x00, 0x08, 0x80, 0x05, 0xE0, 0x11}; ASSERT_TRUE(ac.validChecksum(cool_fan4_28)); ac.setRaw(cool_fan4_28); - EXPECT_EQ("Power: On, Previous Power: On, Mode: 2 (Cool), Temp: 28C, " - "Fan: 7 (High)", + EXPECT_EQ("Power: On, Mode: 2 (Cool), Temp: 28C, Fan: 7 (High), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", ac.toString()); - /* Unsupported / Not yet reverse engineered. uint8_t cool_fan4_28_ion_on[kSharpAcStateLength] = { 0xAA, 0x5A, 0xCF, 0x10, 0xCD, 0x61, 0x72, 0x08, 0x08, 0x80, 0x00, 0xE4, 0xD1}; ASSERT_TRUE(ac.validChecksum(cool_fan4_28_ion_on)); ac.setRaw(cool_fan4_28_ion_on); - EXPECT_EQ("Power: On, Mode: 2 (Cool), Temp: 28C, Fan: 7 (Max)", + EXPECT_EQ("Power: -, Mode: 2 (Cool), Temp: 28C, Fan: 7 (High), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: On, Econo: -, Clean: Off", ac.toString()); + /* Unsupported / Not yet reverse engineered. uint8_t cool_fan4_28_eco1[kSharpAcStateLength] = { 0xAA, 0x5A, 0xCF, 0x10, 0xCD, 0x61, 0x72, 0x18, 0x08, 0x80, 0x00, 0xE8, 0x01}; @@ -692,13 +686,13 @@ TEST(TestSharpAcClass, KnownStates) { 0x11}; ASSERT_TRUE(ac.validChecksum(dry_auto)); ac.setRaw(dry_auto); - EXPECT_EQ("Power: On, Previous Power: On, Mode: 3 (Dry), Temp: 15C, " - "Fan: 2 (Auto)", + EXPECT_EQ("Power: On, Mode: 3 (Dry), Temp: 15C, Fan: 2 (Auto), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", ac.toString()); } TEST(TestSharpAcClass, toCommon) { - IRSharpAc ac(0); + IRSharpAc ac(kGpioUnused); ac.setPower(true); ac.setMode(kSharpAcCool); ac.setTemp(20); @@ -725,32 +719,20 @@ TEST(TestSharpAcClass, toCommon) { ASSERT_EQ(-1, ac.toCommon().clock); } -TEST(TestSharpAcClass, PreviousPower) { +TEST(TestSharpAcClass, Power) { IRSharpAc ac(kGpioUnused); ac.setPower(false, false); EXPECT_FALSE(ac.getPower()); - EXPECT_FALSE(ac.getPreviousPower()); ac.setPower(true); EXPECT_TRUE(ac.getPower()); - EXPECT_FALSE(ac.getPreviousPower()); ac.setPower(false); EXPECT_FALSE(ac.getPower()); - EXPECT_TRUE(ac.getPreviousPower()); - ac.setPower(true); + ac.on(); EXPECT_TRUE(ac.getPower()); - EXPECT_FALSE(ac.getPreviousPower()); - ac.setPower(true); - EXPECT_TRUE(ac.getPower()); - EXPECT_TRUE(ac.getPreviousPower()); - ac.setPreviousPower(false); - EXPECT_TRUE(ac.getPower()); - EXPECT_FALSE(ac.getPreviousPower()); - ac.setPreviousPower(true); - EXPECT_TRUE(ac.getPower()); - EXPECT_TRUE(ac.getPreviousPower()); + ac.off(); + EXPECT_FALSE(ac.getPower()); ac.setPower(true, false); EXPECT_TRUE(ac.getPower()); - EXPECT_FALSE(ac.getPreviousPower()); // Data from: https://github.com/crankyoldgit/IRremoteESP8266/pull/1074#discussion_r403407146 // Command ON (previously OFF) -> 0xAA 5A CF 10 CB 11 22 00 08 80 00 E0 51 @@ -759,21 +741,18 @@ TEST(TestSharpAcClass, PreviousPower) { 0x00, 0x08, 0x80, 0x00, 0xE0, 0x51}; ac.setRaw(on_prev_off); EXPECT_TRUE(ac.getPower()); - EXPECT_FALSE(ac.getPreviousPower()); // Command ON (previously ON) -> 0xAA 5A CF 10 CB 31 22 00 08 80 04 E0 31 const uint8_t on_prev_on[] = { 0xAA, 0x5A, 0xCF, 0x10, 0xCB, 0x31, 0x22, 0x00, 0x08, 0x80, 0x04, 0xE0, 0x31}; ac.setRaw(on_prev_on); EXPECT_TRUE(ac.getPower()); - EXPECT_TRUE(ac.getPreviousPower()); // Command OFF (previously ON) -> 0xAA 5A CF 10 CB 21 22 00 08 80 00 E0 61 const uint8_t off_prev_on[] = { 0xAA, 0x5A, 0xCF, 0x10, 0xCB, 0x21, 0x22, 0x00, 0x08, 0x80, 0x00, 0xE0, 0x61}; ac.setRaw(off_prev_on); EXPECT_FALSE(ac.getPower()); - EXPECT_TRUE(ac.getPreviousPower()); /* Extra test data if needed. // Power:OFF Mode:2(Cool) Fan:2(Auto) Temp:22 const uint8_t collect1[13] = { @@ -810,3 +789,279 @@ TEST(TestSharpAcClass, PreviousPower) { 0x00, 0x08, 0x80, 0x00, 0xE0, 0xB1}; */ } + +TEST(TestSharpAcClass, Turbo) { + IRSharpAc ac(kGpioUnused); + ac.begin(); + + ac.setFan(kSharpAcFanMin); + ac.setTurbo(false); + EXPECT_FALSE(ac.getTurbo()); + EXPECT_EQ(kSharpAcFanMin, ac.getFan()); + + ac.setTurbo(true); + EXPECT_TRUE(ac.getTurbo()); + EXPECT_EQ(kSharpAcFanMax, ac.getFan()); + + ac.setTurbo(false); + EXPECT_FALSE(ac.getTurbo()); + + // ref: https://docs.google.com/spreadsheets/d/1otzVFM5_tegrZ4ROCLgQ_jvJaWCDlZs1vC-YuR1FFXM/edit#gid=0&range=D25 + const uint8_t on_state[] = { + 0xAA, 0x5A, 0xCF, 0x10, 0xC6, 0x61, 0x72, + 0x00, 0x08, 0x80, 0x01, 0xF4, 0xE1}; + const uint8_t off_state[] = { + 0xAA, 0x5A, 0xCF, 0x10, 0xC6, 0x71, 0x72, + 0x00, 0x08, 0x80, 0x01, 0xF4, 0xF1}; + ac.setRaw(on_state); + EXPECT_TRUE(ac.getTurbo()); + EXPECT_EQ(kSharpAcFanMax, ac.getFan()); + EXPECT_EQ( + "Power: -, Mode: 2 (Cool), Temp: 21C, Fan: 7 (High), Turbo: On, " + "Swing(V) Toggle: Off, Ion: On, Econo: -, Clean: Off", + ac.toString()); + + ac.setRaw(off_state); + EXPECT_FALSE(ac.getTurbo()); + EXPECT_EQ( + "Power: -, Mode: 2 (Cool), Temp: 21C, Fan: 7 (High), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: On, Econo: -, Clean: Off", + ac.toString()); +} + +TEST(TestSharpAcClass, SwingToggle) { + IRSharpAc ac(kGpioUnused); + ac.begin(); + + ac.setSwingToggle(false); + EXPECT_FALSE(ac.getSwingToggle()); + + ac.setSwingToggle(true); + EXPECT_TRUE(ac.getSwingToggle()); + + ac.setSwingToggle(false); + EXPECT_FALSE(ac.getSwingToggle()); + + // ref: https://docs.google.com/spreadsheets/d/1otzVFM5_tegrZ4ROCLgQ_jvJaWCDlZs1vC-YuR1FFXM/edit#gid=1057982086&range=C13:E14 + const uint8_t on_state[] = { + 0xAA, 0x5A, 0xCF, 0x10, 0xCA, 0x31, 0x22, + 0x00, 0x0F, 0x80, 0x06, 0xF4, 0x21}; + const uint8_t off_state[] = { + 0xAA, 0x5A, 0xCF, 0x10, 0xC9, 0x31, 0x22, + 0x00, 0x08, 0x80, 0x04, 0xF4, 0x41}; + ac.setRaw(on_state); + EXPECT_TRUE(ac.getSwingToggle()); + + ac.setRaw(off_state); + EXPECT_FALSE(ac.getSwingToggle()); +} + +TEST(TestSharpAcClass, Ion) { + IRSharpAc ac(kGpioUnused); + ac.begin(); + + ac.setIon(false); + EXPECT_FALSE(ac.getIon()); + + ac.setIon(true); + EXPECT_TRUE(ac.getIon()); + + ac.setIon(false); + EXPECT_FALSE(ac.getIon()); + + // ref: https://docs.google.com/spreadsheets/d/1otzVFM5_tegrZ4ROCLgQ_jvJaWCDlZs1vC-YuR1FFXM/edit#gid=1057982086&range=B23:E31 + const uint8_t on_state[] = { + 0xAA, 0x5A, 0xCF, 0x10, 0xCA, 0x61, 0x22, + 0x08, 0x08, 0x80, 0x00, 0xF4, 0xE1}; + const uint8_t off_state[] = { + 0xAA, 0x5A, 0xCF, 0x10, 0xCA, 0x71, 0x22, + 0x08, 0x08, 0x80, 0x00, 0xF0, 0xB1}; + ac.setRaw(on_state); + EXPECT_TRUE(ac.getIon()); + ac.setRaw(off_state); + EXPECT_FALSE(ac.getIon()); +} + +TEST(TestSharpAcClass, Timers) { + IRSharpAc ac(kGpioUnused); + ac.begin(); + + // Off cases + ac.setTimer(false, kSharpAcOffTimerType, 0); + EXPECT_FALSE(ac.getTimerEnabled()); + EXPECT_EQ(kSharpAcOffTimerType, ac.getTimerType()); + EXPECT_EQ(0, ac.getTimerTime()); + + ac.setTimer(false, kSharpAcOnTimerType, 0); + EXPECT_FALSE(ac.getTimerEnabled()); + EXPECT_EQ(kSharpAcOffTimerType, ac.getTimerType()); + EXPECT_EQ(0, ac.getTimerTime()); + + ac.setTimer(true, kSharpAcOnTimerType, 0); + EXPECT_FALSE(ac.getTimerEnabled()); + EXPECT_EQ(kSharpAcOffTimerType, ac.getTimerType()); + EXPECT_EQ(0, ac.getTimerTime()); + + ac.setTimer(false, kSharpAcOffTimerType, 12 * 60); + EXPECT_FALSE(ac.getTimerEnabled()); + EXPECT_EQ(kSharpAcOffTimerType, ac.getTimerType()); + EXPECT_EQ(0, ac.getTimerTime()); + + ac.setTimer(true, kSharpAcOnTimerType, kSharpAcTimerIncrement - 1); + EXPECT_FALSE(ac.getTimerEnabled()); + EXPECT_EQ(kSharpAcOffTimerType, ac.getTimerType()); + EXPECT_EQ(0, ac.getTimerTime()); + + // Trivial cases + ac.setTimer(true, kSharpAcOnTimerType, 30); + EXPECT_TRUE(ac.getTimerEnabled()); + EXPECT_EQ(kSharpAcOnTimerType, ac.getTimerType()); + EXPECT_EQ(30, ac.getTimerTime()); + EXPECT_TRUE(ac.isPowerSpecial()); + + ac.setTimer(true, kSharpAcOffTimerType, 60); + EXPECT_TRUE(ac.getTimerEnabled()); + EXPECT_EQ(kSharpAcOffTimerType, ac.getTimerType()); + EXPECT_EQ(60, ac.getTimerTime()); + + ac.setTimer(true, kSharpAcOnTimerType, 91); + EXPECT_TRUE(ac.getTimerEnabled()); + EXPECT_EQ(kSharpAcOnTimerType, ac.getTimerType()); + EXPECT_EQ(90, ac.getTimerTime()); + + // Bounds checks + ac.setTimer(true, kSharpAcOnTimerType, kSharpAcTimerHoursMax * 60); + EXPECT_TRUE(ac.getTimerEnabled()); + EXPECT_EQ(kSharpAcOnTimerType, ac.getTimerType()); + EXPECT_EQ(kSharpAcTimerHoursMax * 60, ac.getTimerTime()); + + ac.setTimer(false, kSharpAcOffTimerType, 0); // Known good. + ac.setTimer(true, kSharpAcOnTimerType, kSharpAcTimerHoursMax * 60 + + kSharpAcTimerIncrement); + EXPECT_TRUE(ac.getTimerEnabled()); + EXPECT_EQ(kSharpAcOnTimerType, ac.getTimerType()); + EXPECT_EQ(kSharpAcTimerHoursMax * 60, ac.getTimerTime()); + + // ref: https://docs.google.com/spreadsheets/d/1otzVFM5_tegrZ4ROCLgQ_jvJaWCDlZs1vC-YuR1FFXM/edit#gid=0&range=E51 + const uint8_t off_timer_8_5_hrs[] = { + 0xAA, 0x5A, 0xCF, 0x10, 0xC6, 0x81, 0x72, + 0x88, 0x08, 0x80, 0xDE, 0xF4, 0x21}; + ac.setRaw(off_timer_8_5_hrs); + EXPECT_TRUE(ac.getTimerEnabled()); + EXPECT_EQ(kSharpAcOffTimerType, ac.getTimerType()); + EXPECT_EQ(8 * 60 + 30, ac.getTimerTime()); + EXPECT_TRUE(ac.isPowerSpecial()); + EXPECT_EQ( + "Power: -, Mode: 2 (Cool), Temp: 21C, Fan: 7 (High), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: On, Econo: -, Clean: Off, Off Timer: 08:30", + ac.toString()); + + // ref: https://docs.google.com/spreadsheets/d/1otzVFM5_tegrZ4ROCLgQ_jvJaWCDlZs1vC-YuR1FFXM/edit#gid=0&range=E80 + const uint8_t on_timer_12_hrs[] = { + 0xAA, 0x5A, 0xCF, 0x10, 0xC6, 0x81, 0x72, + 0xCC, 0x08, 0x80, 0xC0, 0xF4, 0xD1}; + ac.setRaw(on_timer_12_hrs); + EXPECT_TRUE(ac.getTimerEnabled()); + EXPECT_EQ(kSharpAcOnTimerType, ac.getTimerType()); + EXPECT_EQ(12 * 60, ac.getTimerTime()); + EXPECT_TRUE(ac.isPowerSpecial()); + EXPECT_EQ( + "Power: -, Mode: 2 (Cool), Temp: 21C, Fan: 7 (High), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: On, Econo: -, Clean: Off, On Timer: 12:00", + ac.toString()); +} + +TEST(TestSharpAcClass, Clean) { + IRSharpAc ac(kGpioUnused); + ac.begin(); + + ac.setMode(kSharpAcCool); + ac.setTemp(25); + ASSERT_NE(kSharpAcDry, ac.getMode()); + ASSERT_NE(kSharpAcMinTemp, ac.getTemp()); + ASSERT_NE(kSharpAcFanAuto, ac.getFan()); + + ac.setClean(false); + EXPECT_FALSE(ac.getClean()); + + ac.setClean(true); + EXPECT_TRUE(ac.getClean()); + ASSERT_EQ(kSharpAcDry, ac.getMode()); + ASSERT_EQ(kSharpAcMinTemp, ac.getTemp()); + ASSERT_EQ(kSharpAcFanAuto, ac.getFan()); + + ac.setClean(false); + EXPECT_FALSE(ac.getClean()); + + // ref: https://docs.google.com/spreadsheets/d/1otzVFM5_tegrZ4ROCLgQ_jvJaWCDlZs1vC-YuR1FFXM/edit#gid=1057982086&range=B82:D85 + const uint8_t clean_on_state[] = { + 0xAA, 0x5A, 0xCF, 0x10, 0x00, 0x11, 0x2B, + 0x00, 0x08, 0x80, 0x00, 0xF0, 0xA1}; + const uint8_t clean_off_state[] = { + 0xAA, 0x5A, 0xCF, 0x10, 0xCA, 0x11, 0x72, + 0x00, 0x08, 0x80, 0x00, 0xF0, 0x01}; + ac.setRaw(clean_on_state); + EXPECT_TRUE(ac.getClean()); + EXPECT_EQ( + "Power: On, Mode: 3 (Dry), Temp: 15C, Fan: 2 (Auto), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: On", + ac.toString()); + ac.setRaw(clean_off_state); + EXPECT_FALSE(ac.getClean()); + EXPECT_EQ( + "Power: On, Mode: 2 (Cool), Temp: 25C, Fan: 7 (High), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", + ac.toString()); + + // Try constructing the clean on state. + ac.setClean(true); + EXPECT_STATE_EQ(clean_on_state, ac.getRaw(), kSharpAcBits); + + // Try to replicate the exact sequence of commands to activate clean mode + // and compare it to captured values from the real remote. + // Ref: + // https://github.com/crankyoldgit/IRremoteESP8266/issues/1091#issuecomment-622378747 + ac.stateReset(); + // AC OFF (Mode Cool, Temp 25, Ion OFF, Fan 7) + ac.setMode(kSharpAcCool); + ac.setIon(false); + ac.setTemp(25); + ac.setFan(7); + ac.setPower(false); + EXPECT_EQ( + "Power: Off, Mode: 2 (Cool), Temp: 25C, Fan: 7 (High), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", + ac.toString()); + // Clean ON + ac.setClean(true); + EXPECT_EQ( + "Power: On, Mode: 3 (Dry), Temp: 15C, Fan: 2 (Auto), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: On", + ac.toString()); + // Clean OFF (state is identical to `off_msg`). + // i.e. It just clears the clean settings & turns off the device. + ac.setClean(false); + ac.setPower(false, true); + EXPECT_EQ( + "Power: Off, Mode: 2 (Cool), Temp: 25C, Fan: 7 (High), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", + ac.toString()); + // Clean ON + ac.setClean(true); + EXPECT_EQ( + "Power: On, Mode: 3 (Dry), Temp: 15C, Fan: 2 (Auto), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: On", + ac.toString()); + // AC OFF + ac.off(); + EXPECT_EQ( + "Power: Off, Mode: 2 (Cool), Temp: 25C, Fan: 7 (High), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", + ac.toString()); + // AC ON (Mode Cool, Temp 25, Ion OFF, Fan 7) + ac.on(); + EXPECT_EQ( + "Power: On, Mode: 2 (Cool), Temp: 25C, Fan: 7 (High), Turbo: Off, " + "Swing(V) Toggle: Off, Ion: Off, Econo: -, Clean: Off", + ac.toString()); +} diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Sherwood_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Sherwood_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Sherwood_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Sherwood_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Sony_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Sony_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Sony_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Sony_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Symphony_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Symphony_test.cpp similarity index 70% rename from lib/IRremoteESP8266-2.7.6/test/ir_Symphony_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Symphony_test.cpp index ee4aadfda..e3f818136 100644 --- a/lib/IRremoteESP8266-2.7.6/test/ir_Symphony_test.cpp +++ b/lib/IRremoteESP8266-2.7.7/test/ir_Symphony_test.cpp @@ -13,15 +13,21 @@ TEST(TestSendSymphony, SendDataOnly) { IRsendTest irsend(kGpioUnused); irsend.begin(); - irsend.sendSymphony(0x137); + irsend.sendSymphony(0xD90); EXPECT_EQ( "f38000d50" "m1250s400m1250s400m400s1250m1250s400m1250s400m400s1250m400s1250m1250s400" "m400s1250m400s1250m400s1250" - "m400s8000" + "m400s7850" "m1250s400m1250s400m400s1250m1250s400m1250s400m400s1250m400s1250m1250s400" "m400s1250m400s1250m400s1250" - "m400s8000", + "m400s7850" + "m1250s400m1250s400m400s1250m1250s400m1250s400m400s1250m400s1250m1250s400" + "m400s1250m400s1250m400s1250" + "m400s7850" + "m1250s400m1250s400m400s1250m1250s400m1250s400m400s1250m400s1250m1250s400" + "m400s1250m400s1250m400s1250" + "m400s7850", irsend.outputStr()); } @@ -69,7 +75,7 @@ TEST(TestDecodeSymphony, RealMessageDecode) { EXPECT_TRUE(irrecv.decode(&irsend.capture)); EXPECT_EQ(decode_type_t::SYMPHONY, irsend.capture.decode_type); EXPECT_EQ(kSymphonyBits, irsend.capture.bits); - EXPECT_EQ(0x137, irsend.capture.value); + EXPECT_EQ(0xD90, irsend.capture.value); EXPECT_EQ(0x0, irsend.capture.address); EXPECT_EQ(0x0, irsend.capture.command); EXPECT_FALSE(irsend.capture.repeat); @@ -81,10 +87,10 @@ TEST(TestDecodeSymphony, RealMessageDecode) { 1198, 1284, 396, 444, 1224, 470, 1200, 470, 1198, 472}; irsend.sendRaw(power, 23, 38000); irsend.makeDecodeResult(); - EXPECT_TRUE(irrecv.decode(&irsend.capture)); + EXPECT_TRUE(irrecv.decodeSymphony(&irsend.capture)); EXPECT_EQ(decode_type_t::SYMPHONY, irsend.capture.decode_type); EXPECT_EQ(kSymphonyBits, irsend.capture.bits); - EXPECT_EQ(0x137, irsend.capture.value); + EXPECT_EQ(0xD90, irsend.capture.value); EXPECT_EQ(0x0, irsend.capture.address); EXPECT_EQ(0x0, irsend.capture.command); EXPECT_FALSE(irsend.capture.repeat); @@ -98,7 +104,7 @@ TEST(TestDecodeSymphony, RealMessageDecode) { EXPECT_TRUE(irrecv.decode(&irsend.capture)); EXPECT_EQ(decode_type_t::SYMPHONY, irsend.capture.decode_type); EXPECT_EQ(kSymphonyBits, irsend.capture.bits); - EXPECT_EQ(0x13E, irsend.capture.value); + EXPECT_EQ(0xD82, irsend.capture.value); EXPECT_EQ(0x0, irsend.capture.address); EXPECT_EQ(0x0, irsend.capture.command); EXPECT_FALSE(irsend.capture.repeat); @@ -122,7 +128,7 @@ TEST(TestDecodeSymphony, RealMessageSentViaLibrary) { EXPECT_TRUE(irrecv.decode(&irsend.capture)); EXPECT_EQ(decode_type_t::SYMPHONY, irsend.capture.decode_type); EXPECT_EQ(kSymphonyBits, irsend.capture.bits); - EXPECT_EQ(0x137, irsend.capture.value); + EXPECT_EQ(0xD90, irsend.capture.value); EXPECT_EQ(0x0, irsend.capture.address); EXPECT_EQ(0x0, irsend.capture.command); EXPECT_FALSE(irsend.capture.repeat); @@ -139,12 +145,47 @@ TEST(TestDecodeSymphony, RealMessageSentViaLibrary) { EXPECT_TRUE(irrecv.decode(&irsend.capture)); EXPECT_EQ(decode_type_t::SYMPHONY, irsend.capture.decode_type); EXPECT_EQ(kSymphonyBits, irsend.capture.bits); - EXPECT_EQ(0x137, irsend.capture.value); + EXPECT_EQ(0xD90, irsend.capture.value); EXPECT_EQ(0x0, irsend.capture.address); EXPECT_EQ(0x0, irsend.capture.command); EXPECT_FALSE(irsend.capture.repeat); } +// Decode a real SM5021 generated message. +// Note: This used to fail because it had a "long" mark before the gap in mesg. +TEST(TestDecodeSymphony, Issue1105) { + IRsendTest irsend(kGpioUnused); + IRrecv irrecv(kGpioUnused); + irsend.begin(); + + // Ref: https://github.com/crankyoldgit/IRremoteESP8266/issues/1105#issuecomment-625327833 + irsend.reset(); + uint16_t rawData[191] = { + 1324, 372, 1322, 398, 448, 1218, 476, 1216, 478, 1216, 478, 1218, 478, + 1218, 476, 1218, 476, 1220, 474, 1220, 474, 1220, 1346, 7128, 1320, 402, + 1290, 404, 440, 1252, 442, 1254, 440, 1254, 440, 1254, 440, 1254, 440, + 1254, 440, 1254, 442, 1254, 440, 1254, 1288, 7186, 1288, 408, 1286, 408, + 438, 1254, 440, 1254, 440, 1254, 440, 1254, 440, 1254, 440, 1256, 440, + 1254, 440, 1254, 440, 1254, 1288, 7186, 1288, 408, 1286, 408, 438, 1254, + 440, 1256, 440, 1254, 440, 1254, 440, 1254, 440, 1254, 438, 1256, 438, + 1256, 440, 1254, 1288, 7188, 1288, 408, 1286, 408, 438, 1256, 438, 1256, + 440, 1254, 438, 1256, 438, 1256, 438, 1256, 438, 1256, 438, 1256, 440, + 1254, 1288, 7188, 1286, 408, 1286, 408, 440, 1254, 438, 1256, 438, 1256, + 438, 1256, 440, 1254, 438, 1254, 440, 1256, 438, 1256, 440, 1256, 438, + 8038, 1284, 408, 1286, 408, 438, 1282, 412, 1282, 414, 1280, 414, 1280, + 414, 1282, 414, 1280, 412, 1276, 412, 1286, 414, 1282, 412, 8062, 1260, + 434, 1262, 432, 414, 1280, 414, 1282, 412, 1282, 412, 1282, 412, 1282, + 414, 1280, 414, 1282, 412, 1282, 412, 1282, 412}; // UNKNOWN 827AA7B + irsend.sendRaw(rawData, 191, 38000); + irsend.makeDecodeResult(); + EXPECT_TRUE(irrecv.decode(&irsend.capture)); + EXPECT_EQ(decode_type_t::SYMPHONY, irsend.capture.decode_type); + EXPECT_EQ(kSymphonyBits, irsend.capture.bits); + EXPECT_EQ(0xC01, irsend.capture.value); + EXPECT_EQ(0x0, irsend.capture.address); + EXPECT_EQ(0x0, irsend.capture.command); + EXPECT_FALSE(irsend.capture.repeat); +} TEST(TestUtils, Housekeeping) { ASSERT_EQ("SYMPHONY", typeToString(decode_type_t::SYMPHONY)); diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Tcl_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Tcl_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Tcl_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Tcl_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Teco_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Teco_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Teco_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Teco_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Toshiba_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Toshiba_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Toshiba_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Toshiba_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Trotec_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Trotec_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Trotec_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Trotec_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Vestel_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Vestel_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Vestel_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Vestel_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Whirlpool_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Whirlpool_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Whirlpool_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Whirlpool_test.cpp diff --git a/lib/IRremoteESP8266-2.7.6/test/ir_Whynter_test.cpp b/lib/IRremoteESP8266-2.7.7/test/ir_Whynter_test.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/test/ir_Whynter_test.cpp rename to lib/IRremoteESP8266-2.7.7/test/ir_Whynter_test.cpp diff --git a/lib/IRremoteESP8266-2.7.7/tools/Makefile b/lib/IRremoteESP8266-2.7.7/tools/Makefile new file mode 100644 index 000000000..b30d1207c --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/tools/Makefile @@ -0,0 +1,88 @@ +# SYNOPSIS: +# +# make [all] - makes everything. +# make clean - removes all files generated by make. + +# Please tweak the following variable definitions as needed by your +# project, except GTEST_HEADERS, which you can use in your own targets +# but shouldn't modify. + + +# Where to find user code. +USER_DIR = ../src + +# Where to find test code. +TEST_DIR = ../test + +INCLUDES = -I$(USER_DIR) -I$(TEST_DIR) +# Flags passed to the preprocessor. +# Set Google Test's header directory as a system directory, such that +# the compiler doesn't generate warnings in Google Test headers. +CPPFLAGS += -DUNIT_TEST -D_IR_LOCALE_=en-AU + +# Flags passed to the C++ compiler. +CXXFLAGS += -g -Wall -Wextra -pthread -std=gnu++11 + +all : gc_decode mode2_decode + +run_tests : all + failed=""; \ + for py_unittest in *_test.py; do \ + echo "RUNNING: $${py_unittest}"; \ + python3 ./$${py_unittest} || failed="$${failed} $${py_unittest}"; \ + done; \ + if [ -n "$${failed}" ]; then \ + echo "FAIL: :-( :-( Unit test(s)$${failed} failed! :-( :-("; exit 1; \ + else \ + echo "PASS: \o/ \o/ All unit tests passed. \o/ \o/"; \ + fi + +clean : + rm -f *.o *.pyc gc_decode mode2_decode + + +# Keep all intermediate files. +.SECONDARY: + +# All the IR protocol object files. +PROTOCOL_OBJS = $(patsubst %.cpp,%.o,$(wildcard $(USER_DIR)/ir_*.cpp)) +PROTOCOLS = $(patsubst $(USER_DIR)/%,%,$(PROTOCOL_OBJS)) + +# Common object files +COMMON_OBJ = IRutils.o IRtimer.o IRsend.o IRrecv.o IRtext.o IRac.o $(PROTOCOLS) + +# Common dependencies +COMMON_DEPS = $(USER_DIR)/IRrecv.h $(USER_DIR)/IRsend.h $(USER_DIR)/IRtimer.h \ + $(USER_DIR)/IRutils.h $(USER_DIR)/IRremoteESP8266.h \ + $(TEST_DIR)/IRsend_test.h $(USER_DIR)/IRtext.h $(USER_DIR)/i18n.h +# Common test dependencies +COMMON_TEST_DEPS = $(COMMON_DEPS) $(TEST_DIR)/IRsend_test.h + +IRtext.o : $(USER_DIR)/IRtext.cpp $(USER_DIR)/IRtext.h $(USER_DIR)/IRremoteESP8266.h $(USER_DIR)/i18n.h $(USER_DIR)/locale/*.h + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/IRtext.cpp + +IRutils.o : $(USER_DIR)/IRutils.cpp $(USER_DIR)/IRutils.h $(USER_DIR)/IRremoteESP8266.h + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/IRutils.cpp + +IRsend.o : $(USER_DIR)/IRsend.cpp $(USER_DIR)/IRsend.h $(USER_DIR)/IRremoteESP8266.h + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/IRsend.cpp + +IRrecv.o : $(USER_DIR)/IRrecv.cpp $(USER_DIR)/IRrecv.h $(USER_DIR)/IRremoteESP8266.h $(GTEST_HEADERS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/IRrecv.cpp + +# new specific targets goes above this line + +%_decode : $(COMMON_OBJ) %_decode.o + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ + +ir_%.o : $(USER_DIR)/ir_%.h $(USER_DIR)/ir_%.cpp $(COMMON_DEPS) $(GTEST_HEADERS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_$*.cpp + +ir_%.o : $(USER_DIR)/ir_%.cpp $(GTEST_HEADERS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/ir_$*.cpp + +%.o : %.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $*.cpp + +%.o : $(USER_DIR)/%.cpp $(USER_DIR)/%.h $(COMMON_DEPS) $(GTEST_HEADERS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $(USER_DIR)/$*.cpp diff --git a/lib/IRremoteESP8266-2.7.6/tools/RawToGlobalCache.sh b/lib/IRremoteESP8266-2.7.7/tools/RawToGlobalCache.sh similarity index 100% rename from lib/IRremoteESP8266-2.7.6/tools/RawToGlobalCache.sh rename to lib/IRremoteESP8266-2.7.7/tools/RawToGlobalCache.sh diff --git a/lib/IRremoteESP8266-2.7.6/tools/auto_analyse_raw_data.py b/lib/IRremoteESP8266-2.7.7/tools/auto_analyse_raw_data.py similarity index 89% rename from lib/IRremoteESP8266-2.7.6/tools/auto_analyse_raw_data.py rename to lib/IRremoteESP8266-2.7.7/tools/auto_analyse_raw_data.py index 5bea3926a..4dc4cb698 100755 --- a/lib/IRremoteESP8266-2.7.6/tools/auto_analyse_raw_data.py +++ b/lib/IRremoteESP8266-2.7.7/tools/auto_analyse_raw_data.py @@ -403,49 +403,71 @@ def decode_data(message, defines, code, name="", output=sys.stdout): code["send"].extend([ "#if SEND_%s" % def_name.upper(), - "// Function should be safe up to 64 bits.", + "/// Send a %s formatted message." % name, + "/// Function should be safe up to 64 bits.", + "/// Status: ALPHA / Untested.", + "/// @param[in] data containing the IR command.", + "/// @param[in] nbits Nr. of bits to send. usually k%sBits" % name, + "/// @param[in] repeat Nr. of times the message is to be repeated.", "void IRsend::send%s(const uint64_t data, const uint16_t" " nbits, const uint16_t repeat) {" % def_name, " enableIROut(k%sFreq);" % name, " for (uint16_t r = 0; r <= repeat; r++) {", " uint64_t send_data = data;"]) code["send64+"].extend([ - "// Args:", - "// data: An array of bytes containing the IR command.", - "// It is assumed to be in MSB order for this code.\n" - "// nbytes: Nr. of bytes of data in the array." + "/// @param[in] data An array of bytes containing the IR command.", + "/// It is assumed to be in MSB order for this code.", + "/// @param[in] nbytes Nr. of bytes of data in the array." " (>=k%sStateLength)" % name, - "// repeat: Nr. of times the message is to be repeated.", - "//", - "// Status: ALPHA / Untested.", + "/// @param[in] repeat Nr. of times the message is to be repeated.", "void IRsend::send%s(const uint8_t data[], const uint16_t nbytes," " const uint16_t repeat) {" % def_name, " for (uint16_t r = 0; r <= repeat; r++) {", " uint16_t pos = 0;"]) code["recv"].extend([ "#if DECODE_%s" % def_name.upper(), - "// Function should be safe up to 64 bits.", - "bool IRrecv::decode%s(decode_results *results, const uint16_t nbits," - " const bool strict) {" % def_name, - " if (results->rawlen < 2 * nbits + k%sOverhead)" % name, + "/// Decode the supplied %s message." % name, + "/// Function should be safe up to 64 bits.", + "/// Status: ALPHA / Untested.", + "/// @param[in,out] results Ptr to the data to decode &" + " where to store the decode", + "/// @param[in] offset The starting index to use when" + " attempting to decode the", + "/// raw data. Typically/Defaults to kStartOffset.", + "/// @param[in] nbits The number of data bits to expect.", + "/// @param[in] strict Flag indicating if we should perform strict" + " matching.", + "/// @return A boolean. True if it can decode it, false if it can't.", + "bool IRrecv::decode%s(decode_results *results, uint16_t offset," + " const uint16_t nbits, const bool strict) {" % def_name, + " if (results->rawlen < 2 * nbits + k%sOverhead - offset)" % name, " return false; // Too short a message to match.", " if (strict && nbits != k%sBits)" % name, " return false;", "", - " uint16_t offset = kStartOffset;", " uint64_t data = 0;", " match_result_t data_result;"]) code["recv64+"].extend([ "#if DECODE_%s" % def_name.upper(), - "// Function should be safe over 64 bits.", - "bool IRrecv::decode%s(decode_results *results, const uint16_t nbits," - " const bool strict) {" % def_name, - " if (results->rawlen < 2 * nbits + k%sOverhead)" % name, + "/// Decode the supplied %s message." % name, + "/// Function should be safe over 64 bits.", + "/// Status: ALPHA / Untested.", + "/// @param[in,out] results Ptr to the data to decode &" + " where to store the decode", + "/// @param[in] offset The starting index to use when" + " attempting to decode the", + "/// raw data. Typically/Defaults to kStartOffset.", + "/// @param[in] nbits The number of data bits to expect.", + "/// @param[in] strict Flag indicating if we should perform" + " strict matching.", + "/// @return A boolean. True if it can decode it, false if it can't.", + "bool IRrecv::decode%s(decode_results *results, uint16_t offset," + " const uint16_t nbits, const bool strict) {" % def_name, + " if (results->rawlen < 2 * nbits + k%sOverhead - offset)" % name, " return false; // Too short a message to match.", " if (strict && nbits != k%sBits)" % name, " return false;", "", - " uint16_t offset = kStartOffset;", " uint16_t pos = 0;", " uint16_t used = 0;"]) @@ -630,7 +652,7 @@ def generate_code(defines, code, bits_str, name="", output=sys.stdout): else: def_name = "TBD" output.write("\nGenerating a VERY rough code outline:\n\n" - "// Copyright 2019 David Conran (crankyoldgit)\n" + "// Copyright 2020 David Conran (crankyoldgit)\n" "// Support for %s protocol\n\n" '#include "IRrecv.h"\n' '#include "IRsend.h"\n' @@ -656,12 +678,15 @@ def generate_code(defines, code, bits_str, name="", output=sys.stdout): code["send64+"] = [ "", "#if SEND_%s" % def_name.upper(), - "// Alternative >64bit function to send %s messages" % def_name.upper(), - "// Where data is:", - "// uint8_t data[k%sStateLength] = {0x%s};" % ( + "/// Send a %s formatted message." % name, + "/// Alternative >64bit function to send %s messages" % + def_name.upper(), + "/// Status: ALPHA / Untested.", + "/// Where data is:", + "/// uint8_t data[k%sStateLength] = {0x%s};" % ( name, ", 0x".join("%02X" % int(bits_str[i:i + 8], 2) for i in range(0, len(bits_str), 8))), - "//"] + code["send64+"] + "///"] + code["send64+"] for line in code["send64+"]: output.write("%s\n" % line) output.write("\n") @@ -681,6 +706,34 @@ def generate_code(defines, code, bits_str, name="", output=sys.stdout): for line in code["recv64+"]: output.write("%s\n" % line) +def add_rawdata_args(parser): + """Add the arguments for feeding in the rawdata string(s).""" + arg_group = parser.add_mutually_exclusive_group(required=True) + arg_group.add_argument( + "rawdata", + help="A rawData line from IRrecvDumpV2. e.g. 'uint16_t rawbuf[37] = {" + "7930, 3952, 494, 1482, 520, 1482, 494, 1508, 494, 520, 494, 1482, 494, " + "520, 494, 1482, 494, 1482, 494, 3978, 494, 520, 494, 520, 494, 520, " + "494, 520, 520, 520, 494, 520, 494, 520, 494, 520, 494};'", + nargs="?") + arg_group.add_argument( + "-f", "--file", help="Read in a rawData line from the file.") + arg_group.add_argument( + "--stdin", + help="Read in a rawData line from STDIN.", + action="store_true", + default=False) + +def get_rawdata(arg_options): + """Return the rawdata string(s) as per the options.""" + if arg_options.stdin: + return sys.stdin.read() + if arg_options.file: + with open(arg_options.file) as input_file: + return input_file.read() + else: + return arg_options.rawdata + def main(): """Parse the commandline arguments and call the method.""" @@ -701,16 +754,6 @@ def main(): help="Name of the protocol/device to use in code generation. E.g. Onkyo", dest="name", default="") - arg_group = arg_parser.add_mutually_exclusive_group(required=True) - arg_group.add_argument( - "rawdata", - help="A rawData line from IRrecvDumpV2. e.g. 'uint16_t rawbuf[37] = {" - "7930, 3952, 494, 1482, 520, 1482, 494, 1508, 494, 520, 494, 1482, 494, " - "520, 494, 1482, 494, 1482, 494, 3978, 494, 520, 494, 520, 494, 520, " - "494, 520, 520, 520, 494, 520, 494, 520, 494, 520, 494};'", - nargs="?") - arg_group.add_argument( - "-f", "--file", help="Read in a rawData line from the file.") arg_parser.add_argument( "-r", "--range", @@ -719,22 +762,11 @@ def main(): " it the same value.", dest="margin", default=200) - arg_group.add_argument( - "--stdin", - help="Read in a rawData line from STDIN.", - action="store_true", - default=False) + add_rawdata_args(arg_parser) arg_options = arg_parser.parse_args() - if arg_options.stdin: - data = sys.stdin.read() - elif arg_options.file: - with open(arg_options.file) as input_file: - data = input_file.read() - else: - data = arg_options.rawdata - parse_and_report(data, arg_options.margin, arg_options.gen_code, - arg_options.name) + parse_and_report(get_rawdata(arg_options), arg_options.margin, + arg_options.gen_code, arg_options.name) if __name__ == '__main__': diff --git a/lib/IRremoteESP8266-2.7.6/tools/auto_analyse_raw_data_test.py b/lib/IRremoteESP8266-2.7.7/tools/auto_analyse_raw_data_test.py similarity index 86% rename from lib/IRremoteESP8266-2.7.6/tools/auto_analyse_raw_data_test.py rename to lib/IRremoteESP8266-2.7.7/tools/auto_analyse_raw_data_test.py index fa3a87933..1f90c4661 100755 --- a/lib/IRremoteESP8266-2.7.6/tools/auto_analyse_raw_data_test.py +++ b/lib/IRremoteESP8266-2.7.7/tools/auto_analyse_raw_data_test.py @@ -279,7 +279,7 @@ class TestAutoAnalyseRawData(unittest.TestCase): '\n' 'Generating a VERY rough code outline:\n' '\n' - '// Copyright 2019 David Conran (crankyoldgit)\n' + '// Copyright 2020 David Conran (crankyoldgit)\n' '// Support for FOO protocol\n' '\n' '#include "IRrecv.h"\n' @@ -301,7 +301,12 @@ class TestAutoAnalyseRawData(unittest.TestCase): 'const uint16_t kFOOBits = 16; // Move to IRremoteESP8266.h\n' 'const uint16_t kFOOOverhead = 5;\n' '#if SEND_FOO\n' - '// Function should be safe up to 64 bits.\n' + '/// Send a FOO formatted message.\n' + '/// Function should be safe up to 64 bits.\n' + '/// Status: ALPHA / Untested.\n' + '/// @param[in] data containing the IR command.\n' + '/// @param[in] nbits Nr. of bits to send. usually kFOOBits\n' + '/// @param[in] repeat Nr. of times the message is to be repeated.\n' 'void IRsend::sendFOO(const uint64_t data, const uint16_t nbits,' ' const uint16_t repeat) {\n' ' enableIROut(kFOOFreq);\n' @@ -332,15 +337,25 @@ class TestAutoAnalyseRawData(unittest.TestCase): '#endif // SEND_FOO\n' '\n' '#if DECODE_FOO\n' - '// Function should be safe up to 64 bits.\n' - 'bool IRrecv::decodeFOO(decode_results *results, const uint16_t nbits,' - ' const bool strict) {\n' - ' if (results->rawlen < 2 * nbits + kFOOOverhead)\n' + '/// Decode the supplied FOO message.\n' + '/// Function should be safe up to 64 bits.\n' + '/// Status: ALPHA / Untested.\n' + '/// @param[in,out] results Ptr to the data to decode &' + ' where to store the decode\n' + '/// @param[in] offset The starting index to use when' + ' attempting to decode the\n' + '/// raw data. Typically/Defaults to kStartOffset.\n' + '/// @param[in] nbits The number of data bits to expect.\n' + '/// @param[in] strict Flag indicating if we should perform strict' + ' matching.\n' + "/// @return A boolean. True if it can decode it, false if it can't.\n" + 'bool IRrecv::decodeFOO(decode_results *results, uint16_t offset,' + ' const uint16_t nbits, const bool strict) {\n' + ' if (results->rawlen < 2 * nbits + kFOOOverhead - offset)\n' ' return false; // Too short a message to match.\n' ' if (strict && nbits != kFOOBits)\n' ' return false;\n' '\n' - ' uint16_t offset = kStartOffset;\n' ' uint64_t data = 0;\n' ' match_result_t data_result;\n' '\n' @@ -540,7 +555,7 @@ class TestAutoAnalyseRawData(unittest.TestCase): '\n' 'Generating a VERY rough code outline:\n' '\n' - '// Copyright 2019 David Conran (crankyoldgit)\n' + '// Copyright 2020 David Conran (crankyoldgit)\n' '// Support for Hitachi protocol\n' '\n' '#include "IRrecv.h"\n' @@ -568,7 +583,12 @@ class TestAutoAnalyseRawData(unittest.TestCase): "// DANGER: More than 64 bits detected. A uint64_t for 'data' won't" ' work!\n' '#if SEND_HITACHI\n' - '// Function should be safe up to 64 bits.\n' + '/// Send a Hitachi formatted message.\n' + '/// Function should be safe up to 64 bits.\n' + '/// Status: ALPHA / Untested.\n' + '/// @param[in] data containing the IR command.\n' + '/// @param[in] nbits Nr. of bits to send. usually kHitachiBits\n' + '/// @param[in] repeat Nr. of times the message is to be repeated.\n' 'void IRsend::sendHitachi(const uint64_t data, const uint16_t nbits,' ' const uint16_t repeat) {\n' ' enableIROut(kHitachiFreq);\n' @@ -597,23 +617,22 @@ class TestAutoAnalyseRawData(unittest.TestCase): '#endif // SEND_HITACHI\n' '\n' '#if SEND_HITACHI\n' - '// Alternative >64bit function to send HITACHI messages\n' - '// Where data is:\n' - '// uint8_t data[kHitachiStateLength] = {0x80, 0x08, 0x00, 0x02,' + '/// Send a Hitachi formatted message.\n' + '/// Alternative >64bit function to send HITACHI messages\n' + '/// Status: ALPHA / Untested.\n' + '/// Where data is:\n' + '/// uint8_t data[kHitachiStateLength] = {0x80, 0x08, 0x00, 0x02,' ' 0xFD, 0xFF, 0x00, 0x33, 0xCC, 0x49, 0xB6, 0xC8, 0x37, 0x3A, 0xC5,' ' 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xCA,' ' 0x35, 0x8F, 0x70, 0x00, 0xFF, 0x00, 0xFF, 0x01, 0xFE, 0xC0, 0x3F,' ' 0x80, 0x7F, 0x11, 0xEE, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF,' ' 0x00, 0xFF, 0x00, 0xFF, 0x00};\n' - '//\n' - '// Args:\n' - '// data: An array of bytes containing the IR command.\n' - '// It is assumed to be in MSB order for this code.\n' - '// nbytes: Nr. of bytes of data in the array.' + '///\n' + '/// @param[in] data An array of bytes containing the IR command.\n' + '/// It is assumed to be in MSB order for this code.\n' + '/// @param[in] nbytes Nr. of bytes of data in the array.' ' (>=kHitachiStateLength)\n' - '// repeat: Nr. of times the message is to be repeated.\n' - '//\n' - '// Status: ALPHA / Untested.\n' + '/// @param[in] repeat Nr. of times the message is to be repeated.\n' 'void IRsend::sendHitachi(const uint8_t data[], const uint16_t nbytes,' ' const uint16_t repeat) {\n' ' for (uint16_t r = 0; r <= repeat; r++) {\n' @@ -641,15 +660,25 @@ class TestAutoAnalyseRawData(unittest.TestCase): "// DANGER: More than 64 bits detected. A uint64_t for 'data' won't" ' work!\n' '#if DECODE_HITACHI\n' - '// Function should be safe up to 64 bits.\n' - 'bool IRrecv::decodeHitachi(decode_results *results,' + '/// Decode the supplied Hitachi message.\n' + '/// Function should be safe up to 64 bits.\n' + '/// Status: ALPHA / Untested.\n' + '/// @param[in,out] results Ptr to the data to decode &' + ' where to store the decode\n' + '/// @param[in] offset The starting index to use when' + ' attempting to decode the\n' + '/// raw data. Typically/Defaults to kStartOffset.\n' + '/// @param[in] nbits The number of data bits to expect.\n' + '/// @param[in] strict Flag indicating if we should perform strict' + ' matching.\n' + "/// @return A boolean. True if it can decode it, false if it can't.\n" + 'bool IRrecv::decodeHitachi(decode_results *results, uint16_t offset,' ' const uint16_t nbits, const bool strict) {\n' - ' if (results->rawlen < 2 * nbits + kHitachiOverhead)\n' + ' if (results->rawlen < 2 * nbits + kHitachiOverhead - offset)\n' ' return false; // Too short a message to match.\n' ' if (strict && nbits != kHitachiBits)\n' ' return false;\n' '\n' - ' uint16_t offset = kStartOffset;\n' ' uint64_t data = 0;\n' ' match_result_t data_result;\n' '\n' @@ -695,15 +724,25 @@ class TestAutoAnalyseRawData(unittest.TestCase): '\n' '// Note: This should be 64+ bit safe.\n' '#if DECODE_HITACHI\n' - '// Function should be safe over 64 bits.\n' - 'bool IRrecv::decodeHitachi(decode_results *results,' + '/// Decode the supplied Hitachi message.\n' + '/// Function should be safe over 64 bits.\n' + '/// Status: ALPHA / Untested.\n' + '/// @param[in,out] results Ptr to the data to decode &' + ' where to store the decode\n' + '/// @param[in] offset The starting index to use when' + ' attempting to decode the\n' + '/// raw data. Typically/Defaults to kStartOffset.\n' + '/// @param[in] nbits The number of data bits to expect.\n' + '/// @param[in] strict Flag indicating if we should perform strict' + ' matching.\n' + "/// @return A boolean. True if it can decode it, false if it can't.\n" + 'bool IRrecv::decodeHitachi(decode_results *results, uint16_t offset,' ' const uint16_t nbits, const bool strict) {\n' - ' if (results->rawlen < 2 * nbits + kHitachiOverhead)\n' + ' if (results->rawlen < 2 * nbits + kHitachiOverhead - offset)\n' ' return false; // Too short a message to match.\n' ' if (strict && nbits != kHitachiBits)\n' ' return false;\n' '\n' - ' uint16_t offset = kStartOffset;\n' ' uint16_t pos = 0;\n' ' uint16_t used = 0;\n' '\n' @@ -824,7 +863,7 @@ class TestAutoAnalyseRawData(unittest.TestCase): '\n' 'Generating a VERY rough code outline:\n' '\n' - '// Copyright 2019 David Conran (crankyoldgit)\n' + '// Copyright 2020 David Conran (crankyoldgit)\n' '// Support for FOO protocol\n' '\n' '#include "IRrecv.h"\n' @@ -850,7 +889,12 @@ class TestAutoAnalyseRawData(unittest.TestCase): "// DANGER: More than 64 bits detected. A uint64_t for 'data' won't" ' work!\n' '#if SEND_FOO\n' - '// Function should be safe up to 64 bits.\n' + '/// Send a FOO formatted message.\n' + '/// Function should be safe up to 64 bits.\n' + '/// Status: ALPHA / Untested.\n' + '/// @param[in] data containing the IR command.\n' + '/// @param[in] nbits Nr. of bits to send. usually kFOOBits\n' + '/// @param[in] repeat Nr. of times the message is to be repeated.\n' 'void IRsend::sendFOO(const uint64_t data, const uint16_t nbits,' ' const uint16_t repeat) {\n' ' enableIROut(kFOOFreq);\n' @@ -907,18 +951,18 @@ class TestAutoAnalyseRawData(unittest.TestCase): '#endif // SEND_FOO\n' '\n' '#if SEND_FOO\n' - '// Alternative >64bit function to send FOO messages\n' - '// Where data is:\n' - '// uint8_t data[kFOOStateLength] = {0x5F, 0x5F, 0x40, 0x40, 0x5F,' + '/// Send a FOO formatted message.\n' + '/// Alternative >64bit function to send FOO messages\n' + '/// Status: ALPHA / Untested.\n' + '/// Where data is:\n' + '/// uint8_t data[kFOOStateLength] = {0x5F, 0x5F, 0x40, 0x40, 0x5F,' ' 0x5F, 0x40, 0x40, 0x2F, 0x2F, 0x6C, 0x6C, 0x2F, 0x2F, 0x6C, 0x6C};\n' - '//\n' - '// Args:\n' - '// data: An array of bytes containing the IR command.\n' - '// It is assumed to be in MSB order for this code.\n' - '// nbytes: Nr. of bytes of data in the array. (>=kFOOStateLength)\n' - '// repeat: Nr. of times the message is to be repeated.\n' - '//\n' - '// Status: ALPHA / Untested.\n' + '///\n' + '/// @param[in] data An array of bytes containing the IR command.\n' + '/// It is assumed to be in MSB order for this code.\n' + '/// @param[in] nbytes Nr. of bytes of data in the array.' + ' (>=kFOOStateLength)\n' + '/// @param[in] repeat Nr. of times the message is to be repeated.\n' 'void IRsend::sendFOO(const uint8_t data[], const uint16_t nbytes,' ' const uint16_t repeat) {\n' ' for (uint16_t r = 0; r <= repeat; r++) {\n' @@ -974,15 +1018,25 @@ class TestAutoAnalyseRawData(unittest.TestCase): "// DANGER: More than 64 bits detected. A uint64_t for 'data' won't " 'work!\n' '#if DECODE_FOO\n' - '// Function should be safe up to 64 bits.\n' - 'bool IRrecv::decodeFOO(decode_results *results, const uint16_t nbits,' - ' const bool strict) {\n' - ' if (results->rawlen < 2 * nbits + kFOOOverhead)\n' + '/// Decode the supplied FOO message.\n' + '/// Function should be safe up to 64 bits.\n' + '/// Status: ALPHA / Untested.\n' + '/// @param[in,out] results Ptr to the data to decode &' + ' where to store the decode\n' + '/// @param[in] offset The starting index to use when' + ' attempting to decode the\n' + '/// raw data. Typically/Defaults to kStartOffset.\n' + '/// @param[in] nbits The number of data bits to expect.\n' + '/// @param[in] strict Flag indicating if we should perform strict' + ' matching.\n' + "/// @return A boolean. True if it can decode it, false if it can't.\n" + 'bool IRrecv::decodeFOO(decode_results *results, uint16_t offset,' + ' const uint16_t nbits, const bool strict) {\n' + ' if (results->rawlen < 2 * nbits + kFOOOverhead - offset)\n' ' return false; // Too short a message to match.\n' ' if (strict && nbits != kFOOBits)\n' ' return false;\n' '\n' - ' uint16_t offset = kStartOffset;\n' ' uint64_t data = 0;\n' ' match_result_t data_result;\n' '\n' @@ -1086,15 +1140,25 @@ class TestAutoAnalyseRawData(unittest.TestCase): '\n' '// Note: This should be 64+ bit safe.\n' '#if DECODE_FOO\n' - '// Function should be safe over 64 bits.\n' - 'bool IRrecv::decodeFOO(decode_results *results, const uint16_t nbits,' - ' const bool strict) {\n' - ' if (results->rawlen < 2 * nbits + kFOOOverhead)\n' + '/// Decode the supplied FOO message.\n' + '/// Function should be safe over 64 bits.\n' + '/// Status: ALPHA / Untested.\n' + '/// @param[in,out] results Ptr to the data to decode &' + ' where to store the decode\n' + '/// @param[in] offset The starting index to use when' + ' attempting to decode the\n' + '/// raw data. Typically/Defaults to kStartOffset.\n' + '/// @param[in] nbits The number of data bits to expect.\n' + '/// @param[in] strict Flag indicating if we should perform strict' + ' matching.\n' + "/// @return A boolean. True if it can decode it, false if it can't.\n" + 'bool IRrecv::decodeFOO(decode_results *results, uint16_t offset,' + ' const uint16_t nbits, const bool strict) {\n' + ' if (results->rawlen < 2 * nbits + kFOOOverhead - offset)\n' ' return false; // Too short a message to match.\n' ' if (strict && nbits != kFOOBits)\n' ' return false;\n' '\n' - ' uint16_t offset = kStartOffset;\n' ' uint16_t pos = 0;\n' ' uint16_t used = 0;\n' '\n' @@ -1229,7 +1293,7 @@ class TestAutoAnalyseRawData(unittest.TestCase): '\n' 'Generating a VERY rough code outline:\n' '\n' - '// Copyright 2019 David Conran (crankyoldgit)\n' + '// Copyright 2020 David Conran (crankyoldgit)\n' '// Support for TBD protocol\n' '\n' '#include "IRrecv.h"\n' @@ -1254,7 +1318,12 @@ class TestAutoAnalyseRawData(unittest.TestCase): "// DANGER: More than 64 bits detected. A uint64_t for 'data' won't" ' work!\n' '#if SEND_TBD\n' - '// Function should be safe up to 64 bits.\n' + '/// Send a formatted message.\n' + '/// Function should be safe up to 64 bits.\n' + '/// Status: ALPHA / Untested.\n' + '/// @param[in] data containing the IR command.\n' + '/// @param[in] nbits Nr. of bits to send. usually kBits\n' + '/// @param[in] repeat Nr. of times the message is to be repeated.\n' 'void IRsend::sendTBD(const uint64_t data, const uint16_t nbits, const' ' uint16_t repeat) {\n' ' enableIROut(kFreq);\n' @@ -1274,18 +1343,18 @@ class TestAutoAnalyseRawData(unittest.TestCase): '#endif // SEND_TBD\n' '\n' '#if SEND_TBD\n' - '// Alternative >64bit function to send TBD messages\n' - '// Where data is:\n' - '// uint8_t data[kStateLength] = {0xA5, 0x5A, 0x00, 0x00, 0x40, 0x00,' - ' 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80};\n' - '//\n' - '// Args:\n' - '// data: An array of bytes containing the IR command.\n' - '// It is assumed to be in MSB order for this code.\n' - '// nbytes: Nr. of bytes of data in the array. (>=kStateLength)\n' - '// repeat: Nr. of times the message is to be repeated.\n' - '//\n' - '// Status: ALPHA / Untested.\n' + '/// Send a formatted message.\n' + '/// Alternative >64bit function to send TBD messages\n' + '/// Status: ALPHA / Untested.\n' + '/// Where data is:\n' + '/// uint8_t data[kStateLength] = {0xA5, 0x5A, 0x00, 0x00, 0x40,' + ' 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80};\n' + '///\n' + '/// @param[in] data An array of bytes containing the IR command.\n' + '/// It is assumed to be in MSB order for this code.\n' + '/// @param[in] nbytes Nr. of bytes of data in the array.' + ' (>=kStateLength)\n' + '/// @param[in] repeat Nr. of times the message is to be repeated.\n' 'void IRsend::sendTBD(const uint8_t data[], const uint16_t nbytes,' ' const uint16_t repeat) {\n' ' for (uint16_t r = 0; r <= repeat; r++) {\n' @@ -1309,15 +1378,25 @@ class TestAutoAnalyseRawData(unittest.TestCase): "// DANGER: More than 64 bits detected. A uint64_t for 'data' won't" ' work!\n' '#if DECODE_TBD\n' - '// Function should be safe up to 64 bits.\n' - 'bool IRrecv::decodeTBD(decode_results *results, const uint16_t nbits,' - ' const bool strict) {\n' - ' if (results->rawlen < 2 * nbits + kOverhead)\n' + '/// Decode the supplied message.\n' + '/// Function should be safe up to 64 bits.\n' + '/// Status: ALPHA / Untested.\n' + '/// @param[in,out] results Ptr to the data to decode &' + ' where to store the decode\n' + '/// @param[in] offset The starting index to use when' + ' attempting to decode the\n' + '/// raw data. Typically/Defaults to kStartOffset.\n' + '/// @param[in] nbits The number of data bits to expect.\n' + '/// @param[in] strict Flag indicating if we should perform strict' + ' matching.\n' + "/// @return A boolean. True if it can decode it, false if it can't.\n" + 'bool IRrecv::decodeTBD(decode_results *results, uint16_t offset,' + ' const uint16_t nbits, const bool strict) {\n' + ' if (results->rawlen < 2 * nbits + kOverhead - offset)\n' ' return false; // Too short a message to match.\n' ' if (strict && nbits != kBits)\n' ' return false;\n' '\n' - ' uint16_t offset = kStartOffset;\n' ' uint64_t data = 0;\n' ' match_result_t data_result;\n' '\n' @@ -1348,15 +1427,25 @@ class TestAutoAnalyseRawData(unittest.TestCase): '\n' '// Note: This should be 64+ bit safe.\n' '#if DECODE_TBD\n' - '// Function should be safe over 64 bits.\n' - 'bool IRrecv::decodeTBD(decode_results *results, const uint16_t nbits,' - ' const bool strict) {\n' - ' if (results->rawlen < 2 * nbits + kOverhead)\n' + '/// Decode the supplied message.\n' + '/// Function should be safe over 64 bits.\n' + '/// Status: ALPHA / Untested.\n' + '/// @param[in,out] results Ptr to the data to decode &' + ' where to store the decode\n' + '/// @param[in] offset The starting index to use when' + ' attempting to decode the\n' + '/// raw data. Typically/Defaults to kStartOffset.\n' + '/// @param[in] nbits The number of data bits to expect.\n' + '/// @param[in] strict Flag indicating if we should perform strict' + ' matching.\n' + "/// @return A boolean. True if it can decode it, false if it can't.\n" + 'bool IRrecv::decodeTBD(decode_results *results, uint16_t offset,' + ' const uint16_t nbits, const bool strict) {\n' + ' if (results->rawlen < 2 * nbits + kOverhead - offset)\n' ' return false; // Too short a message to match.\n' ' if (strict && nbits != kBits)\n' ' return false;\n' '\n' - ' uint16_t offset = kStartOffset;\n' ' uint16_t pos = 0;\n' ' uint16_t used = 0;\n' '\n' diff --git a/lib/IRremoteESP8266-2.7.6/tools/gc_decode.cpp b/lib/IRremoteESP8266-2.7.7/tools/gc_decode.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/tools/gc_decode.cpp rename to lib/IRremoteESP8266-2.7.7/tools/gc_decode.cpp diff --git a/lib/IRremoteESP8266-2.7.6/tools/generate_irtext_h.sh b/lib/IRremoteESP8266-2.7.7/tools/generate_irtext_h.sh similarity index 100% rename from lib/IRremoteESP8266-2.7.6/tools/generate_irtext_h.sh rename to lib/IRremoteESP8266-2.7.7/tools/generate_irtext_h.sh diff --git a/lib/IRremoteESP8266-2.7.6/tools/mkkeywords b/lib/IRremoteESP8266-2.7.7/tools/mkkeywords similarity index 100% rename from lib/IRremoteESP8266-2.7.6/tools/mkkeywords rename to lib/IRremoteESP8266-2.7.7/tools/mkkeywords diff --git a/lib/IRremoteESP8266-2.7.6/tools/mode2_decode.cpp b/lib/IRremoteESP8266-2.7.7/tools/mode2_decode.cpp similarity index 100% rename from lib/IRremoteESP8266-2.7.6/tools/mode2_decode.cpp rename to lib/IRremoteESP8266-2.7.7/tools/mode2_decode.cpp diff --git a/lib/IRremoteESP8266-2.7.7/tools/raw_to_pronto_code.py b/lib/IRremoteESP8266-2.7.7/tools/raw_to_pronto_code.py new file mode 100755 index 000000000..307ae7121 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/tools/raw_to_pronto_code.py @@ -0,0 +1,103 @@ +#!/usr/bin/python +"""Convert IRremoteESP8266's Raw data output into Pronto Code.""" +# +# Copyright 2020 David Conran +import argparse +import sys +from auto_analyse_raw_data import convert_rawdata, add_rawdata_args, get_rawdata + + +# pylint: disable=too-many-arguments +def parse_and_report(rawdata_str, hertz=38000, end_usecs=100000, + use_initial=False, generate_code=False, verbose=False, + output=sys.stdout): + """Analyse the rawdata c++ definition of a IR message.""" + + # Parse the input. + rawdata = convert_rawdata(rawdata_str) + if verbose: + output.write("Found %d timing entries.\n" % len(rawdata)) + + # Do we need to pad out the rawdata to make it even in length? + if end_usecs > 0 and len(rawdata) % 2 == 1: + rawdata.append(end_usecs) + + result = ["0000"] + # Work out the frequency code. + pronto_freq = int(1000000.0 / (hertz * 0.241246)) + if verbose: + output.write("Pronto frequency is %X (%d Hz).\n" % (pronto_freq, hertz)) + result.append("%04X" % pronto_freq) + period = 1000000.0 / max(1, hertz) + if verbose: + output.write("Pronto period is %f uSecs.\n" % period) + # Add the lengths to the code. + if use_initial: + result.append("%04x" % int(len(rawdata) / 2)) # Initial burst code length + result.append("%04x" % 0) # No Repeat code length + else: + result.append("%04x" % 0) # No Initial burst code length + result.append("%04x" % int(len(rawdata) / 2)) # Repeat code length + + # Add the data. + if verbose: + output.write("Raw data: %s " % rawdata) + for i in rawdata: + result.append("%04x" % int(i / period)) + if generate_code: + output.write("uint16_t pronto[%d] = {0x%s};\n" % (len(result), + ", 0x".join(result))) + else: + output.write("Pronto code = '%s'\n" % " ".join(result)) +# pylint: enable=too-many-arguments + + +def main(): + """Parse the commandline arguments and call the method.""" + arg_parser = argparse.ArgumentParser( + description="Read an IRremoteESP8266 rawData declaration and tries to " + "convert it in to a Pronto code.", + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + arg_parser.add_argument( + "--hz", + "--hertz", + type=int, + help="Frequency of the protocol to use in code generation. E.g. 38000Hz", + dest="hertz", + required=True) + arg_parser.add_argument( + "-c", + "--code", + action='store_true', + help="Output C/C++ code instead of human-readable.", + dest="generate_code") + arg_parser.add_argument( + "-g", + "--gap", + "--endgap", + type=int, + help="Nr. of uSeconds of gap to add to the end of the message.", + dest="usecs", + default=100000) + arg_parser.add_argument( + "-i", + "--initial_burst", + action='store_true', + help="Send using only the 'inital burst' section of the pronto code.", + dest="use_initial") + arg_parser.add_argument( + "-v", + "--verbose", + help="Increase output verbosity", + action="store_true", + dest="verbose", + default=False) + add_rawdata_args(arg_parser) + arg_options = arg_parser.parse_args() + parse_and_report(get_rawdata(arg_options), arg_options.hertz, + arg_options.usecs, arg_options.use_initial, + arg_options.generate_code, arg_options.verbose) + + +if __name__ == '__main__': + main() diff --git a/lib/IRremoteESP8266-2.7.7/tools/raw_to_pronto_code_test.py b/lib/IRremoteESP8266-2.7.7/tools/raw_to_pronto_code_test.py new file mode 100755 index 000000000..b7b029b66 --- /dev/null +++ b/lib/IRremoteESP8266-2.7.7/tools/raw_to_pronto_code_test.py @@ -0,0 +1,81 @@ +#!/usr/bin/python3 +"""Unit tests for raw_to_pronto_code.py""" +from io import StringIO +import unittest +import raw_to_pronto_code as pronto + +class TestRawToPronto(unittest.TestCase): + """Unit tests for the methods in raw_to_pronto_code.""" + + def test_parse_and_report_at_38000(self): + """Tests for the parse_and_report() function @ 38kHz.""" + + output = StringIO() + input_str = """ + uint16_t rawData[7] = { + 20100, 20472, 15092, 30704, 20102, 20472, 15086};""" + pronto.parse_and_report(input_str, 38000, 100000, True, False, False, + output) + self.assertEqual( + output.getvalue(), + "Pronto code = " + "'0000 006D 0004 0000 02fb 0309 023d 048e 02fb 0309 023d 0ed8'\n") + + def test_parse_and_report_at_36000(self): + """Tests for the parse_and_report() function @ 36kHz.""" + + output = StringIO() + input_str = """ + uint16_t rawData[7] = { + 20100, 20472, 15092, 30704, 20102, 20472, 15086};""" + pronto.parse_and_report(input_str, 36000, 100000, True, False, False, + output) + self.assertEqual( + output.getvalue(), + "Pronto code = " + "'0000 0073 0004 0000 02d3 02e0 021f 0451 02d3 02e0 021f 0e10'\n") + + def test_parse_and_report_at_57600(self): + """Tests for the parse_and_report() function @ 57.6kHz.""" + + output = StringIO() + input_str = """ + uint16_t rawData[7] = { + 20100, 20472, 15092, 30704, 20102, 20472, 15086};""" + pronto.parse_and_report(input_str, 57600, 100000, True, False, False, + output) + self.assertEqual( + output.getvalue(), + "Pronto code = " + "'0000 0047 0004 0000 0485 049b 0365 06e8 0485 049b 0364 1680'\n") + + def test_using_repeat(self): + """Tests for the parse_and_report() function @38kHz using repeat section.""" + + output = StringIO() + input_str = """ + uint16_t rawData[7] = { + 20100, 20472, 15092, 30704, 20102, 20472, 15086};""" + pronto.parse_and_report(input_str, 38000, 30000, False, False, False, + output) + self.assertEqual( + output.getvalue(), + "Pronto code = " + "'0000 006D 0000 0004 02fb 0309 023d 048e 02fb 0309 023d 0474'\n") + + def test_generate_code_output(self): + """Tests for the parse_and_report() function geneating code output.""" + + output = StringIO() + input_str = """ + uint16_t rawData[7] = { + 20100, 20472, 15092, 30704, 20102, 20472, 15086};""" + pronto.parse_and_report(input_str, 38000, 30000, True, True, False, output) + self.assertEqual( + output.getvalue(), + "uint16_t pronto[12] = {0x0000, 0x006D, 0x0004, 0x0000, 0x02fb, " + "0x0309, 0x023d, 0x048e, 0x02fb, 0x0309, 0x023d, 0x0474};\n") + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/lib/IRremoteESP8266-2.7.6/tools/scrape_supported_devices.py b/lib/IRremoteESP8266-2.7.7/tools/scrape_supported_devices.py similarity index 98% rename from lib/IRremoteESP8266-2.7.6/tools/scrape_supported_devices.py rename to lib/IRremoteESP8266-2.7.7/tools/scrape_supported_devices.py index c859bbf06..4beb6c9c3 100755 --- a/lib/IRremoteESP8266-2.7.6/tools/scrape_supported_devices.py +++ b/lib/IRremoteESP8266-2.7.7/tools/scrape_supported_devices.py @@ -23,7 +23,8 @@ EXCLUDED_ACS = ["Magiquest", "NEC"] MARKDOWN_HEADER = """""".format(time.asctime()) + Last generated: {} --->""".format( + time.strftime("%a %d %b %Y %H:%M:%S +0000", time.gmtime())) def getallprotocols(): diff --git a/lib/Unishox-1.0-shadinger/python/unishox.py b/lib/Unishox-1.0-shadinger/python/unishox.py index feafe0500..6d00c7589 100644 --- a/lib/Unishox-1.0-shadinger/python/unishox.py +++ b/lib/Unishox-1.0-shadinger/python/unishox.py @@ -47,10 +47,10 @@ class Unishox: SHX_SET1B = 2 SHX_SET2 = 3 - sets = [[0, ' ', 'e', 0, 't', 'a', 'o', 'i', 'n', 's', 'r'], - [0, 'l', 'c', 'd', 'h', 'u', 'p', 'm', 'b', 'g', 'w'], - ['f', 'y', 'v', 'k', 'q', 'j', 'x', 'z', 0, 0, 0], - [0, '9', '0', '1', '2', '3', '4', '5', '6', '7', '8'], + sets = [['\0', ' ', 'e', '\0', 't', 'a', 'o', 'i', 'n', 's', 'r'], + ['\0', 'l', 'c', 'd', 'h', 'u', 'p', 'm', 'b', 'g', 'w'], + ['f', 'y', 'v', 'k', 'q', 'j', 'x', 'z', '\0', '\0', '\0'], + ['\0', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8'], ['.', ',', '-', '/', '?', '+', ' ', '(', ')', '$', '@'], [';', '#', ':', '<', '^', '*', '"', '{', '}', '[', ']'], ['=', '%', '\'', '>', '&', '_', '!', '\\', '|', '~', '`']] @@ -319,6 +319,8 @@ class Unishox: code = 0 count = 0 while count < 5: + if bit_no_p >= len_: + return -1, bit_no_p # detect marker if self.ESCAPE_MARKER == inn[bit_no_p >> 3]: bit_no_p += 8 # skip marker diff --git a/lib/Unishox-1.0-shadinger/src/unishox.cpp b/lib/Unishox-1.0-shadinger/src/unishox.cpp index 4b17dce2e..743eed38c 100644 --- a/lib/Unishox-1.0-shadinger/src/unishox.cpp +++ b/lib/Unishox-1.0-shadinger/src/unishox.cpp @@ -57,7 +57,7 @@ typedef unsigned char byte; // we squeeze both c_95[] and l_95[] in a sinle array. // c_95[] uses only the 3 upper nibbles (or 12 most signifcant bits), while the last nibble encodes length (3..13) -uint16_t cl_95[95] PROGMEM = {0x4000 + 3, 0x3F80 + 11, 0x3D80 + 11, 0x3C80 + 10, 0x3BE0 + 12, 0x3E80 + 10, 0x3F40 + 11, 0x3EC0 + 10, 0x3BA0 + 11, 0x3BC0 + 11, 0x3D60 + 11, 0x3B60 + 11, 0x3A80 + 10, 0x3AC0 + 10, 0x3A00 + 9, 0x3B00 + 10, 0x38C0 + 10, 0x3900 + 10, 0x3940 + 11, 0x3960 + 11, 0x3980 + 11, 0x39A0 + 11, 0x39C0 + 11, 0x39E0 + 12, 0x39F0 + 12, 0x3880 + 10, 0x3CC0 + 10, 0x3C00 + 9, 0x3D00 + 10, 0x3E00 + 9, 0x3F00 + 10, 0x3B40 + 11, 0x3BF0 + 12, 0x2B00 + 8, 0x21C0 + 11, 0x20C0 + 10, 0x2100 + 10, 0x2600 + 7, 0x2300 + 11, 0x21E0 + 12, 0x2140 + 11, 0x2D00 + 8, 0x2358 + 13, 0x2340 + 12, 0x2080 + 10, 0x21A0 + 11, 0x2E00 + 8, 0x2C00 + 8, 0x2180 + 11, 0x2350 + 13, 0x2F80 + 9, 0x2F00 + 9, 0x2A00 + 8, 0x2160 + 11, 0x2330 + 12, 0x21F0 + 12, 0x2360 + 13, 0x2320 + 12, 0x2368 + 13, 0x3DE0 + 12, 0x3FA0 + 11, 0x3DF0 + 12, 0x3D40 + 11, 0x3F60 + 11, 0x3FF0 + 12, 0xB000 + 4, 0x1C00 + 7, 0x0C00 + 6, 0x1000 + 6, 0x6000 + 3, 0x3000 + 7, 0x1E00 + 8, 0x1400 + 7, 0xD000 + 4, 0x3580 + 9, 0x3400 + 8, 0x0800 + 6, 0x1A00 + 7, 0xE000 + 4, 0xC000 + 4, 0x1800 + 7, 0x3500 + 9, 0xF800 + 5, 0xF000 + 5, 0xA000 + 4, 0x1600 + 7, 0x3300 + 8, 0x1F00 + 8, 0x3600 + 9, 0x3200 + 8, 0x3680 + 9, 0x3DA0 + 11, 0x3FC0 + 11, 0x3DC0 + 11, 0x3FE0 + 12 }; +static uint16_t cl_95[95] PROGMEM = {0x4000 + 3, 0x3F80 + 11, 0x3D80 + 11, 0x3C80 + 10, 0x3BE0 + 12, 0x3E80 + 10, 0x3F40 + 11, 0x3EC0 + 10, 0x3BA0 + 11, 0x3BC0 + 11, 0x3D60 + 11, 0x3B60 + 11, 0x3A80 + 10, 0x3AC0 + 10, 0x3A00 + 9, 0x3B00 + 10, 0x38C0 + 10, 0x3900 + 10, 0x3940 + 11, 0x3960 + 11, 0x3980 + 11, 0x39A0 + 11, 0x39C0 + 11, 0x39E0 + 12, 0x39F0 + 12, 0x3880 + 10, 0x3CC0 + 10, 0x3C00 + 9, 0x3D00 + 10, 0x3E00 + 9, 0x3F00 + 10, 0x3B40 + 11, 0x3BF0 + 12, 0x2B00 + 8, 0x21C0 + 11, 0x20C0 + 10, 0x2100 + 10, 0x2600 + 7, 0x2300 + 11, 0x21E0 + 12, 0x2140 + 11, 0x2D00 + 8, 0x2358 + 13, 0x2340 + 12, 0x2080 + 10, 0x21A0 + 11, 0x2E00 + 8, 0x2C00 + 8, 0x2180 + 11, 0x2350 + 13, 0x2F80 + 9, 0x2F00 + 9, 0x2A00 + 8, 0x2160 + 11, 0x2330 + 12, 0x21F0 + 12, 0x2360 + 13, 0x2320 + 12, 0x2368 + 13, 0x3DE0 + 12, 0x3FA0 + 11, 0x3DF0 + 12, 0x3D40 + 11, 0x3F60 + 11, 0x3FF0 + 12, 0xB000 + 4, 0x1C00 + 7, 0x0C00 + 6, 0x1000 + 6, 0x6000 + 3, 0x3000 + 7, 0x1E00 + 8, 0x1400 + 7, 0xD000 + 4, 0x3580 + 9, 0x3400 + 8, 0x0800 + 6, 0x1A00 + 7, 0xE000 + 4, 0xC000 + 4, 0x1800 + 7, 0x3500 + 9, 0xF800 + 5, 0xF000 + 5, 0xA000 + 4, 0x1600 + 7, 0x3300 + 8, 0x1F00 + 8, 0x3600 + 9, 0x3200 + 8, 0x3680 + 9, 0x3DA0 + 11, 0x3FC0 + 11, 0x3DC0 + 11, 0x3FE0 + 12 }; // Original version with c/l separate // uint16_t c_95[95] PROGMEM = {0x4000, 0x3F80, 0x3D80, 0x3C80, 0x3BE0, 0x3E80, 0x3F40, 0x3EC0, 0x3BA0, 0x3BC0, 0x3D60, 0x3B60, 0x3A80, 0x3AC0, 0x3A00, 0x3B00, 0x38C0, 0x3900, 0x3940, 0x3960, 0x3980, 0x39A0, 0x39C0, 0x39E0, 0x39F0, 0x3880, 0x3CC0, 0x3C00, 0x3D00, 0x3E00, 0x3F00, 0x3B40, 0x3BF0, 0x2B00, 0x21C0, 0x20C0, 0x2100, 0x2600, 0x2300, 0x21E0, 0x2140, 0x2D00, 0x2358, 0x2340, 0x2080, 0x21A0, 0x2E00, 0x2C00, 0x2180, 0x2350, 0x2F80, 0x2F00, 0x2A00, 0x2160, 0x2330, 0x21F0, 0x2360, 0x2320, 0x2368, 0x3DE0, 0x3FA0, 0x3DF0, 0x3D40, 0x3F60, 0x3FF0, 0xB000, 0x1C00, 0x0C00, 0x1000, 0x6000, 0x3000, 0x1E00, 0x1400, 0xD000, 0x3580, 0x3400, 0x0800, 0x1A00, 0xE000, 0xC000, 0x1800, 0x3500, 0xF800, 0xF000, 0xA000, 0x1600, 0x3300, 0x1F00, 0x3600, 0x3200, 0x3680, 0x3DA0, 0x3FC0, 0x3DC0, 0x3FE0 }; // uint8_t l_95[95] PROGMEM = { 3, 11, 11, 10, 12, 10, 11, 10, 11, 11, 11, 11, 10, 10, 9, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 10, 10, 9, 10, 9, 10, 11, 12, 8, 11, 10, 10, 7, 11, 12, 11, 8, 13, 12, 10, 11, 8, 8, 11, 13, 9, 9, 8, 11, 12, 12, 13, 12, 13, 12, 11, 12, 11, 11, 12, 4, 7, 6, 6, 3, 7, 8, 7, 4, 9, 8, 6, 7, 4, 4, 7, 9, 5, 5, 4, 7, 8, 8, 9, 8, 9, 11, 11, 11, 12 }; @@ -66,7 +66,7 @@ enum {SHX_STATE_1 = 1, SHX_STATE_2}; // removed Unicode state enum {SHX_SET1 = 0, SHX_SET1A, SHX_SET1B, SHX_SET2, SHX_SET3, SHX_SET4, SHX_SET4A}; // changed mapping in Set3, Set4, Set4A to accomodate frequencies in Rules and Javascript -char sets[][11] PROGMEM = +static char sets[][11] PROGMEM = {{ 0, ' ', 'e', 0, 't', 'a', 'o', 'i', 'n', 's', 'r'}, { 0, 'l', 'c', 'd', 'h', 'u', 'p', 'm', 'b', 'g', 'w'}, {'f', 'y', 'v', 'k', 'q', 'j', 'x', 'z', 0, 0, 0}, @@ -87,7 +87,7 @@ char sets[][11] PROGMEM = // First 2 bits 00, Next 3 bits indicate index of code from 0, // last 3 bits indicate code length in bits // 0, 1, 2, 3, 4, -char us_vcode[32] PROGMEM = +static char us_vcode[32] PROGMEM = {2 + (0 << 3), 3 + (3 << 3), 3 + (1 << 3), 4 + (6 << 3), 0, // 5, 6, 7, 8, 9, 10 4 + (4 << 3), 3 + (2 << 3), 4 + (8 << 3), 0, 0, 0, @@ -98,7 +98,7 @@ char us_vcode[32] PROGMEM = // 24, 25, 26, 27, 28, 29, 30, 31 0, 0, 0, 0, 0, 0, 0, 5 + (10 << 3)}; // 0, 1, 2, 3, 4, 5, 6, 7, -char us_hcode[32] PROGMEM = +static char us_hcode[32] PROGMEM = {1 + (1 << 3), 2 + (0 << 3), 0, 3 + (2 << 3), 0, 0, 0, 5 + (3 << 3), // 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 5 + (5 << 3), @@ -107,28 +107,28 @@ char us_hcode[32] PROGMEM = // 24, 25, 26, 27, 28, 29, 30, 31 0, 0, 0, 0, 0, 0, 0, 5 + (6 << 3)}; -const char ESCAPE_MARKER = 0x2A; // Escape any null char +static const char ESCAPE_MARKER = 0x2A; // Escape any null char -const uint16_t TERM_CODE = 0x37C0; // 0b0011011111000000 -const uint16_t TERM_CODE_LEN = 10; -const uint16_t DICT_CODE = 0x0000; -const uint16_t DICT_CODE_LEN = 5; -const uint16_t DICT_OTHER_CODE = 0x0000; // not used -const uint16_t DICT_OTHER_CODE_LEN = 6; +static const uint16_t TERM_CODE = 0x37C0; // 0b0011011111000000 +static const uint16_t TERM_CODE_LEN = 10; +static const uint16_t DICT_CODE = 0x0000; +static const uint16_t DICT_CODE_LEN = 5; +static const uint16_t DICT_OTHER_CODE = 0x0000; // not used +static const uint16_t DICT_OTHER_CODE_LEN = 6; // const uint16_t RPT_CODE = 0x2370; // const uint16_t RPT_CODE_LEN = 13; -const uint16_t RPT_CODE_TASMOTA = 0x3780; -const uint16_t RPT_CODE_TASMOTA_LEN = 10; -const uint16_t BACK2_STATE1_CODE = 0x2000; // 0010 = back to lower case -const uint16_t BACK2_STATE1_CODE_LEN = 4; -const uint16_t BACK_FROM_UNI_CODE = 0xFE00; -const uint16_t BACK_FROM_UNI_CODE_LEN = 8; +static const uint16_t RPT_CODE_TASMOTA = 0x3780; +static const uint16_t RPT_CODE_TASMOTA_LEN = 10; +static const uint16_t BACK2_STATE1_CODE = 0x2000; // 0010 = back to lower case +static const uint16_t BACK2_STATE1_CODE_LEN = 4; +static const uint16_t BACK_FROM_UNI_CODE = 0xFE00; +static const uint16_t BACK_FROM_UNI_CODE_LEN = 8; // const uint16_t CRLF_CODE = 0x3780; // const uint16_t CRLF_CODE_LEN = 10; -const uint16_t LF_CODE = 0x3700; -const uint16_t LF_CODE_LEN = 9; -const uint16_t TAB_CODE = 0x2400; -const uint16_t TAB_CODE_LEN = 7; +static const uint16_t LF_CODE = 0x3700; +static const uint16_t LF_CODE_LEN = 9; +static const uint16_t TAB_CODE = 0x2400; +static const uint16_t TAB_CODE_LEN = 7; // const uint16_t UNI_CODE = 0x8000; // Unicode disabled // const uint16_t UNI_CODE_LEN = 3; // const uint16_t UNI_STATE_SPL_CODE = 0xF800; @@ -137,21 +137,21 @@ const uint16_t TAB_CODE_LEN = 7; // const uint16_t UNI_STATE_DICT_CODE_LEN = 7; // const uint16_t CONT_UNI_CODE = 0x2800; // const uint16_t CONT_UNI_CODE_LEN = 7; -const uint16_t ALL_UPPER_CODE = 0x2200; -const uint16_t ALL_UPPER_CODE_LEN = 8; -const uint16_t SW2_STATE2_CODE = 0x3800; -const uint16_t SW2_STATE2_CODE_LEN = 7; -const uint16_t ST2_SPC_CODE = 0x3B80; -const uint16_t ST2_SPC_CODE_LEN = 11; -const uint16_t BIN_CODE_TASMOTA = 0x8000; -const uint16_t BIN_CODE_TASMOTA_LEN = 3; +static const uint16_t ALL_UPPER_CODE = 0x2200; +static const uint16_t ALL_UPPER_CODE_LEN = 8; +static const uint16_t SW2_STATE2_CODE = 0x3800; +static const uint16_t SW2_STATE2_CODE_LEN = 7; +static const uint16_t ST2_SPC_CODE = 0x3B80; +static const uint16_t ST2_SPC_CODE_LEN = 11; +static const uint16_t BIN_CODE_TASMOTA = 0x8000; +static const uint16_t BIN_CODE_TASMOTA_LEN = 3; // const uint16_t BIN_CODE = 0x2000; // const uint16_t BIN_CODE_LEN = 9; #define NICE_LEN 5 // uint16_t mask[] PROGMEM = {0x8000, 0xC000, 0xE000, 0xF000, 0xF800, 0xFC00, 0xFE00, 0xFF00}; -uint8_t mask[] PROGMEM = {0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF}; +static const uint8_t mask[] PROGMEM = {0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF}; @@ -378,14 +378,19 @@ int32_t Unishox::unishox_compress(const char *p_in, size_t p_len, char *p_out, s state = SHX_STATE_1; append_bits(TERM_CODE, 8 - bits); // 0011 0111 1100 0000 TERM = 0011 0111 11 } - return ol/8+(ol%8?1:0); + return ol / 8; // we already arrived to a byte boundary + // return ol/8+(ol%8?1:0); } uint32_t Unishox::getNextBit(void) { if (8 == bit_no) { + if (byte_no >= len) { + in_eof = true; + return 1; // return only 1s, which appends 'r' in worst case + } byte_in = in[byte_no++]; if (ESCAPE_MARKER == byte_in) { - byte_in = in[byte_no++] - 1; + byte_in = in[byte_no++] - 1; // we shouldn't need to test if byte_no >= len, because it should not be possible to end with ESCAPE_MARKER } bit_no = 0; } @@ -399,8 +404,7 @@ int32_t Unishox::getCodeIdx(const char *code_type) { int32_t code = 0; int32_t count = 0; do { - if (bit_no >= len) - return -1; // invalid state + if (in_eof) return -1; // invalid state code += getNextBit() << count; count++; uint8_t code_type_code = pgm_read_byte(&code_type[code]); @@ -416,6 +420,7 @@ int32_t Unishox::getNumFromBits(uint32_t count) { while (count--) { ret += getNextBit() << count; } + if (in_eof) return 0; return ret; } @@ -433,8 +438,8 @@ int32_t Unishox::getNumFromBits(uint32_t count) { // Code size optimized, recalculate adder[] like in encodeCount uint32_t Unishox::readCount(void) { int32_t idx = getCodeIdx(us_hcode); + if ((1 == idx) || (idx >= sizeof(bit_len)) || (idx < 0)) return 0; // unsupported or end of stream if (idx >= 1) idx--; // we skip v = 1 (code '0') since we no more accept 2 bits encoding - if ((idx >= sizeof(bit_len)) || (idx < 0)) return 0; // unsupported or end of stream int base; int till = 0; @@ -452,9 +457,11 @@ uint32_t Unishox::readCount(void) { void Unishox::decodeRepeat(void) { uint32_t dict_len = readCount() + NICE_LEN; uint32_t dist = readCount() + NICE_LEN - 1; + if (ol + dict_len <= len_out) { memcpy(out + ol, out + ol - dist, dict_len); ol += dict_len; } +} int32_t Unishox::unishox_decompress(const char *p_in, size_t p_len, char *p_out, size_t p_len_out) { in = p_in; @@ -462,15 +469,16 @@ int32_t Unishox::unishox_decompress(const char *p_in, size_t p_len, char *p_out, out = p_out; len_out = p_len_out; + in_eof = false; ol = 0; bit_no = 8; // force load of first byte, pretending we expired the last one byte_no = 0; dstate = SHX_SET1; is_all_upper = 0; - len <<= 3; // *8, len in bits out[ol] = 0; - while (bit_no < len) { + // while ((byte_no << 3) + bit_no - 8 < len) { + while (!in_eof) { int32_t h, v; char c = 0; byte is_upper = is_all_upper; diff --git a/lib/Unishox-1.0-shadinger/src/unishox.h b/lib/Unishox-1.0-shadinger/src/unishox.h index d1cda8976..9b6ba1329 100644 --- a/lib/Unishox-1.0-shadinger/src/unishox.h +++ b/lib/Unishox-1.0-shadinger/src/unishox.h @@ -48,6 +48,7 @@ private: uint32_t ol; int32_t bit_no; uint32_t byte_no; + bool in_eof; // have we reached end of file for compressed input const char * in; char * out; size_t len; diff --git a/platformio_override_sample.ini b/platformio_override_sample.ini index 071c28887..d292724c7 100644 --- a/platformio_override_sample.ini +++ b/platformio_override_sample.ini @@ -159,7 +159,7 @@ build_type = debug ; *** expect the unexpected. Many features not working!!! *** [common32] -platform = espressif32@1.12.0 +platform = espressif32@1.12.1 platform_packages = tool-esptoolpy@1.20800.0 board = esp32dev board_build.ldscript = esp32_out.ld diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index 1f343928e..056a0edd6 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -2,8 +2,12 @@ ### 8.3.1.1 20200518 +- Change IRremoteESP8266 library updated to v2.7.7 - Add command ``Rule0`` to change global rule parameters - Add more functionality to ``Switchmode`` 11 and 12 (#8450) +- Add dump of compressed rules over 512 chars and unishox decompress fix +- Add support for VEML6075 UVA/UVB/UVINDEX Sensor by device111 (#8432) +- Add support for VEML7700 Ambient light intensity Sensor by device111 (#8432) ## Released diff --git a/tasmota/i18n.h b/tasmota/i18n.h index e8286e585..698192e99 100644 --- a/tasmota/i18n.h +++ b/tasmota/i18n.h @@ -586,6 +586,16 @@ // Commands xsns_02_analog.ino #define D_CMND_ADCPARAM "AdcParam" +// xsns_70_veml6075.ino +#define D_JSON_UVA_INTENSITY "UvaIntensity" +#define D_JSON_UVB_INTENSITY "UvbItensity" +#define D_CMND_VEML6075_POWER "power" +#define D_CMND_VEML6075_DYNAMIC "dynamic" +#define D_CMND_VEML6075_INTTIME "inttime" + +// xsns_71_veml7700.ino +#define D_JSON_WHITE_CONTENT "WhiteContent" + /********************************************************************************************/ // Log message prefix diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 9b04a2ea2..1a65eb571 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -516,6 +516,8 @@ // #define USE_HDC1080 // [I2cDriver45] Enable HDC1080 temperature/humidity sensor (I2C address 0x40) (+1k5 code) // #define USE_IAQ // [I2cDriver46] Enable iAQ-core air quality sensor (I2C address 0x5a) (+0k6 code) // #define USE_AS3935 // [I2cDriver48] Enable AS3935 Franklin Lightning Sensor (I2C address 0x03) (+5k4 code) +// #define USE_VEML6075 // [I2cDriver49] Enable VEML6075 UVA/UVB/UVINDEX Sensor (I2C address 0x10) (+2k1 code) +// #define USE_VEML7700 // [I2cDriver50] Enable VEML7700 Ambient Light sensor (I2C addresses 0x10) (+4k5 code) // #define USE_DISPLAY // Add I2C Display Support (+2k code) #define USE_DISPLAY_MODES1TO5 // Enable display mode 1 to 5 in addition to mode 0 diff --git a/tasmota/support_features.ino b/tasmota/support_features.ino index 02a04a962..ef757e5b6 100644 --- a/tasmota/support_features.ino +++ b/tasmota/support_features.ino @@ -563,10 +563,13 @@ void GetFeatures(void) #ifdef USE_THERMOSTAT feature6 |= 0x00000400; // xdrv_39_heating.ino #endif +#ifdef USE_VEML6075 + feature6 |= 0x00000800; // xsns_70_veml6075.ino +#endif +#ifdef USE_VEML7700 + feature6 |= 0x00001000; // xsns_71_veml7700.ino +#endif -// feature6 |= 0x00000800; - -// feature6 |= 0x00001000; // feature6 |= 0x00002000; // feature6 |= 0x00004000; // feature6 |= 0x00008000; diff --git a/tasmota/tasmota_configurations.h b/tasmota/tasmota_configurations.h index 37ac20237..8ba54e60b 100644 --- a/tasmota/tasmota_configurations.h +++ b/tasmota/tasmota_configurations.h @@ -83,6 +83,8 @@ #define USE_BME680 // Add additional support for BME680 sensor using Bosch BME680 library (+4k code) #define USE_BH1750 // Add I2C code for BH1750 sensor (+0k5 code) #define USE_VEML6070 // Add I2C code for VEML6070 sensor (+0k5 code) +// #define USE_VEML6075 // Add I2C code for VEML6075 UVA/UVB/UVINDEX Sensor (+2k1 code) +// #define USE_VEML7700 // Add I2C code for VEML7700 Ambient Light sensor (+4k5 code) #define USE_ADS1115 // Add I2C code for ADS1115 16 bit A/D converter based on Adafruit ADS1x15 library (no library needed) (+0k7 code) #define USE_INA219 // Add I2C code for INA219 Low voltage and current sensor (+1k code) //#define USE_INA226 // Enable INA226 (I2C address 0x40, 0x41 0x44 or 0x45) Low voltage and current sensor (+2k3 code) diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index a1e4a247b..4fb1303ed 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -428,18 +428,18 @@ const char HTTP_FORM_MODULE[] PROGMEM = const char HTTP_FORM_WIFI[] PROGMEM = "
 " D_WIFI_PARAMETERS " " "
" - "

" D_AP1_SSID " (" STA_SSID1 ")

" - "


" - "

" D_AP2_SSID " (" STA_SSID2 ")

" - "


" - "

" D_HOSTNAME " (%s)

" - "

" D_CORS_DOMAIN "

"; + "

" D_AP1_SSID " (" STA_SSID1 ")

" // Need \" instead of ' to be able to use ' in text (#8489) + "


" + "

" D_AP2_SSID " (" STA_SSID2 ")

" + "


" + "

" D_HOSTNAME " (%s)

" + "

" D_CORS_DOMAIN "

"; const char HTTP_FORM_LOG1[] PROGMEM = "
 " D_LOGGING_PARAMETERS " " ""; const char HTTP_FORM_LOG2[] PROGMEM = - "

" D_SYSLOG_HOST " (" SYS_LOG_HOST ")

" + "

" D_SYSLOG_HOST " (" SYS_LOG_HOST ")

" "

" D_SYSLOG_PORT " (" STR(SYS_LOG_PORT) ")

" "

" D_TELEMETRY_PERIOD " (" STR(TELE_PERIOD) ")

"; @@ -448,15 +448,15 @@ const char HTTP_FORM_OTHER[] PROGMEM = "" "

" "
 " D_TEMPLATE " " - "

" + "

" "

" "
" "
" - "

" + "

" "
" "
" "
" - "

" + "

" "
"; const char HTTP_FORM_END[] PROGMEM = @@ -471,7 +471,7 @@ const char HTTP_FORM_UPG[] PROGMEM = "
" "
 " D_UPGRADE_BY_WEBSERVER " " "" - "
" D_OTA_URL "

" + "
" D_OTA_URL "

" "
" "


" "
 " D_UPGRADE_BY_FILE_UPLOAD " "; @@ -2004,7 +2004,7 @@ void HandleOtherConfiguration(void) #endif // USE_SONOFF_IFAN for (uint32_t i = 0; i < maxfn; i++) { snprintf_P(stemp, sizeof(stemp), PSTR("%d"), i +1); - WSContentSend_P(PSTR("" D_FRIENDLY_NAME " %d (" FRIENDLY_NAME "%s)

"), + WSContentSend_P(PSTR("" D_FRIENDLY_NAME " %d (" FRIENDLY_NAME "%s)

"), i +1, (i) ? stemp : "", i, diff --git a/tasmota/xdrv_02_mqtt.ino b/tasmota/xdrv_02_mqtt.ino index eaa2562e8..9e06f4e90 100644 --- a/tasmota/xdrv_02_mqtt.ino +++ b/tasmota/xdrv_02_mqtt.ino @@ -1240,14 +1240,14 @@ const char HTTP_BTN_MENU_MQTT[] PROGMEM = const char HTTP_FORM_MQTT1[] PROGMEM = "
 " D_MQTT_PARAMETERS " " "
" - "

" D_HOST " (" MQTT_HOST ")

" + "

" D_HOST " (" MQTT_HOST ")

" "

" D_PORT " (" STR(MQTT_PORT) ")

" - "

" D_CLIENT " (%s)

"; + "

" D_CLIENT " (%s)

"; const char HTTP_FORM_MQTT2[] PROGMEM = - "

" D_USER " (" MQTT_USER ")

" - "


" - "

" D_TOPIC " = %%topic%% (%s)

" - "

" D_FULL_TOPIC " (%s)

"; + "

" D_USER " (" MQTT_USER ")

" + "


" + "

" D_TOPIC " = %%topic%% (%s)

" + "

" D_FULL_TOPIC " (%s)

"; void HandleMqttConfiguration(void) { diff --git a/tasmota/xdrv_10_rules.ino b/tasmota/xdrv_10_rules.ino index d23f3e122..25a62d288 100644 --- a/tasmota/xdrv_10_rules.ino +++ b/tasmota/xdrv_10_rules.ino @@ -2017,7 +2017,25 @@ void CmndRule(void) } String rule = GetRule(index - 1); size_t rule_len = rule.length(); - if (rule_len >= MAX_RULE_SIZE) { + if (rule_len > MAX_RULE_SIZE - 3) { + + size_t start_index = 0; // start from 0 + while (start_index < rule_len) { // until we reached end of rule + size_t last_index = start_index + MAX_RULE_SIZE - 3; // set max length to what would fit uncompressed, i.e. MAX_RULE_SIZE - 3 (first NULL + length + last NULL) + if (last_index < rule_len) { // if we didn't reach the end, try to shorten to last space character + int32_t next_index = rule.lastIndexOf(" ", last_index); + if (next_index > 0) { // if space was found and is not at the first position (i.e. we are progressing) + last_index = next_index; // shrink to the last space + } // otherwise it means there are no spaces, we need to cut somewhere even if the result cannot be entered back + } else { + last_index = rule_len; // until the end of the rule + } + AddLog_P2(LOG_LEVEL_INFO, PSTR("RUL: Rule%d %s%s"), + index, 0 == start_index ? PSTR("") : PSTR("+"), + rule.substring(start_index, last_index).c_str()); + start_index = last_index + 1; + } + // we need to split the rule in chunks rule = rule.substring(0, MAX_RULE_SIZE); rule += F("..."); diff --git a/tasmota/xdrv_10_scripter.ino b/tasmota/xdrv_10_scripter.ino index 8c2dcbc4f..eb0d00f29 100755 --- a/tasmota/xdrv_10_scripter.ino +++ b/tasmota/xdrv_10_scripter.ino @@ -52,7 +52,9 @@ keywords if then else endif, or, and are better readable for beginners (others m #endif #define MAXNVARS MAXVARS-MAXSVARS +#ifndef MAXFILT #define MAXFILT 5 +#endif #define SCRIPT_SVARSIZE 20 #define SCRIPT_MAXSSIZE 48 #define SCRIPT_EOL '\n' @@ -66,8 +68,17 @@ keywords if then else endif, or, and are better readable for beginners (others m uint32_t EncodeLightId(uint8_t relay_id); uint32_t DecodeLightId(uint32_t hue_id); +#ifdef USE_SCRIPT_COMPRESSION #include +Unishox compressor; // singleton +#define SCRIPT_COMPRESS compressor.unishox_compress +#define SCRIPT_DECOMPRESS compressor.unishox_decompress +#ifndef UNISHOXRSIZE +#define UNISHOXRSIZE 2560 +#endif +#endif // USE_SCRIPT_COMPRESSION + #if defined(ESP32) && defined(ESP32_SCRIPT_SIZE) && !defined(USE_24C256) && !defined(USE_SCRIPT_FATFS) #include "FS.h" #include "SPIFFS.h" @@ -1757,7 +1768,7 @@ chknext: lp=GetNumericResult(lp,OPER_EQU,&fvar2,0); lp++; //fvar=pow(fvar1,fvar2); - fvar=FastPrecisePow(fvar1,fvar2); + fvar=FastPrecisePowf(fvar1,fvar2); len=0; goto exit; } @@ -3966,24 +3977,24 @@ void ScriptSaveSettings(void) { glob_script_mem.script_mem_size=0; } - -#ifndef UNISHOXRSIZE -#define UNISHOXRSIZE 2560 -#endif -#ifdef USE_RULES_COMPRESSION +#ifdef USE_SCRIPT_COMPRESSION #ifndef USE_24C256 #ifndef USE_SCRIPT_FATFS #ifndef ESP32_SCRIPT_SIZE - uint32_t len_compressed = unishox_compress(glob_script_mem.script_ram, strlen(glob_script_mem.script_ram), Settings.rules[0], UNISHOXRSIZE); + + //AddLog_P2(LOG_LEVEL_INFO,PSTR("in string: %s len = %d"),glob_script_mem.script_ram,strlen(glob_script_mem.script_ram)); + uint32_t len_compressed = SCRIPT_COMPRESS(glob_script_mem.script_ram, strlen(glob_script_mem.script_ram)+1, Settings.rules[0], MAX_SCRIPT_SIZE-1); + Settings.rules[0][len_compressed] = 0; if (len_compressed > 0) { - AddLog_P2(LOG_LEVEL_INFO,PSTR("compressed to %d"),len_compressed * 100 / strlen(glob_script_mem.script_ram)); + AddLog_P2(LOG_LEVEL_INFO,PSTR("script compressed to %d %%"),len_compressed * 100 / strlen(glob_script_mem.script_ram)); } else { AddLog_P2(LOG_LEVEL_INFO, PSTR("script compress error: %d"), len_compressed); } + #endif #endif #endif -#endif // USE_RULES_COMPRESSION +#endif // USE_SCRIPT_COMPRESSION if (bitRead(Settings.rule_enabled, 0)) { int16_t res=Init_Scripter(); @@ -4912,6 +4923,10 @@ const char SCRIPT_MSG_GTABLEb[] PROGMEM = const char SCRIPT_MSG_GOPT1[] PROGMEM = "title:'%s',isStacked:false"; +const char SCRIPT_MSG_GOPT3[] PROGMEM = +"title:'%s',vAxes:{0:{maxValue:%d},1:{maxValue:%d}},series:{0:{targetAxisIndex:0},1:{targetAxisIndex:1}}"; + + const char SCRIPT_MSG_GOPT2[] PROGMEM = "showRowNumber:true,sort:'disable',allowHtml:true,width:'100%%',height:'100%%',cssClassNames:cssc"; @@ -5223,14 +5238,27 @@ void ScriptWebShow(char mc) { lp=GetStringResult(lp,OPER_EQU,header,0); SCRIPT_SKIP_SPACES - char options[128]; + char options[256]; snprintf_P(options,sizeof(options),SCRIPT_MSG_GOPT1,header); + //uint32_t slen=sizeof(SCRIPT_MSG_GOPT1)+strlen(header); const char *type; if (*lp!=')') { switch (*lp) { case 'l': type=PSTR("LineChart"); + if (*(lp+1)=='2') { + // 2 y axes variant + lp+=2; + SCRIPT_SKIP_SPACES + float max1; + lp=GetNumericResult(lp,OPER_EQU,&max1,0); + SCRIPT_SKIP_SPACES + float max2; + lp=GetNumericResult(lp,OPER_EQU,&max2,0); + SCRIPT_SKIP_SPACES + snprintf_P(options,sizeof(options),SCRIPT_MSG_GOPT3,header,(uint32_t)max1,(uint32_t)max2); + } break; case 'b': type=PSTR("BarChart"); @@ -5255,6 +5283,7 @@ void ScriptWebShow(char mc) { } else { type=PSTR("ColumnChart"); } + lp++; WSContentSend_PD(SCRIPT_MSG_GTABLEb,options,type,chartindex); chartindex++; @@ -5423,6 +5452,7 @@ uint32_t scripter_create_task(uint32_t num, uint32_t time, uint32_t core) { bool Xdrv10(uint8_t function) { bool result = false; + char *sprt; switch (function) { case FUNC_PRE_INIT: @@ -5434,18 +5464,22 @@ bool Xdrv10(uint8_t function) glob_script_mem.script_pram=(uint8_t*)Settings.script_pram[0]; glob_script_mem.script_pram_size=PMEM_SIZE; -#ifdef USE_RULES_COMPRESSION +#ifdef USE_SCRIPT_COMPRESSION #ifndef USE_24C256 #ifndef USE_SCRIPT_FATFS #ifndef ESP32_SCRIPT_SIZE - glob_script_mem.script_ram=(char*)calloc(UNISHOXRSIZE+8,1); - if (!glob_script_mem.script_ram) { break; } - unishox_decompress(Settings.rules[0], strlen(Settings.rules[0]), glob_script_mem.script_ram, UNISHOXRSIZE); + int32_t len_decompressed; + sprt=(char*)calloc(UNISHOXRSIZE+8,1); + if (!sprt) { break; } + glob_script_mem.script_ram=sprt; glob_script_mem.script_size=UNISHOXRSIZE; + len_decompressed = SCRIPT_DECOMPRESS(Settings.rules[0], strlen(Settings.rules[0]), glob_script_mem.script_ram, glob_script_mem.script_size); + glob_script_mem.script_ram[len_decompressed]=0; + //AddLog_P2(LOG_LEVEL_INFO, PSTR("decompressed script len %d"),len_decompressed); #endif #endif #endif -#endif // USE_RULES_COMPRESSION +#endif // USE_SCRIPT_COMPRESSION #ifdef USE_BUTTON_EVENT for (uint32_t cnt=0;cnt= 128 bool wt_light = false; // Controls a White Light when SetOption37 is >= 128 bool err_flag = false; // When true it blocks the creation of entities if the order of the Relays is not correct to avoid issue with Lights + bool PwmMod = false; // Controls PWM_DIMMER module uint8_t dimmer = 1; uint8_t max_lights = 1; + #ifdef ESP8266 + if (PWM_DIMMER == my_module_type) { PwmMod = true; } + #endif //ESP8266 + // If there is a special Light to be enabled and managed with SetOption68 or SetOption37 >= 128, Discovery calculates the maximum number of entities to be generated in advance if (PwmMulti) { max_lights = Light.subtype; } @@ -213,7 +218,7 @@ void HAssAnnounceRelayLight(void) for (uint32_t i = 1; i <= MAX_RELAYS; i++) { bool RelayX = PinUsed(GPIO_REL1 +i-1); - is_topic_light = Settings.flag.hass_light && RelayX || light_type && !RelayX; // SetOption30 - Enforce HAss autodiscovery as light + is_topic_light = Settings.flag.hass_light && RelayX || light_type && !RelayX || PwmMod; // SetOption30 - Enforce HAss autodiscovery as light mqtt_data[0] = '\0'; // Clear retained message @@ -232,7 +237,7 @@ void HAssAnnounceRelayLight(void) AddLog_P2(LOG_LEVEL_ERROR, PSTR("%s"), kHAssError2); } else { if (Settings.flag.hass_discovery && (RelayX || (Light.device > 0) && (max_lights > 0)) && !err_flag ) - { // SetOption19 - Control Home Assistantautomatic discovery (See SetOption59) + { // SetOption19 - Control Home Assistant automatic discovery (See SetOption59) char name[TOPSZ]; // friendlyname(33) + " " + index char value_template[33]; char prefix[TOPSZ]; @@ -255,13 +260,8 @@ void HAssAnnounceRelayLight(void) TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP_getChipId()); #ifdef USE_LIGHT - if ((i >= Light.device) - #ifdef ESP8266 - || PWM_DIMMER == my_module_type - #endif - ) - { - if (!RelayX) { + if (i >= Light.device) { + if (!RelayX || PwmMod) { char *brightness_command_topic = stemp1; strncpy_P(stemp3, Settings.flag.not_power_linked ? PSTR("last") : PSTR("brightness"), sizeof(stemp3)); // SetOption20 - Control power in relation to Dimmer/Color/Ct changes char channel_num[9]; diff --git a/tasmota/xdrv_35_pwm_dimmer.ino b/tasmota/xdrv_35_pwm_dimmer.ino index fd7a9d86b..39ab399df 100644 --- a/tasmota/xdrv_35_pwm_dimmer.ino +++ b/tasmota/xdrv_35_pwm_dimmer.ino @@ -552,6 +552,7 @@ void PWMDimmerHandleButton(void) if (button_hold_time[button_index] >= now) { bri_offset = (is_down_button ? -1 : 1); dgr_item = 255; + state_updated = true; } // If the button was held and the hold was not processed by a rule, we changed the @@ -601,7 +602,7 @@ void PWMDimmerHandleButton(void) } if (new_bri != bri) { #ifdef USE_DEVICE_GROUPS - SendDeviceGroupMessage(power_button_index, (dgr_item ? DGR_MSGTYP_UPDATE : DGR_MSGTYP_UPDATE_MORE_TO_COME), DGR_ITEM_LIGHT_BRI, new_bri); + SendDeviceGroupMessage(power_button_index, DGR_MSGTYP_UPDATE_MORE_TO_COME, DGR_ITEM_LIGHT_BRI, new_bri); #endif // USE_DEVICE_GROUPS #ifdef USE_PWM_DIMMER_REMOTE if (!active_device_is_local) @@ -663,7 +664,7 @@ void PWMDimmerHandleButton(void) // If we're not changing the brightness or toggling the power and we made changes, send a group // update. - else if (dgr_item) { + if (dgr_item) { #ifdef USE_DEVICE_GROUPS if (dgr_item == 255) dgr_item = 0; SendDeviceGroupMessage(power_button_index, (dgr_more_to_come ? DGR_MSGTYP_UPDATE_MORE_TO_COME : DGR_MSGTYP_UPDATE_DIRECT), dgr_item, dgr_value); diff --git a/tasmota/xdrv_39_thermostat.ino b/tasmota/xdrv_39_thermostat.ino index 8471bed40..79e842dc5 100644 --- a/tasmota/xdrv_39_thermostat.ino +++ b/tasmota/xdrv_39_thermostat.ino @@ -24,8 +24,8 @@ // Enable/disable debugging //#define DEBUG_THERMOSTAT -// Enable/disable experimental PI auto-tuning inspired by the Arduino Autotune Library by -// Brett Beauregard brettbeauregard.com +// Enable/disable experimental PI auto-tuning inspired by the Arduino +// Autotune Library by Brett Beauregard //#define USE_PI_AUTOTUNING // (Ziegler-Nichols closed loop method) #ifdef DEBUG_THERMOSTAT @@ -75,6 +75,8 @@ #define D_CMND_TIMEPIINTEGRREAD "TimePiIntegrRead" #define D_CMND_TIMESENSLOSTSET "TimeSensLostSet" #define D_CMND_DIAGNOSTICMODESET "DiagnosticModeSet" +#define D_CMND_CTRDUTYCYCLEREAD "CtrDutyCycleRead" +#define D_CMND_ENABLEOUTPUTSET "EnableOutputSet" enum ThermostatModes { THERMOSTAT_OFF, THERMOSTAT_AUTOMATIC_OP, THERMOSTAT_MANUAL_OP, THERMOSTAT_MODES_MAX }; #ifdef USE_PI_AUTOTUNING @@ -100,7 +102,11 @@ enum ThermostatSupportedInputSwitches { THERMOSTAT_INPUT_SWT1 = 1, // Buttons THERMOSTAT_INPUT_SWT2, THERMOSTAT_INPUT_SWT3, - THERMOSTAT_INPUT_SWT4 + THERMOSTAT_INPUT_SWT4, + THERMOSTAT_INPUT_SWT5, + THERMOSTAT_INPUT_SWT6, + THERMOSTAT_INPUT_SWT7, + THERMOSTAT_INPUT_SWT8 }; enum ThermostatSupportedOutputRelays { THERMOSTAT_OUTPUT_NONE, @@ -132,12 +138,12 @@ typedef union { uint32_t counter_seconds : 6; // Second counter used to track minutes uint32_t output_relay_number : 4; // Output relay number uint32_t input_switch_number : 3; // Input switch number + uint32_t enable_output : 1; // Enables / disables the physical output #ifdef USE_PI_AUTOTUNING uint32_t autotune_flag : 1; // Enable/disable autotune uint32_t autotune_perf_mode : 2; // Autotune performance mode - uint32_t free : 1; // Free bits #else - uint32_t free : 4; // Free bits + uint32_t free : 3; // Free bits #endif // USE_PI_AUTOTUNING }; } ThermostatStateBitfield; @@ -168,7 +174,8 @@ const char kThermostatCommands[] PROGMEM = "|" D_CMND_THERMOSTATMODESET "|" D_CM #endif // USE_PI_AUTOTUNING D_CMND_TIMEMINACTIONSET "|" D_CMND_TIMEMINTURNOFFACTIONSET "|" D_CMND_TEMPRUPDELTINSET "|" D_CMND_TEMPRUPDELTOUTSET "|" D_CMND_TIMERAMPUPMAXSET "|" D_CMND_TIMERAMPUPCYCLESET "|" D_CMND_TEMPRAMPUPPIACCERRSET "|" D_CMND_TIMEPIPROPORTREAD "|" - D_CMND_TIMEPIINTEGRREAD "|" D_CMND_TIMESENSLOSTSET "|" D_CMND_DIAGNOSTICMODESET; + D_CMND_TIMEPIINTEGRREAD "|" D_CMND_TIMESENSLOSTSET "|" D_CMND_DIAGNOSTICMODESET "|" D_CMND_CTRDUTYCYCLEREAD "|" + D_CMND_ENABLEOUTPUTSET; void (* const ThermostatCommand[])(void) PROGMEM = { &CmndThermostatModeSet, &CmndClimateModeSet, &CmndTempFrostProtectSet, &CmndControllerModeSet, &CmndInputSwitchSet, @@ -181,7 +188,8 @@ void (* const ThermostatCommand[])(void) PROGMEM = { &CmndTimeMaxActionSet, &CmndTimeMinActionSet, &CmndTimeMinTurnoffActionSet, &CmndTempRupDeltInSet, #endif // USE_PI_AUTOTUNING &CmndTempRupDeltOutSet, &CmndTimeRampupMaxSet, &CmndTimeRampupCycleSet, &CmndTempRampupPiAccErrSet, - &CmndTimePiProportRead, &CmndTimePiIntegrRead, &CmndTimeSensLostSet, &CmndDiagnosticModeSet }; + &CmndTimePiProportRead, &CmndTimePiIntegrRead, &CmndTimeSensLostSet, &CmndDiagnosticModeSet, &CmndCtrDutyCycleRead, + &CmndEnableOutputSet }; struct THERMOSTAT { ThermostatStateBitfield status; // Bittfield including states as well as several flags @@ -268,6 +276,7 @@ void ThermostatInit(uint8_t ctr_output) Thermostat[ctr_output].status.output_relay_number = (THERMOSTAT_RELAY_NUMBER + ctr_output); Thermostat[ctr_output].status.input_switch_number = (THERMOSTAT_SWITCH_NUMBER + ctr_output); Thermostat[ctr_output].status.use_input = INPUT_NOT_USED; + Thermostat[ctr_output].status.enable_output = IFACE_ON; Thermostat[ctr_output].diag.output_inconsist_ctr = 0; Thermostat[ctr_output].diag.diagnostic_mode = DIAGNOSTIC_ON; #ifdef USE_PI_AUTOTUNING @@ -275,7 +284,9 @@ void ThermostatInit(uint8_t ctr_output) Thermostat[ctr_output].status.autotune_perf_mode = AUTOTUNE_PERF_FAST; #endif // USE_PI_AUTOTUNING // Make sure the Output is OFF - ExecuteCommandPower(Thermostat[ctr_output].status.output_relay_number, POWER_OFF, SRC_THERMOSTAT); + if (Thermostat[ctr_output].status.enable_output == IFACE_ON) { + ExecuteCommandPower(Thermostat[ctr_output].status.output_relay_number, POWER_OFF, SRC_THERMOSTAT); + } } bool ThermostatMinuteCounter(uint8_t ctr_output) @@ -292,7 +303,7 @@ bool ThermostatMinuteCounter(uint8_t ctr_output) inline bool ThermostatSwitchIdValid(uint8_t switchId) { - return (switchId >= THERMOSTAT_INPUT_SWT1 && switchId <= THERMOSTAT_INPUT_SWT4); + return (switchId >= THERMOSTAT_INPUT_SWT1 && switchId <= THERMOSTAT_INPUT_SWT8); } inline bool ThermostatRelayIdValid(uint8_t relayId) @@ -366,7 +377,8 @@ void ThermostatSignalPreProcessingSlow(uint8_t ctr_output) void ThermostatSignalPostProcessingSlow(uint8_t ctr_output) { // Increate counter when inconsistent output state exists - if (Thermostat[ctr_output].status.status_output != Thermostat[ctr_output].status.command_output) { + if ((Thermostat[ctr_output].status.status_output != Thermostat[ctr_output].status.command_output) + &&(Thermostat[ctr_output].status.enable_output == IFACE_ON)) { Thermostat[ctr_output].diag.output_inconsist_ctr++; } else { @@ -540,7 +552,9 @@ void ThermostatEmergencyShutdown(uint8_t ctr_output) // Emergency switch to THERMOSTAT_OFF Thermostat[ctr_output].status.thermostat_mode = THERMOSTAT_OFF; Thermostat[ctr_output].status.command_output = IFACE_OFF; - ThermostatOutputRelay(ctr_output, Thermostat[ctr_output].status.command_output); + if (Thermostat[ctr_output].status.enable_output == IFACE_ON) { + ThermostatOutputRelay(ctr_output, Thermostat[ctr_output].status.command_output); + } } void ThermostatState(uint8_t ctr_output) @@ -576,7 +590,9 @@ void ThermostatOutputRelay(uint8_t ctr_output, uint32_t command) if ((command == IFACE_ON) && (Thermostat[ctr_output].status.status_output == IFACE_OFF)) { //#ifndef DEBUG_THERMOSTAT - ExecuteCommandPower(Thermostat[ctr_output].status.output_relay_number, POWER_ON, SRC_THERMOSTAT); + if (Thermostat[ctr_output].status.enable_output == IFACE_ON) { + ExecuteCommandPower(Thermostat[ctr_output].status.output_relay_number, POWER_ON, SRC_THERMOSTAT); + } //#endif // DEBUG_THERMOSTAT Thermostat[ctr_output].status.status_output = IFACE_ON; #ifdef DEBUG_THERMOSTAT @@ -588,7 +604,9 @@ void ThermostatOutputRelay(uint8_t ctr_output, uint32_t command) // then switch output to OFF else if ((command == IFACE_OFF) && (Thermostat[ctr_output].status.status_output == IFACE_ON)) { //#ifndef DEBUG_THERMOSTAT - ExecuteCommandPower(Thermostat[ctr_output].status.output_relay_number, POWER_OFF, SRC_THERMOSTAT); + if (Thermostat[ctr_output].status.enable_output == IFACE_ON) { + ExecuteCommandPower(Thermostat[ctr_output].status.output_relay_number, POWER_OFF, SRC_THERMOSTAT); + } //#endif // DEBUG_THERMOSTAT Thermostat[ctr_output].timestamp_output_off = uptime; Thermostat[ctr_output].status.status_output = IFACE_OFF; @@ -1917,6 +1935,44 @@ void CmndDiagnosticModeSet(void) } } +void CmndCtrDutyCycleRead(void) +{ + if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= THERMOSTAT_CONTROLLER_OUTPUTS)) { + uint8_t ctr_output = XdrvMailbox.index - 1; + uint8_t value = 0; + if ( (Thermostat[ctr_output].status.controller_mode == CTR_PI) + || ((Thermostat[ctr_output].status.controller_mode == CTR_HYBRID) + &&(Thermostat[ctr_output].status.phase_hybrid_ctr == CTR_HYBRID_PI))) { + value = Thermostat[ctr_output].time_total_pi / Thermostat[ctr_output].time_pi_cycle; + } + else if ( (Thermostat[ctr_output].status.controller_mode == CTR_RAMP_UP) + || ((Thermostat[ctr_output].status.controller_mode == CTR_HYBRID) + &&(Thermostat[ctr_output].status.phase_hybrid_ctr == CTR_HYBRID_RAMP_UP))) { + if (Thermostat[ctr_output].status.status_output == IFACE_ON) { + value = 100; + } + else { + value = 0; + } + } + ResponseCmndNumber((int)value); + } +} + +void CmndEnableOutputSet(void) +{ + if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= THERMOSTAT_CONTROLLER_OUTPUTS)) { + uint8_t ctr_output = XdrvMailbox.index - 1; + if (XdrvMailbox.data_len > 0) { + uint8_t value = (uint8_t)(CharToFloat(XdrvMailbox.data)); + if ((value >= IFACE_OFF) && (value <= IFACE_ON)) { + Thermostat[ctr_output].status.enable_output = value; + } + } + ResponseCmndNumber((int)Thermostat[ctr_output].status.enable_output); + } +} + /*********************************************************************************************\ * Interface \*********************************************************************************************/ diff --git a/tasmota/xsns_70_veml6075.ino b/tasmota/xsns_70_veml6075.ino new file mode 100644 index 000000000..4735d1140 --- /dev/null +++ b/tasmota/xsns_70_veml6075.ino @@ -0,0 +1,306 @@ +/* + xsns_70_veml6075.ino - VEML6075 UVA/UVB/UVINDEX Sensor support for Tasmota + + Copyright (C) 2020 Martin Wagner + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifdef USE_I2C +#ifdef USE_VEML6075 +/*********************************************************************************************\ + * VEML6075 UVA/UVB/UVINDEX Sensor + * + * I2C Address: 0x10 +\*********************************************************************************************/ + +#define XSNS_70 70 +#define XI2C_49 49 // See I2CDEVICES.md + + +#define VEML6075_ADDR 0x10 // I2C address +#define VEML6075_CHIP_ID 0x26 // Manufacture ID + +// I2C register +#define VEML6075_REG_CONF 0x00 // Configuration register +#define VEML6075_REG_UVA 0x07 // UVA band raw measurement +#define VEML6075_REG_DARK 0x08 // Dark current (?) measurement +#define VEML6075_REG_UVB 0x09 // UVB band raw measurement +#define VEML6075_REG_UVCOMP1 0x0A // UV1 compensation value +#define VEML6075_REG_UVCOMP2 0x0B // UV2 compensation value +#define VEML6075_REG_ID 0x0C // ID Register + +// global constants for Calc +#define VEML6075_DEFAULT_UVA_A_COEFF 2.22 // Default for no coverglass +#define VEML6075_DEFAULT_UVA_B_COEFF 1.33 // Default for no coverglass +#define VEML6075_DEFAULT_UVB_C_COEFF 2.95 // Default for no coverglass +#define VEML6075_DEFAULT_UVB_D_COEFF 1.74 // Default for no coverglass +#define UVA_RESPONSIVITY_100MS_UNCOVERED 0.001461 // Default for no coverglass +#define UVB_RESPONSIVITY_100MS_UNCOVERED 0.002591 // Default for no coverglass + +const float UVA_RESPONSIVITY[] PROGMEM = +{ + UVA_RESPONSIVITY_100MS_UNCOVERED / 0.5016286645, // 50ms + UVA_RESPONSIVITY_100MS_UNCOVERED, // 100ms + UVA_RESPONSIVITY_100MS_UNCOVERED / 2.039087948, // 200ms + UVA_RESPONSIVITY_100MS_UNCOVERED / 3.781758958, // 400ms + UVA_RESPONSIVITY_100MS_UNCOVERED / 7.371335505 // 800ms +}; + +const float UVB_RESPONSIVITY[] PROGMEM = +{ + UVB_RESPONSIVITY_100MS_UNCOVERED / 0.5016286645, // 50ms + UVB_RESPONSIVITY_100MS_UNCOVERED, // 100ms + UVB_RESPONSIVITY_100MS_UNCOVERED / 2.039087948, // 200ms + UVB_RESPONSIVITY_100MS_UNCOVERED / 3.781758958, // 400ms + UVB_RESPONSIVITY_100MS_UNCOVERED / 7.371335505 // 800ms +}; + +// http and json defines +#define D_NAME_VEML6075 "VEML6075" +#define D_UVA_INTENSITY "UVA intensity" +#define D_UVB_INTENSITY "UVB intensity" + +const char HTTP_SNS_UVA[] PROGMEM = "{s}%s " D_UVA_INTENSITY "{m}%d " D_UNIT_WATT_METER_QUADRAT "{e}"; +const char HTTP_SNS_UVB[] PROGMEM = "{s}%s " D_UVB_INTENSITY "{m}%d " D_UNIT_WATT_METER_QUADRAT "{e}"; +const char HTTP_SNS_UVINDEX[] PROGMEM = "{s}%s " D_UV_INDEX "{m}%s {e}"; +const char JSON_SNS_VEML6075[] PROGMEM = ",\"%s\":{\"" D_JSON_UVA_INTENSITY "\":%d,\"" D_JSON_UVB_INTENSITY "\":%d,\"" D_JSON_UV_INDEX "\":%s}"; +const char S_JSON_VEML6075_COMMAND_NVALUE[] PROGMEM = "{\"" D_NAME_VEML6075 "\":{\"%s\":%d}}"; + +const char kVEML6075_Commands[] PROGMEM = D_CMND_VEML6075_POWER "|" D_CMND_VEML6075_DYNAMIC "|" D_CMND_VEML6075_INTTIME; + +enum VEML6075_Commands { // commands for Console + CMND_VEML6075_PWR, + CMND_VEML6075_SET_HD, + CMND_VEML6075_SET_UVIT, + }; + +// global variables +struct VEML6075STRUCT +{ + char types[9] = D_NAME_VEML6075; + uint8_t address = VEML6075_ADDR; + uint8_t inttime = 0; + uint16_t uva = 0; + uint16_t uvb = 0; + uint16_t uva_raw = 0; + uint16_t uvb_raw = 0; + uint16_t comp1 = 0; + uint16_t comp2 = 0; + uint16_t conf = 0; + float uvi = 0.0f; +} veml6075_sensor; + +uint8_t veml6075_active = 0; + +// typedef of config register +typedef union { + struct { + uint8_t pwr:1; // Shut Down + uint8_t forded_auto:1; // Auto or forced + uint8_t forced_trigger:1; // Trigger forced mode + uint8_t hd:1; // High dynamic + uint8_t inttime:3; // Integration Time + uint8_t spare7:1; // spare + }; + uint16_t config; +} veml6075configRegister; + +veml6075configRegister veml6075Config; + +/********************************************************************************************/ + +uint16_t VEML6075read16 (uint8_t reg) { + uint16_t swap = I2cRead16(VEML6075_ADDR, reg); + uint16_t ret = ((swap & 0xFF) << 8) | (swap >> 8); + return ret; +} + +void VEML6075write16 (uint8_t reg, uint16_t val) { + uint16_t swap = ((val & 0xFF) << 8) | (val >> 8); + I2cWrite16(VEML6075_ADDR, reg, swap); +} + +float VEML6075calcUVA (void) { + float uva_calc = veml6075_sensor.uva_raw - (VEML6075_DEFAULT_UVA_A_COEFF * veml6075_sensor.comp1) - (VEML6075_DEFAULT_UVA_B_COEFF * veml6075_sensor.comp2); + return uva_calc; +} + +float VEML6075calcUVB (void) { + float uvb_calc = veml6075_sensor.uvb_raw - (VEML6075_DEFAULT_UVB_C_COEFF * veml6075_sensor.comp1) - (VEML6075_DEFAULT_UVB_D_COEFF * veml6075_sensor.comp2); + return uvb_calc; +} + +float VEML6075calcUVI (void) { + float uvi_calc = ((veml6075_sensor.uva * UVA_RESPONSIVITY[veml6075_sensor.inttime]) + (veml6075_sensor.uvb * UVB_RESPONSIVITY[veml6075_sensor.inttime])) / 2; + return uvi_calc; +} + +void VEML6075SetHD(uint8_t val){ + veml6075Config.hd = val; + VEML6075write16 (VEML6075_REG_CONF, veml6075Config.config); +} + +uint8_t VEML6075ReadHD(void){ + veml6075Config.config = VEML6075read16 (VEML6075_REG_CONF); + return veml6075Config.hd; +} + +void VEML6075SetUvIt(uint8_t val){ + veml6075Config.inttime = val; + VEML6075Pwr(1); + VEML6075write16 (VEML6075_REG_CONF, veml6075Config.config); + VEML6075Pwr(0); +} + +uint8_t VEML6075GetUvIt(void){ + veml6075Config.config = VEML6075read16 (VEML6075_REG_CONF); + return veml6075Config.inttime; +} + +void VEML6075Pwr(uint8_t val){ + veml6075Config.pwr = val; + VEML6075write16 (VEML6075_REG_CONF, veml6075Config.config); +} + +uint8_t VEML6075GetPwr(void){ + veml6075Config.config = VEML6075read16 (VEML6075_REG_CONF); + return veml6075Config.pwr; +} + +void VEML6075ReadData(void) +{ + veml6075_sensor.uva_raw = VEML6075read16 (VEML6075_REG_UVA); + veml6075_sensor.uvb_raw = VEML6075read16 (VEML6075_REG_UVB); + veml6075_sensor.comp1 = VEML6075read16 (VEML6075_REG_UVCOMP1); + veml6075_sensor.comp2 = VEML6075read16 (VEML6075_REG_UVCOMP2); + veml6075_sensor.inttime = VEML6075GetUvIt(); + veml6075_sensor.uva = VEML6075calcUVA(); + veml6075_sensor.uvb = VEML6075calcUVB(); + veml6075_sensor.uvi = VEML6075calcUVI(); +} + +bool VEML6075init(void) +{ + uint8_t id = VEML6075read16 (VEML6075_REG_ID); + if(id == VEML6075_CHIP_ID) // Sensor id + return true; + return false; +} + +void VEML6075Detect(void) { + if (I2cActive(veml6075_sensor.address)) return; + + if (VEML6075init()) { + I2cSetActiveFound(veml6075_sensor.address, veml6075_sensor.types); + VEML6075write16 (VEML6075_REG_CONF, 0x10); // set default + veml6075_active = 1; + } +} + +void VEML6075EverySecond(void) { + VEML6075ReadData(); +} + +bool VEML6075Cmd(void) { + char command[CMDSZ]; + uint8_t name_len = strlen(D_NAME_VEML6075); + if (!strncasecmp_P(XdrvMailbox.topic, PSTR(D_NAME_VEML6075), name_len)) { + uint32_t command_code = GetCommandCode(command, sizeof(command), XdrvMailbox.topic + name_len, kVEML6075_Commands); + switch (command_code) { + case CMND_VEML6075_PWR: + if (XdrvMailbox.data_len) { + if (2 >= XdrvMailbox.payload) { + VEML6075Pwr(XdrvMailbox.payload); + } + } + Response_P(S_JSON_VEML6075_COMMAND_NVALUE, command, VEML6075GetPwr()); + break; + case CMND_VEML6075_SET_HD: + if (XdrvMailbox.data_len) { + if (2 >= XdrvMailbox.payload) { + VEML6075SetHD(XdrvMailbox.payload); + } + } + Response_P(S_JSON_VEML6075_COMMAND_NVALUE, command, VEML6075ReadHD()); + break; + case CMND_VEML6075_SET_UVIT: + if (XdrvMailbox.data_len) { + if (4 >= XdrvMailbox.payload) { + VEML6075SetUvIt(XdrvMailbox.payload); + } + } + Response_P(S_JSON_VEML6075_COMMAND_NVALUE, command, VEML6075GetUvIt()); + break; + default: + return false; + } + return true; + } else { + return false; + } +} + +void VEML6075Show(bool json) +{ + char s_uvindex[FLOATSZ]; + dtostrfd(veml6075_sensor.uvi,1, s_uvindex); + + if (json) { + ResponseAppend_P(JSON_SNS_VEML6075, D_NAME_VEML6075, veml6075_sensor.uva, veml6075_sensor.uvb, s_uvindex); +#ifdef USE_WEBSERVER + } else { + WSContentSend_PD(HTTP_SNS_UVA, D_NAME_VEML6075, veml6075_sensor.uva); + WSContentSend_PD(HTTP_SNS_UVB, D_NAME_VEML6075, veml6075_sensor.uvb); + WSContentSend_PD(HTTP_SNS_UVINDEX, D_NAME_VEML6075 ,s_uvindex); +#endif // USE_WEBSERVER + } +} + +/*********************************************************************************************\ + * Interface +\*********************************************************************************************/ + +bool Xsns70(uint8_t function) +{ + if (!I2cEnabled(XI2C_49)) { return false; } + + bool result = false; + + if (FUNC_INIT == function) { + VEML6075Detect(); + } + else if (veml6075_active) { + switch (function) { + case FUNC_EVERY_SECOND: + VEML6075EverySecond(); + break; + case FUNC_COMMAND: + result = VEML6075Cmd(); + break; + case FUNC_JSON_APPEND: + VEML6075Show(1); + break; +#ifdef USE_WEBSERVER + case FUNC_WEB_SENSOR: + VEML6075Show(0); + break; +#endif // USE_WEBSERVER + } + } + return result; +} + +#endif // USE_VEML6075 +#endif // USE_I2C diff --git a/tasmota/xsns_71_veml7700.ino b/tasmota/xsns_71_veml7700.ino new file mode 100644 index 000000000..de28661cc --- /dev/null +++ b/tasmota/xsns_71_veml7700.ino @@ -0,0 +1,116 @@ +/* + xsns_71_VEML7700.ino - VEML7700 Ambient light intensity Sensor support for Tasmota + + Copyright (C) 2020 Martin Wagner + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifdef USE_I2C +#ifdef USE_VEML7700 +/*********************************************************************************************\ + * VEML7700 ALS Sensor + * Using the Adafruit VEML7700 Libary + * I2C Address: 0x10 +\*********************************************************************************************/ + +#define XSNS_71 71 +#define XI2C_50 50 // See I2CDEVICES.md + +#include "Adafruit_VEML7700.h" +Adafruit_VEML7700 veml7700 = Adafruit_VEML7700(); //create object copy + +#define D_NAME_VEML7700 "VEML7700" +#define D_WHITE_CONTENT "White content" + +const char HTTP_SNS_WHITE[] PROGMEM = "{s}%s " D_WHITE_CONTENT "{m}%d {e}"; +const char JSON_SNS_VEML7700[] PROGMEM = ",\"%s\":{\"" D_JSON_ILLUMINANCE "\":%d,\"" D_JSON_WHITE_CONTENT "\":%d}"; + +struct VEML7700STRUCT +{ + char types[9] = D_NAME_VEML7700; + uint8_t address = VEML7700_I2CADDR_DEFAULT; + uint16_t lux = 0; + uint16_t white = 0; +} veml7700_sensor; + +uint8_t veml7700_active = 0; + +/********************************************************************************************/ + +void VEML7700Detect(void) { + if (I2cActive(veml7700_sensor.address)) return; + if (veml7700.begin()) { + I2cSetActiveFound(veml7700_sensor.address, veml7700_sensor.types); + veml7700_active = 1; + } +} + +void VEML7700EverySecond(void) { + veml7700_sensor.lux = (uint16_t) veml7700.readLux(); + veml7700_sensor.white = (uint16_t) veml7700.readWhite(); +} + +void VEML7700Show(bool json) +{ + if (json) { + ResponseAppend_P(JSON_SNS_VEML7700, D_NAME_VEML7700, veml7700_sensor.lux, veml7700_sensor.white); + +#ifdef USE_DOMOTICZ + if (0 == tele_period) DomoticzSensor(DZ_ILLUMINANCE, veml7700_sensor.lux); +#endif // USE_DOMOTICZ +#ifdef USE_WEBSERVER + } else { + WSContentSend_PD(HTTP_SNS_ILLUMINANCE, D_NAME_VEML7700, veml7700_sensor.lux); + WSContentSend_PD(HTTP_SNS_WHITE, D_NAME_VEML7700, veml7700_sensor.white); +#endif // USE_WEBSERVER + } +} + +/*********************************************************************************************\ + * Interface +\*********************************************************************************************/ + +bool Xsns71(uint8_t function) +{ + if (!I2cEnabled(XI2C_50)) { return false; } + + bool result = false; + + if (FUNC_INIT == function) { + VEML7700Detect(); + } + else if (veml7700_active) { + switch (function) { + case FUNC_EVERY_SECOND: + VEML7700EverySecond(); + break; + case FUNC_COMMAND: + //result = VEML7700Cmd(); + break; + case FUNC_JSON_APPEND: + VEML7700Show(1); + break; +#ifdef USE_WEBSERVER + case FUNC_WEB_SENSOR: + VEML7700Show(0); + break; +#endif // USE_WEBSERVER + } + } + return result; +} + +#endif // USE_VEML7700 +#endif // USE_I2C diff --git a/tools/decode-status.py b/tools/decode-status.py index 748589495..a992a621c 100755 --- a/tools/decode-status.py +++ b/tools/decode-status.py @@ -147,7 +147,8 @@ a_setoption = [[ "Disable non-json MQTT response", "Enable light fading at start/power on", "Set PWM Mode from regular PWM to ColorTemp control","", - "","","","", + "Keep uncompressed rules in memory to avoid CPU load of uncompressing at each tick", + "","","", "","","","", "","","","", "","","","", @@ -195,15 +196,15 @@ a_features = [[ "USE_INA226","USE_A4988_STEPPER","USE_DDS2382","USE_SM2135", "USE_SHUTTER","USE_PCF8574","USE_DDSU666","USE_DEEPSLEEP", "USE_SONOFF_SC","USE_SONOFF_RF","USE_SONOFF_L1","USE_EXS_DIMMER", - "USE_ARDUINO_SLAVE","USE_HIH6","USE_HPMA","USE_TSL2591", + "USE_TASMOTA_SLAVE","USE_HIH6","USE_HPMA","USE_TSL2591", "USE_DHT12","USE_DS1624","USE_GPS","USE_HOTPLUG", "USE_NRF24","USE_MIBLE","USE_HM10","USE_LE01MR", "USE_AHT1x","USE_WEMOS_MOTOR_V1","USE_DEVICE_GROUPS","USE_PWM_DIMMER" ],[ "USE_KEELOQ","USE_HRXL","USE_SONOFF_D1","USE_HDC1080", "USE_IAQ","USE_DISPLAY_SEVENSEG","USE_AS3935","USE_PING", - "USE_WINDMETER","USE_OPENTHERM","USE_THERMOSTAT","", - "","","","", + "USE_WINDMETER","USE_OPENTHERM","USE_THERMOSTAT","USE_VEML6075", + "USE_VEML7700","","","", "","","","", "","","","", "","","","", @@ -241,7 +242,7 @@ else: obj = json.load(fp) def StartDecode(): - print ("\n*** decode-status.py v20200507 by Theo Arends and Jacek Ziolkowski ***") + print ("\n*** decode-status.py v20200510 by Theo Arends and Jacek Ziolkowski ***") # print("Decoding\n{}".format(obj))