Skip to content

Add protocol Delonghi N* to library #2195

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
46 changes: 46 additions & 0 deletions src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) {
#if SEND_DELONGHI_AC
case decode_type_t::DELONGHI_AC:
#endif
#if SEND_DELONGHI_N
case decode_type_t::DELONGHI_N:
#endif
#if SEND_ECOCLIM
case decode_type_t::ECOCLIM:
#endif
Expand Down Expand Up @@ -1117,6 +1120,26 @@ void IRac::delonghiac(IRDelonghiAc *ac,
}
#endif // SEND_DELONGHI_AC

#if SEND_DELONGHI_N
/// Send a Delonghi N message with the supplied settings.
/// @param[in, out] ac A Ptr to an IRDelonghi_N object 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.
void IRac::delonghi_n(IRDelonghi_N *ac,
const bool on, const stdAc::opmode_t mode, const bool celsius,
const float degrees, const stdAc::fanspeed_t fan) {
ac->begin();
ac->setPower(on);
ac->setMode(ac->convertMode(mode));
ac->setTemp(degrees, !celsius);
ac->setFan(ac->convertFan(fan));
ac->send();
}
#endif // SEND_DELONGHI_N

#if SEND_ECOCLIM
/// Send an EcoClim A/C message with the supplied settings.
/// @param[in, out] ac A Ptr to an IREcoclimAc object to use.
Expand Down Expand Up @@ -3220,6 +3243,14 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) {
break;
}
#endif // SEND_DELONGHI_AC
#if SEND_DELONGHI_N
case DELONGHI_N:
{
IRDelonghi_N ac(_pin, _inverted, _modulation);
delonghi_n(&ac, send.power, send.mode, send.celsius, degC, send.fanspeed);
break;
}
#endif // SEND_DELONGHI_N
#if SEND_ECOCLIM
case ECOCLIM:
{
Expand Down Expand Up @@ -4198,6 +4229,13 @@ String resultAcToString(const decode_results * const result) {
return ac.toString();
}
#endif // DECODE_DELONGHI_AC
#if DECODE_DELONGHI_N
case decode_type_t::DELONGHI_N: {
IRDelonghi_N ac(kGpioUnused);
ac.setRaw(result->value); // Delonghi_N uses value instead of state.
return ac.toString();
}
#endif // DECODE_DELONGHI_N
#if DECODE_ECOCLIM
case decode_type_t::ECOCLIM: {
if (result->bits == kEcoclimBits) {
Expand Down Expand Up @@ -4695,6 +4733,14 @@ bool decodeToState(const decode_results *decode, stdAc::state_t *result,
break;
}
#endif // DECODE_DELONGHI_AC
#if DECODE_DELONGHI_N
case decode_type_t::DELONGHI_N: {
IRDelonghi_N ac(kGpioUnused);
ac.setRaw(decode->value); // Uses value instead of state.
*result = ac.toCommon();
break;
}
#endif // DECODE_DELONGHI_N
#if DECODE_ECOCLIM
case decode_type_t::ECOCLIM: {
if (decode->bits == kEcoclimBits) {
Expand Down
5 changes: 5 additions & 0 deletions src/IRac.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ void daikin216(IRDaikin216 *ac,
const float degrees, const stdAc::fanspeed_t fan,
const bool turbo, const int16_t sleep = -1);
#endif // SEND_DELONGHI_AC
#if SEND_DELONGHI_N
void delonghi_n(IRDelonghi_N *ac,
const bool on, const stdAc::opmode_t mode, const bool celsius,
const float degrees, const stdAc::fanspeed_t fan);
#endif // SEND_DELONGHI_N
#if SEND_ECOCLIM
void ecoclim(IREcoclimAc *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 @@ -802,6 +802,10 @@ bool IRrecv::decode(decode_results *results, irparams_t *save,
return true;
#endif
*/
#if DECODE_DELONGHI_N
DPRINTLN("Attempting Delonghi N decode");
if (decodeDelonghi_N(results, offset)) return true;
#endif // DECODE_DELONGHI_N
#if DECODE_NEC
// Some devices send NEC-like codes that don't follow the true NEC spec.
// This should detect those. e.g. Apple TV remote etc.
Expand Down
5 changes: 5 additions & 0 deletions src/IRrecv.h
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,11 @@ class IRrecv {
const uint16_t nbits = kBluestarHeavyBits,
const bool strict = true);
#endif // DECODE_BLUESTARHEAVY
#if DECODE_DELONGHI_N
bool decodeDelonghi_N(decode_results *results, uint16_t offset = kStartOffset,
const uint16_t nbits = kDelonghi_N_Bits,
const bool strict = true);
#endif // DECODE_DELONGHI_N
};

#endif // IRRECV_H_
13 changes: 12 additions & 1 deletion src/IRremoteESP8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,13 @@
#define SEND_BLUESTARHEAVY _IR_ENABLE_DEFAULT_
#endif // SEND_BLUESTARHEAVY

#ifndef DECODE_DELONGHI_N
#define DECODE_DELONGHI_N _IR_ENABLE_DEFAULT_
#endif // DECODE_DELONGHI_N
#ifndef SEND_DELONGHI_N
#define SEND_DELONGHI_N _IR_ENABLE_DEFAULT_
#endif // SEND_DELONGHI_N

#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 @@ -978,6 +985,7 @@
DECODE_DAIKIN200 || DECODE_HAIER_AC160 || DECODE_TCL96AC || \
DECODE_BOSCH144 || DECODE_SANYO_AC152 || DECODE_DAIKIN312 || \
DECODE_CARRIER_AC84 || DECODE_YORK || DECODE_BLUESTARHEAVY || \
DECODE_DELONGHI_N || \
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 @@ -1145,8 +1153,9 @@ enum decode_type_t {
CARRIER_AC84, // 125
YORK,
BLUESTARHEAVY,
DELONGHI_N,
// Add new entries before this one, and update it to point to the last entry.
kLastDecodeType = BLUESTARHEAVY,
kLastDecodeType = DELONGHI_N,
};

// Message lengths & required repeat values
Expand Down Expand Up @@ -1229,6 +1238,8 @@ const uint16_t kDaikin312Bits = kDaikin312StateLength * 8;
const uint16_t kDaikin312DefaultRepeat = kNoRepeat;
const uint16_t kDelonghiAcBits = 64;
const uint16_t kDelonghiAcDefaultRepeat = kNoRepeat;
const uint16_t kDelonghi_N_Bits = 32;
const uint16_t kDelonghi_N_DefaultRepeat = kNoRepeat;
const uint16_t kTechnibelAcBits = 56;
const uint16_t kTechnibelAcDefaultRepeat = kNoRepeat;
const uint16_t kDenonBits = 15;
Expand Down
6 changes: 6 additions & 0 deletions src/IRsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ uint16_t IRsend::defaultBits(const decode_type_t protocol) {
case SAMSUNG:
case SHERWOOD:
case WHYNTER:
case DELONGHI_N:
return 32;
case AIRWELL:
return 34;
Expand Down Expand Up @@ -887,6 +888,11 @@ bool IRsend::send(const decode_type_t type, const uint64_t data,
sendDelonghiAc(data, nbits, min_repeat);
break;
#endif
#if SEND_DELONGHI_N
case DELONGHI_N:
sendDelonghi_N(data, nbits, min_repeat);
break;
#endif
#if SEND_DENON
case DENON:
sendDenon(data, nbits, min_repeat);
Expand Down
4 changes: 4 additions & 0 deletions src/IRsend.h
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,10 @@ class IRsend {
const uint16_t nbytes = kBluestarHeavyStateLength,
const uint16_t repeat = kNoRepeat);
#endif // SEND_BLUESTARHEAVY
#if SEND_DELONGHI_N
void sendDelonghi_N(uint64_t data, uint16_t nbits = kDelonghi_N_Bits,
uint16_t repeat = kDelonghi_N_DefaultRepeat);
#endif

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 @@ -561,6 +561,8 @@ IRTEXT_CONST_BLOB_DECL(kAllProtocolNamesStr) {
D_STR_YORK, D_STR_UNSUPPORTED) "\x0"
COND(DECODE_BLUESTARHEAVY || SEND_BLUESTARHEAVY,
D_STR_BLUESTARHEAVY, D_STR_UNSUPPORTED) "\x0"
COND(DECODE_DELONGHI_N || SEND_DELONGHI_N,
D_STR_DELONGHI_N, D_STR_UNSUPPORTED) "\x0"
///< New protocol (macro) strings should be added just above this line.
"\x0" ///< This string requires double null termination.
};
Expand Down
Loading
Loading