@@ -315,8 +315,7 @@ IRSanyoAc::IRSanyoAc(const uint16_t pin, const bool inverted,
315315 const bool use_modulation)
316316 : _irsend(pin, inverted, use_modulation) { stateReset (); }
317317
318- // / Reset the state of the remote to a known good state/sequence.
319- // / @see https://docs.google.com/spreadsheets/d/1dYfLsnYvpjV-SgO8pdinpfuBIpSzm8Q1R5SabrLeskw/edit?ts=5f0190a5#gid=1050142776&range=A2:B2
318+ // / Reset the state of the remote to a known state/sequence.
320319void IRSanyoAc::stateReset (void ) {
321320 static const uint8_t kReset [kSanyoAcStateLength ] = {
322321 0x6A , 0x6D , 0x51 , 0x00 , 0x10 , 0x45 , 0x00 , 0x00 , 0x33 };
@@ -748,7 +747,7 @@ IRSanyoAc88::IRSanyoAc88(const uint16_t pin, const bool inverted,
748747// / @see https://docs.google.com/spreadsheets/d/1dYfLsnYvpjV-SgO8pdinpfuBIpSzm8Q1R5SabrLeskw/edit?ts=5f0190a5#gid=1050142776&range=A2:B2
749748void IRSanyoAc88::stateReset (void ) {
750749 static const uint8_t kReset [kSanyoAc88StateLength ] = {
751- 0xAA , 0x55 , 0xA0 , 0x16 , 0x0F , 0x21 , 0x01 , 0x01 , 0x00 , 0x00 , 0x10 };
750+ 0xAA , 0x55 , 0xA0 , 0x16 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x10 };
752751 std::memcpy (_.raw , kReset , kSanyoAc88StateLength );
753752}
754753
@@ -874,6 +873,21 @@ uint8_t IRSanyoAc88::convertFan(const stdAc::fanspeed_t speed) {
874873 }
875874}
876875
876+ // / Get the current clock time.
877+ // / @return The time as the nr. of minutes past midnight.
878+ uint16_t IRSanyoAc88::getClock (void ) const {
879+ return _.ClockHrs * 60 + _.ClockMins ;
880+ }
881+
882+ // / Set the current clock time.
883+ // / @param[in] mins_since_midnight The time as nr. of minutes past midnight.
884+ void IRSanyoAc88::setClock (const uint16_t mins_since_midnight) {
885+ uint16_t mins = std::min (mins_since_midnight, (uint16_t )(23 * 60 + 59 ));
886+ _.ClockMins = mins % 60 ;
887+ _.ClockHrs = mins / 60 ;
888+ _.ClockSecs = 0 ;
889+ }
890+
877891// / Convert a native fan speed into its stdAc equivalent.
878892// / @param[in] spd The native setting to be converted.
879893// / @return The stdAc equivalent of the native setting.
@@ -933,22 +947,22 @@ stdAc::state_t IRSanyoAc88::toCommon(void) const {
933947 result.filter = _.Filter ;
934948 result.turbo = _.Turbo ;
935949 result.sleep = _.Sleep ? 0 : -1 ;
950+ result.clock = getClock ();
936951 // Not supported.
937952 result.swingh = stdAc::swingh_t ::kOff ;
938953 result.econo = false ;
939954 result.light = false ;
940955 result.quiet = false ;
941956 result.beep = false ;
942957 result.clean = false ;
943- result.clock = -1 ;
944958 return result;
945959}
946960
947961// / Convert the current internal state into a human readable string.
948962// / @return A human readable string.
949963String IRSanyoAc88::toString (void ) const {
950964 String result = " " ;
951- result.reserve (100 );
965+ result.reserve (115 );
952966 result += addBoolToString (getPower (), kPowerStr , false );
953967 result += addModeToString (_.Mode , kSanyoAc88Auto , kSanyoAc88Cool ,
954968 kSanyoAc88Heat , kSanyoAc88Auto , kSanyoAc88Fan );
@@ -959,5 +973,6 @@ String IRSanyoAc88::toString(void) const {
959973 result += addBoolToString (_.SwingV , kSwingVStr );
960974 result += addBoolToString (_.Turbo , kTurboStr );
961975 result += addBoolToString (_.Sleep , kSleepStr );
976+ result += addLabeledString (minsToString (getClock ()), kClockStr );
962977 return result;
963978}
0 commit comments