Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gree: Fix reporting vertical swing (#2125)
toCommonSwingV() is only called when SwingAuto is false, but it converts kGreeSwingLastPos to kAuto. It doesn't make sense, because: 1. kGreeSwingLastPos means that swinging is stopped (i.e. the shutter remains in its last position), which corresponds to kOff. 2. kAuto shouldn't be returned from this function at all, because it's handled separately in toCommon() when SwingAuto is true. 3. As can be seen in setSwingVertical(), when automatic is false, the valid set of positions includes kGreeSwingLastPos, but not kGreeSwingAuto. Fix the logic by amending toCommonSwingV() according to the considerations above. It fixes parsing of received IR packets when the user disables vertical swinging from the remote (tested with YAP1FB). For consistency and robustness, educate setSwingVertical() and convertSwingV() about the supported kGreeSwingLastPos mode. Add a unit test for the described bug.
- Loading branch information