Skip to content
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
10 changes: 10 additions & 0 deletions src/ir_Mitsubishi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,16 @@ uint8_t IRMitsubishiAC::getWideVane(void) const {
return _.WideVane;
}

/// Set the requested Left Vane (Vertical Swing) operation mode of the a/c unit.
Copy link
Owner

Choose a reason for hiding this comment

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

Is it "Vertical Swing" or "Horizontal Swing"? Your description Mitsubishi144Protocol (VaneLeft) indicates it's a "SwingH(Left)". Hence the question.

Copy link
Contributor Author

@hideosasaki hideosasaki Aug 25, 2021

Choose a reason for hiding this comment

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

it's Vertical Swing. The comment was wrong. See the attached photo on the first post.

/// @param[in] position The position/mode to set the vane to.
void IRMitsubishiAC::setVaneLeft(const uint8_t position) {
_.VaneLeft = std::min(position, kMitsubishiAcVaneAutoMove); // bounds check
}

/// Get the Left Vane (Vertical Swing) 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.

Ditto other comment.

/// @return The native position/mode setting.
uint8_t IRMitsubishiAC::getVaneLeft(void) const { return _.VaneLeft; }

/// Get the clock time of the A/C unit.
/// @return Nr. of 10 minute increments past midnight.
/// @note 1 = 1/6 hour (10 minutes). e.g. 4pm = 48.
Expand Down
13 changes: 11 additions & 2 deletions src/ir_Mitsubishi.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
// Brand: Mitsubishi Electric, Model: RH151/M21ED6426 remote (MITSUBISHI_AC)
// Brand: Mitsubishi Electric, Model: MSZ-SF25VE3 A/C (MITSUBISHI_AC)
// Brand: Mitsubishi Electric, Model: SG15D remote (MITSUBISHI_AC)
// Brand: Mitsubishi Electric, Model: MSZ-ZW4017S A/C (MITSUBISHI_AC)

#ifndef IR_MITSUBISHI_H_
#define IR_MITSUBISHI_H_
Expand Down Expand Up @@ -84,8 +85,14 @@ union Mitsubishi144Protocol{
uint8_t Timer :3;
uint8_t WeeklyTimer :1;
uint8_t :4;
// Byte 14~16
uint8_t pad1[3];
// Byte 14
uint8_t :8;
// Byte 15
uint8_t :8;
// Byte 16
uint8_t :3;
uint8_t VaneLeft :3; // SwingV(Left)
uint8_t :2;
// Byte 17
uint8_t Sum :8;
};
Expand Down Expand Up @@ -271,6 +278,8 @@ class IRMitsubishiAC {
void setWideVane(const uint8_t position);
uint8_t getVane(void) const;
uint8_t getWideVane(void) const;
void setVaneLeft(const uint8_t position);
uint8_t getVaneLeft(void) const;
uint8_t* getRaw(void);
void setRaw(const uint8_t* data);
uint8_t getClock(void) const;
Expand Down
29 changes: 25 additions & 4 deletions test/ir_Mitsubishi_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,26 @@ TEST(TestMitsubishiACClass, VaneMode) {
EXPECT_EQ(kMitsubishiAcVaneAutoMove - 1, ac.getVane());
}

TEST(TestMitsubishiACClass, VaneLeft) {
IRMitsubishiAC ac(kGpioUnused);
ac.begin();

ac.setVaneLeft(kMitsubishiAcVaneAuto);
EXPECT_EQ(kMitsubishiAcVaneAuto, ac.getVaneLeft());

ac.setVaneLeft(kMitsubishiAcVaneAuto + 1);
EXPECT_EQ(kMitsubishiAcVaneAuto + 1, ac.getVaneLeft());

ac.setVaneLeft(kMitsubishiAcVaneAutoMove);
EXPECT_EQ(kMitsubishiAcVaneAutoMove, ac.getVaneLeft());

ac.setVaneLeft(kMitsubishiAcVaneAutoMove + 1);
EXPECT_EQ(kMitsubishiAcVaneAutoMove, ac.getVaneLeft());

ac.setVaneLeft(kMitsubishiAcVaneAutoMove - 1);
EXPECT_EQ(kMitsubishiAcVaneAutoMove - 1, ac.getVaneLeft());
}

TEST(TestMitsubishiACClass, FanSpeed) {
IRMitsubishiAC ac(kGpioUnused);
ac.begin();
Expand Down Expand Up @@ -697,6 +717,7 @@ TEST(TestMitsubishiACClass, MessageConstuction) {
ac.setMode(kMitsubishiAcCool);
ac.setTemp(27);
ac.setVane(3);
ac.setVaneLeft(2);
ac.on();

// Check everything for kicks.
Expand Down Expand Up @@ -727,8 +748,8 @@ TEST(TestMitsubishiACClass, MessageConstuction) {
"m450s420m450s420m450s420m450s420m450s420m450s420m450s420m450s420"
"m450s420m450s420m450s420m450s420m450s420m450s420m450s420m450s420"
"m450s420m450s420m450s420m450s420m450s420m450s420m450s420m450s420"
"m450s420m450s420m450s420m450s420m450s420m450s420m450s420m450s420"
"m450s420m450s1300m450s1300m450s1300m450s420m450s420m450s1300m450s420"
"m450s420m450s420m450s420m450s420m450s1300m450s420m450s420m450s420"
"m450s420m450s1300m450s1300m450s1300m450s1300m450s420m450s1300m450s420"
"m440s17100"
"m3400s1750"
"m450s1300m450s1300m450s420m450s420m450s420m450s1300m450s420m450s420"
Expand All @@ -747,8 +768,8 @@ TEST(TestMitsubishiACClass, MessageConstuction) {
"m450s420m450s420m450s420m450s420m450s420m450s420m450s420m450s420"
"m450s420m450s420m450s420m450s420m450s420m450s420m450s420m450s420"
"m450s420m450s420m450s420m450s420m450s420m450s420m450s420m450s420"
"m450s420m450s420m450s420m450s420m450s420m450s420m450s420m450s420"
"m450s420m450s1300m450s1300m450s1300m450s420m450s420m450s1300m450s420"
"m450s420m450s420m450s420m450s420m450s1300m450s420m450s420m450s420"
"m450s420m450s1300m450s1300m450s1300m450s1300m450s420m450s1300m450s420"
"m440s17100",
irsend.outputStr());
}
Expand Down