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