diff --git a/Android/GyverLamp2.apk b/Android/GyverLamp2.apk index 1cdbdb5..a014e97 100644 Binary files a/Android/GyverLamp2.apk and b/Android/GyverLamp2.apk differ diff --git a/firmware/GyverLamp2_v0.7b/Button.h b/firmware/GyverLamp2_v0.8b/Button.h similarity index 100% rename from firmware/GyverLamp2_v0.7b/Button.h rename to firmware/GyverLamp2_v0.8b/Button.h diff --git a/firmware/GyverLamp2_v0.7b/FFT_C.h b/firmware/GyverLamp2_v0.8b/FFT_C.h similarity index 100% rename from firmware/GyverLamp2_v0.7b/FFT_C.h rename to firmware/GyverLamp2_v0.8b/FFT_C.h diff --git a/firmware/GyverLamp2_v0.7b/FastFilter.h b/firmware/GyverLamp2_v0.8b/FastFilter.h similarity index 100% rename from firmware/GyverLamp2_v0.7b/FastFilter.h rename to firmware/GyverLamp2_v0.8b/FastFilter.h diff --git a/firmware/GyverLamp2_v0.7b/GyverLamp2_v0.7b.ino b/firmware/GyverLamp2_v0.8b/GyverLamp2_v0.8b.ino similarity index 92% rename from firmware/GyverLamp2_v0.7b/GyverLamp2_v0.7b.ino rename to firmware/GyverLamp2_v0.8b/GyverLamp2_v0.8b.ino index 5b01753..cd1d963 100644 --- a/firmware/GyverLamp2_v0.7b/GyverLamp2_v0.7b.ino +++ b/firmware/GyverLamp2_v0.8b/GyverLamp2_v0.8b.ino @@ -31,8 +31,8 @@ const char WiFiPassword[] = "12345678"; // ------------ Прочее ------------- #define MIC_VCC D6 // питание микрофона #define PHOT_VCC D5 // питание фоторезистора -#define EE_TOUT 303000 // таймаут сохранения епром после изменения, мс -#define DEBUG_SERIAL // закомментируй чтобы выключить отладку (скорость 115200) +#define EE_TOUT 30000 // таймаут сохранения епром после изменения, мс +//#define DEBUG_SERIAL // закомментируй чтобы выключить отладку (скорость 115200) #define EE_KEY 40 // ключ сброса WiFi (измени для сброса всех настроек) #define NTP_UPD_PRD 5 // период обновления времени с NTP сервера, минут @@ -89,6 +89,7 @@ void setup() { startWiFi(); // старт вайфай setupTime(); // выставляем время setupADC(); // настраиваем анализ + presetRotation(true); // форсировать смену режима } void loop() { @@ -97,7 +98,7 @@ void loop() { parsing(); // ловим данные yield(); checkEEupdate(); // сохраняем епром - presetRotation(); // смена режимов + presetRotation(0); // смена режимов по расписанию effectsRoutine(); // мигаем yield(); button(); // проверяем кнопку diff --git a/firmware/GyverLamp2_v0.7b/NTPClient-Gyver.cpp b/firmware/GyverLamp2_v0.8b/NTPClient-Gyver.cpp similarity index 100% rename from firmware/GyverLamp2_v0.7b/NTPClient-Gyver.cpp rename to firmware/GyverLamp2_v0.8b/NTPClient-Gyver.cpp diff --git a/firmware/GyverLamp2_v0.7b/NTPClient-Gyver.h b/firmware/GyverLamp2_v0.8b/NTPClient-Gyver.h similarity index 100% rename from firmware/GyverLamp2_v0.7b/NTPClient-Gyver.h rename to firmware/GyverLamp2_v0.8b/NTPClient-Gyver.h diff --git a/firmware/GyverLamp2_v0.7b/Time.h b/firmware/GyverLamp2_v0.8b/Time.h similarity index 100% rename from firmware/GyverLamp2_v0.7b/Time.h rename to firmware/GyverLamp2_v0.8b/Time.h diff --git a/firmware/GyverLamp2_v0.7b/VolAnalyzer.h b/firmware/GyverLamp2_v0.8b/VolAnalyzer.h similarity index 100% rename from firmware/GyverLamp2_v0.7b/VolAnalyzer.h rename to firmware/GyverLamp2_v0.8b/VolAnalyzer.h diff --git a/firmware/GyverLamp2_v0.7b/analog.ino b/firmware/GyverLamp2_v0.8b/analog.ino similarity index 100% rename from firmware/GyverLamp2_v0.7b/analog.ino rename to firmware/GyverLamp2_v0.8b/analog.ino diff --git a/firmware/GyverLamp2_v0.7b/button.ino b/firmware/GyverLamp2_v0.8b/button.ino similarity index 100% rename from firmware/GyverLamp2_v0.7b/button.ino rename to firmware/GyverLamp2_v0.8b/button.ino diff --git a/firmware/GyverLamp2_v0.7b/data.h b/firmware/GyverLamp2_v0.8b/data.h similarity index 100% rename from firmware/GyverLamp2_v0.7b/data.h rename to firmware/GyverLamp2_v0.8b/data.h diff --git a/firmware/GyverLamp2_v0.7b/eeprom.ino b/firmware/GyverLamp2_v0.8b/eeprom.ino similarity index 97% rename from firmware/GyverLamp2_v0.7b/eeprom.ino rename to firmware/GyverLamp2_v0.8b/eeprom.ino index 5df9df1..4de02b4 100644 --- a/firmware/GyverLamp2_v0.7b/eeprom.ino +++ b/firmware/GyverLamp2_v0.8b/eeprom.ino @@ -17,7 +17,7 @@ void EE_startup() { EEPROM.get(sizeof(cfg) + sizeof(dawn), preset); // запускаем всё - trnd.setChannel(cfg.group); + //trnd.setChannel(cfg.group); FastLED.setMaxPowerInVoltsAndMilliamps(STRIP_VOLT, cfg.maxCur * 100); } diff --git a/firmware/GyverLamp2_v0.7b/effects.ino b/firmware/GyverLamp2_v0.8b/effects.ino similarity index 96% rename from firmware/GyverLamp2_v0.7b/effects.ino rename to firmware/GyverLamp2_v0.8b/effects.ino index f0555f2..f6f3135 100644 --- a/firmware/GyverLamp2_v0.7b/effects.ino +++ b/firmware/GyverLamp2_v0.8b/effects.ino @@ -1,15 +1,14 @@ void effectsRoutine() { static timerMillis effTmr(30, true); if (cfg.state && effTmr.isReady()) { - FastLED.setBrightness(getBright()); - int thisLength = getLength(); byte thisScale = getScale(); int thisWidth = (cfg.deviceType > 1) ? cfg.width : 1; + FastLED.setBrightness(getBright()); + switch (CUR_PRES.effect) { case 1: // =================================== ПЕРЛИН =================================== - FastLED.clear(); if (cfg.deviceType > 1) { FOR_j(0, cfg.length) { FOR_i(0, cfg.width) { @@ -32,7 +31,6 @@ void effectsRoutine() { } break; case 2: // ==================================== ЦВЕТ ==================================== - FastLED.clear(); { fill_solid(leds, cfg.length * thisWidth, CHSV(CUR_PRES.color, thisScale, CUR_PRES.min)); CRGB thisColor = CHSV(CUR_PRES.color, thisScale, CUR_PRES.max); @@ -45,7 +43,6 @@ void effectsRoutine() { } break; case 3: // ================================= СМЕНА ЦВЕТА ================================= - FastLED.clear(); { CRGB thisColor = ColorFromPalette(paletteArr[CUR_PRES.palette - 1], (now.weekMs >> 5) * CUR_PRES.speed / 255, CUR_PRES.min, LINEARBLEND); fill_solid(leds, cfg.length * thisWidth, thisColor); @@ -59,7 +56,6 @@ void effectsRoutine() { } break; case 4: // ================================== ГРАДИЕНТ ================================== - FastLED.clear(); if (CUR_PRES.fromCenter) { FOR_i(cfg.length / 2, cfg.length) { byte bright = 255; @@ -88,15 +84,14 @@ void effectsRoutine() { } break; case 5: // =================================== ЧАСТИЦЫ =================================== - //FastLED.clear(); FOR_i(0, cfg.length * cfg.width) leds[i].fadeToBlackBy(70); if (cfg.deviceType > 1) { uint16_t rndVal = 0; FOR_i(0, thisScale / 8) { int thisY = inoise16(i * 100000000ul + (now.weekMs << 6) * CUR_PRES.speed / 255); - thisY = map(thisY, 20000, 45000, 0, cfg.length); + thisY = map(thisY, 10000, 55000, 0, cfg.length); int thisX = inoise16(i * 100000000ul + 2000000000ul + (now.weekMs << 6) * CUR_PRES.speed / 255); - thisX = map(thisX, 20000, 45000, 0, cfg.width); + thisX = map(thisX, 10000, 55000, 0, cfg.width); rndVal = rndVal * 2053 + 13849; // random2053 алгоритм if (thisY >= 0 && thisY < cfg.length && thisX >= 0 && thisX < cfg.width) @@ -106,14 +101,13 @@ void effectsRoutine() { uint16_t rndVal = 0; FOR_i(0, thisScale / 8) { int thisPos = inoise16(i * 100000000ul + (now.weekMs << 6) * CUR_PRES.speed / 255); - thisPos = map(thisPos, 20000, 45000, 0, cfg.length); + thisPos = map(thisPos, 10000, 55000, 0, cfg.length); rndVal = rndVal * 2053 + 13849; // random2053 алгоритм if (thisPos >= 0 && thisPos < cfg.length) leds[thisPos] = CHSV(CUR_PRES.rnd ? rndVal : CUR_PRES.color, 255, 255); } } break; case 6: // ==================================== ОГОНЬ ==================================== - FastLED.clear(); { if (cfg.deviceType > 1) { // 2D огонь fireRoutine(); diff --git a/firmware/GyverLamp2_v0.7b/fastRandom.h b/firmware/GyverLamp2_v0.8b/fastRandom.h similarity index 100% rename from firmware/GyverLamp2_v0.7b/fastRandom.h rename to firmware/GyverLamp2_v0.8b/fastRandom.h diff --git a/firmware/GyverLamp2_v0.7b/fire2D.ino b/firmware/GyverLamp2_v0.8b/fire2D.ino similarity index 100% rename from firmware/GyverLamp2_v0.7b/fire2D.ino rename to firmware/GyverLamp2_v0.8b/fire2D.ino diff --git a/firmware/GyverLamp2_v0.7b/palettes.h b/firmware/GyverLamp2_v0.8b/palettes.h similarity index 100% rename from firmware/GyverLamp2_v0.7b/palettes.h rename to firmware/GyverLamp2_v0.8b/palettes.h diff --git a/firmware/GyverLamp2_v0.7b/parsing.ino b/firmware/GyverLamp2_v0.8b/parsing.ino similarity index 97% rename from firmware/GyverLamp2_v0.7b/parsing.ino rename to firmware/GyverLamp2_v0.8b/parsing.ino index 8c66b1a..2e312ee 100644 --- a/firmware/GyverLamp2_v0.7b/parsing.ino +++ b/firmware/GyverLamp2_v0.8b/parsing.ino @@ -91,6 +91,7 @@ void parsing() { } } EE_updatePreset(); + presetRotation(true); // форсировать смену режима break; case 3: DEBUGLN("Dawn"); @@ -111,6 +112,7 @@ void parsing() { } break; } + FastLED.clear(); // на всякий случай } } } diff --git a/firmware/GyverLamp2_v0.7b/presetManager.ino b/firmware/GyverLamp2_v0.8b/presetManager.ino similarity index 89% rename from firmware/GyverLamp2_v0.7b/presetManager.ino rename to firmware/GyverLamp2_v0.8b/presetManager.ino index caf1700..d8a2259 100644 --- a/firmware/GyverLamp2_v0.7b/presetManager.ino +++ b/firmware/GyverLamp2_v0.8b/presetManager.ino @@ -1,5 +1,5 @@ -void presetRotation() { - if (cfg.rotation && now.newMin()) { // если автосмена и новая минута +void presetRotation(bool force) { + if (cfg.rotation && (now.newMin() || force)) { // если автосмена и новая минута if (cfg.rotRnd) { // случайная cfg.curPreset = trnd.fromMin(cfg.rotPeriod, cfg.presetAmount); DEBUG("Rnd changed to "); diff --git a/firmware/GyverLamp2_v0.7b/startup.ino b/firmware/GyverLamp2_v0.8b/startup.ino similarity index 98% rename from firmware/GyverLamp2_v0.7b/startup.ino rename to firmware/GyverLamp2_v0.8b/startup.ino index 9fb3c6c..28ffdc6 100644 --- a/firmware/GyverLamp2_v0.7b/startup.ino +++ b/firmware/GyverLamp2_v0.8b/startup.ino @@ -58,9 +58,7 @@ void checkGroup() { } if (flag) { EEPROM.put(0, cfg); - EEPROM.commit(); - delay(100); - ESP.reset(); + EEPROM.commit(); } DEBUG("group: "); DEBUGLN(cfg.group); diff --git a/firmware/GyverLamp2_v0.7b/time.ino b/firmware/GyverLamp2_v0.8b/time.ino similarity index 100% rename from firmware/GyverLamp2_v0.7b/time.ino rename to firmware/GyverLamp2_v0.8b/time.ino diff --git a/firmware/GyverLamp2_v0.7b/timeRandom.h b/firmware/GyverLamp2_v0.8b/timeRandom.h similarity index 100% rename from firmware/GyverLamp2_v0.7b/timeRandom.h rename to firmware/GyverLamp2_v0.8b/timeRandom.h diff --git a/firmware/GyverLamp2_v0.7b/timerMillis.h b/firmware/GyverLamp2_v0.8b/timerMillis.h similarity index 100% rename from firmware/GyverLamp2_v0.7b/timerMillis.h rename to firmware/GyverLamp2_v0.8b/timerMillis.h