Skip to content

Commit

Permalink
supported FUNIKI remote AC
Browse files Browse the repository at this point in the history
  • Loading branch information
QuangThai2297 committed Jun 29, 2024
1 parent dc0fd31 commit efbb86b
Show file tree
Hide file tree
Showing 12 changed files with 916 additions and 6 deletions.
79 changes: 79 additions & 0 deletions src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) {
#endif
#if SEND_WHIRLPOOL_AC
case decode_type_t::WHIRLPOOL_AC:
#endif
#if SEND_FUNIKI
case decode_type_t::FUNIKI:
#endif
return true;
default:
Expand Down Expand Up @@ -1274,7 +1277,56 @@ void IRac::fujitsu(IRFujitsuAC *ac, const fujitsu_ac_remote_model_t model,
ac->send();
}
#endif // SEND_FUJITSU_AC
#if SEND_FUNIKI
/// Send a Funiki A/C message with the supplied settings.
/// @param[in, out] ac A Ptr to an IRFujitsuAC object to use.
/// @param[in] model The A/C model to use.
/// @param[in] on The power setting.
/// @param[in] mode The operation mode setting.
/// @param[in] celsius Temperature units. True is Celsius, False is Fahrenheit.
/// @param[in] degrees The temperature setting in degrees.
/// @param[in] fan The speed setting for the fan.
/// @param[in] swingv The vertical swing setting.
/// @param[in] swingh The horizontal swing setting.
/// @param[in] clock The clock setting.
/// @param[in] iFeel Whether to enable iFeel (remote temp) mode on the A/C unit.
/// @param[in] turbo Run the device in turbo/powerful mode.
/// @param[in] econo Run the device in economical mode.
/// @param[in] light Turn on the LED/Display mode.
/// @param[in] clean Turn on the self-cleaning mode. e.g. Mould, dry filters etc
/// @param[in] sleep Nr. of minutes for sleep mode. <= 0 is Off, > 0 is on.
void IRac::funiki(IRFunikiAC *ac, const funiki_ac_remote_model_t model,
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 stdAc::swingh_t swingh,
const int16_t clock,
const bool iFeel, const bool turbo, const bool econo,
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, !celsius);
ac->setFan(ac->convertFan(fan));
ac->setSwingVertical(swingv == stdAc::swingv_t::kAuto, // Set auto flag.
ac->convertSwingV(swingv));
ac->setSleep(sleep >= 0); // Sleep on this A/C is either on or off.
// No Econo setting available.
(void)(swingh);
(void)(iFeel);
(void)(turbo);
(void)(econo);
(void)(light);
(void)(clean);

// No Filter setting available.
// No Beep setting available.
// No Quiet setting available.
// No Clock setting available.
if (clock >= 0) ac->setClock(clock);
ac->send();
}
#endif // SEND_FUNIKI
#if SEND_GOODWEATHER
/// Send a Goodweather A/C message with the supplied settings.
/// @param[in, out] ac A Ptr to an IRGoodweatherAc object to use.
Expand Down Expand Up @@ -3244,6 +3296,18 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) {
break;
}
#endif // SEND_FUJITSU_AC
#if SEND_FUNIKI
case FUNIKI:
{
IRFunikiAC ac(_pin, (funiki_ac_remote_model_t)send.model, _inverted,
_modulation);
funiki(&ac, (funiki_ac_remote_model_t)send.model, send.power, send.mode,
send.celsius, send.degrees, send.fanspeed, send.swingv, send.swingh,
send.clock,
send.turbo, send.econo, send.light, send.clean, send.sleep);
break;
}
#endif // SEND_FUNIKI
#if SEND_GOODWEATHER
case GOODWEATHER:
{
Expand Down Expand Up @@ -4215,6 +4279,13 @@ namespace IRAcUtils {
return ac.toString();
}
#endif // DECODE_FUJITSU_AC
#if DECODE_FUNIKI
case decode_type_t::FUNIKI: {
IRFunikiAC ac(kGpioUnused);
ac.setRaw(result->state);
return ac.toString();
}
#endif // DECODE_FUNIKI
#if DECODE_GOODWEATHER
case decode_type_t::GOODWEATHER: {
IRGoodweatherAc ac(kGpioUnused);
Expand Down Expand Up @@ -4716,6 +4787,14 @@ namespace IRAcUtils {
break;
}
#endif // DECODE_FUJITSU_AC
#if DECODE_FUNIKI
case decode_type_t::FUNIKI: {
IRFunikiAC ac(kGpioUnused);
ac.setRaw(decode->state);
*result = ac.toCommon();
break;
}
#endif // DECODE_FUNIKI
#if DECODE_GOODWEATHER
case decode_type_t::GOODWEATHER: {
IRGoodweatherAc ac(kGpioUnused);
Expand Down
11 changes: 10 additions & 1 deletion src/IRac.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#include "ir_Voltas.h"
#include "ir_Whirlpool.h"
#include "ir_York.h"

#include "ir_Funiki.h"
// Constants
const int8_t kGpioUnused = -1; ///< A placeholder for not using an actual GPIO.

Expand Down Expand Up @@ -276,6 +276,15 @@ void electra(IRElectraAc *ac,
const bool quiet, const bool turbo, const bool econo,
const bool filter, const bool clean, const int16_t sleep = -1);
#endif // SEND_FUJITSU_AC
#if SEND_FUNIKI
void funiki(IRFunikiAC *ac, const funiki_ac_remote_model_t model,
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 stdAc::swingh_t swingh,
const int16_t clock,
const bool iFeel, const bool turbo, const bool econo,
const bool light, const bool clean, const int16_t sleep = -1);
#endif // SEND_FUNIKI
#if SEND_GOODWEATHER
void goodweather(IRGoodweatherAc *ac,
const bool on, const stdAc::opmode_t mode,
Expand Down
4 changes: 4 additions & 0 deletions src/IRrecv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,10 @@ bool IRrecv::decode(decode_results *results, irparams_t *save,
DPRINTLN("Attempting York decode");
if (decodeYork(results, offset, kYorkBits)) return true;
#endif // DECODE_YORK
#if DECODE_FUNIKI
DPRINTLN("Attempting Funiki decode");
if (decodeFuniki(results, offset)) return true;
#endif
// Typically new protocols are added above this line.
}
#if DECODE_HASH
Expand Down
5 changes: 5 additions & 0 deletions src/IRrecv.h
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,11 @@ class IRrecv {
const uint16_t kYorkBits,
const bool strict = true);
#endif // DECODE_YORK
#if DECODE_FUNIKI
bool decodeFuniki(decode_results *results, uint16_t offset = kStartOffset,
const uint16_t nbits = kFunikiBits,
const bool strict = true);
#endif // DECODE_FUNIKI
};

#endif // IRRECV_H_
16 changes: 13 additions & 3 deletions src/IRremoteESP8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,13 @@
#define SEND_YORK _IR_ENABLE_DEFAULT_
#endif // SEND_YORK

#ifndef DECODE_FUNIKI
#define DECODE_FUNIKI _IR_ENABLE_DEFAULT_
#endif // DECODE_FUNIKI
#ifndef SEND_FUNIKI
#define SEND_FUNIKI _IR_ENABLE_DEFAULT_
#endif // SEND_FUNIKI

#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 || \
Expand All @@ -970,7 +977,7 @@
DECODE_KELON168 || DECODE_HITACHI_AC296 || DECODE_CARRIER_AC128 || \
DECODE_DAIKIN200 || DECODE_HAIER_AC160 || DECODE_TCL96AC || \
DECODE_BOSCH144 || DECODE_SANYO_AC152 || DECODE_DAIKIN312 || \
DECODE_CARRIER_AC84 || DECODE_YORK || \
DECODE_CARRIER_AC84 || DECODE_YORK || DECODE_FUNIKI ||\
false)
// Add any DECODE to the above if it uses result->state (see kStateSizeMax)
// you might also want to add the protocol to hasACState function
Expand Down Expand Up @@ -1137,8 +1144,9 @@ enum decode_type_t {
WOWWEE,
CARRIER_AC84, // 125
YORK,
FUNIKI,
// Add new entries before this one, and update it to point to the last entry.
kLastDecodeType = YORK,
kLastDecodeType = FUNIKI,
};

// Message lengths & required repeat values
Expand Down Expand Up @@ -1435,7 +1443,9 @@ const uint16_t kRhossDefaultRepeat = 0;
const uint16_t kClimaButlerBits = 52;
const uint16_t kYorkBits = 136;
const uint16_t kYorkStateLength = 17;

const uint16_t kFunikiStateLength = 10;
const uint16_t kFunikiBits = kFunikiStateLength * 8;
const uint16_t kFunikiDefaultRepeat = kNoRepeat;

// Legacy defines. (Deprecated)
#define AIWA_RC_T501_BITS kAiwaRcT501Bits
Expand Down
7 changes: 7 additions & 0 deletions src/IRsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,8 @@ uint16_t IRsend::defaultBits(const decode_type_t protocol) {
return kXmpBits;
case YORK:
return kYorkBits;
case FUNIKI:
return kFunikiBits;
// No default amount of bits.
case FUJITSU_AC:
case MWM:
Expand Down Expand Up @@ -1434,6 +1436,11 @@ bool IRsend::send(const decode_type_t type, const uint8_t *state,
sendYork(state, nbytes);
break;
#endif // SEND_YORK
#if SEND_FUNIKI
case FUNIKI:
sendFuniki(state, nbytes);
break;
#endif // SEND_FUNIKI
default:
return false;
}
Expand Down
10 changes: 9 additions & 1 deletion src/IRsend.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ enum fujitsu_ac_remote_model_t {
ARRY4, ///< (5) AR-RY4 (Same as AR-RAH2E but with clean & filter)
ARREW4E, ///< (6) Similar to ARRAH2E, but with different temp config.
};

/// Funiki A/C model numbers
enum funiki_ac_remote_model_t {
UNKOWN = 1, // (1)(Default)
};
/// Gree A/C model numbers
enum gree_ac_remote_model_t {
YAW1F = 1, // (1) Ultimate, EKOKAI, RusClimate (Default)
Expand Down Expand Up @@ -885,6 +888,11 @@ class IRsend {
const uint16_t nbytes = kYorkStateLength,
const uint16_t repeat = kNoRepeat);
#endif // SEND_YORK
#if SEND_FUNIKI
void sendFuniki(const uint8_t data[],
const uint16_t nbytes = kFunikiStateLength,
const uint16_t repeat = kFunikiDefaultRepeat);
#endif // SEND_FUNIKI

protected:
#ifdef UNIT_TEST
Expand Down
2 changes: 2 additions & 0 deletions src/IRtext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ IRTEXT_CONST_BLOB_DECL(kAllProtocolNamesStr) {
D_STR_CARRIER_AC84, D_STR_UNSUPPORTED) "\x0"
COND(DECODE_YORK || SEND_YORK,
D_STR_YORK, D_STR_UNSUPPORTED) "\x0"
COND(DECODE_FUNIKI || SEND_FUNIKI,
D_STR_FUNIKI, D_STR_UNSUPPORTED) "\x0"
///< New protocol (macro) strings should be added just above this line.
"\x0" ///< This string requires double null termination.
};
Expand Down
1 change: 1 addition & 0 deletions src/IRutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ bool hasACState(const decode_type_t protocol) {
case DAIKIN312:
case ELECTRA_AC:
case FUJITSU_AC:
case FUNIKI:
case GREE:
case HAIER_AC:
case HAIER_AC_YRW02:
Expand Down
Loading

0 comments on commit efbb86b

Please sign in to comment.