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

MITSUBISHI_AC: Added support for i-SAVE mode. #1666

Merged
merged 9 commits into from
Nov 30, 2021

Conversation

ratnick
Copy link
Contributor

@ratnick ratnick commented Nov 7, 2021

This mode puts the A/C in an energy saving mode, maintaining the temp at 10C.

…Z-FHnnVE A/C.

Not yet tested if it can be sent to A/C.
No use of common Econo mode. Instead a new mode iSave10C is made.
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.

Btw, thanks for doing this, and providing a PR for it. That's great.

Sorry about all the comments/feedback. This is typical for a first-time contributor to this project, so don't feel bad or discouraged. We have lots & lots of automated checks & tests to keep things consistent & keep everything working, hence why there are a tonne of things. The tests are there so we don't stuff anything up, and we ourselves trip over them all the time so it's completely normal.

Keep it up. You picked a fairly well established project to make your first ever Contribution/PR too. So this would be rougher than most people's first contribution. Sorry.

Also remove "tools/analysis of bytes from Mitshubishi MSZ-FHnnVE AC remote.xlsm" file from the PR. Feel free to add it to the conversation stream for the PR etc, or as a link to a documented publicly etc, but not in the code repo that everyone will be downloading.

Linter issues found:

src/IRac.cpp:2926:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
src/ir_Mitsubishi.cpp:459:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/ir_Mitsubishi.cpp:459:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
src/ir_Mitsubishi.cpp:460:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
src/ir_Mitsubishi.cpp:461:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
src/ir_Mitsubishi.cpp:462:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
src/ir_Mitsubishi.cpp:463:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
src/ir_Mitsubishi.cpp:464:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/ir_Mitsubishi.h:93:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
src/ir_Mitsubishi.h:93:  Should have a space between // and comment  [whitespace/comments] [4]
src/ir_Mitsubishi.h:280:  Should have a space between // and comment  [whitespace/comments] [4]
src/ir_Mitsubishi.h:281:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
src/ir_Mitsubishi.h:281:  Should have a space between // and comment  [whitespace/comments] [4]

Unit tests now fail to compile as you've adjusted the mitsubishi() function in IRac.
See: https://github.com/crankyoldgit/IRremoteESP8266/runs/4135829425?check_suite_focus=true#step:4:129

and a Doxygen error:
https://github.com/crankyoldgit/IRremoteESP8266/runs/4135834351?check_suite_focus=true#step:4:66

