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

Added support for Argo WREM-3 A/C remote protocol [part1] #1920

Merged

Conversation

mbronk
Copy link
Contributor

@mbronk mbronk commented Nov 19, 2022

Adds support for ARGO WREM-3 remote

For: #1912

This PR is a standalone part1 of changes detached from: #1913

@crankyoldgit crankyoldgit self-requested a review November 21, 2022 23:50
@crankyoldgit crankyoldgit self-assigned this Nov 21, 2022
Copy link
Owner

@crankyoldgit crankyoldgit left a comment

Choose a reason for hiding this comment

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

Again, thanks for the massive effort. I understand what it's like.

Thanks for splitting it up too.

Doxyfile Outdated Show resolved Hide resolved
src/IRutils.cpp Outdated Show resolved Hide resolved
src/IRutils.cpp Outdated Show resolved Hide resolved
src/IRutils.cpp Outdated Show resolved Hide resolved
src/IRutils.h Outdated Show resolved Hide resolved
src/ir_Argo.cpp Outdated
Comment on lines 1816 to 1762
switch (messageType) {
case argoIrMessageType_t::AC_CONTROL :
if (nbits != kArgo3AcControlStateLength * 8) { return false; }
break;
case argoIrMessageType_t::CONFIG_PARAM_SET:
if (nbits != kArgo3ConfigStateLength * 8) { return false; }
break;
case argoIrMessageType_t::TIMER_COMMAND:
if (nbits != kArgo3TimerStateLength * 8) { return false; }
break;
case argoIrMessageType_t::IFEEL_TEMP_REPORT:
if (nbits != kArgo3iFeelReportStateLength * 8) { return false; }
break;
default:
return false;
}
Copy link
Owner

Choose a reason for hiding this comment

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

Divide by 8 much earlier to get the bytes. And do the comparisons via that. That will reduce the resultant code size, and improve readablity. e.g. statelength.

Copy link
Owner

Choose a reason for hiding this comment

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

Also, this really is a "strict" condition IMHO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That will reduce the resultant code size, and improve readablity. e.g. statelength.

Good point - will simplify (agree with the readability part of the comment).
Must add though, that I'd be very surprised it does anything positive to the resulting code size.
Compiler should be perfectly capable of optimizing it on its own.


Also, this really is a "strict" condition IMHO.

Well, yes and no.
That is, it is about the only thing separating WREM2 from WREM3 (and WREM3 detection must run before WREM2 non-strict, as it is a swallow-all).
While there's indeed a getMessageType() doing the detect, it only takes 2 bits of input, so a chance of a false-positive is way high. Aka. I consider "checksum" strict check, but anything else... I deliberately wanted to fall through to WREM2 and not get handled here.

That said, I only use the detect in strict mode anyway, so the point I'm making above is a bit moot and I could equally well remove 'strict' param entirely...
Leaving as-is for now, let me know where you'd like to take it.

Copy link
Owner

Choose a reason for hiding this comment

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

My unwritten policy for strict is, if it is in some way protocol-format related and can cause it to abort decoding, encapsulate it in strict. The purpose is to allow more loose matching with strict set to false, and/or code re-use where the protocol timings etc are compatible, but the length or structure of the data differs in a different protocol.
i.e. Maximum potential for code-reuse to reduce library binary size etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please note though that WREM2 and WREM3 are variants (models) of the same ARGO IR protocol.
The difference is in message decoding and parsing, so in the case you describe:

... but the length or structure of the data differs in a different protocol....

...there's already a decodeArgo(..., strict=false) which would accomplish that result just fine.
The WREM3 flavor was meant signify this is semantically a different sub-proto.

If I make the length-check non-strict, then, arguably, decodeArgoWREM3(..., strict=false) would be almost no different from decodeArgo(..., strict=false)... which makes it a bit redundant IMHO (but arguably consistent)

My preferences (from most-preferred):

  1. Leave as is (possibly less semantically consistent, but the most versatile impl.)
  2. Remove strict param from decodeArgoWREM3 altogether
  3. Make the length non-strict (it has a potential to clash with wrem2, but since I'm not calling it this way anyway... I guess the user would know what they're after).
    I.e. when you call it with strict=false a true response no longer means there's any confidence in it really being a WREM3.

Your pick? :)

Copy link
Owner

Choose a reason for hiding this comment

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

Users typically can't call the decodeProtocol() routines directly. So, it's just us "internal" users.
Practically every decodeProtocol() has a strict, so I'd like to keep that calling convention.
Of the options, 3. sounds best to me. It is almost always a given if a decodeProtocol() is called with strict=false that it's not a confident match. It assumes the caller knows what they are doing.

