2022-06-05 10:14:23 +03:00
|
|
|
#pragma once
|
|
|
|
|
2022-12-30 18:31:20 +03:00
|
|
|
#include <ESP8266WiFi.h>
|
2022-06-05 10:14:23 +03:00
|
|
|
#include <IRremoteESP8266.h>
|
|
|
|
#include <IRsend.h>
|
2022-12-30 18:31:20 +03:00
|
|
|
#include <HALightBrightness.hpp>
|
2022-06-05 10:14:23 +03:00
|
|
|
|
2022-12-30 18:31:20 +03:00
|
|
|
class IRLight: public HALightBrightnessController {
|
2022-06-05 10:14:23 +03:00
|
|
|
private:
|
|
|
|
bool state;
|
2022-12-30 18:31:20 +03:00
|
|
|
short brightness;
|
|
|
|
|
2022-06-05 10:14:23 +03:00
|
|
|
IRsend *irsend;
|
|
|
|
|
2022-12-30 18:31:20 +03:00
|
|
|
const uint16_t RDOn[67] = {
|
2022-06-05 10:14:23 +03:00
|
|
|
8980, 4420, 580, 520, 630, 470, 630, 520, 580, 520, 630, 470,
|
|
|
|
630, 520, 580, 520, 630, 1570, 630, 1620, 580, 1620, 630, 1620,
|
|
|
|
580, 1570, 680, 1570, 630, 1570, 630, 1570, 630, 520, 630, 1570,
|
|
|
|
630, 470, 630, 520, 630, 470, 630, 470, 630, 470, 680, 470,
|
|
|
|
630, 470, 630, 520, 630, 1570, 630, 1570, 630, 1620, 630, 1570,
|
|
|
|
630, 1570, 630, 1570, 680, 1570, 630};
|
|
|
|
|
2022-12-30 18:31:20 +03:00
|
|
|
const uint16_t RDOff[67] = {
|
2022-06-05 10:14:23 +03:00
|
|
|
8980, 4370, 680, 420, 730, 420, 680, 420, 680, 420, 730, 420,
|
|
|
|
680, 420, 680, 420, 730, 1470, 730, 1520, 680, 1520, 730, 1470,
|
|
|
|
730, 1470, 730, 1520, 680, 1520, 730, 1470, 730, 420, 680, 470,
|
|
|
|
680, 1470, 730, 420, 680, 1520, 730, 1470, 730, 420, 680, 420,
|
|
|
|
680, 470, 580, 1620, 630, 470, 630, 1570, 630, 520, 580, 520,
|
|
|
|
630, 1570, 680, 1520, 730, 1520, 680};
|
|
|
|
|
2022-12-30 18:31:20 +03:00
|
|
|
const uint16_t RDCentralButton[67] = {
|
|
|
|
9030, 4320, 680, 470, 630, 470, 680, 420, 680, 470, 630, 470,
|
|
|
|
680, 420, 680, 470, 630, 1570, 680, 1520, 680, 1520, 680, 1520,
|
|
|
|
730, 1520, 680, 1520, 680, 1520, 680, 1570, 680, 420, 680, 1520,
|
|
|
|
680, 470, 680, 1520, 680, 470, 630, 470, 680, 420, 680, 470,
|
|
|
|
630, 470, 630, 470, 680, 1520, 680, 470, 680, 1520, 630, 1570,
|
|
|
|
680, 1520, 680, 1570, 680, 1520, 680};
|
|
|
|
|
|
|
|
const uint16_t RDBrightnessUp[67] = {
|
|
|
|
9080,4270, 730,420, 680,420, 680,420, 730,420, 680,420, 680,420, 730,420,
|
|
|
|
680,1520, 680,1520, 730,1470, 730,1470, 730,1520, 680,1520, 730,1470,
|
|
|
|
730,1520, 680,420, 680,470, 580,1620, 580,520, 630,520, 580,1620, 580,520,
|
|
|
|
630,520, 580,520, 630,1570, 580,570, 580,1570, 630,1620, 630,520, 580,1570,
|
|
|
|
730,1520, 680,1520, 730};
|
|
|
|
|
|
|
|
const uint16_t RDBrightnessDown[67] = {
|
|
|
|
9030, 4320, 630, 520, 630, 470, 630, 470, 630, 520, 630, 470,
|
|
|
|
630, 470, 630, 520, 630, 1570, 630, 1570, 630, 1620, 630, 1570,
|
|
|
|
630, 1570, 630, 1620, 630, 1570, 630, 1570, 630, 470, 680, 470,
|
|
|
|
630, 1570, 630, 1570, 680, 1570, 630, 1570, 630, 470, 680, 470,
|
|
|
|
630, 470, 630, 1570, 680, 470, 630, 470, 630, 470, 680, 470,
|
|
|
|
630, 1570, 630, 1570, 680, 1570, 630};
|
|
|
|
|
2022-06-05 10:14:23 +03:00
|
|
|
public:
|
|
|
|
IRLight(int pin);
|
|
|
|
IRLight(IRsend *irsend);
|
2022-12-30 18:31:20 +03:00
|
|
|
|
|
|
|
void setState(bool state);
|
|
|
|
bool getState();
|
2022-06-05 10:14:23 +03:00
|
|
|
void on();
|
|
|
|
void off();
|
|
|
|
|
2022-12-30 18:31:20 +03:00
|
|
|
void setBrightness(int brightness);
|
|
|
|
int getBrightness();
|
|
|
|
|
|
|
|
void brightnessUp();
|
|
|
|
void brightnessDown();
|
|
|
|
int getBrightnessScale();
|
|
|
|
|
|
|
|
void begin();
|
2022-06-05 10:14:23 +03:00
|
|
|
|
|
|
|
~IRLight();
|
|
|
|
};
|