мигрирует с raw на nec
This commit is contained in:
parent
2394f772f4
commit
52871cc149
@ -13,38 +13,19 @@ private:
|
|||||||
|
|
||||||
IRsend *irsend;
|
IRsend *irsend;
|
||||||
|
|
||||||
const uint16_t RDOn[67] = {
|
const uint32_t RDOn = irsend->encodeNEC(0x80, 0x1);
|
||||||
9080,4270, 680,470, 680,420, 680,420, 680,470, 680,420, 680,420, 680,420, 730,1470, 730,1520, 680,1520, 730,1470, 730,1470, 730,1520, 680,1520, 730,1470, 730,420, 680,1520, 730,420, 680,420, 680,420, 730,420, 680,420, 680,420, 730,420, 680,420, 680,1520, 680,1520, 730,1470, 730,1470, 730,1520, 730,1470, 730,1470, 730};
|
|
||||||
|
|
||||||
const uint16_t RDOff[67] = {
|
const uint32_t RDOff = irsend->encodeNEC(0x80, 0x1A);
|
||||||
9030,4320, 630,470, 680,420, 680,470, 630,470, 680,420, 680,470, 630,470, 680,1520, 680,1570, 630,1570, 630,1570, 680,1520, 680,1570, 630,1570, 680,1520, 680,470, 630,470, 680,1520, 680,370, 730,1570, 630,1570, 680,420, 680,470, 630,470, 680,1520, 680,470, 630,1570, 680,420, 680,470, 630,1570, 680,1520, 680,1570, 630};
|
|
||||||
|
|
||||||
const uint16_t RDButtonCenter[67] = {
|
const uint32_t RDButtonCenter = irsend->encodeNEC(0x80, 0x5);
|
||||||
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] = {
|
const uint32_t RDBrightnessUp = irsend->encodeNEC(0x80, 0x12);
|
||||||
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] = {
|
const uint32_t RDBrightnessDown = irsend->encodeNEC(0x80, 0x1E);
|
||||||
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};
|
|
||||||
|
|
||||||
const uint16_t RDButtonA[67] = {8980,4370, 630,470, 680,470, 630,470, 630,470, 630,520, 630,470, 630,470, 630,1620, 630,1570, 630,1620, 580,1570, 630,1620, 630,1570, 630,1570, 630,1570, 680,470, 630,1570, 630,1570, 630,1620, 630,470, 630,470, 630,470, 680,470, 630,470, 630,470, 680,470, 630,470, 630,1570, 630,1620, 630,1570, 630,1570, 630,1570, 630};
|
const uint32_t RDButtonA = irsend->encodeNEC(0x80, 0x7);
|
||||||
|
|
||||||
const uint16_t RDButtonB[67] = {9030,4320, 630,520, 580,520, 630,470, 630,470, 680,470, 580,520, 630,470, 680,1570, 630,1570, 630,1570, 630,1570, 630,1620, 580,1620, 630,1570, 630,1620, 580,520, 580,520, 630,470, 680,470, 630,1570, 630,470, 630,520, 580,520, 630,470, 630,1620, 630,1570, 630,1570, 630,470, 680,1570, 630,1570, 630,1570, 630,1570, 680};
|
const uint32_t RDButtonB = irsend->encodeNEC(0x80, 0x8);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IRLight(int pin);
|
explicit IRLight(int pin);
|
||||||
|
@ -19,12 +19,12 @@ void IRLight::setState(bool state) {
|
|||||||
|
|
||||||
void IRLight::on() {
|
void IRLight::on() {
|
||||||
state = true;
|
state = true;
|
||||||
irsend->sendRaw(RDOn, 67, 38);
|
irsend->sendNEC(RDOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRLight::off() {
|
void IRLight::off() {
|
||||||
state = false;
|
state = false;
|
||||||
irsend->sendRaw(RDOff, 67, 38);
|
irsend->sendNEC(RDOff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRLight::setBrightness(int newBrightness) {
|
void IRLight::setBrightness(int newBrightness) {
|
||||||
@ -46,15 +46,15 @@ void IRLight::setColorTemperature(int color) {
|
|||||||
if (color < 208) {
|
if (color < 208) {
|
||||||
color_temp = 2;
|
color_temp = 2;
|
||||||
brightness = 14;
|
brightness = 14;
|
||||||
irsend->sendRaw(RDButtonB, 67, 38);
|
irsend->sendNEC(RDButtonB);
|
||||||
} else if (color < 294) {
|
} else if (color < 294) {
|
||||||
color_temp = 1;
|
color_temp = 1;
|
||||||
brightness = 14;
|
brightness = 14;
|
||||||
irsend->sendRaw(RDButtonCenter, 67, 38);
|
irsend->sendNEC(RDButtonCenter);
|
||||||
} else {
|
} else {
|
||||||
color_temp = 0;
|
color_temp = 0;
|
||||||
brightness = 14;
|
brightness = 14;
|
||||||
irsend->sendRaw(RDButtonA, 67, 38);
|
irsend->sendNEC(RDButtonA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,14 +74,14 @@ int IRLight::getColorTemperature() {
|
|||||||
void IRLight::brightnessUp() {
|
void IRLight::brightnessUp() {
|
||||||
if (brightness < getBrightnessScale()) {
|
if (brightness < getBrightnessScale()) {
|
||||||
brightness++;
|
brightness++;
|
||||||
irsend->sendRaw(RDBrightnessUp, 67, 38);
|
irsend->sendNEC(RDBrightnessUp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRLight::brightnessDown() {
|
void IRLight::brightnessDown() {
|
||||||
if (brightness > 0) {
|
if (brightness > 0) {
|
||||||
brightness--;
|
brightness--;
|
||||||
irsend->sendRaw(RDBrightnessDown, 67, 38);
|
irsend->sendNEC(RDBrightnessDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ void IRLight::begin() {
|
|||||||
irsend->begin();
|
irsend->begin();
|
||||||
brightness = 14;
|
brightness = 14;
|
||||||
color_temp = 1;
|
color_temp = 1;
|
||||||
irsend->sendRaw(RDButtonCenter, 67, 38);
|
irsend->sendNEC(RDButtonCenter);
|
||||||
delay(500);
|
delay(500);
|
||||||
off();
|
off();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user