src/IRac.cpp Outdated
@@ -1539,6 +1539,7 @@ void IRac::mirage(IRMirageAc *ac,
/// @note Clock can only be set in 10 minute increments. i.e. % 10.
void IRac::mitsubishi(IRMitsubishiAC *ac,
const bool on, const stdAc::opmode_t mode,
const bool iSave10C,
Copy link
Owner

Choose a reason for hiding this comment

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

Rename to "econo", and move it to after the "quiet" parameter.
You also need the special comment line above the function for doxygen to document it.
e.g.

/// @param[in] econo Toggle the device's economical mode.

src/IRac.cpp Outdated
@@ -1553,6 +1554,8 @@ void IRac::mitsubishi(IRMitsubishiAC *ac,
ac->setVane(ac->convertSwingV(swingv));
ac->setWideVane(ac->convertSwingH(swingh));
if (quiet) ac->setFan(kMitsubishiAcFanSilent);
ac->setiSave10C(iSave10C);

Copy link
Owner

Choose a reason for hiding this comment

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

Remove the blank line.

Copy link
Owner

Choose a reason for hiding this comment

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

Please remove the blank line at line 1557

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

src/IRac.cpp Outdated
@@ -2920,7 +2923,7 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) {
case MITSUBISHI_AC:
{
IRMitsubishiAC ac(_pin, _inverted, _modulation);
mitsubishi(&ac, send.power, send.mode, degC, send.fanspeed, send.swingv,
mitsubishi(&ac, send.power, send.mode, send.econo, degC, send.fanspeed, send.swingv,
Copy link
Owner

Choose a reason for hiding this comment

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

You will need to move this parameter per earlier comment.

Comment on lines 459 to 463
/// Normal minimum temp is 16C, and i-SAVE mode works as a gate to enable AC to use 10C as setting. However, when Remote control shows 10C, it still emits 16C on the "Temp" bits,
/// and instead it uses other bits to indicate a target temp of 10C. Slightly strange, but I guess it's to keep compatibility to systems without i-SAVE.
/// i-SAVE only has this 10C functionality when the AC is already in Heat mode. In all other modes, minimum temp is 16C.
/// I have found no other difference between normal Heat mode and i-SAVE other than the ability to go to 10C.
/// In this implementation, i-SAVE mode is ONLY used to enable the AC temperature setting to 10C. Therefore "Temp" is set to 16 disregarding what the remote shows, and mode is set to Heat.
Copy link
Owner

Choose a reason for hiding this comment

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

Start the block of comments with /// @note
e.g.

/// @note Normal minimum temp is 16C, ...

Plus the linter will complain that these lines are over 80 chars long. Please line wrap them so they don't go over 80 chars.

/// I have found no other difference between normal Heat mode and i-SAVE other than the ability to go to 10C.
/// In this implementation, i-SAVE mode is ONLY used to enable the AC temperature setting to 10C. Therefore "Temp" is set to 16 disregarding what the remote shows, and mode is set to Heat.
///
void IRMitsubishiAC::setiSave10C(bool iSave10C) {
Copy link
Owner

Choose a reason for hiding this comment

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

void IRMitsubishiAC::setiSave10C(const bool iSave10C) {

Comment on lines 717 to 718
// Supported by MSZ-FH series
// result.iSave10C = getiSave10C();
Copy link
Owner

Choose a reason for hiding this comment

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

Replace with:

result.econo = getiSave10C();

@@ -88,7 +89,9 @@ union Mitsubishi144Protocol{
// Byte 14
uint8_t :8;
// Byte 15
uint8_t :8;
uint8_t :5;
uint8_t iSave10C :1; //i-SAVE: 1 if in Heat mode AND iSave os on, and temperature THEN set to 10C
Copy link
Owner

Choose a reason for hiding this comment

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

Needs a space after comment chars.
e.g.
uint8_t iSave10C :1; // i-SAVE: 1 if in Heat mode AND iSave os on, and temperature THEN set to 10C

Comment on lines 280 to 281
bool getiSave10C(void) const; //1 = in i-Save mode and temp = 10C
void setiSave10C(bool); //1 = set to i-Save mode when temp = 10C on remote. "Temp" byte is not affected by this(!). 10C temp is implied through other bits
Copy link
Owner

Choose a reason for hiding this comment

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

Ditto previous comment. Space after the // chars.

Comment on lines 280 to 281
bool getiSave10C(void) const; //1 = in i-Save mode and temp = 10C
void setiSave10C(bool); //1 = set to i-Save mode when temp = 10C on remote. "Temp" byte is not affected by this(!). 10C temp is implied through other bits
Copy link
Owner

Choose a reason for hiding this comment

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

Line to long (> 80 chars)
Please wrap the comments etc.

@crankyoldgit crankyoldgit self-assigned this Nov 8, 2021
@ratnick
Copy link
Contributor Author

ratnick commented Nov 8, 2021

I like the comments, and I take it as learning. in fact, I think your comments are very thorough - so thanks for that.
It's been more than 20 years since I developed professionally, and there was no Github or anything like that (at my work). We modified huge warehouse management systems straight on the production servers with only minimum testing:-). Some customers suffered pretty much from that strategy :-(.
So I'm enjoying leaning about this "new" world, and hope you can bear with my newbie mistakes.
I will have a look at the comment over the next couple of weeks.

@crankyoldgit crankyoldgit changed the title No use of common Econo mode + suggested cleanups MITSUBISHI_AC: Added support for i-SAVE mode. Nov 10, 2021
…sting in other series):

  - I-See mode
  - Absense Detect mode  (MZS-FH series, unknown if existing in other series)
  - Ecocool mode  (MZS-FH series, unknown if existing in other series)
  - Natural Flow mode  (MZS-FH series, unknown if existing in other series)
Corrected LINT errors and warnings from last commit
Cleaned up order of setWideVane and getWideVane
Removed test tool (excel)
@ratnick
Copy link
Contributor Author

ratnick commented Nov 14, 2021

I have now corrected the errors and warnings.
I also added 4 more modes supported by the A/C.

I am unsure if I should create a new Pull Request or if what I have done here is fine?

@ratnick
Copy link
Contributor Author

ratnick commented Nov 14, 2021

PS: How do I run the build myself, so I can check the build output myself (before submitting to you)?

@crankyoldgit
Copy link
Owner

PS: How do I run the build myself, so I can check the build output myself (before submitting to you)?

Read this:
https://github.com/crankyoldgit/IRremoteESP8266/wiki/Library-Maintainers-Guide

/// i-SAVE only has this 10C functionality when the AC is already in Heat mode. In all other modes, minimum temp is 16C.
/// I have found no other difference between normal Heat mode and i-SAVE other than the ability to go to 10C.
/// In this implementation, i-SAVE mode is ONLY used to enable the AC temperature setting to 10C. Therefore "Temp" is set to 16 disregarding what the remote shows, and mode is set to Heat.
/// Normal minimum temp is 16C, and i-SAVE mode works as a gate to enable AC
Copy link
Owner

Choose a reason for hiding this comment

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

/// @note Normal minimum temp is 16C, and i-SAVE mode works as a gate to enable AC

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you are requesting here?

Copy link
Owner

Choose a reason for hiding this comment

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

What I'm saying is, please add @note to the start of that line.
i.e.
Change: /// Normal minimum temp is 16C, and i-SAVE mode works as a gate to enable AC to /// @note Normal minimum temp is 16C, and i-SAVE mode works as a gate to enable AC

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines 481 to 483
if (state) setMode(kMitsubishiAcHeat);
if (state) setTemp(kMitsubishiAcMinTemp);
_.iSave10C = state;
Copy link
Owner

Choose a reason for hiding this comment

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

  if (state) {
    setMode(kMitsubishiAcHeat);
    setTemp(kMitsubishiAcMinTemp); 
  }
  _.iSave10C = state;

Comment on lines 492 to 541
void IRMitsubishiAC::setISee(const bool state) {
_.ISee = state;
}

bool IRMitsubishiAC::getISee(void) const {
return _.ISee;
}

void IRMitsubishiAC::setEcocool(const bool state) {
_.Ecocool = state;
}

bool IRMitsubishiAC::getEcocool(void) const {
return _.Ecocool;
}

void IRMitsubishiAC::setAbsenseDetect(const bool state) {
_.AbsenseDetect = state;
}

bool IRMitsubishiAC::getAbsenseDetect(void) const {
return _.AbsenseDetect;
}

/// Set the requested Direct/Indirect mode. Only works if I-See mode is ON.
/// @param[in] The requested Direct/Indirect mode..
void IRMitsubishiAC::setDirectIndirect(const uint8_t mode) {
if (_.ISee) {
_.DirectIndirect = std::min(mode, kMitsubishiAcDirect); // bounds check
}
else {
_.DirectIndirect = 0;
}
}

/// Get the LDirect/Indirect mode of the A/C.
/// @return The native mode setting.
uint8_t IRMitsubishiAC::getDirectIndirect(void) const {
return _.DirectIndirect;
}

void IRMitsubishiAC::setNaturalFlow(const bool state) {
_.NaturalFlow = state;
}

bool IRMitsubishiAC::getNaturalFlow(void) const{
return _.NaturalFlow;
}


Copy link
Owner

Choose a reason for hiding this comment

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

Style-guide-nitpick: Only two (not four) spaces for each level of indentation please.

}
}

/// Get the LDirect/Indirect mode of the A/C.
Copy link
Owner

Choose a reason for hiding this comment

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

LDirect? typo?

Comment on lines 519 to 524
if (_.ISee) {
_.DirectIndirect = std::min(mode, kMitsubishiAcDirect); // bounds check
}
else {
_.DirectIndirect = 0;
}
Copy link
Owner

Choose a reason for hiding this comment

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

  _.DirectIndirect = _.ISee ? std::min(mode, kMitsubishiAcDirect) : kMitsubishiAcDirectOff;

Comment on lines 290 to 292
/// 1 = set to i-Save when temp=10C on remote.
/// "Temp" byte is not affected by this;
/// 10C temp is implied through other bits.
Copy link
Owner

Choose a reason for hiding this comment

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

Move those comments in/near the procedures in the .cpp file. e.g. Doxygen will automatically turn the comments into documentation for us.

Comment on lines 219 to 227
#ifndef D_STR_DIRECTINDIRECTMODE
#define D_STR_DIRECTINDIRECTMODE "Direct / Indirect mode"
#endif // D_STR_DIRECTINDIRECTMODE
#ifndef D_STR_DIRECT
#define D_STR_DIRECT "Direct"
#endif // D_STR_DIRECT
#ifndef D_STR_INDIRECT
#define D_STR_INDIRECT "Indirect"
#endif // D_STR_INDIRECT
Copy link
Owner

Choose a reason for hiding this comment

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

If we re-order them, we can use the sub-words for the compound term. This can help for internationalisation/translations.

#ifndef D_STR_DIRECT
#define D_STR_DIRECT "Direct"
#endif  // D_STR_DIRECT
#ifndef D_STR_INDIRECT
#define D_STR_INDIRECT "Indirect"
#endif  // D_STR_INDIRECT
#ifndef D_STR_DIRECTINDIRECTMODE
#define D_STR_DIRECTINDIRECTMODE  D_STR_DIRECT" / " D_STR_INDIRECT " mode"
#endif  // D_STR_DIRECTINDIRECTMODE

Comment on lines 252 to 254
#ifndef D_STR_NATURALFLOW
#define D_STR_NATURALFLOW "Natural Flow"
#endif // D_STR_NATURALFLOW
Copy link
Owner

Choose a reason for hiding this comment

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

[Q] What does this feature do? If we can, we want to reuse an existing term/word/name etc to reduce translation effort and to reduce the space required for the strings.

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 used Mitsubishis terminology from the remote and from the user’s manual. In this way it’s consistent for the next (Mitsubishi) user in line.
The functionality is that it just open the airflow from outside without heating or cooling.

Copy link
Owner

Choose a reason for hiding this comment

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

Would kFreshStr be an acceptable alternative? If not, leaving this as is fine. Same argument as Econo vs Ecocool, except "Natural Flow" is even larger/more space 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.

OK, done for both Ecocool and Natural Flow

src/locale/defaults.h Show resolved Hide resolved
@@ -66,6 +66,9 @@
#ifndef D_STR_ECONO
#define D_STR_ECONO "Econo"
#endif // D_STR_ECONO
#ifndef D_STR_ECOCOOL
#define D_STR_ECOCOOL "Ecocool"
Copy link
Owner

Choose a reason for hiding this comment

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

[Q] What does this feature do? If we can, we want to reuse an existing term/word/name etc to reduce translation effort and to reduce the space required for the strings.
e.g. Would Econo be enough?

Copy link
Contributor Author

@ratnick ratnick Nov 23, 2021

Choose a reason for hiding this comment

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

I used Mitsubishis terminology from the remote and from the user’s manual. In this way it’s consistent for the next (Mitsubishi) user in line.
Not sure of the exact functionality, but my guess is that it lowers the power consumption when cooling at the expense of cooling speed. To me, “Econo” can be used for both heating and cooling, and is thus a broader term.

Copy link
Owner

Choose a reason for hiding this comment

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

Please (re)use the "Econo" / D_STR_ECONO / kEconoStr string in your code for this, instead of a new string.
I understand the vendor has a special name for it, but if we did this for every vendor, we would have a dozen names for basically the same mode/setting. That would chew up valuable storage/memory space. e.g. Using kEconoStr instead of the new string, will save at least 8 to 12 bytes of flash. It might not seem like much, but it adds up.

@crankyoldgit
Copy link
Owner

FYI: Linter issues:

src/IRac.h:340:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/IRtext.cpp:86:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
src/IRtext.cpp:87:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
src/ir_Mitsubishi.cpp:403:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/ir_Mitsubishi.cpp:479:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/ir_Mitsubishi.cpp:482:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/ir_Mitsubishi.cpp:522:  An else should appear on the same line as the preceding }  [whitespace/newline] [4]
src/ir_Mitsubishi.cpp:522:  If an else has a brace on one side, it should have it on both  [readability/braces] [5]
src/ir_Mitsubishi.cpp:529:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/ir_Mitsubishi.cpp:537:  Missing space before {  [whitespace/braces] [5]
src/ir_Mitsubishi.h:98:  At least two spaces is best between code and comments  [whitespace/comments] [2]
src/ir_Mitsubishi.h:98:  Should have a space between // and comment  [whitespace/comments] [4]
src/ir_Mitsubishi.h:291:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/ir_Mitsubishi.h:305:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
src/ir_Mitsubishi.h:305:  At least two spaces is best between code and comments  [whitespace/comments] [2]

And the unit tests need to be updated too:
See https://github.com/crankyoldgit/IRremoteESP8266/runs/4205298502?check_suite_focus=true

- removed spaces at end of line
- no lines longer than 80 chars
- changed from 4 to 2 indents
- space between // and comment
- Doxygen comments for all functions
- reordered and reused some strings (defaults.h) as per suggestion
- Updated unit test, expected output
@ratnick
Copy link
Contributor Author

ratnick commented Nov 22, 2021 via email

@crankyoldgit
Copy link
Owner

Unit test errors:

[ RUN      ] TestIRac.Mitsubishi
IRac_test.cpp:1433: Failure
Expected equality of these values:
  expected
    Which is: "Power: On, Mode: 3 (Cool), Temp: 20C, Fan: 2 (Medium), Swing(V): 0 (Auto), Swing(H): 3 (Middle), Clock: 14:30, On Timer: 00:00, Off Timer: 00:00, Timer: -, Weekly Timer: Off"
  ac.toString()
    Which is: "Power: On, Mode: 3 (Cool), Temp: 20C, Fan: 2 (Medium), Swing(V): 0 (Auto), Swing(H): 3 (Middle), Clock: 14:30, On Timer: 00:00, Off Timer: 00:00, Timer: -, Weekly Timer: Off, 10C Heat: Off, ISee: Off, Ecocool: Off, Absense detect: Off, Direct / Indirect Mode: 0, Natural Flow: Off"

&

[ RUN      ] TestMitsubishiACClass.HumanReadable
ir_Mitsubishi_test.cpp:912: Failure
Expected equality of these values:
  "Power: On, Mode: 1 (Heat), Temp: 22C, Fan: 6 (Quiet), " "Swing(V): 0 (Auto), Swing(H): 3 (Middle), " "Clock: 17:10, On Timer: 00:00, Off Timer: 00:00, Timer: -, " "Weekly Timer: Off" ", 10C Heat : Off, ISee : Off, Ecocool : Off, Absense detect : Off, " "Direct / Indirect mode : 0, Natural Flow : Off"
    Which is: "Power: On, Mode: 1 (Heat), Temp: 22C, Fan: 6 (Quiet), Swing(V): 0 (Auto), Swing(H): 3 (Middle), Clock: 17:10, On Timer: 00:00, Off Timer: 00:00, Timer: -, Weekly Timer: Off, 10C Heat : Off, ISee : Off, Ecocool : Off, Absense detect : Off, Direct / Indirect mode : 0, Natural Flow : Off"
  ac.toString()
    Which is: "Power: On, Mode: 1 (Heat), Temp: 22C, Fan: 6 (Quiet), Swing(V): 0 (Auto), Swing(H): 3 (Middle), Clock: 17:10, On Timer: 00:00, Off Timer: 00:00, Timer: -, Weekly Timer: Off, 10C Heat: Off, ISee: Off, Ecocool: Off, Absense detect: Off, Direct / Indirect Mode: 0, Natural Flow: Off"
ir_Mitsubishi_test.cpp:922: Failure
Expected equality of these values:
  "Power: On, Mode: 1 (Heat), Temp: 21.5C, Fan: 6 (Quiet), " "Swing(V): 0 (Auto), Swing(H): 3 (Middle), " "Clock: 17:10, On Timer: 00:00, Off Timer: 00:00, Timer: -, " "Weekly Timer: On" ", 10C Heat : Off, ISee : Off, Ecocool : Off, Absense detect : Off, " "Direct / Indirect mode : 0, Natural Flow : Off"
    Which is: "Power: On, Mode: 1 (Heat), Temp: 21.5C, Fan: 6 (Quiet), Swing(V): 0 (Auto), Swing(H): 3 (Middle), Clock: 17:10, On Timer: 00:00, Off Timer: 00:00, Timer: -, Weekly Timer: On, 10C Heat : Off, ISee : Off, Ecocool : Off, Absense detect : Off, Direct / Indirect mode : 0, Natural Flow : Off"
  ac.toString()
    Which is: "Power: On, Mode: 1 (Heat), Temp: 21.5C, Fan: 6 (Quiet), Swing(V): 0 (Auto), Swing(H): 3 (Middle), Clock: 17:10, On Timer: 00:00, Off Timer: 00:00, Timer: -, Weekly Timer: On, 10C Heat: Off, ISee: Off, Ecocool: Off, Absense detect: Off, Direct / Indirect Mode: 0, Natural Flow: Off"
[ RUN      ] TestDecodeMitsubishiAC.Issue891
ir_Mitsubishi_test.cpp:1437: Failure
Expected equality of these values:
  "Power: Off, Mode: 3 (Cool), Temp: 24C, Fan: 0 (Auto), " "Swing(V): 0 (Auto), Swing(H): 3 (Middle), " "Clock: 00:00, On Timer: 00:00, Off Timer: 00:00, Timer: -, " "Weekly Timer: Off" ", 10C Heat: Off, ISee: Off, Ecocool: Off, Absense detect: Off, " "Direct / Indirect mode: 0, Natural Flow: Off"
    Which is: "Power: Off, Mode: 3 (Cool), Temp: 24C, Fan: 0 (Auto), Swing(V): 0 (Auto), Swing(H): 3 (Middle), Clock: 00:00, On Timer: 00:00, Off Timer: 00:00, Timer: -, Weekly Timer: Off, 10C Heat: Off, ISee: Off, Ecocool: Off, Absense detect: Off, Direct / Indirect mode: 0, Natural Flow: Off"
  ac.toString()
    Which is: "Power: Off, Mode: 3 (Cool), Temp: 24C, Fan: 0 (Auto), Swing(V): 0 (Auto), Swing(H): 3 (Middle), Clock: 00:00, On Timer: 00:00, Off Timer: 00:00, Timer: -, Weekly Timer: Off, 10C Heat: Off, ISee: Off, Ecocool: Off, Absense detect: Off, Direct / Indirect Mode: 0, Natural Flow: Off"
[  FAILED  ] TestDecodeMitsubishiAC.Issue891 (0 ms)

Doxygen errors:

doxygen ./Doxyfile
/github/workspace/src/ir_Mitsubishi.cpp:464: error: argument 'on' of command @param is not found in the argument list of IRMitsubishiAC::setiSave10C(const bool state) (warning treated as error, aborting now)

Linter issues:

src/IRtext.cpp:86:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/IRtext.cpp:88:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/ir_Mitsubishi.cpp:403:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/ir_Mitsubishi.cpp:478:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/ir_Mitsubishi.cpp:481:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/locale/defaults.h:228:  Lines should be <= 80 characters long  [whitespace/line_length] [2]

I'll do a proper re-review and answer your feedback later.

Removed a few line spaces at line end. NOTE: One line is still one char too long.
Corrected argument name in doxygen comment.
@ratnick ratnick requested a review from crankyoldgit November 23, 2021 14:19
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.

Apologies for the delay in reviewing, I've been busy with other stuff lately.

/// i-SAVE only has this 10C functionality when the AC is already in Heat mode. In all other modes, minimum temp is 16C.
/// I have found no other difference between normal Heat mode and i-SAVE other than the ability to go to 10C.
/// In this implementation, i-SAVE mode is ONLY used to enable the AC temperature setting to 10C. Therefore "Temp" is set to 16 disregarding what the remote shows, and mode is set to Heat.
/// Normal minimum temp is 16C, and i-SAVE mode works as a gate to enable AC
Copy link
Owner

Choose a reason for hiding this comment

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

What I'm saying is, please add @note to the start of that line.
i.e.
Change: /// Normal minimum temp is 16C, and i-SAVE mode works as a gate to enable AC to /// @note Normal minimum temp is 16C, and i-SAVE mode works as a gate to enable AC

src/IRac.cpp Outdated
@@ -1553,6 +1554,8 @@ void IRac::mitsubishi(IRMitsubishiAC *ac,
ac->setVane(ac->convertSwingV(swingv));
ac->setWideVane(ac->convertSwingH(swingh));
if (quiet) ac->setFan(kMitsubishiAcFanSilent);
ac->setiSave10C(iSave10C);

Copy link
Owner

Choose a reason for hiding this comment

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

Please remove the blank line at line 1557

/// In this implementation, i-SAVE mode is ONLY used to enable the AC
/// temperature setting to 10C. Therefore "Temp" is set to 16 disregarding
/// what the remote shows, and mode is set to Heat.
void IRMitsubishiAC::setiSave10C(const bool state) {
Copy link
Owner

Choose a reason for hiding this comment

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

Nitpick: Please change the procedure names as follows to comply with the code capitalisation style we use:
e.g.
setiSave10C(...) -> setISave10C(...)
getiSave10C -> getISave10C(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -66,6 +66,9 @@
#ifndef D_STR_ECONO
#define D_STR_ECONO "Econo"
#endif // D_STR_ECONO
#ifndef D_STR_ECOCOOL
#define D_STR_ECOCOOL "Ecocool"
Copy link
Owner

Choose a reason for hiding this comment

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

Please (re)use the "Econo" / D_STR_ECONO / kEconoStr string in your code for this, instead of a new string.
I understand the vendor has a special name for it, but if we did this for every vendor, we would have a dozen names for basically the same mode/setting. That would chew up valuable storage/memory space. e.g. Using kEconoStr instead of the new string, will save at least 8 to 12 bytes of flash. It might not seem like much, but it adds up.

src/locale/defaults.h Show resolved Hide resolved
Comment on lines 252 to 254
#ifndef D_STR_NATURALFLOW
#define D_STR_NATURALFLOW "Natural Flow"
#endif // D_STR_NATURALFLOW
Copy link
Owner

Choose a reason for hiding this comment

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

Would kFreshStr be an acceptable alternative? If not, leaving this as is fine. Same argument as Econo vs Ecocool, except "Natural Flow" is even larger/more space etc.

@crankyoldgit
Copy link
Owner

Waiting on the new commits to be pushed.

"Natural Flow" => "Flow".
"Ecocool" => "Econo".
setiSave() => setISave().
getiSave() => getISave().
blank line in IRac.cpp removed.
"@note" inserted
(No changes to D_STR_IFEEL.)
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.

Just two automated minor issues/changes left, other than that I'm happy:

[ RUN      ] TestIRac.Mitsubishi
IRac_test.cpp:1466: Failure
Expected equality of these values:
  expected
    Which is: "Power: On, Mode: 3 (Cool), Temp: 20C, Fan: 2 (Medium), Swing(V): 0 (Auto), Swing(H): 3 (Middle), Clock: 14:30, On Timer: 00:00, Off Timer: 00:00, Timer: -, Weekly Timer: Off, 10C Heat: Off, ISee: Off, Ecocool: Off, Absense detect: Off, Direct / Indirect Mode: 0, Natural Flow: Off"
  ac.toString()
    Which is: "Power: On, Mode: 3 (Cool), Temp: 20C, Fan: 2 (Medium), Swing(V): 0 (Auto), Swing(H): 3 (Middle), Clock: 14:30, On Timer: 00:00, Off Timer: 00:00, Timer: -, Weekly Timer: Off, 10C Heat: Off, ISee: Off, Econo: Off, Absense detect: Off, Direct / Indirect Mode: 0, Fresh: Off"


/// Set the iSave10C (i-SAVE) mode of the A/C.
/// @param[in] state true, the setting is on. false, the setting is off.
/// @note Normal minimum temp is 16C, and i-SAVE mode works as a gate to enable AC
Copy link
Owner

Choose a reason for hiding this comment

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

Linter issue:
src/ir_Mitsubishi.cpp:465: Lines should be <= 80 characters long [whitespace/line_length] [2]

@ratnick
Copy link
Contributor Author

ratnick commented Nov 30, 2021 via email

@ratnick
Copy link
Contributor Author

ratnick commented Nov 30, 2021 via email

"Natural Flow" => "Flow".
"Ecocool" => "Econo".
setiSave() => setISave().
getiSave() => getISave().
blank line in IRac.cpp removed.
"@note" inserted
(No changes to D_STR_IFEEL.)
@crankyoldgit
Copy link
Owner

Sorry – got it now. Will re-release in 2 min.

Haha, Thanks, I'll approve and merge once the automated tests have finished.

@ratnick
Copy link
Contributor Author

ratnick commented Nov 30, 2021 via email

@crankyoldgit crankyoldgit merged commit 0f2ff14 into crankyoldgit:master Nov 30, 2021
crankyoldgit added a commit that referenced this pull request Dec 31, 2021
_v2.8.1 (20220101)_

**[Bug Fixes]**
- Arduino ESP32 Core v2.0.2+ crashes due to our timer hack. (#1715 #1715)
- SONY: Fix old Sony CD-Player Remote (12 Bit) (#1714)

**[Features]**
- Add tool to convert protocol & code to raw timing info. (#1708 #1707 #1703)
- Add basic support for COOLIX48 protocol. (#1697 #1694)
- MITSUBISHI_AC: Added support for i-SAVE mode. (#1666)
- TOSHIBA_AC: Add Filter setting support. aka. Pure. (#1693 #1692)
- Airton: Add detailed A/C support. (#1688 #1670)

**[Misc]**
- Add a structured library version number. (#1717)
- Workflows Split UnitTests (#1712)
- Reduce time for workflow/Build (#1709)
- Fix some compiler & linter warnings (#1699 #1700)
- Fujitsu: Update supported A/C models (#1690 #1689 #1702 #1701)
- Remove extra `const` qualifier for char pointer (#1704)
- TCL: Update supported devices. (#1698)
- ESP32-C3: Work around for some C3 specific compiler issues. (#1696 #1695)
@crankyoldgit crankyoldgit mentioned this pull request Dec 31, 2021
crankyoldgit added a commit that referenced this pull request Jan 1, 2022
## _v2.8.1 (20220101)_

**[Bug Fixes]**
- Arduino ESP32 Core v2.0.2+ crashes due to our timer hack. (#1715 #1713 )
- SONY: Fix old Sony CD-Player Remote (12 Bit) (#1714)

**[Features]**
- Add tool to convert protocol & code to raw timing info. (#1708 #1707 #1703)
- Add basic support for COOLIX48 protocol. (#1697 #1694)
- MITSUBISHI_AC: Added support for i-SAVE mode. (#1666)
- TOSHIBA_AC: Add Filter setting support. aka. Pure. (#1693 #1692)
- Airton: Add detailed A/C support. (#1688 #1670)

**[Misc]**
- Add a structured library version number. (#1717)
- Workflows Split UnitTests (#1712)
- Reduce time for workflow/Build (#1709)
- Fix some compiler & linter warnings (#1699 #1700)
- Fujitsu: Update supported A/C models (#1690 #1689 #1702 #1701)
- Remove extra `const` qualifier for char pointer (#1704)
- TCL: Update supported devices. (#1698)
- ESP32-C3: Work around for some C3 specific compiler issues. (#1696 #1695)
@crankyoldgit
Copy link
Owner

FYI, the changes mentioned above have now been included in the new v2.8.1 release of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants