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

Add support for Kelon ACs #1494

Merged
merged 36 commits into from
Jul 3, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2168624
Add support for Kelon ACs
depau Jun 30, 2021
7252f46
Allow converting signed ints to string
depau Jun 5, 2021
3810875
Kelon: print dry grade as signed integer
depau Jun 5, 2021
2aa7841
Order strings alphabetically
depau Jun 5, 2021
f8392eb
Kelon: Use uint64 to store raw data
depau Jun 5, 2021
9e2b158
Kelon: Fix issues reported by CI
depau Jun 6, 2021
6b87f7b
Kelon: Add defaultBits
depau Jun 6, 2021
217e315
Kelon: Fix incorrect timer operator order
depau Jun 8, 2021
67fae81
Kelon: Add timer time to toString()
depau Jun 8, 2021
583f43b
Kelon: Do not expect footerspace
depau Jun 11, 2021
07e8a96
Kelon: Fix incorrect previous temp/mode revert
depau Jun 11, 2021
31f1793
Kelon: Supercool should set/revert fan speed max
depau Jun 11, 2021
7a289ad
Kelon: toCommon(): do not access _ directly
depau Jun 11, 2021
df75050
Kelon: Add unit tests
depau Jun 11, 2021
f45f938
Kelon: Add utility method to ensure power on/off
depau Jun 11, 2021
1171ba6
Kelon: Fix Doxygen
depau Jun 12, 2021
ff82688
Kelon: Resolve requested changes and lint issues
depau Jun 14, 2021
4d67d14
Kelon: Replace "Dry grade" with just "Dry"
depau Jun 14, 2021
46877ec
Allow converting signed ints to string
depau Jun 5, 2021
7105e42
Kelon: Use signed int string helper for dry grade
depau Jun 14, 2021
1cac6ab
Kelon: Adjust tests for string changes
depau Jun 14, 2021
66c35b1
Kelon: Fix minor lint issues
depau Jun 14, 2021
8553005
Kelon: Add gap between ensurePower commands
depau Jun 30, 2021
c3009a2
Kelon: Send ensure power off command separately
depau Jun 30, 2021
47948e2
Kelon: Mark Kelon as stable
depau Jun 30, 2021
1de5d68
Kelon: Lint
depau Jun 30, 2021
892abf9
Fix rebase issues
depau Jun 30, 2021
9a97cb6
Kelon: Address PR review change requests
depau Jul 1, 2021
badcad3
Kelon: Add self to Contributors.md
depau Jul 1, 2021
7da0f7e
Kelon: Address PR review change requests
depau Jul 1, 2021
f396072
Kelon: Allow providing prev common state
depau Jul 1, 2021
4743f8b
Kelon: Fix typos
depau Jul 1, 2021
b8c8174
Kelon: Move toCommon() default value to header
depau Jul 1, 2021
792025f
Kelon: Fix gap time in tests
depau Jul 1, 2021
09ebeb8
Kelon: Handle toggles in toCommon()
depau Jul 2, 2021
e4c66dc
Kelon: Add tests for toCommon() toggles
depau Jul 2, 2021
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
Prev Previous commit
Next Next commit
Kelon: Use uint64 to store raw data
  • Loading branch information
depau committed Jun 30, 2021
commit f8392eba158b9a5ca0a7896d05c80f59cdb6e0e8
4 changes: 2 additions & 2 deletions src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3334,7 +3334,7 @@ namespace IRAcUtils {
#if DECODE_KELON
case decode_type_t::KELON: {
IRKelonAC ac(kGpioUnused);
ac.setRaw(result->state);
ac.setRaw(result->value);
return ac.toString();
}
#endif // DECODE_KELON
Expand Down Expand Up @@ -3826,7 +3826,7 @@ namespace IRAcUtils {
#if DECODE_KELON
case decode_type_t::KELON: {
IRKelonAC ac(kGpioUnused);
ac.setRaw(decode->state);
ac.setRaw(decode->value);
*result = ac.toCommon();
break;
}
Expand Down
3 changes: 1 addition & 2 deletions src/IRremoteESP8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,7 @@ const uint16_t kHitachiAc424Bits = kHitachiAc424StateLength * 8;
const uint16_t kInaxBits = 24;
const uint16_t kInaxMinRepeat = kSingleRepeat;
const uint16_t kJvcBits = 16;
const uint16_t kKelonStateLength = 6;
const uint16_t kKelonBits = kKelonStateLength * 8;
const uint16_t kKelonBits = 48;
const uint16_t kKelvinatorStateLength = 16;
const uint16_t kKelvinatorBits = kKelvinatorStateLength * 8;
const uint16_t kKelvinatorDefaultRepeat = kNoRepeat;
Expand Down
10 changes: 5 additions & 5 deletions src/IRsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,11 @@ bool IRsend::send(const decode_type_t type, const uint64_t data,
sendJVC(data, nbits, min_repeat);
break;
#endif
#if SEND_KELON
case KELON:
sendKelon(data, nbits, min_repeat);
break;
#endif // SEND_KELON
#if SEND_LASERTAG
case LASERTAG:
sendLasertag(data, nbits, min_repeat);
Expand Down Expand Up @@ -1182,11 +1187,6 @@ bool IRsend::send(const decode_type_t type, const uint8_t *state,
sendHitachiAc424(state, nbytes);
break;
#endif // SEND_HITACHI_AC424
#if SEND_KELON
case KELON:
sendKelon(state, nbytes);
break;
#endif // SEND_KELON
#if SEND_KELVINATOR
case KELVINATOR:
sendKelvinator(state, nbytes);
Expand Down
4 changes: 2 additions & 2 deletions src/IRsend.h
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,8 @@ class IRsend {
const uint16_t repeat = kNoRepeat);
#endif // SEND_TEKNOPOINT
#if SEND_KELON
void sendKelon(const unsigned char data[], const uint16_t nbytes = kKelonStateLength,
const uint16_t repeat = kNoRepeat);
void sendKelon(const uint64_t data, const uint16_t nbits = kKelonBits,
const uint16_t repeat = kNoRepeat);
#endif // SEND_KELON

protected:
Expand Down
1 change: 0 additions & 1 deletion src/IRutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ bool hasACState(const decode_type_t protocol) {
case HITACHI_AC3:
case HITACHI_AC344:
case HITACHI_AC424:
case KELON:
case KELVINATOR:
case MIRAGE:
case MITSUBISHI136:
Expand Down
19 changes: 9 additions & 10 deletions src/ir_Kelon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,15 @@ const uint16_t kKelonFreq = 38000;

/// Send a Kelon message.
/// Status: Beta / Should be working.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is working for you, you should list it as STABLE.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll keep these open and do some final testing with the actual AC before this is merged.

/// @param[in] data The message to be sent.
/// @param[in] nbytes The number of bytes of message to be sent.
/// @param[in] data The data to be transmitted.
/// @param[in] nbits Nr. of bits of data to be sent.
/// @param[in] repeat The number of times the command is to be repeated.
void IRsend::sendKelon(const unsigned char data[], const uint16_t nbytes,
const uint16_t repeat) {
void IRsend::sendKelon(const uint64_t data, const uint16_t nbits, const uint16_t repeat) {
sendGeneric(kKelonHdrMark, kKelonHdrSpace,
kKelonBitMark, kKelonOneSpace,
kKelonBitMark, kKelonZeroSpace,
kKelonBitMark, kKelonGap,
data, nbytes, kKelonFreq, false, // LSB First.
data, nbits, kKelonFreq, false, // LSB First.
repeat, 50);
}

Expand Down Expand Up @@ -100,7 +99,7 @@ IRKelonAC::IRKelonAC(const uint16_t pin, const bool inverted, const bool use_mod

/// Reset the internals of the object to a known good state.
void IRKelonAC::stateReset() {
for (unsigned char &i : _.raw) i = 0x0;
_.raw = 0L;
_.preamble[0] = 0b10000011;
_.preamble[1] = 0b00000110;
}
Expand All @@ -110,7 +109,7 @@ void IRKelonAC::stateReset() {
/// Send the current internal state as an IR message.
/// @param[in] repeat Nr. of times the message will be repeated.
void IRKelonAC::send(const uint16_t repeat) {
_irsend.sendKelon(getRaw(), kKelonStateLength, repeat);
_irsend.sendKelon(getRaw(), kKelonBits, repeat);

// Reset toggle flags
_.PowerToggle = false;
Expand Down Expand Up @@ -319,14 +318,14 @@ bool IRKelonAC::getTimerEnabled() const {
/// Get the raw state of the object, suitable to be sent with the appropriate
/// IRsend object method.
/// @return A PTR to the internal state.
uint8_t *IRKelonAC::getRaw() {
uint64_t IRKelonAC::getRaw() const {
return _.raw;
}

/// Set the raw state of the object.
/// @param[in] new_code The raw state from the native IR message.
void IRKelonAC::setRaw(const uint8_t *new_code) {
std::memcpy(_.raw, new_code, kKelonStateLength);
void IRKelonAC::setRaw(const uint64_t new_code) {
_.raw = new_code;
}

/// Convert a standard A/C mode (stdAc::opmode_t) into it a native mode.
Expand Down
6 changes: 3 additions & 3 deletions src/ir_Kelon.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "IRutils.h"

union KelonProtocol {
uint8_t raw[kKelonStateLength];
uint64_t raw;

struct {
uint8_t preamble[2];
Expand Down Expand Up @@ -124,9 +124,9 @@ class IRKelonAC {

bool getTimerEnabled() const;

uint8_t *getRaw();
uint64_t getRaw() const;

void setRaw(const uint8_t new_code[]);
void setRaw(const uint64_t new_code);

static uint8_t convertMode(stdAc::opmode_t mode);

Expand Down