src/ir_Argo.h Outdated Show resolved Hide resolved
src/IRtext.h Show resolved Hide resolved
src/locale/defaults.h Outdated Show resolved Hide resolved
src/locale/defaults.h Outdated Show resolved Hide resolved
@mbronk
Copy link
Contributor Author

mbronk commented Nov 22, 2022

@crankyoldgit Thanks so much for reviewing! I know it wasn't a pleasant read, given the volume of changes in Argo class.

I think I addressed most of your comments in the new update. On a few comments that I left behind, I added replies or questions to you. Please take a look.
I'd also appreciate if you mark the conversations as resolved where you believe the changes address your comments, so that I know if there's anything withstanding. Where I did not comment, I merely incorporated the proposal as-is (hopefully didn't miss any).
For now I'm leaving it as-is and waiting for your inputs as to any follow-ups needed.
Thanks!

Copy link
Owner

@crankyoldgit crankyoldgit left a comment

Choose a reason for hiding this comment

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

Looking a lot better. Just a couple of minor things left.

Incl. a macro 'gadget' to allow capturing raw command sent by IRac.

Signed-off-by: Mateusz Bronk <[email protected]>
@mbronk mbronk force-pushed the private/mbronk/argo_WREM3_part1 branch from b26e701 to 914c0ed Compare November 23, 2022 21:00
@mbronk
Copy link
Contributor Author

mbronk commented Nov 23, 2022

Reverted the doc/doxy changes. Unfortunately, I wanted to do it (too) cleanly and rebased the whole thing, not to show the add + revert... which seems to have thrown github's incremental diff off :( Sorry for that!

Bottom line, as far as I can tell the only remaining comment from the original round would be the one about "strict" mode. Please take a look

@mbronk mbronk force-pushed the private/mbronk/argo_WREM3_part1 branch from 914c0ed to 9d2b66c Compare November 23, 2022 21:29
@crankyoldgit
Copy link
Owner

Let me know when the strict changes are in as discussed, and I'm fine to approve & merge.

Signed-off-by: Mateusz Bronk <[email protected]>
@mbronk mbronk force-pushed the private/mbronk/argo_WREM3_part1 branch from 9d2b66c to c951ada Compare November 24, 2022 09:04
@mbronk
Copy link
Contributor Author

mbronk commented Nov 24, 2022

Let me know when the strict changes are in as discussed

Just pushed. Please take a look.
Note I have pushed the lax logic into decodeArgoWREM3() (if not strict, bypasses call to isValidWrem3Message entirely).
Reason being: if I were to not make the length check in isValidWrem3Message, it becomes a return true.

@crankyoldgit
Copy link
Owner

Let me know when the strict changes are in as discussed

Just pushed. Please take a look. Note I have pushed the lax logic into decodeArgoWREM3() (if not strict, bypasses call to isValidWrem3Message entirely). Reason being: if I were to not make the length check in isValidWrem3Message, it becomes a return true.

Good. 'Cause that what I'd expect.

@crankyoldgit crankyoldgit self-requested a review November 24, 2022 09:26
Copy link
Owner

@crankyoldgit crankyoldgit left a comment

Choose a reason for hiding this comment

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

As discussed, LGTM

@crankyoldgit crankyoldgit merged commit a5ddcdd into crankyoldgit:master Nov 24, 2022
crankyoldgit added a commit that referenced this pull request Mar 5, 2023
_v2.8.5 (20230305)_

**[Bug Fixes]**
- Missing argument in use of midea function (#1959 #1958)
- IRMQTTServer: Improve HA MQTT climate handling. (#1911)
- SEND_SANYO_AC88: Fix poor cut-n-paste error (#1905 #1897)

**[Features]**
- IRMQTTServer: SHT-3x Temperature Sensor Support (#1951)
- IRMQTTServer: HA multi output discovery (#1947)
- IRMQTTServer: extended with new A/C common fields (#1940)
- IRMQTTServer: Sync the on state to power from mode for HA (#1946)
- Experimental basic support for Carrier 84-bit protocol. (#1945 #1943)
- Add support the WowWee 11-Bit RoboRaptor-X protocol. (#1939 #1938)
- Added 'sensorTemperature' and 'iFeel' to IRac (common) (#1928)
- Added extra 'mid' option for Fan & SwingV to IRac (#1929)
- Added "commandType" to IRAc (#1921)
- Added support for Argo WREM-3 A/C remote protocol [part1] (#1920)
- Added Dutch (nl-NL) translation (#1907)
- ARGO: Improve code & add support for decoding 32bit sensor msgs. (#1906 #1859)
- Added support for Gorenje cooker hood IR protocol (#1888 #1887)

**[Misc]**
- Update `XMP` status to Stable (#1944)
- upgrade to a later version of `googletest` (#1936)
- MITSUBISHI128: Added model to supported protocol (#1924)
- Added Dutch (nl-NL) README (#1908)
- Added GMock to UT Makefile (#1902)
- Update HA example config for HA 2022.6+ (#1901 #1900)
crankyoldgit added a commit that referenced this pull request May 8, 2023
_v2.8.5 (20230508)_

**[Bug Fixes]**
- Fix a bug where we never detached the timer interrupt on ESP32s. (#1984 #1983)
- Missing argument in use of midea function (#1959 #1958)
- IRMQTTServer: Improve HA MQTT climate handling. (#1911)
- SEND_SANYO_AC88: Fix poor cut-n-paste error (#1905 #1897)

**[Features]**
- Add support for a 40bit variant of the standard Panasonic protocol (#1977 @1976)
- Initial support for York AC protocol (#1889)
- IRMQTTServer: SHT-3x Temperature Sensor Support (#1951)
- IRMQTTServer: HA multi output discovery (#1947)
- IRMQTTServer: extended with new A/C common fields (#1940)
- IRMQTTServer: Sync the on state to power from mode for HA (#1946)
- Experimental basic support for Carrier 84-bit protocol. (#1945 #1943)
- Add support the WowWee 11-Bit RoboRaptor-X protocol. (#1939 #1938)
- Added 'sensorTemperature' and 'iFeel' to IRac (common) (#1928)
- Added extra 'mid' option for Fan & SwingV to IRac (#1929)
- Added "commandType" to IRAc (#1921)
- Added support for Argo WREM-3 A/C remote protocol [part1] (#1920)
- Added Dutch (nl-NL) translation (#1907)
- ARGO: Improve code & add support for decoding 32bit sensor msgs. (#1906 #1859)
- Added support for Gorenje cooker hood IR protocol (#1888 #1887)

**[Misc]**
- Add Electrolux YKR-H/531E as a supported device (#1981 #1980)
- Update `XMP` status to Stable (#1944)
- upgrade to a later version of `googletest` (#1936)
- MITSUBISHI128: Added model to supported protocol (#1924)
- Added Dutch (nl-NL) README (#1908)
- Added GMock to UT Makefile (#1902)
- Update HA example config for HA 2022.6+ (#1901 #1900)
- Add a `d1_mini_noMDNS` build option to `IRMQTTServer`. (#1985)
@crankyoldgit crankyoldgit mentioned this pull request May 8, 2023
crankyoldgit added a commit that referenced this pull request May 8, 2023
## _v2.8.5 (20230508)_

**[Bug Fixes]**
- Fix a bug where we never detached the timer interrupt on ESP32s. (#1984 #1983)
- Missing argument in use of midea function (#1959 #1958)
- IRMQTTServer: Improve HA MQTT climate handling. (#1911)
- SEND_SANYO_AC88: Fix poor cut-n-paste error (#1905 #1897)

**[Features]**
- Add support for a 40bit variant of the standard Panasonic protocol (#1977 @1976)
- Initial support for York AC protocol (#1889)
- IRMQTTServer: SHT-3x Temperature Sensor Support (#1951)
- IRMQTTServer: HA multi output discovery (#1947)
- IRMQTTServer: extended with new A/C common fields (#1940)
- IRMQTTServer: Sync the on state to power from mode for HA (#1946)
- Experimental basic support for Carrier 84-bit protocol. (#1945 #1943)
- Add support the WowWee 11-Bit RoboRaptor-X protocol. (#1939 #1938)
- Added 'sensorTemperature' and 'iFeel' to IRac (common) (#1928)
- Added extra 'mid' option for Fan & SwingV to IRac (#1929)
- Added "commandType" to IRAc (#1921)
- Added support for Argo WREM-3 A/C remote protocol [part1] (#1920)
- Added Dutch (nl-NL) translation (#1907)
- ARGO: Improve code & add support for decoding 32bit sensor msgs. (#1906 #1859)
- Added support for Gorenje cooker hood IR protocol (#1888 #1887)

**[Misc]**
- Add Electrolux YKR-H/531E as a supported device (#1981 #1980)
- Update `XMP` status to Stable (#1944)
- upgrade to a later version of `googletest` (#1936)
- MITSUBISHI128: Added model to supported protocol (#1924)
- Added Dutch (nl-NL) README (#1908)
- Added GMock to UT Makefile (#1902)
- Update HA example config for HA 2022.6+ (#1901 #1900)
- Add a `d1_mini_noMDNS` build option to `IRMQTTServer`. (#1985)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants