Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support for Goodweather A/Cs. #715

Merged
merged 5 commits into from
May 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions examples/IRMQTTServer/IRMQTTServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ void handleRoot(void) {
"<option value='17'>Denon</option>"
"<option value='13'>Dish</option>"
"<option value='43'>GICable</option>"
"<option value='63'>Goodweather</option>"
"<option value='64'>Inax</option>"
"<option value='6'>JVC</option>"
"<option value='36'>Lasertag</option>"
Expand Down Expand Up @@ -2823,6 +2824,13 @@ bool sendIRCode(IRsend *irsend, int const ir_type,
irsend->sendLegoPf(code, bits, repeat);
break;
#endif
#if SEND_GOODWEATHER
case GOODWEATHER: // 63
if (bits == 0) bits = kGoodweatherBits;
repeat = std::max(repeat, kGoodweatherMinRepeat);
irsend->sendGoodweather(code, bits, repeat);
break;
#endif // SEND_GOODWEATHER
default:
// If we got here, we didn't know how to send it.
success = false;
Expand Down Expand Up @@ -3140,6 +3148,14 @@ bool decodeCommonAc(const decode_results *decode) {
break;
}
#endif // DECODE_FUJITSU_AC
#if DECODE_GOODWEATHER
case decode_type_t::GOODWEATHER: {
IRGoodweatherAc ac(IR_LED);
ac.setRaw(decode->value); // Uses value instead of state.
state = ac.toCommon();
break;
}
#endif // DECODE_GOODWEATHER
#if DECODE_GREE
case decode_type_t::GREE: {
IRGreeAC ac(IR_LED);
Expand Down
8 changes: 8 additions & 0 deletions examples/IRrecvDumpV2/IRrecvDumpV2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <ir_Coolix.h>
#include <ir_Daikin.h>
#include <ir_Fujitsu.h>
#include <ir_Goodweather.h>
#include <ir_Gree.h>
#include <ir_Haier.h>
#include <ir_Hitachi.h>
Expand Down Expand Up @@ -182,6 +183,13 @@ void dumpACInfo(decode_results *results) {
description = ac.toString();
}
#endif // DECODE_TOSHIBA_AC
#if DECODE_GOODWEATHER
if (results->decode_type == GOODWEATHER) {
IRGoodweatherAc ac(0);
ac.setRaw(results->value); // Goodweather uses value instead of state.
description = ac.toString();
}
#endif // DECODE_GOODWEATHER
#if DECODE_GREE
if (results->decode_type == GREE) {
IRGreeAC ac(0);
Expand Down
40 changes: 40 additions & 0 deletions src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) {
#if SEND_FUJITSU_AC
case decode_type_t::FUJITSU_AC:
#endif
#if SEND_GOODWEATHER
case decode_type_t::GOODWEATHER:
#endif
#if SEND_GREE
case decode_type_t::GREE:
#endif
Expand Down Expand Up @@ -284,6 +287,34 @@ void IRac::fujitsu(IRFujitsuAC *ac, const fujitsu_ac_remote_model_t model,
}
#endif // SEND_FUJITSU_AC

#if SEND_GOODWEATHER
void IRac::goodweather(IRGoodweatherAc *ac,
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 int16_t sleep) {
ac->setMode(ac->convertMode(mode));
ac->setTemp(degrees);
ac->setFan(ac->convertFan(fan));
ac->setSwing(swingv == stdAc::swingv_t::kOff ? kGoodweatherSwingOff
: kGoodweatherSwingSlow);
ac->setTurbo(turbo);
ac->setLight(light);
// No Clean setting available.
ac->setSleep(sleep >= 0); // Sleep on this A/C is either on or off.
// No Horizontal Swing setting available.
// No Econo setting available.
// No Filter setting available.
// No Beep setting available.
// No Quiet setting available.
// No Clock setting available.
ac->setPower(on);
ac->send();
}
#endif // SEND_GOODWEATHER

#if SEND_GREE
void IRac::gree(IRGreeAC *ac,
const bool on, const stdAc::opmode_t mode, const float degrees,
Expand Down Expand Up @@ -832,6 +863,15 @@ bool IRac::sendAc(const decode_type_t vendor, const int16_t model,
break;
}
#endif // SEND_FUJITSU_AC
#if SEND_GOODWEATHER
case GOODWEATHER:
{
IRGoodweatherAc ac(_pin);
ac.begin();
goodweather(&ac, on, mode, degC, fan, swingv, turbo, light, sleep);
break;
}
#endif // SEND_GOODWEATHER
#if SEND_GREE
case GREE:
{
Expand Down
10 changes: 10 additions & 0 deletions src/IRac.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "ir_Coolix.h"
#include "ir_Daikin.h"
#include "ir_Fujitsu.h"
#include "ir_Goodweather.h"
#include "ir_Gree.h"
#include "ir_Haier.h"
#include "ir_Hitachi.h"
Expand Down Expand Up @@ -106,6 +107,15 @@ void daikin216(IRDaikin216 *ac,
const stdAc::swingv_t swingv, const stdAc::swingh_t swingh,
const bool quiet);
#endif // SEND_FUJITSU_AC
#if SEND_GOODWEATHER
void goodweather(IRGoodweatherAc *ac,
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 int16_t sleep = -1);
#endif // SEND_GOODWEATHER
#if SEND_GREE
void gree(IRGreeAC *ac,
const bool on, const stdAc::opmode_t mode, const float degrees,
Expand Down
4 changes: 4 additions & 0 deletions src/IRrecv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,10 @@ bool IRrecv::decode(decode_results *results, irparams_t *save) {
DPRINTLN("Attempting SHARP_AC decode");
if (decodeSharpAc(results)) return true;
#endif
#if DECODE_GOODWEATHER
DPRINTLN("Attempting GOODWEATHER decode");
if (decodeGoodweather(results)) return true;
#endif // DECODE_GOODWEATHER
#if DECODE_INAX
DPRINTLN("Attempting Inax decode");
if (decodeInax(results)) return true;
Expand Down
5 changes: 5 additions & 0 deletions src/IRrecv.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ class IRrecv {
bool decodeCarrierAC(decode_results *results, uint16_t nbits = kCarrierAcBits,
bool strict = true);
#endif
#if DECODE_GOODWEATHER
bool decodeGoodweather(decode_results *results,
const uint16_t nbits = kGoodweatherBits,
const bool strict = true);
#endif // DECODE_GOODWEATHER
#if DECODE_GREE
bool decodeGree(decode_results *results, uint16_t nbits = kGreeBits,
bool strict = true);
Expand Down
5 changes: 5 additions & 0 deletions src/IRremoteESP8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@
#define DECODE_GLOBALCACHE false // Not written.
#define SEND_GLOBALCACHE true

#define DECODE_GOODWEATHER true
#define SEND_GOODWEATHER true

#define DECODE_GREE true
#define SEND_GREE true

Expand Down Expand Up @@ -363,6 +366,8 @@ const uint16_t kFujitsuAcBits = kFujitsuAcStateLength * 8;
const uint16_t kFujitsuAcMinBits = (kFujitsuAcStateLengthShort - 1) * 8;
const uint16_t kGicableBits = 16;
const uint16_t kGicableMinRepeat = kSingleRepeat;
const uint16_t kGoodweatherBits = 48;
const uint16_t kGoodweatherMinRepeat = kNoRepeat;
const uint16_t kGreeStateLength = 8;
const uint16_t kGreeBits = kGreeStateLength * 8;
const uint16_t kGreeDefaultRepeat = kNoRepeat;
Expand Down
5 changes: 5 additions & 0 deletions src/IRsend.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ class IRsend {
void sendGree(uint8_t data[], uint16_t nbytes = kGreeStateLength,
uint16_t repeat = kGreeDefaultRepeat);
#endif
#if SEND_GOODWEATHER
void sendGoodweather(const uint64_t data,
const uint16_t nbits = kGoodweatherBits,
const uint16_t repeat = kGoodweatherMinRepeat);
#endif // SEND_GOODWEATHER
#if SEND_PRONTO
void sendPronto(uint16_t data[], uint16_t len, uint16_t repeat = kNoRepeat);
#endif
Expand Down
5 changes: 5 additions & 0 deletions src/IRutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ decode_type_t strToDecodeType(const char * const str) {
return decode_type_t::GICABLE;
else if (!strcmp(str, "GLOBALCACHE"))
return decode_type_t::GLOBALCACHE;
else if (!strcmp(str, "GOODWEATHER"))
return decode_type_t::GOODWEATHER;
else if (!strcmp(str, "GREE"))
return decode_type_t::GREE;
else if (!strcmp(str, "HAIER_AC"))
Expand Down Expand Up @@ -351,6 +353,9 @@ std::string typeToString(const decode_type_t protocol, const bool isRepeat) {
case GLOBALCACHE:
result = F("GLOBALCACHE");
break;
case GOODWEATHER:
result = F("GOODWEATHER");
break;
case GREE:
result = F("GREE");
break;
Expand Down
Loading