MCPcopy Create free account
hub / github.com/Arduino-IRremote/Arduino-IRremote / sendTemperatureFanSpeedAndMode

Method sendTemperatureFanSpeedAndMode

src/ac_LG.hpp:263–314  ·  view source on GitHub ↗

* Takes values from static variables */

Source from the content-addressed store, hash-verified

261 * Takes values from static variables
262 */
263void Aircondition_LG::sendTemperatureFanSpeedAndMode() {
264
265 uint8_t tTemperature = Temperature;
266 INFO_PRINT(F("Send temperature="));
267 INFO_PRINT(tTemperature);
268 INFO_PRINT(F(" fan intensity="));
269 INFO_PRINT(FanIntensity);
270 INFO_PRINT(F(" mode="));
271 INFO_PRINTLN((char )Mode);
272
273
274 WordUnion tIRCommand;
275 tIRCommand.UWord = 0;
276
277 // Temperature is coded in the upper nibble of the LowByte
278 tIRCommand.UByte.LowByte = ((tTemperature - 15) << 4); // 16 -> 0x00, 18 -> 0x30, 30 -> 0xF0
279
280 // Fan intensity is coded in the lower nibble of the LowByte
281 if (ACIsWallType) {
282 tIRCommand.UByte.LowByte |= AC_FAN_WALL[FanIntensity];
283 } else {
284 tIRCommand.UByte.LowByte |= AC_FAN_TOWER[FanIntensity];
285 }
286
287 switch (Mode) {
288 case AC_MODE_COOLING:
289 tIRCommand.UByte.HighByte = LG_MODE_COOLING >> 8;
290 break;
291 case AC_MODE_HEATING:
292 tIRCommand.UByte.HighByte = LG_MODE_HEATING >> 8;
293 break;
294 case AC_MODE_AUTO:
295 tIRCommand.UByte.HighByte = LG_MODE_AUTO >> 8;
296 break;
297 case AC_MODE_FAN:
298 tTemperature = 18;
299 tIRCommand.UByte.HighByte = LG_MODE_FAN >> 8;
300 break;
301 case AC_MODE_DEHUMIDIFIYING:
302 tIRCommand.UWord = LG_MODE_DEHUMIDIFIYING;
303 break;
304 default:
305 break;
306 }
307 if (!PowerIsOn) {
308 // switch on requires masked bit
309 tIRCommand.UByte.HighByte &= ~(LG_SWITCH_ON_MASK >> 8);
310 }
311 PowerIsOn = true;
312
313 sendIRCommand(tIRCommand.UWord);
314}
315
316/** @}*/
317#include "LocalDebugLevelEnd.h"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected