Add support for ZH/JG-01
This commit is contained in:
parent
9ce31e5f2f
commit
3dc4bc8007
|
@ -79,6 +79,8 @@ HeatpumpIR* HeatpumpIRFactory::create(const char *modelName) {
|
|||
return new ToshibaDaiseikaiHeatpumpIR();
|
||||
} else if (strcmp_P(modelName, PSTR("toshiba")) == 0) {
|
||||
return new ToshibaHeatpumpIR();
|
||||
} else if (strcmp_P(modelName, PSTR("ZHJG01")) == 0) {
|
||||
return new ZHJG01HeatpumpIR();
|
||||
} else if (strcmp_P(modelName, PSTR("ZHLT01")) == 0) {
|
||||
return new ZHLT01HeatpumpIR();
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <SharpHeatpumpIR.h>
|
||||
#include <ToshibaDaiseikaiHeatpumpIR.h>
|
||||
#include <ToshibaHeatpumpIR.h>
|
||||
#include <ZHJG01HeatpumpIR.h>
|
||||
#include <ZHLT01HeatpumpIR.h>
|
||||
|
||||
class HeatpumpIRFactory
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
#include <ZHJG01HeatpumpIR.h>
|
||||
|
||||
ZHJG01HeatpumpIR::ZHJG01HeatpumpIR() : HeatpumpIR()
|
||||
{
|
||||
static const char model[] PROGMEM = "ZHJG01";
|
||||
static const char info[] PROGMEM = "{\"mdl\":\"ZHJG01\",\"dn\":\"ZHJG01\",\"mT\":18,\"xT\":32,\"fs\":3,\"maint\":[10]}}";
|
||||
|
||||
_model = model;
|
||||
_info = info;
|
||||
}
|
||||
|
||||
void ZHJG01HeatpumpIR::send(IRSender& IR,
|
||||
uint8_t powerModeCmd,
|
||||
uint8_t operatingModeCmd,
|
||||
uint8_t fanSpeedCmd,
|
||||
uint8_t temperatureCmd,
|
||||
uint8_t swingVCmd,
|
||||
uint8_t swingHCmd)
|
||||
{
|
||||
|
||||
uint8_t operatingMode = ZHJG01_MODE_AUTO;
|
||||
uint8_t fanSpeed = ZHJG01_FAN_AUTO;
|
||||
uint8_t temperature = 25;
|
||||
uint8_t swingV = ZHJG01_VDIR_FIXED;
|
||||
|
||||
uint8_t powerMode = powerModeCmd == 0 ? ZHJG01_POWER_OFF : ZHJG01_POWER_ON;
|
||||
|
||||
switch (operatingModeCmd)
|
||||
{
|
||||
case MODE_COOL:
|
||||
operatingMode = ZHJG01_MODE_COOL;
|
||||
break;
|
||||
case MODE_FAN:
|
||||
operatingMode = ZHJG01_MODE_FAN;
|
||||
break;
|
||||
case MODE_DRY:
|
||||
operatingMode = ZHJG01_MODE_DRY;
|
||||
temperatureCmd = 25;
|
||||
break;
|
||||
case MODE_HEAT:
|
||||
operatingMode = ZHJG01_MODE_HEAT;
|
||||
break;
|
||||
default:
|
||||
operatingMode = ZHJG01_MODE_AUTO;
|
||||
temperatureCmd = 25;
|
||||
}
|
||||
|
||||
switch (fanSpeedCmd)
|
||||
{
|
||||
case FAN_AUTO:
|
||||
fanSpeed = ZHJG01_FAN_AUTO;
|
||||
break;
|
||||
case FAN_1:
|
||||
fanSpeed = ZHJG01_FAN1;
|
||||
break;
|
||||
case FAN_2:
|
||||
fanSpeed = ZHJG01_FAN2;
|
||||
break;
|
||||
case FAN_3:
|
||||
fanSpeed = ZHJG01_FAN3;
|
||||
break;
|
||||
case FAN_4:
|
||||
case FAN_5:
|
||||
fanSpeed = ZHJG01_FAN_TURBO;
|
||||
break;
|
||||
case FAN_SILENT:
|
||||
fanSpeed = ZHJG01_FAN_ECO;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (swingVCmd)
|
||||
{
|
||||
case VDIR_AUTO:
|
||||
swingV = ZHJG01_VDIR_WIND;
|
||||
break;
|
||||
case VDIR_SWING:
|
||||
swingV = ZHJG01_VDIR_SWING;
|
||||
break;
|
||||
default:
|
||||
swingV = ZHJG01_VDIR_FIXED;
|
||||
}
|
||||
|
||||
// temperature must be between 17 and 32 degrees
|
||||
if (temperatureCmd < 16)
|
||||
{
|
||||
temperature = 16;
|
||||
}
|
||||
else if (temperatureCmd > 32)
|
||||
{
|
||||
temperature = 32;
|
||||
} else
|
||||
{
|
||||
temperature = temperatureCmd;
|
||||
}
|
||||
|
||||
sendZHJG01(IR, powerMode, operatingMode, fanSpeed, temperature, swingV);
|
||||
}
|
||||
|
||||
void ZHJG01HeatpumpIR::sendZHJG01(IRSender& IR,
|
||||
uint8_t powerMode,
|
||||
uint8_t operatingMode,
|
||||
uint8_t fanSpeed,
|
||||
uint8_t temperature,
|
||||
uint8_t swingV)
|
||||
{
|
||||
uint8_t ZHJG01Template[] = { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF };
|
||||
// Bytenumbers: 0 1 2 3 4 5
|
||||
|
||||
/********************************************************************************
|
||||
* Byte[0]: Turbo, Eco, Fan, Vertical Swing
|
||||
* TURBO ON: B0x1xxxxx
|
||||
* ECO ON: B0x0xxxxx
|
||||
* TURBO/ECO OFF: B1xxxxxxx
|
||||
* FAN1: Bx00xxxxx
|
||||
* FAN2: Bx01xxxxx
|
||||
* FAN3: Bx10xxxxx
|
||||
* FAN AUTO: Bx11xxxxx
|
||||
* VERTICAL FIXED: Bxxx01xxx
|
||||
* VERTICAL SWING: Bxxx10xxx
|
||||
* VERTICAL WIND: Bxxx11xxx
|
||||
*******************************************************************************/
|
||||
ZHJG01Template[1] = fanSpeed | swingV;
|
||||
ZHJG01Template[0] = ~ ZHJG01Template[1];
|
||||
|
||||
/********************************************************************************
|
||||
* Byte[2]: Temp, Power, Mode
|
||||
* TEMP: Bttttxxxx
|
||||
* POWER ON: Bxxxx0xxx
|
||||
* POWER OFF: Bxxxx1xxx
|
||||
* MODE HEAT: Bxxxxx011
|
||||
* MODE VENT: Bxxxxx100
|
||||
* MODE DRY: Bxxxxx101
|
||||
* MODE COOL: Bxxxxx110
|
||||
* MODE AUTO: Bxxxxx111
|
||||
*******************************************************************************/
|
||||
|
||||
uint8_t tempBits = ((temperature - 17) << 4) & 0b11110000;
|
||||
ZHJG01Template[3] = tempBits | powerMode | operatingMode;
|
||||
ZHJG01Template[2] = ~ ZHJG01Template[3];
|
||||
|
||||
|
||||
ZHJG01Template[5] = 0b11010101; // Undecoded (timer?)
|
||||
ZHJG01Template[4] = ~ ZHJG01Template[5];
|
||||
|
||||
// 38 kHz PWM frequency
|
||||
IR.setFrequency(38);
|
||||
|
||||
// Header
|
||||
IR.mark(ZHJG01_HDR_MARK);
|
||||
IR.space(ZHJG01_HDR_SPACE);
|
||||
|
||||
// Data
|
||||
for (unsigned int i=0; i<sizeof(ZHJG01Template); i++) {
|
||||
IR.sendIRbyte(ZHJG01Template[i], ZHJG01_BIT_MARK, ZHJG01_ZERO_SPACE, ZHJG01_ONE_SPACE);
|
||||
}
|
||||
|
||||
// End mark
|
||||
IR.mark(ZHJG01_BIT_MARK);
|
||||
IR.space(0);
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/********************************************************************************
|
||||
* Airconditional remote control decoder for:
|
||||
*
|
||||
* ZH/JG-01 Remote control https://www.google.com/search?q=zh/JG-01
|
||||
*
|
||||
* The ZH/JG-01 remote control is used for many locally branded Split airconditioners,
|
||||
* so it is better to name this protocol by the name of the protocol rather then the
|
||||
* name of the Airconditioner. For this project I used a TACHIAIR airconditioner.
|
||||
*
|
||||
* For airco-brands:
|
||||
* Tachiair
|
||||
* Chigo
|
||||
* Etc.
|
||||
*
|
||||
***********************************************************************************
|
||||
* SUMMARY FUNCTIONAL DESCRIPTION
|
||||
**********************************************************************************
|
||||
* The remote sends a 6 Byte message which contains all possible settings every
|
||||
* time.
|
||||
*
|
||||
* Every EVEN Byte (00,02,04,06,08 and 10) hold command data
|
||||
* Every UNeven Byte (01,03,05,07 and 09) hold a checksum of the corresponding
|
||||
* command by inverting the bits, for example:
|
||||
*
|
||||
* The identifier byte[0] = 0xD5 = B1101 0101
|
||||
* The checksum byte[1] = 0x2A = B0010 1010
|
||||
*
|
||||
* So, you can check the message by:
|
||||
* - inverting the bits of the checksum byte with the corresponding command, they
|
||||
* should be the same, or
|
||||
* - Summing up the checksum byte and the corresponding command,
|
||||
* they should always add up to 0xFF = B11111111 = 255
|
||||
*
|
||||
* ******************************************************************************
|
||||
* Written by: Abílio Costa
|
||||
* Date: 2023-07-03
|
||||
* Version: 1.0
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef ZHJG01HeatpumpIR_h
|
||||
#define ZHJG01HeatpumpIR_h
|
||||
|
||||
#include <HeatpumpIR.h>
|
||||
|
||||
/********************************************************************************
|
||||
* TIMINGS
|
||||
* Space: Not used
|
||||
* Header Mark: 6550 us
|
||||
* Header Space: 7755 us
|
||||
* Bit Mark: 560 us
|
||||
* Zero Space: 1530 us
|
||||
* One Space: 3750 us
|
||||
*******************************************************************************/
|
||||
#define ZHJG01_HDR_MARK 6550
|
||||
#define ZHJG01_HDR_SPACE 7755
|
||||
#define ZHJG01_BIT_MARK 560
|
||||
#define ZHJG01_ZERO_SPACE 1530
|
||||
#define ZHJG01_ONE_SPACE 3750
|
||||
|
||||
/********************************************************************************
|
||||
*
|
||||
* ZHJG01 codes
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
// Power
|
||||
#define ZHJG01_POWER_OFF 0x00
|
||||
#define ZHJG01_POWER_ON 0x08
|
||||
|
||||
// Operating Modes
|
||||
#define ZHJG01_MODE_AUTO 0x00
|
||||
#define ZHJG01_MODE_COOL 0x01
|
||||
#define ZHJG01_MODE_DRY 0x02
|
||||
#define ZHJG01_MODE_FAN 0x03
|
||||
#define ZHJG01_MODE_HEAT 0x04
|
||||
|
||||
//Fan control
|
||||
#define ZHJG01_FAN_AUTO 0x00
|
||||
#define ZHJG01_FAN1 0x60
|
||||
#define ZHJG01_FAN2 0x40
|
||||
#define ZHJG01_FAN3 0x20
|
||||
#define ZHJG01_FAN_TURBO 0x80
|
||||
#define ZHJG01_FAN_ECO 0xA0
|
||||
// FAN_4 and FAN_5 are not supported, but are implemented as button "TURBO"
|
||||
// This only works for HEAT and COOL. Otherwise FAN_3 is used.
|
||||
// FAN_SILENT is not supported, but is implmented as button "ECO".
|
||||
|
||||
// Vertical Swing
|
||||
#define ZHJG01_VDIR_WIND 0x00 // "Natural Wind", implemented on VDIR_AUTO
|
||||
#define ZHJG01_VDIR_SWING 0x08 // Swing
|
||||
#define ZHJG01_VDIR_FIXED 0x10 // All others are not supported
|
||||
// and implemented as Fixed
|
||||
|
||||
class ZHJG01HeatpumpIR : public HeatpumpIR
|
||||
{
|
||||
public:
|
||||
ZHJG01HeatpumpIR();
|
||||
void send(IRSender& IR, uint8_t powerModeCmd,
|
||||
uint8_t operatingModeCmd,
|
||||
uint8_t fanSpeedCmd,
|
||||
uint8_t temperatureCmd,
|
||||
uint8_t swingVCmd,
|
||||
uint8_t swingHCmd);
|
||||
|
||||
protected:
|
||||
void sendZHJG01(IRSender& IR, uint8_t powerMode,
|
||||
uint8_t operatingMode,
|
||||
uint8_t fanSpeed,
|
||||
uint8_t temperature,
|
||||
uint8_t swingV);
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue