Skip to content

Commit

Permalink
Merge pull request #24 from alvikskor/Alex_Dev
Browse files Browse the repository at this point in the history
Alex dev
  • Loading branch information
alvikskor committed Oct 18, 2023
2 parents 47671ae + afe5058 commit 3dd207c
Show file tree
Hide file tree
Showing 33 changed files with 907 additions and 574 deletions.
Binary file not shown.
6 changes: 3 additions & 3 deletions FieryLedLampMultilingual/FieryLedLampMultilingual/Constants.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Поточна версія / Current version : v3.45_sound_Multilingual_IR 112 ефектов
// Поточна версія / Current version : v3.7_sound_Multilingual_IR 112 ефектов
// УВАГА!!! Більшість установок перенесено у файл data/config і може змінюватися в процесі експлуатації лампи.
// Уважно читайте файл ПРОЧИТИ МЕНЕ!!!.txt і ПРОЧТИ МЕНЕ.doc (тут з картинками)

#pragma once

#define FLL_VERSION (" Ver.3.45.112")
#define FLL_VERSION (" Ver.3.7.112")

//#include <ESP8266WebServer.h>

Expand Down Expand Up @@ -385,7 +385,7 @@ static const uint8_t defaultSettings[][3] PROGMEM = {
{ 10, 205, 50}, // Радіальна хвиля
{ 10, 220, 50}, // Мозайка
{ 40, 240, 75}, // Феєрверк 2
{ 15, 200, 51}, // Восьминіг
{ 15, 230, 51}, // Восьминіг
{ 15, 200, 55}, // Краплі на воді
{ 20, 200, 96}, // Чарівний ліхтарик
{ 15, 127, 92}, // Кольоровий Пітон
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ void HTTP_init(void) {
String restart = HTTP.arg("device"); // Получаем значение device из запроса
if (restart == "ok") { // Если значение равно Ок
HTTP.send(200, F("text / plain"), F("Reset OK")); // Oтправляем ответ Reset OK
delay(1000);
ESP.restart(); // перезагружаем модуль
}
else { // иначе
Expand Down
90 changes: 59 additions & 31 deletions FieryLedLampMultilingual/FieryLedLampMultilingual/IR_Receiver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ void IR_Receive_Handle () { // Обробка прийнятого си
if (Enter_Digit_1 && millis() - IR_Dgit_Enter_Timer > IR_DIGIT_ENTER_TIMER){ // Якщо одна цифра натиснута та час очікування натискання другої цифри вийшов
Enter_Digit_1 = 0;
currentMode = eff_num_correct[Enter_Number];
jsonWrite(configSetup, "eff_sel", Enter_Number);
jsonWrite(configSetup, "br", modes[currentMode].Brightness);
jsonWrite(configSetup, "eff_sel", Enter_Number);
jsonWrite(configSetup, "br", modes[currentMode].Brightness);
jsonWrite(configSetup, "sp", modes[currentMode].Speed);
jsonWrite(configSetup, "sc", modes[currentMode].Scale);
FastLED.setBrightness(modes[currentMode].Brightness);
SetBrightness(modes[currentMode].Brightness);
loadingFlag = true;
//settChanged = true;
//eepromTimeout = millis();
Expand Down Expand Up @@ -388,23 +388,27 @@ void IR_Power() {
#ifdef TM1637_USE
clockTicker_blink();
#endif
FastLED.setBrightness(modes[currentMode].Brightness);
SetBrightness(modes[currentMode].Brightness);
changePower();
}
return;
}
else
{
ONflag = !ONflag;
jsonWrite(configSetup, "Power", ONflag);
jsonWrite(configSetup, "Power", ONflag);
if (!ONflag) {
//eepromTimeout = millis() - EEPROM_WRITE_DELAY;
timeout_save_file_changes = millis() - SAVE_FILE_DELAY_TIMEOUT;
if (!FavoritesManager::FavoritesRunning) EepromManager::EepromPut(modes);
save_file_changes = 7;
timeTick();
}
else EepromManager::EepromGet(modes);
else {
EepromManager::EepromGet(modes);
timeout_save_file_changes = millis();
bitSet (save_file_changes, 0);
}
changePower();
}
loadingFlag = true;
Expand All @@ -419,7 +423,12 @@ void IR_Power() {
updateRemoteBlynkParams();
#endif
#ifdef USE_MULTIPLE_LAMPS_CONTROL
multiple_lamp_control ();
if (ONflag) {
repeat_multiple_lamp_control=true;
}
else {
multiple_lamp_control ();
}
#endif //USE_MULTIPLE_LAMPS_CONTROL
}

Expand Down Expand Up @@ -448,6 +457,9 @@ void Mute() { // Вкл / Откл звука
jsonWrite(configSetup, "on_sound", constrain (eff_sound_on,0,1));
timeout_save_file_changes = millis();
bitSet (save_file_changes, 0);
#ifdef USE_MULTIPLE_LAMPS_CONTROL
repeat_multiple_lamp_control = true;
#endif //USE_MULTIPLE_LAMPS_CONTROL
#endif //MP3_TX_PIN
}

Expand All @@ -457,7 +469,7 @@ void Prev_Next_eff(bool direction) {
uint8_t temp = jsonReadtoInt(configSetup, "eff_sel");
if (direction) {
if (Favorit_only)
{
{
uint8_t lastMode = currentMode;
do
{
Expand All @@ -467,13 +479,13 @@ void Prev_Next_eff(bool direction) {
if (currentMode == lastMode) // если ни один режим не добавлен в избранное, всё равно куда-нибудь переключимся
if (++temp >= MODE_AMOUNT) temp = 0;
currentMode = eff_num_correct[temp];
}
}
else
if (++temp >= MODE_AMOUNT) temp = 0;
}
else {
if (Favorit_only)
{
if (Favorit_only)
{
uint8_t lastMode = currentMode;
do
{
Expand All @@ -483,16 +495,16 @@ void Prev_Next_eff(bool direction) {
if (currentMode == lastMode) // если ни один режим не добавлен в избранное, всё равно куда-нибудь переключимся
if (--temp >= MODE_AMOUNT) temp = MODE_AMOUNT - 1;
currentMode = eff_num_correct[temp];
}
else
if (--temp >= MODE_AMOUNT) temp = MODE_AMOUNT - 1;
}
else
if (--temp >= MODE_AMOUNT) temp = MODE_AMOUNT - 1;
}
currentMode = eff_num_correct[temp];
jsonWrite(configSetup, "eff_sel", temp);
jsonWrite(configSetup, "br", modes[currentMode].Brightness);
jsonWrite(configSetup, "eff_sel", temp);
jsonWrite(configSetup, "br", modes[currentMode].Brightness);
jsonWrite(configSetup, "sp", modes[currentMode].Speed);
jsonWrite(configSetup, "sc", modes[currentMode].Scale);
FastLED.setBrightness(modes[currentMode].Brightness);
SetBrightness(modes[currentMode].Brightness);
loadingFlag = true;
//settChanged = true;
//eepromTimeout = millis();
Expand Down Expand Up @@ -521,8 +533,8 @@ void Cycle_on_off() {
if (ONflag) {
uint8_t tmp;
jsonReadtoInt(configSetup, "cycle_on") == 0? tmp = 1 : tmp = 0;
jsonWrite(configSetup, "cycle_on", tmp);
FavoritesManager::FavoritesRunning = tmp;
jsonWrite(configSetup, "cycle_on", tmp);
FavoritesManager::FavoritesRunning = tmp;
if (tmp){
showWarning(CRGB::Blue, 500, 250U); // мигание синим цветом 0.5 секунды
EepromManager::EepromPut(modes);
Expand All @@ -544,8 +556,8 @@ void Cycle_on_off() {
void Bright_Up_Down(bool direction) {
uint8_t delta = IR_Data_Ready == 1 ? 1U : 4U;
modes[currentMode].Brightness = constrain(direction ? modes[currentMode].Brightness + delta : modes[currentMode].Brightness - delta, 1, 255);
jsonWrite(configSetup, "br", modes[currentMode].Brightness);
FastLED.setBrightness(modes[currentMode].Brightness);
jsonWrite(configSetup, "br", modes[currentMode].Brightness);
SetBrightness(modes[currentMode].Brightness);
#ifdef TM1637_USE
DisplayFlag = 3;
Display_Timer(modes[currentMode].Brightness);
Expand All @@ -571,7 +583,7 @@ void Bright_Up_Down(bool direction) {
void Speed_Up_Down(bool direction) {
uint8_t delta = IR_Data_Ready == 1 ? 1U : 4U;
modes[currentMode].Speed = constrain(direction ? modes[currentMode].Speed + delta : modes[currentMode].Speed - delta, 1, 255);
jsonWrite(configSetup, "sp", modes[currentMode].Speed);
jsonWrite(configSetup, "sp", modes[currentMode].Speed);
loadingFlag = true; // без перезапуска эффекта ничего и не увидишь
#ifdef TM1637_USE
DisplayFlag = 3;
Expand All @@ -598,7 +610,7 @@ void Speed_Up_Down(bool direction) {
void Scale_Up_Down(bool direction) {
uint8_t delta = IR_Data_Ready == 1 ? 1U : 2U;
modes[currentMode].Scale = constrain(direction ? modes[currentMode].Scale + delta : modes[currentMode].Scale - delta, 1, 100);
jsonWrite(configSetup, "sc", modes[currentMode].Scale);
jsonWrite(configSetup, "sc", modes[currentMode].Scale);
loadingFlag = true; // без перезапуска эффекта ничего и не увидишь
#ifdef TM1637_USE
DisplayFlag = 3;
Expand Down Expand Up @@ -632,8 +644,9 @@ void Volum_Up_Down (bool direction) {
DisplayFlag = 3;
Display_Timer(eff_volume);
#endif
//timeout_save_file_changes = millis();
//bitSet (save_file_changes, 0);
#ifdef USE_MULTIPLE_LAMPS_CONTROL
repeat_multiple_lamp_control = true;
#endif //USE_MULTIPLE_LAMPS_CONTROL
#endif //MP3_TX_PIN
}

Expand All @@ -645,13 +658,23 @@ void Print_IP() {
{
loadingFlag = true;
while(!fillString(WiFi.localIP().toString().c_str(), CRGB::White, false)) { delay(1); ESP.wdtFeed();}
if (ColorTextFon & (!ONflag || (currentMode == EFF_COLOR && modes[currentMode].Scale < 3))){
FastLED.clear();
delay(1);
FastLED.show();
}
loadingFlag = true;
}
else
{
loadingFlag = true;
String str = "Access Point 192.168.4.1";
while(!fillString(str.c_str(), CRGB::White, false)) { delay(1); ESP.wdtFeed();}
if (ColorTextFon & (!ONflag || (currentMode == EFF_COLOR && modes[currentMode].Scale < 3))){
FastLED.clear();
delay(1);
FastLED.show();
}
loadingFlag = true;
}
#if defined(MOSFET_PIN) && defined(MOSFET_LEVEL) // установка сигнала в пин, управляющий MOSFET транзистором, соответственно состоянию вкл/выкл матрицы или будильника
Expand All @@ -661,11 +684,13 @@ void Print_IP() {

void Folder_Next_Prev(bool direction) {
#ifdef MP3_TX_PIN
if (!pause_on && !mp3_stop && eff_sound_on) {
if (true) { //(!pause_on && !mp3_stop && eff_sound_on) {
CurrentFolder = constrain(direction ? CurrentFolder + 1 : CurrentFolder - 1, 0, 99);
jsonWrite(configSetup, "fold_sel", CurrentFolder);
send_command(0x17,FEEDBACK,0,CurrentFolder); // Попередня папка / Наступна папка
delay(mp3_delay);
if (!pause_on && !mp3_stop && eff_sound_on) {
send_command(0x17,FEEDBACK,0,CurrentFolder); // Включити безперервне відтворення вказаної папки
delay(mp3_delay);
}
}
#ifdef GENERAL_DEBUG
LOG.print (F("\nCurrent folder "));
Expand All @@ -675,6 +700,9 @@ void Folder_Next_Prev(bool direction) {
DisplayFlag = 0;
Display_Timer();
#endif
#ifdef USE_MULTIPLE_LAMPS_CONTROL
repeat_multiple_lamp_control = true;
#endif //USE_MULTIPLE_LAMPS_CONTROL
#endif //MP3_TX_PIN
}

Expand Down Expand Up @@ -743,11 +771,11 @@ void Digit_Handle (uint8_t digit) {
DisplayFlag = 3;
Display_Timer(Enter_Number);
#endif
jsonWrite(configSetup, "eff_sel", Enter_Number);
jsonWrite(configSetup, "br", modes[currentMode].Brightness);
jsonWrite(configSetup, "eff_sel", Enter_Number);
jsonWrite(configSetup, "br", modes[currentMode].Brightness);
jsonWrite(configSetup, "sp", modes[currentMode].Speed);
jsonWrite(configSetup, "sc", modes[currentMode].Scale);
FastLED.setBrightness(modes[currentMode].Brightness);
SetBrightness(modes[currentMode].Brightness);
loadingFlag = true;
//timeout_save_file_changes = millis();
//bitSet (save_file_changes, 0);
Expand Down
12 changes: 6 additions & 6 deletions FieryLedLampMultilingual/FieryLedLampMultilingual/blynk.ino
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void processParams(char *prefix, const char *paramValue)
MqttManager::needToPublish = true;
}
#endif
FastLED.setBrightness(modes[currentMode].Brightness);
SetBrightness(modes[currentMode].Brightness);

updateRemoteBlynkParams();
}
Expand All @@ -186,20 +186,20 @@ void processParams(char *prefix, const char *paramValue)
modes[currentMode].Brightness = 10U;
modes[currentMode].Speed = 99U;
modes[currentMode].Scale = 38U;
jsonWrite(configSetup, "br", modes[currentMode].Brightness);
jsonWrite(configSetup, "sp", modes[currentMode].Speed);
jsonWrite(configSetup, "sc", modes[currentMode].Scale);
jsonWrite(configSetup, "br", modes[currentMode].Brightness);
jsonWrite(configSetup, "sp", modes[currentMode].Speed);
jsonWrite(configSetup, "sc", modes[currentMode].Scale);
otaManager.RequestOtaUpdate();
delay(70);
//if (otaManager.RequestOtaUpdate()) по идее, нужен положительный ответ от менеджера, но он не поступает с первого раза...
otaManager.RequestOtaUpdate();
//{
currentMode = EFF_MATRIX; // принудительное включение режима "Матрица" для индикации перехода в режим обновления по воздуху
jsonWrite(configSetup, "eff_sel", currentMode);
jsonWrite(configSetup, "eff_sel", currentMode);
FastLED.clear();
delay(1);
ONflag = true;
jsonWrite(configSetup, "Power", ONflag);
jsonWrite(configSetup, "Power", ONflag);
changePower();
//}
updateRemoteBlynkParams();
Expand Down
Loading

0 comments on commit 3dd207c

Please sign in to comment.