29 uint8_t remote_state[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00};
35 remote_state[2] = 0x20;
36 remote_state[3] = 0x50;
41 remote_state[2] = 0x60;
42 remote_state[3] = 0x50;
47 remote_state[5] = 0x40;
50 remote_state[0] |= (1 << 6);
59 remote_state[2] = 0x20;
60 remote_state[3] = 0x50;
61 remote_state[6] = 0x20;
64 remote_state[0] |= (1 << 6);
74 remote_state[2] = (remote_state[2] & 0x0F) | this->
mode_bits_;
79 remote_state[2] |= GREE_FAN_TURBO_BIT;
82 if (this->
preset_() == GREE_PRESET_SLEEP) {
83 remote_state[0] |= GREE_PRESET_SLEEP_BIT;
89 remote_state[7] = ((remote_state[0] << 4) + (remote_state[1] << 4) + 0xC0);
92 ((((remote_state[0] & 0x0F) + (remote_state[1] & 0x0F) + (remote_state[2] & 0x0F) + (remote_state[3] & 0x0F) +
93 ((remote_state[4] & 0xF0) >> 4) + ((remote_state[5] & 0xF0) >> 4) + ((remote_state[6] & 0xF0) >> 4) + 0x0A) &
98 ((((remote_state[0] & 0x0F) + (remote_state[1] & 0x0F) + (remote_state[2] & 0x0F) + (remote_state[3] & 0x0F) +
99 ((remote_state[5] & 0xF0) >> 4) + ((remote_state[6] & 0xF0) >> 4) + ((remote_state[7] & 0xF0) >> 4) + 0x0A) &
102 (remote_state[7] & 0x0F);
109 data->mark(GREE_HEADER_MARK);
111 data->space(GREE_YAC1FB9_HEADER_SPACE);
113 data->space(GREE_HEADER_SPACE);
116 for (
int i = 0; i < 4; i++) {
117 for (uint8_t mask = 1; mask > 0; mask <<= 1) {
118 data->mark(GREE_BIT_MARK);
119 bool bit = remote_state[i] & mask;
120 data->space(bit ? GREE_ONE_SPACE : GREE_ZERO_SPACE);
124 data->mark(GREE_BIT_MARK);
125 data->space(GREE_ZERO_SPACE);
126 data->mark(GREE_BIT_MARK);
127 data->space(GREE_ONE_SPACE);
128 data->mark(GREE_BIT_MARK);
129 data->space(GREE_ZERO_SPACE);
131 data->mark(GREE_BIT_MARK);
133 data->space(GREE_YAC1FB9_MESSAGE_SPACE);
135 data->space(GREE_MESSAGE_SPACE);
138 for (
int i = 4; i < 8; i++) {
139 for (uint8_t mask = 1; mask > 0; mask <<= 1) {
140 data->mark(GREE_BIT_MARK);
141 bool bit = remote_state[i] & mask;
142 data->space(bit ? GREE_ONE_SPACE : GREE_ZERO_SPACE);
146 data->mark(GREE_BIT_MARK);