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

SharpAc: Add model support for A705 #1313

Merged
merged 4 commits into from
Nov 9, 2020
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
21 changes: 16 additions & 5 deletions src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1672,22 +1672,25 @@ void IRac::sanyo(IRSanyoAc *ac,
/// Send a Sharp A/C message with the supplied settings.
/// @note Multiple IR messages may be generated & sent.
/// @param[in, out] ac A Ptr to an IRSharpAc object to use.
/// @param[in] model The A/C model to use.
/// @param[in] on The power setting.
/// @param[in] prev_power The power setting from the previous A/C state.
/// @param[in] mode The operation mode setting.
/// @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] turbo Run the device in turbo/powerful mode.
/// @param[in] light Turn on the LED/Display mode.
/// @param[in] filter Turn on the (ion/pollen/etc) filter mode.
/// @param[in] clean Turn on the self-cleaning mode. e.g. Mould, dry filters etc
void IRac::sharp(IRSharpAc *ac,
void IRac::sharp(IRSharpAc *ac, const sharp_ac_remote_model_t model,
const bool on, const bool prev_power,
const stdAc::opmode_t mode,
const float degrees, const stdAc::fanspeed_t fan,
const stdAc::swingv_t swingv, const bool turbo,
const bool filter, const bool clean) {
const bool light, const bool filter, const bool clean) {
ac->begin();
ac->setModel(model);
ac->setPower(on, prev_power);
ac->setMode(ac->convertMode(mode));
ac->setTemp(degrees);
Expand All @@ -1698,7 +1701,7 @@ void IRac::sharp(IRSharpAc *ac,
ac->setIon(filter);
// No Horizontal swing setting available.
// No Quiet setting available.
// No Light setting available.
ac->setLightToggle(light);
// No Beep setting available.
// No Sleep setting available.
// No Clock setting available.
Expand Down Expand Up @@ -2110,7 +2113,14 @@ stdAc::state_t IRac::handleToggles(const stdAc::state_t desired,
case decode_type_t::CORONA_AC:
case decode_type_t::HITACHI_AC344:
case decode_type_t::HITACHI_AC424:
if ((desired.swingv == stdAc::swingv_t::kOff) ^
(prev->swingv == stdAc::swingv_t::kOff)) // It changed, so toggle.
result.swingv = stdAc::swingv_t::kAuto;
else
result.swingv = stdAc::swingv_t::kOff; // No change, so no toggle.
break;
case decode_type_t::SHARP_AC:
result.light = desired.light ^ prev->light;
if ((desired.swingv == stdAc::swingv_t::kOff) ^
(prev->swingv == stdAc::swingv_t::kOff)) // It changed, so toggle.
result.swingv = stdAc::swingv_t::kAuto;
Expand Down Expand Up @@ -2538,8 +2548,9 @@ 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,
send.swingv, send.turbo, send.filter, send.clean);
sharp(&ac, (sharp_ac_remote_model_t)send.model, send.power, prev_power,
send.mode, degC, send.fanspeed, send.swingv, send.turbo, send.light,
send.filter, send.clean);
break;
}
#endif // SEND_SHARP_AC
Expand Down
6 changes: 3 additions & 3 deletions src/IRac.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,11 @@ void electra(IRElectraAc *ac,
const bool beep, const int16_t sleep = -1);
#endif // SEND_SANYO_AC
#if SEND_SHARP_AC
void sharp(IRSharpAc *ac,
void sharp(IRSharpAc *ac, const sharp_ac_remote_model_t model,
const bool on, const bool prev_power, const stdAc::opmode_t mode,
const float degrees, const stdAc::fanspeed_t fan,
const stdAc::swingv_t swingv, const bool turbo, const bool filter,
const bool clean);
const stdAc::swingv_t swingv, const bool turbo, const bool light,
const bool filter, const bool clean);
#endif // SEND_SHARP_AC
#if SEND_TCL112AC
void tcl112(IRTcl112Ac *ac,
Expand Down
6 changes: 6 additions & 0 deletions src/IRsend.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ enum panasonic_ac_remote_model_t {
kPanasonicRkr = 6,
};

/// Sharp A/C model numbers
enum sharp_ac_remote_model_t {
A907 = 1, // 802 too.
A705 = 2,
};

/// Voltas A/C model numbers
enum voltas_ac_remote_model_t {
kVoltasUnknown = 0, // Full Function
Expand Down
7 changes: 7 additions & 0 deletions src/IRutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,13 @@ namespace irutils {
default: return kUnknownStr;
}
break;
case decode_type_t::SHARP_AC:
switch (model) {
case sharp_ac_remote_model_t::A907: return F("A907");
case sharp_ac_remote_model_t::A705: return F("A705");
default: return kUnknownStr;
}
break;
case decode_type_t::PANASONIC_AC:
switch (model) {
case panasonic_ac_remote_model_t::kPanasonicLke: return F("LKE");
Expand Down
Loading