mirror of
https://github.com/gunner47/GyverLamp.git
synced 2025-08-08 09:20:59 +03:00
upd
This commit is contained in:
@@ -127,6 +127,9 @@ void setup() {
|
|||||||
FastLED.clear();
|
FastLED.clear();
|
||||||
FastLED.show();
|
FastLED.show();
|
||||||
randomSeed(analogRead(0)); // пинаем генератор случайных чисел
|
randomSeed(analogRead(0)); // пинаем генератор случайных чисел
|
||||||
|
touch.setStepTimeout(100);
|
||||||
|
touch.setClickTimeout(500);
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
// WI-FI
|
// WI-FI
|
||||||
@@ -189,8 +192,7 @@ void setup() {
|
|||||||
Udp.write(reply);
|
Udp.write(reply);
|
||||||
Udp.endPacket();
|
Udp.endPacket();
|
||||||
|
|
||||||
timeClient.begin();
|
timeClient.begin();
|
||||||
touch.setStepTimeout(100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
@@ -17,17 +17,18 @@ void buttonTick() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (touch.isDouble()) {
|
if (ONflag && touch.isDouble()) {
|
||||||
if (++currentMode >= MODE_AMOUNT) currentMode = 0;
|
if (++currentMode >= MODE_AMOUNT) currentMode = 0;
|
||||||
|
FastLED.setBrightness(modes[currentMode].brightness);
|
||||||
loadingFlag = true;
|
loadingFlag = true;
|
||||||
settChanged = true;
|
settChanged = true;
|
||||||
eepromTimer = millis();
|
eepromTimer = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (touch.isHolded()) {
|
if (ONflag && touch.isHolded()) {
|
||||||
brightDirection = !brightDirection;
|
brightDirection = !brightDirection;
|
||||||
}
|
}
|
||||||
if (touch.isStep()) {
|
if (ONflag && touch.isStep()) {
|
||||||
if (brightDirection) {
|
if (brightDirection) {
|
||||||
if (modes[currentMode].brightness < 250) modes[currentMode].brightness += 5;
|
if (modes[currentMode].brightness < 250) modes[currentMode].brightness += 5;
|
||||||
else modes[currentMode].brightness = 255;
|
else modes[currentMode].brightness = 255;
|
||||||
|
@@ -45,7 +45,7 @@ void effectsTick() {
|
|||||||
void changePower() {
|
void changePower() {
|
||||||
if (ONflag) {
|
if (ONflag) {
|
||||||
effectsTick();
|
effectsTick();
|
||||||
for (int i = 0; i < modes[currentMode].brightness; i += 5) {
|
for (int i = 0; i < modes[currentMode].brightness; i += 8) {
|
||||||
FastLED.setBrightness(i);
|
FastLED.setBrightness(i);
|
||||||
delay(1);
|
delay(1);
|
||||||
FastLED.show();
|
FastLED.show();
|
||||||
@@ -54,7 +54,7 @@ void changePower() {
|
|||||||
FastLED.show();
|
FastLED.show();
|
||||||
} else {
|
} else {
|
||||||
effectsTick();
|
effectsTick();
|
||||||
for (int i = modes[currentMode].brightness; i > 8; i -= 5) {
|
for (int i = modes[currentMode].brightness; i > 8; i -= 8) {
|
||||||
FastLED.setBrightness(i);
|
FastLED.setBrightness(i);
|
||||||
delay(1);
|
delay(1);
|
||||||
FastLED.show();
|
FastLED.show();
|
||||||
|
@@ -14,6 +14,7 @@ void parseUDP() {
|
|||||||
currentMode = (byte)inputBuffer.substring(3).toInt();
|
currentMode = (byte)inputBuffer.substring(3).toInt();
|
||||||
loadingFlag = true;
|
loadingFlag = true;
|
||||||
sendCurrent();
|
sendCurrent();
|
||||||
|
FastLED.setBrightness(modes[currentMode].brightness);
|
||||||
} else if (inputBuffer.startsWith("BRI")) {
|
} else if (inputBuffer.startsWith("BRI")) {
|
||||||
modes[currentMode].brightness = inputBuffer.substring(3).toInt();
|
modes[currentMode].brightness = inputBuffer.substring(3).toInt();
|
||||||
FastLED.setBrightness(modes[currentMode].brightness);
|
FastLED.setBrightness(modes[currentMode].brightness);
|
||||||
|
Reference in New Issue
Block a user