forked from gal-m/ESP-32-AirConditioner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFanAccessory.cpp
More file actions
20 lines (17 loc) · 730 Bytes
/
Copy pathFanAccessory.cpp
File metadata and controls
20 lines (17 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "FanAccessory.h"
FanAccessory::FanAccessory(IRController *irCtrl)
: irController(irCtrl) {
active = new Characteristic::Active(0, true);
swingMode = new Characteristic::SwingMode(0, true);
fanRotationSpeed = new Characteristic::RotationSpeed(25, true);
currentFanState = new Characteristic::CurrentFanState(0, true);
rotationDirection = new Characteristic::RotationDirection(0, true);
fanRotationSpeed->setRange(0, 100, 33);
irController->setFanCharacteristics(fanRotationSpeed, rotationDirection);
}
boolean FanAccessory::update() {
int fanSpeed = fanRotationSpeed->getNewVal();
bool direction = rotationDirection->getNewVal();
irController->sendFanCommand(fanSpeed, direction);
return true;
}