Repository: AlexGyver/GyverLamp2 Branch: main Commit: 145fbfb99bd7 Files: 204 Total size: 1.2 MB Directory structure: gitextract_ayibu_de/ ├── .gitattributes ├── Android/ │ ├── GyverLamp2.aia │ ├── GyverLamp2.apk │ └── Исходник собран в App Inventor.txt ├── README.md ├── docs/ │ └── Протокол/ │ ├── GyverLamp2_UDP.txt │ └── GyverLamp_UDP.xlsx ├── firmware/ │ ├── GyverLamp2/ │ │ ├── 0_func.ino │ │ ├── Button.h │ │ ├── Clap.h │ │ ├── FFT_C.h │ │ ├── FastFilter.h │ │ ├── GyverLamp2.ino │ │ ├── NTPClient-Gyver.cpp │ │ ├── NTPClient-Gyver.h │ │ ├── Time.h │ │ ├── VolAnalyzer.h │ │ ├── analog.ino │ │ ├── button.ino │ │ ├── data.h │ │ ├── eeprom.ino │ │ ├── effects.ino │ │ ├── fastRandom.h │ │ ├── fire2020.ino │ │ ├── fire2D.ino │ │ ├── mString.h │ │ ├── palettes.h │ │ ├── parsing.ino │ │ ├── presetManager.ino │ │ ├── startup.ino │ │ ├── time.ino │ │ ├── timeRandom.h │ │ └── timerMillis.h │ └── PlatformIO/ │ ├── .gitignore │ ├── .vscode/ │ │ ├── extensions.json │ │ └── settings.json │ ├── README.md │ ├── include/ │ │ └── README │ ├── lib/ │ │ └── README │ ├── platformio.ini │ └── test/ │ └── README └── libraries/ └── FastLED-3.4.0/ ├── .gitignore ├── LICENSE ├── PORTING.md ├── README.md ├── component.mk ├── docs/ │ ├── Doxyfile │ └── mainpage.dox ├── examples/ │ ├── AnalogOutput/ │ │ └── AnalogOutput.ino │ ├── Blink/ │ │ └── Blink.ino │ ├── ColorPalette/ │ │ └── ColorPalette.ino │ ├── ColorTemperature/ │ │ └── ColorTemperature.ino │ ├── Cylon/ │ │ └── Cylon.ino │ ├── DemoReel100/ │ │ └── DemoReel100.ino │ ├── Fire2012/ │ │ └── Fire2012.ino │ ├── Fire2012WithPalette/ │ │ └── Fire2012WithPalette.ino │ ├── FirstLight/ │ │ └── FirstLight.ino │ ├── Multiple/ │ │ ├── ArrayOfLedArrays/ │ │ │ └── ArrayOfLedArrays.ino │ │ ├── MirroringSample/ │ │ │ └── MirroringSample.ino │ │ ├── MultiArrays/ │ │ │ └── MultiArrays.ino │ │ ├── MultipleStripsInOneArray/ │ │ │ └── MultipleStripsInOneArray.ino │ │ ├── OctoWS2811Demo/ │ │ │ └── OctoWS2811Demo.ino │ │ └── ParallelOutputDemo/ │ │ └── ParallelOutputDemo.ino │ ├── Noise/ │ │ └── Noise.ino │ ├── NoisePlayground/ │ │ └── NoisePlayground.ino │ ├── NoisePlusPalette/ │ │ └── NoisePlusPalette.ino │ ├── Pacifica/ │ │ └── Pacifica.ino │ ├── Pintest/ │ │ └── Pintest.ino │ ├── Ports/ │ │ └── PJRCSpectrumAnalyzer/ │ │ └── PJRCSpectrumAnalyzer.ino │ ├── Pride2015/ │ │ └── Pride2015.ino │ ├── RGBCalibrate/ │ │ └── RGBCalibrate.ino │ ├── RGBSetDemo/ │ │ └── RGBSetDemo.ino │ ├── SmartMatrix/ │ │ └── SmartMatrix.ino │ ├── TwinkleFox/ │ │ └── TwinkleFox.ino │ └── XYMatrix/ │ └── XYMatrix.ino ├── extras/ │ ├── AppleII.s65 │ ├── FastLED6502.s65 │ └── RainbowDemo.s65 ├── keywords.txt ├── library.json ├── library.properties ├── release_notes.md └── src/ ├── FastLED.cpp ├── FastLED.h ├── bitswap.cpp ├── bitswap.h ├── chipsets.h ├── color.h ├── colorpalettes.cpp ├── colorpalettes.h ├── colorutils.cpp ├── colorutils.h ├── controller.h ├── cpp_compat.h ├── dmx.h ├── fastled_config.h ├── fastled_delay.h ├── fastled_progmem.h ├── fastpin.h ├── fastspi.h ├── fastspi_bitbang.h ├── fastspi_dma.h ├── fastspi_nop.h ├── fastspi_ref.h ├── fastspi_types.h ├── hsv2rgb.cpp ├── hsv2rgb.h ├── led_sysdefs.h ├── lib8tion/ │ ├── math8.h │ ├── random8.h │ ├── scale8.h │ └── trig8.h ├── lib8tion.cpp ├── lib8tion.h ├── noise.cpp ├── noise.h ├── pixelset.h ├── pixeltypes.h ├── platforms/ │ ├── apollo3/ │ │ ├── clockless_apollo3.h │ │ ├── fastled_apollo3.h │ │ ├── fastpin_apollo3.h │ │ ├── fastspi_apollo3.h │ │ └── led_sysdefs_apollo3.h │ ├── arm/ │ │ ├── common/ │ │ │ └── m0clockless.h │ │ ├── d21/ │ │ │ ├── clockless_arm_d21.h │ │ │ ├── fastled_arm_d21.h │ │ │ ├── fastpin_arm_d21.h │ │ │ └── led_sysdefs_arm_d21.h │ │ ├── d51/ │ │ │ ├── README.txt │ │ │ ├── clockless_arm_d51.h │ │ │ ├── fastled_arm_d51.h │ │ │ ├── fastpin_arm_d51.h │ │ │ └── led_sysdefs_arm_d51.h │ │ ├── k20/ │ │ │ ├── clockless_arm_k20.h │ │ │ ├── clockless_block_arm_k20.h │ │ │ ├── fastled_arm_k20.h │ │ │ ├── fastpin_arm_k20.h │ │ │ ├── fastspi_arm_k20.h │ │ │ ├── led_sysdefs_arm_k20.h │ │ │ ├── octows2811_controller.h │ │ │ ├── smartmatrix_t3.h │ │ │ └── ws2812serial_controller.h │ │ ├── k66/ │ │ │ ├── clockless_arm_k66.h │ │ │ ├── clockless_block_arm_k66.h │ │ │ ├── fastled_arm_k66.h │ │ │ ├── fastpin_arm_k66.h │ │ │ ├── fastspi_arm_k66.h │ │ │ └── led_sysdefs_arm_k66.h │ │ ├── kl26/ │ │ │ ├── clockless_arm_kl26.h │ │ │ ├── fastled_arm_kl26.h │ │ │ ├── fastpin_arm_kl26.h │ │ │ ├── fastspi_arm_kl26.h │ │ │ └── led_sysdefs_arm_kl26.h │ │ ├── mxrt1062/ │ │ │ ├── block_clockless_arm_mxrt1062.h │ │ │ ├── clockless_arm_mxrt1062.h │ │ │ ├── fastled_arm_mxrt1062.h │ │ │ ├── fastpin_arm_mxrt1062.h │ │ │ ├── fastspi_arm_mxrt1062.h │ │ │ └── led_sysdefs_arm_mxrt1062.h │ │ ├── nrf51/ │ │ │ ├── clockless_arm_nrf51.h │ │ │ ├── fastled_arm_nrf51.h │ │ │ ├── fastpin_arm_nrf51.h │ │ │ ├── fastspi_arm_nrf51.h │ │ │ └── led_sysdefs_arm_nrf51.h │ │ ├── nrf52/ │ │ │ ├── arbiter_nrf52.h │ │ │ ├── clockless_arm_nrf52.h │ │ │ ├── fastled_arm_nrf52.h │ │ │ ├── fastpin_arm_nrf52.h │ │ │ ├── fastpin_arm_nrf52_variants.h │ │ │ ├── fastspi_arm_nrf52.h │ │ │ └── led_sysdefs_arm_nrf52.h │ │ ├── sam/ │ │ │ ├── clockless_arm_sam.h │ │ │ ├── clockless_block_arm_sam.h │ │ │ ├── fastled_arm_sam.h │ │ │ ├── fastpin_arm_sam.h │ │ │ ├── fastspi_arm_sam.h │ │ │ └── led_sysdefs_arm_sam.h │ │ └── stm32/ │ │ ├── clockless_arm_stm32.h │ │ ├── cm3_regs.h │ │ ├── fastled_arm_stm32.h │ │ ├── fastpin_arm_stm32.h │ │ └── led_sysdefs_arm_stm32.h │ ├── avr/ │ │ ├── clockless_trinket.h │ │ ├── fastled_avr.h │ │ ├── fastpin_avr.h │ │ ├── fastspi_avr.h │ │ └── led_sysdefs_avr.h │ └── esp/ │ ├── 32/ │ │ ├── clockless_block_esp32.h │ │ ├── clockless_i2s_esp32.h │ │ ├── clockless_rmt_esp32.cpp │ │ ├── clockless_rmt_esp32.h │ │ ├── fastled_esp32.h │ │ ├── fastpin_esp32.h │ │ └── led_sysdefs_esp32.h │ └── 8266/ │ ├── clockless_block_esp8266.h │ ├── clockless_esp8266.h │ ├── fastled_esp8266.h │ ├── fastpin_esp8266.h │ └── led_sysdefs_esp8266.h ├── platforms.cpp ├── platforms.h ├── power_mgt.cpp ├── power_mgt.h └── wiring.cpp ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitattributes ================================================ # Auto detect text files and perform LF normalization * text=auto ================================================ FILE: Android/Исходник собран в App Inventor.txt ================================================ ================================================ FILE: README.md ================================================ # GyverLamp2 ![Logo](/docs/banner2.png) ## Отличия от первой версии GyverLamp: - Возможность объединять устройства в группы с синхронизированными эффектами и их автоматическим переключением - Возможность создать свой список режимов для каждой группы устройств - Конструктор режимов, позволяющий получить несколько сотен уникальных эффектов - Минимум настроек в прошивке, всё настраивается из приложения - Гибкие настройки сети, позволяющие на лету менять точки подключения, адресацию и роли - Светомузыка - реакция на звук может быть наложена на любой эффект несколькими способами - Адаптивная яркость благодаря датчику освещённости - Режим работы по расписанию и таймер выключения для группы устройств - Мультиязычное приложение со встроенными инструкциями и подсказками - Простая и удобная загрузка прошивки (скомпилированный файл), прошивка возможна даже со смартфона! - Обновление прошивки «по воздуху» из приложения (требуется подключение к Интернет) - Схема как у первой версии, перепаивать электронику не нужно (без учёта микрофона и датчика освещённости) - Автоматическое определение типа кнопки - Устройство может работать без кнопки, все важные настройки можно сделать с приложения Сеть: - Работа в локальной сети роутера (все устройства подключаются к роутеру) - Работа в локальной сети одной лампы (все устройства подключаются к одной лампе) Время: - Устройства подключаются к Интернету через роутер и запрашивают текущее время - Работа по расписанию: час включения и час выключения - Таймер выключения - Будильник-рассвет на каждый день недели Тип устройства: - GyverLamp2 может работать как с лентами, так и с матрицами различной конструкции Адресация: - Объединение устройств в группы с индивидуальным набором настроек и режимов - Роли Master и Slave: состояние и яркость Slave устройств подчиняется Master устройству при ручном управлении Режимы: - Каждой группе может быть задан свой набор режимов работы - Режим представляет собой эффект и его настройки (сам эффект, реакция на звук, яркость, скорость и т.д.) - Ручное переключение режимов кнопкой или из приложения (для всех устройств в группе) - Автоматическое по порядку с установленным периодом (для всех устройств в группе) - Автоматическое в случайном порядке с установленным периодом (для всех устройств в группе) - Режимы синхронизированы: все устройства группы показывают один и тот же режим в любой момент времени Эффекты: - 7 базовых эффектов, у каждого есть индивидуальные настройки - У некоторых эффектов возможен выбор цветовой палитры из 25 доступных - Эффекты синхронизированы у всех устройств в группе Реакция на звук: - При подключении микрофона все режимы могут работать как светомузыка - Реакция на общую громкость, отдельно низкие и отдельно высокие частоты - Реакция на звук может менять яркость режима, а также некоторые настройки эффекта Автоматическая яркость: - Есть возможность подключить датчик освещённости для автоматической настройки яркости лампы Будильник-рассвет: - Подключенная к роутеру группа может будить в установленное время плавным рассветом - Можно настроить время конкретные дни недели, а также яркость рассвета ================================================ FILE: docs/Протокол/GyverLamp2_UDP.txt ================================================ Отправляем на адрес x.x.x.255, первые 3 октета - адрес сети, к которой подключен смартфон Порт UDP формируется из имени сети: GLkey = "ключ" portNum = 17; // uint16_t (или % 65536) for (byte i = 0; i < длина ключа; i++) portNum *= GLkey[i]; portNum %= 15000; portNum += 50000; portNum += номер группы Таким образом порт лежит в диапазоне 50 001... 65 010 UDP пакет вида ,<тип>,<дата1>,<дата2>... разделитель - запятая ================================================ FILE: firmware/GyverLamp2/0_func.ino ================================================ void sendUDP(char *data) { Udp.beginPacket(broadIP, portNum + cfg.group); Udp.write(data); Udp.endPacket(); } void sendUDP(byte cmd, int data1 = 0, int data2 = 0, int data3 = 0) { char reply[20] = ""; mString packet(reply); packet = packet + "GL," + cmd + ',' + data1 + ',' + data2 + ',' + data3; sendUDP(reply); //DEBUG("Sending: "); //DEBUGLN(cmd); } void iAmOnline() { if (onlineTmr.isReady()) { char reply[10] = "GL_ONL"; mString packet(reply); packet += cfg.curPreset; sendUDP(reply); } } void restartUDP() { Udp.stop(); Udp.begin(portNum + cfg.group); broadIP = WiFi.localIP(); broadIP[3] = 255; DEBUG("UDP port: "); DEBUGLN(portNum + cfg.group); } void blink16(CRGB color) { FOR_i(0, 3) { fill_solid(leds, 16, color); FastLED.show(); delay(300); FastLED.clear(); FastLED.show(); delay(300); } } const uint8_t font5x7[][5] = { {0x3e, 0x51, 0x49, 0x45, 0x3e}, // 0 0x30 48 {0x00, 0x42, 0x7f, 0x40, 0x00}, // 1 0x31 49 {0x42, 0x61, 0x51, 0x49, 0x46}, // 2 0x32 50 {0x21, 0x41, 0x45, 0x4b, 0x31}, // 3 0x33 51 {0x18, 0x14, 0x12, 0x7f, 0x10}, // 4 0x34 52 {0x27, 0x45, 0x45, 0x45, 0x39}, // 5 0x35 53 {0x3c, 0x4a, 0x49, 0x49, 0x30}, // 6 0x36 54 {0x01, 0x71, 0x09, 0x05, 0x03}, // 7 0x37 55 {0x36, 0x49, 0x49, 0x49, 0x36}, // 8 0x38 56 {0x06, 0x49, 0x49, 0x29, 0x1e}, // 9 0x39 57 {0x00, 0x08, 0x08, 0x08, 0x00}, // 10 - {0x00, 0x00, 0x00, 0x00, 0x00}, // 11 empty }; void drawDigit(byte digit, int X, int Y, CRGB color) { FOR_i(0, 5) { FOR_j(0, 7) { if (font5x7[digit][i] & (1 << 6 - j)) setPix(i + X, j + Y, color); } } } void drawDots(int X, int Y, CRGB color) { setPix(X, Y + 2, color); setPix(X, Y + 4, color); } void drawClock(byte Y, byte speed, CRGB color) { if (cfg.deviceType == 1) return; // лента - на выход byte h1, h2, m1, m2; if (gotNTP || gotTime) { h1 = now.hour / 10; if (h1 == 0) h1 = 11; h2 = now.hour % 10; m1 = now.min / 10; m2 = now.min % 10; } else { h1 = h2 = m1 = m2 = 10; } int pos; if (speed == 0) pos = cfg.width / 2 - 13; else pos = cfg.width - (now.weekMs / (speed * 2)) % (cfg.width + 26); drawDigit(h1, pos, Y, color); drawDigit(h2, pos + 6, Y, color); if (now.getMs() < 500) drawDots(pos + 12, Y, color); drawDigit(m1, pos + 14, Y, color); drawDigit(m2, pos + 20, Y, color); } ================================================ FILE: firmware/GyverLamp2/Button.h ================================================ #pragma once #define BTN_DEB 100 #define BTN_HOLD 800 // (пин, инверт), инверт 1 - для pullup, 0 - для pulldown class Button { public: Button (byte pin) : _pin(pin) { pinMode(_pin, INPUT_PULLUP); } void setLevel(bool inv) { _inv = inv; } void tick() { uint32_t deb = millis() - _tmr; if (state()) { if (_flag && deb > BTN_HOLD) _hold = 1; if (!_flag && deb > BTN_DEB) _flag = 1; } else { if (_flag) { _flag = _hold = 0; if (deb < BTN_HOLD) _click = 1; } _tmr = millis(); } } bool state() { return (digitalRead(_pin) ^ _inv); } bool isHold() { return _hold; } bool isClick() { if (_click) { _click = 0; return 1; } return 0; } private: const byte _pin; bool _inv = 1; uint32_t _tmr = 0; bool _flag = 0, _click = 0, _hold = 0; }; ================================================ FILE: firmware/GyverLamp2/Clap.h ================================================ #pragma once #include class Clap { public: void tick(int val) { if (millis() - _tmr >= 10) { _tmr = millis(); int der = val - _prevVal; _prevVal = val; int signal = 0; int front = 0; if (der > _trsh) signal = 1; if (der < -_trsh) signal = -1; if (_prevSignal == 0 && signal == 1) front = 1; if (_prevSignal == 0 && signal == -1) front = -1; _prevSignal = signal; uint32_t deb = millis() - _tmr2; if (front == 1 && _state == 0) { _state = 1; if (!_startClap) { _claps = 0; _ready = 0; } _startClap = 1; _clap = 0; _tmr2 = millis(); } else if (front == -1 && _state == 1 && deb <= 200) { _state = 2; _tmr2 = millis(); } else if (front == 0 && _state == 2 && deb <= 200) { _state = 0; _claps++; _clap = 1; _tmr2 = millis(); } else if (_startClap && deb > _tout) { _state = 0; _startClap = 0; if (_claps != 0) _ready = 1; } } } void setTrsh(int trsh) { _trsh = trsh; } void setTimeout(int tout) { _tout = tout; } bool isClap() { if (_clap) { _clap = 0; return 1; } return 0; } bool hasClaps(byte claps) { if (_ready && _claps == claps) { _ready = 0; _claps = 0; return 1; } return 0; } bool hasClaps() { return _ready; } byte getClaps() { if (_ready) { _ready = 0; byte buf = _claps; _claps = 0; return buf; } return 0; } private: uint32_t _tmr = 0, _tmr2 = 0; int _prevVal = 0; int _trsh = 150; byte _state = 0; int8_t _prevSignal = 0; int _tout = 700; byte _claps = 0; bool _ready = 0; bool _clap = 0; bool _startClap = 0; }; ================================================ FILE: firmware/GyverLamp2/FFT_C.h ================================================ #pragma once #define FFT_SIZE 64 // размер выборки (кратно степени 2) static float sinF[] = {0.0, -1.0, -0.707107, -0.382683, -0.195090, -0.098017, -0.049068, -0.024541, -0.012272, -0.006136}; void FFT(int* AVal, int* FTvl) { int i, j, m, Mmax, Istp, count = 0; float Tmpr, Tmpi, Tmvl[FFT_SIZE * 2]; float Wpr, Wr, Wi; for (i = 0; i < FFT_SIZE * 2; i += 2) { Tmvl[i] = 0; Tmvl[i + 1] = AVal[i / 2]; } i = j = 1; while (i < FFT_SIZE * 2) { if (j > i) { Tmpr = Tmvl[i]; Tmvl[i] = Tmvl[j]; Tmvl[j] = Tmpr; Tmpr = Tmvl[i + 1]; Tmvl[i + 1] = Tmvl[j + 1]; Tmvl[j + 1] = Tmpr; } i = i + 2; m = FFT_SIZE; while ((m >= 2) && (j > m)) { j = j - m; m = m >> 1; } j = j + m; } Mmax = 2; while (FFT_SIZE * 2 > Mmax) { Wpr = sinF[count + 1] * sinF[count + 1] * 2; Istp = Mmax * 2; Wr = 1; Wi = 0; m = 1; while (m < Mmax) { i = m; m = m + 2; Tmpr = Wr; Tmpi = Wi; Wr += -Tmpr * Wpr - Tmpi * sinF[count]; Wi += Tmpr * sinF[count] - Tmpi * Wpr; while (i < FFT_SIZE * 2) { j = i + Mmax; Tmpr = Wr * Tmvl[j] - Wi * Tmvl[j - 1]; Tmpi = Wi * Tmvl[j] + Wr * Tmvl[j - 1]; Tmvl[j] = Tmvl[i] - Tmpr; Tmvl[j - 1] = Tmvl[i - 1] - Tmpi; Tmvl[i] = Tmvl[i] + Tmpr; Tmvl[i - 1] = Tmvl[i - 1] + Tmpi; i = i + Istp; } } count++; Mmax = Istp; } for (i = 0; i < FFT_SIZE; i++) { j = i * 2; FTvl[i] = (int)(Tmvl[j] * Tmvl[j] + Tmvl[j + 1] * Tmvl[j + 1]) >> 18; } } // по мотивам https://ru.wikibooks.org/wiki/%D0%A0%D0%B5%D0%B0%D0%BB%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D0%B8_%D0%B0%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC%D0%BE%D0%B2/%D0%91%D1%8B%D1%81%D1%82%D1%80%D0%BE%D0%B5_%D0%BF%D1%80%D0%B5%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5_%D0%A4%D1%83%D1%80%D1%8C%D0%B5 ================================================ FILE: firmware/GyverLamp2/FastFilter.h ================================================ #pragma once #include #define FF_SCALE 0 #define FF_PASS_MAX 1 #define FF_PASS_MIN 2 class FastFilter { public: FastFilter(byte k = 20, int dt = 0) { setK(k); setDt(dt); } void setK(byte k) { _k1 = k; _k2 = 32 - k; } void setDt(int dt) { _dt = dt; } void setPass(byte pass) { _pass = pass; } void setRaw(int raw) { _raw = raw; } void setFil(int fil) { _raw_f = fil; } bool checkPass(int val) { if (_pass == FF_PASS_MAX && val > _raw_f) { _raw_f = val; return 1; } else if (_pass == FF_PASS_MIN && val < _raw_f) { _raw_f = val; return 1; } return 0; } void compute() { if (_dt == 0 || millis() - _tmr >= _dt) { _tmr = millis(); _raw_f = (_k1 * _raw_f + _k2 * _raw) >> 5; } } long getFil() { return _raw_f; } long getRaw() { return _raw; } private: uint32_t _tmr = 0; int _dt = 0; byte _k1 = 20, _k2 = 12; byte _pass = 0; int _raw_f = 0, _raw = 0; }; ================================================ FILE: firmware/GyverLamp2/GyverLamp2.ino ================================================ /* ВНИМАНИЕ! ВНИМАНИЕ! ВНИМАНИЕ! ВНИМАНИЕ! ВНИМАНИЕ! ВНИМАНИЕ! ВНИМАНИЕ! ДЛЯ КОМПИЛЯЦИИ ПРОШИВКИ ПОД NODEMCU/WEMOS/ESP01/ESP12 ВЫБИРАТЬ Инструменты / Плата Generic ESP8266 Инструменты / Flash Size 4MB (FS:2MB OTA) CPU Frequency / 160 MHz (рекомендуется для стабильности светомузыки!!!) При прошивке с других прошивок лампы поставить: Инструменты/Erase Flash/All Flash Contents ESP core 2.7.4+ http://arduino.esp8266.com/stable/package_esp8266com_index.json FastLED 3.4.0+ https://github.com/FastLED/FastLED/releases */ /* Версия 0.23b Поправлена яркость рассвета Компилится на версии ядра esp v3 TODO: Upload -> Применить Длина огня в светомуз? Плавная смена режимов Mqtt Базовый пак Поддержка куба Погода https://it4it.club/topic/40-esp8266-i-parsing-pogodyi-s-openweathermap/ */ // ---------- Настройки ----------- #define GL_KEY "GL" // ключ сети // ------------ Кнопка ------------- #define BTN_PIN 4 // пин кнопки GPIO4 (D2 на wemos/node), 0 для схемы с ESP-01 #define USE_BTN 1 // 1 использовать кнопку, 0 нет // ------------- АЦП -------------- #define USE_ADC 1 // можно выпилить АЦП #define USE_CLAP 1 // два хлопка в ладоши вкл выкл лампу #define MIC_VCC 12 // питание микрофона GPIO12 (D6 на wemos/node) #define PHOT_VCC 14 // питание фоторезистора GPIO14 (D5 на wemos/node) // ------------ Лента ------------- #define STRIP_PIN 2 // пин ленты GPIO2 (D4 на wemos/node), GPIO5 (D1) для module #define MAX_LEDS 300 // макс. светодиодов #define STRIP_CHIP WS2812 // чип ленты #define STRIP_COLOR GRB // порядок цветов в ленте #define STRIP_VOLT 5 // напряжение ленты, V /* WS2811, GBR, 12V WS2812, GRB, 5V WS2813, GRB, 5V WS2815, GRB, 12V WS2818, RGB, 12V */ // ------------ WiFi AP ------------ const char AP_NameChar[] = "GyverLamp2"; const char WiFiPassword[] = "12345678"; // ------------ Прочее ------------- #define GL_VERSION 23 // код версии прошивки #define EE_TOUT 30000 // таймаут сохранения епром после изменения, мс #define DEBUG_SERIAL_LAMP // закомментируй чтобы выключить отладку (скорость 115200) #define EE_KEY 56 // ключ сброса eeprom #define NTP_UPD_PRD 5 // период обновления времени с NTP сервера, минут //#define SKIP_WIFI // пропустить подключение к вафле (для отладки) // ------------ БИЛДЕР ------------- #define GL_BUILD 0 // 0: com 300, 1: com 900, 2: esp1 300, 3: esp1 900, 4: module 300, 5: module 900 #if (GL_BUILD == 0) #elif (GL_BUILD == 1) #define MAX_LEDS 900 #elif (GL_BUILD == 2) #define MAX_LEDS 300 #define BTN_PIN 0 #define STRIP_PIN 2 #define USE_ADC 0 #elif (GL_BUILD == 3) #define MAX_LEDS 900 #define BTN_PIN 0 #define STRIP_PIN 2 #define USE_ADC 0 #elif (GL_BUILD == 4) #define MAX_LEDS 300 #define STRIP_PIN 5 #elif (GL_BUILD == 5) #define MAX_LEDS 900 #define STRIP_PIN 5 #endif // ---------- БИБЛИОТЕКИ ----------- //#define FASTLED_ALLOW_INTERRUPTS 0 #include "data.h" // данные #include "Time.h" // часы #include "timeRandom.h" // случайные числа по времени //#include "fastRandom.h" // быстрый рандом #include "Button.h" // библа кнопки #include "palettes.h" // палитры #include "NTPClient-Gyver.h" // сервер времени (модиф) #include "timerMillis.h" // таймер миллис #include "VolAnalyzer.h" // анализатор громкости #include "FFT_C.h" // фурье #include // лента #include // базовая либа есп #include // общение по UDP #include // епром #include "ESP8266httpUpdate.h" // OTA #include "mString.h" // стринг билдер #include "Clap.h" // обработка хлопков // ------------------- ДАТА -------------------- Config cfg; Preset preset[MAX_PRESETS]; Dawn dawn; Palette pal; WiFiServer server(80); WiFiUDP Udp; WiFiUDP ntpUDP; IPAddress broadIP; NTPClient ntp(ntpUDP); CRGB leds[MAX_LEDS]; Time now; Button btn(BTN_PIN); timerMillis EEtmr(EE_TOUT), turnoffTmr, connTmr(120000ul), dawnTmr, holdPresTmr(30000ul), blinkTmr(300); timerMillis effTmr(30, true), onlineTmr(500, true), postDawn(10 * 60000ul); TimeRandom trnd; VolAnalyzer vol(A0), low, high; FastFilter phot; Clap clap; uint16_t portNum; uint32_t udpTmr = 0, gotADCtmr = 0; byte btnClicks = 0, brTicks = 0; unsigned char matrixValue[11][16]; bool gotNTP = false, gotTime = false; bool loading = true; int udpLength = 0; byte udpScale = 0, udpBright = 0; // ------------------- SETUP -------------------- void setup() { misc(); delay(2000); // ждём старта есп #ifdef DEBUG_SERIAL_LAMP Serial.begin(115200); DEBUGLN(); #endif startStrip(); // старт ленты btn.setLevel(digitalRead(BTN_PIN)); // смотрим что за кнопка EE_startup(); // читаем епром #ifndef SKIP_WIFI checkUpdate(); // индикация было ли обновление showRGB(); // показываем ргб checkGroup(); // показываем или меняем адрес checkButton(); // проверяем кнопку на удержание startWiFi(); // старт вайфай setupTime(); // выставляем время #endif setupADC(); // настраиваем анализ presetRotation(true); // форсировать смену режима } void loop() { timeTicker(); // обновляем время yield(); #ifndef SKIP_WIFI tryReconnect(); // пробуем переподключиться если WiFi упал yield(); parsing(); // ловим данные yield(); #endif checkEEupdate(); // сохраняем епром presetRotation(0); // смена режимов по расписанию effectsRoutine(); // мигаем yield(); button(); // проверяем кнопку checkAnalog(); // чтение звука и датчика yield(); iAmOnline(); } ================================================ FILE: firmware/GyverLamp2/NTPClient-Gyver.cpp ================================================ /** The MIT License (MIT) Copyright (c) 2015 by Fabrice Weinberg Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "NTPClient-Gyver.h" NTPClient::NTPClient(UDP& udp) { this->_udp = &udp; } NTPClient::NTPClient(UDP& udp, long timeOffset) { this->_udp = &udp; this->_timeOffset = timeOffset; } NTPClient::NTPClient(UDP& udp, const char* poolServerName) { this->_udp = &udp; this->_poolServerName = poolServerName; } NTPClient::NTPClient(UDP& udp, const char* poolServerName, long timeOffset) { this->_udp = &udp; this->_timeOffset = timeOffset; this->_poolServerName = poolServerName; } NTPClient::NTPClient(UDP& udp, const char* poolServerName, long timeOffset, unsigned long updateInterval) { this->_udp = &udp; this->_timeOffset = timeOffset; this->_poolServerName = poolServerName; this->_updateInterval = updateInterval; } void NTPClient::begin() { this->begin(NTP_DEFAULT_LOCAL_PORT); } void NTPClient::begin(int port) { this->_port = port; this->_udp->begin(this->_port); this->_udpSetup = true; } bool NTPClient::forceUpdate() { #ifdef DEBUG_NTPClient Serial.println("Update from NTP Server"); #endif this->sendNTPPacket(); // Wait till data is there or timeout... byte timeout = 0; int cb = 0; do { delay ( 10 ); cb = this->_udp->parsePacket(); if (timeout > 100) return false; // timeout after 1000 ms timeout++; } while (cb == 0); this->_lastUpdate = millis() - (10 * (timeout + 1)); // Account for delay in reading the time this->_udp->read(this->_packetBuffer, NTP_PACKET_SIZE); unsigned long highWord = word(this->_packetBuffer[40], this->_packetBuffer[41]); unsigned long lowWord = word(this->_packetBuffer[42], this->_packetBuffer[43]); /// добавлено AlexGyver uint32_t frac = (uint32_t) _packetBuffer[44] << 24 | (uint32_t) _packetBuffer[45] << 16 | (uint32_t) _packetBuffer[46] << 8 | (uint32_t) _packetBuffer[47] << 0; uint16_t mssec = ((uint64_t) frac * 1000) >> 32; //https://arduino.stackexchange.com/questions/49567/synching-local-clock-usign-ntp-to-milliseconds _lastUpdate -= mssec; /// добавлено AlexGyver // combine the four bytes (two words) into a long integer // this is NTP time (seconds since Jan 1 1900): unsigned long secsSince1900 = highWord << 16 | lowWord; this->_currentEpoc = secsSince1900 - SEVENZYYEARS; return true; } bool NTPClient::update() { if ((millis() - this->_lastUpdate >= this->_updateInterval) // Update after _updateInterval || this->_lastUpdate == 0) { // Update if there was no update yet. if (!this->_udpSetup) this->begin(); // setup the UDP client if needed return this->forceUpdate(); } return true; } unsigned long NTPClient::getEpochTime() const { return this->_timeOffset + // User offset this->_currentEpoc + // Epoc returned by the NTP server ((millis() - this->_lastUpdate) / 1000); // Time since last update } int NTPClient::getDay() const { return (((this->getEpochTime() / 86400L) + 4 ) % 7); //0 is Sunday } int NTPClient::getHours() const { return ((this->getEpochTime() % 86400L) / 3600); } int NTPClient::getMinutes() const { return ((this->getEpochTime() % 3600) / 60); } int NTPClient::getSeconds() const { return (this->getEpochTime() % 60); } int NTPClient::getMillis() const { return ((millis() - this->_lastUpdate) % 1000); } int NTPClient::getMillisLastUpd() const { return (millis() - this->_lastUpdate); } String NTPClient::getFormattedTime() const { unsigned long rawTime = this->getEpochTime(); unsigned long hours = (rawTime % 86400L) / 3600; String hoursStr = hours < 10 ? "0" + String(hours) : String(hours); unsigned long minutes = (rawTime % 3600) / 60; String minuteStr = minutes < 10 ? "0" + String(minutes) : String(minutes); unsigned long seconds = rawTime % 60; String secondStr = seconds < 10 ? "0" + String(seconds) : String(seconds); return hoursStr + ":" + minuteStr + ":" + secondStr; } void NTPClient::end() { this->_udp->stop(); this->_udpSetup = false; } void NTPClient::setTimeOffset(int timeOffset) { this->_timeOffset = timeOffset; } void NTPClient::setUpdateInterval(unsigned long updateInterval) { this->_updateInterval = updateInterval; } void NTPClient::setPoolServerName(const char* poolServerName) { this->_poolServerName = poolServerName; } void NTPClient::sendNTPPacket() { // set all bytes in the buffer to 0 memset(this->_packetBuffer, 0, NTP_PACKET_SIZE); // Initialize values needed to form NTP request // (see URL above for details on the packets) this->_packetBuffer[0] = 0b11100011; // LI, Version, Mode this->_packetBuffer[1] = 0; // Stratum, or type of clock this->_packetBuffer[2] = 6; // Polling Interval this->_packetBuffer[3] = 0xEC; // Peer Clock Precision // 8 bytes of zero for Root Delay & Root Dispersion this->_packetBuffer[12] = 49; this->_packetBuffer[13] = 0x4E; this->_packetBuffer[14] = 49; this->_packetBuffer[15] = 52; // all NTP fields have been given values, now // you can send a packet requesting a timestamp: this->_udp->beginPacket(this->_poolServerName, 123); //NTP requests are to port 123 this->_udp->write(this->_packetBuffer, NTP_PACKET_SIZE); this->_udp->endPacket(); } ================================================ FILE: firmware/GyverLamp2/NTPClient-Gyver.h ================================================ #pragma once // добавлена синхронизация обнвления по миллисекундам // добавлен вывод миллисекунд #include "Arduino.h" #include #define SEVENZYYEARS 2208988800UL #define NTP_PACKET_SIZE 48 #define NTP_DEFAULT_LOCAL_PORT 1337 class NTPClient { private: UDP* _udp; bool _udpSetup = false; const char* _poolServerName = "pool.ntp.org"; // Default time server int _port = NTP_DEFAULT_LOCAL_PORT; long _timeOffset = 0; unsigned long _updateInterval = 60000; // In ms unsigned long _currentEpoc = 0; // In s unsigned long _lastUpdate = 0; // In ms byte _packetBuffer[NTP_PACKET_SIZE]; void sendNTPPacket(); public: NTPClient(UDP& udp); NTPClient(UDP& udp, long timeOffset); NTPClient(UDP& udp, const char* poolServerName); NTPClient(UDP& udp, const char* poolServerName, long timeOffset); NTPClient(UDP& udp, const char* poolServerName, long timeOffset, unsigned long updateInterval); /** Set time server name @param poolServerName */ void setPoolServerName(const char* poolServerName); /** Starts the underlying UDP client with the default local port */ void begin(); /** Starts the underlying UDP client with the specified local port */ void begin(int port); /** This should be called in the main loop of your application. By default an update from the NTP Server is only made every 60 seconds. This can be configured in the NTPClient constructor. @return true on success, false on failure */ bool update(); /** This will force the update from the NTP Server. @return true on success, false on failure */ bool forceUpdate(); int getDay() const; int getHours() const; int getMinutes() const; int getSeconds() const; int getMillis() const; int getMillisLastUpd() const; /** Changes the time offset. Useful for changing timezones dynamically */ void setTimeOffset(int timeOffset); /** Set the update interval to another frequency. E.g. useful when the timeOffset should not be set in the constructor */ void setUpdateInterval(unsigned long updateInterval); /** @return time formatted like `hh:mm:ss` */ String getFormattedTime() const; /** @return time in seconds since Jan. 1, 1970 */ unsigned long getEpochTime() const; /** Stops the underlying UDP client */ void end(); }; ================================================ FILE: firmware/GyverLamp2/Time.h ================================================ class Time { public: byte sec = 0; byte min = 0; byte hour = 0; byte day = 0; int ms = 0; uint32_t weekMs = 0; uint32_t weekS = 0; int getMs() { return (tmr - millis()); } void setMs(int ms) { tmr = millis() + ms; } uint32_t getWeekS() { return day * 86400ul + hour * 3600ul + min * 60 + sec; } bool newSec() { if (prevSec != sec) { prevSec = sec; return true; } return false; } bool newMin() { if (prevMin != min) { prevMin = min; return true; } return false; } void tick() { ms = millis() - tmr; if (ms >= 1000) { tmr += 1000; if (++sec >= 60) { sec = 0; if (++min >= 60) { min = 0; if (++hour >= 24) { hour = 0; if (++day >= 7) { day = 0; } } } } } weekMs = getWeekS() * 1000ul + millis() - tmr; } private: uint32_t tmr; byte prevSec = 0; byte prevMin = 0; }; ================================================ FILE: firmware/GyverLamp2/VolAnalyzer.h ================================================ #pragma once #include #include "FastFilter.h" class VolAnalyzer { public: VolAnalyzer (int pin = -1) { volF.setDt(20); volF.setPass(FF_PASS_MAX); maxF.setPass(FF_PASS_MAX); setVolK(25); setAmpliK(31); if (pin != -1) setPin(pin); } void setPin(int pin) { _pin = pin; pinMode(_pin, INPUT); } void setDt(int dt) { _dt = dt; } void setPeriod(int period) { _period = period; } void setVolDt(int volDt) { volF.setDt(volDt); } void setAmpliDt(int ampliDt) { _ampliDt = ampliDt; } void setWindow(int window) { _window = window; } void setVolK(byte k) { volF.setK(k); } void setAmpliK(byte k) { maxF.setK(k); minF.setK(k); } void setVolMin(int scale) { _volMin = scale; } void setVolMax(int scale) { _volMax = scale; } void setTrsh(int trsh) { _trsh = trsh; } bool tick(int thisRead = -1) { volF.compute(); if (millis() - tmr3 >= _ampliDt) { // период сглаживания амплитуды tmr3 = millis(); maxF.setRaw(maxs); minF.setRaw(mins); maxF.compute(); minF.compute(); maxs = 0; mins = 1023; } if (_period == 0 || millis() - tmr1 >= _period) { // период между захватом сэмплов if (_dt == 0 || micros() - tmr2 >= _dt) { // период выборки tmr2 = micros(); if (thisRead == -1) thisRead = analogRead(_pin); if (thisRead > max) max = thisRead; // ищем максимум if (!_first) { _first = 1; maxF.setFil(thisRead); minF.setFil(thisRead); } if (++count >= _window) { // выборка завершена tmr1 = millis(); raw = max; if (max > maxs) maxs = max; // максимумы среди максимумов if (max < mins) mins = max; // минимумы реди максимумов rawMax = maxs; maxF.checkPass(max); // проверка выше максимума if (getMax() - getMin() < _trsh) max = 0; // если окно громкости меньше порого то 0 else max = constrain(map(max, getMin(), getMax(), _volMin, _volMax), _volMin, _volMax); // перевод в громкость volF.setRaw(max); // фильтр столбика громкости if (volF.checkPass(max)) _pulse = 1; // проверка выше максимума max = count = 0; return true; // выборка завершена } } } return false; } int getRaw() { return raw; } int getRawMax() { return rawMax; } int getVol() { return volF.getFil(); } int getMin() { return minF.getFil(); } int getMax() { return maxF.getFil(); } bool getPulse() { if (_pulse) { _pulse = false; return true; } return false; } private: int _pin; int _dt = 500; // 500 мкс между сэмплами достаточно для музыки int _period = 4; // 4 мс между выборами достаточно int _ampliDt = 150; int _window = 20; // при таком размере окна получаем длительность оцифровки вполне хватает uint32_t tmr1 = 0, tmr2 = 0, tmr3 = 0; int raw = 0; int rawMax = 0; int max = 0, count = 0; int maxs = 0, mins = 1023; int _volMin = 0, _volMax = 100, _trsh = 30; bool _pulse = 0, _first = 0; FastFilter minF, maxF, volF; }; ================================================ FILE: firmware/GyverLamp2/analog.ino ================================================ #if (USE_ADC == 1) void setupADC() { clap.setTimeout(500); clap.setTrsh(250); vol.setDt(700); vol.setPeriod(5); vol.setWindow(map(MAX_LEDS, 300, 900, 20, 1)); low.setDt(0); low.setPeriod(0); low.setWindow(0); high.setDt(0); high.setPeriod(0); high.setWindow(0); vol.setVolK(26); low.setVolK(26); high.setVolK(26); vol.setTrsh(50); low.setTrsh(50); high.setTrsh(50); vol.setVolMin(0); low.setVolMin(0); high.setVolMin(0); vol.setVolMax(255); low.setVolMax(255); high.setVolMax(255); phot.setDt(80); phot.setK(31); if (cfg.adcMode == GL_ADC_BRI) switchToPhot(); else if (cfg.adcMode == GL_ADC_MIC) switchToMic(); } void checkAnalog() { if (cfg.role || millis() - gotADCtmr >= 2000) { // только мастер или слейв по таймауту опрашивает АЦП! switch (cfg.adcMode) { case GL_ADC_NONE: break; case GL_ADC_BRI: checkPhot(); break; case GL_ADC_MIC: checkMusic(); break; case GL_ADC_BOTH: { static timerMillis tmr(1000, 1); if (tmr.isReady()) { switchToPhot(); phot.setRaw(analogRead(A0)); switchToMic(); } else { checkMusic(); } phot.compute(); } break; } } } void checkMusic() { vol.tick(); yield(); #if (USE_CLAP == 1) clap.tick(vol.getRawMax()); if (clap.hasClaps(2)) controlHandler(!cfg.state); #endif if (CUR_PRES.advMode == GL_ADV_LOW || CUR_PRES.advMode == GL_ADV_HIGH) { // частоты int raw[FFT_SIZE], spectr[FFT_SIZE]; for (int i = 0; i < FFT_SIZE; i++) raw[i] = analogRead(A0); yield(); FFT(raw, spectr); int low_raw = 0; int high_raw = 0; for (int i = 0; i < FFT_SIZE / 2; i++) { spectr[i] = (spectr[i] * (i + 2)) >> 1; if (i < 2) low_raw += spectr[i]; else high_raw += spectr[i]; } low.tick(low_raw); high.tick(high_raw); } } void checkPhot() { static timerMillis tmr(1000, true); if (tmr.isReady()) phot.setRaw(analogRead(A0)); phot.compute(); } byte getSoundVol() { switch (CUR_PRES.advMode) { case GL_ADV_VOL: return vol.getVol(); case GL_ADV_LOW: return low.getVol(); case GL_ADV_HIGH: return high.getVol(); } return 0; } void switchToMic() { digitalWrite(PHOT_VCC, 0); pinMode(PHOT_VCC, INPUT); pinMode(MIC_VCC, OUTPUT); digitalWrite(MIC_VCC, 1); } void switchToPhot() { digitalWrite(MIC_VCC, 0); pinMode(MIC_VCC, INPUT); pinMode(PHOT_VCC, OUTPUT); digitalWrite(PHOT_VCC, 1); } void disableADC() { digitalWrite(PHOT_VCC, 0); pinMode(PHOT_VCC, INPUT); digitalWrite(MIC_VCC, 0); pinMode(MIC_VCC, INPUT); } #else void setupADC() {} void checkAnalog() {} void checkMusic() {} void checkPhot() {} byte getSoundVol() { return 0; } void switchToMic() {} void switchToPhot() {} void disableADC() {} #endif ================================================ FILE: firmware/GyverLamp2/button.ino ================================================ #define CLICKS_TOUT 800 void button() { #if (USE_BTN == 1) static bool flag = 0, holdFlag = 0, brDir = 0; static timerMillis stepTmr(80, true); static uint32_t tmr = 0; btn.tick(); if (btn.isClick()) { btnClicks++; tmr = millis(); } if (btnClicks > 0 && millis() - tmr > CLICKS_TOUT) { DEBUG("clicks: "); DEBUGLN(btnClicks); switch (btnClicks) { case 1: controlHandler(!cfg.state); break; case 2: changePreset(1); sendToSlaves(1, cfg.curPreset); break; case 3: changePreset(-1); sendToSlaves(1, cfg.curPreset); break; case 4: setPreset(0); sendToSlaves(1, cfg.curPreset); break; case 5: cfg.role = 0; blink16(CRGB::DarkSlateBlue); break; case 6: cfg.role = 1; blink16(CRGB::Maroon); break; } EE_updateCfg(); btnClicks = 0; } if (cfg.state && btn.isHold()) { if (stepTmr.isReady()) { holdFlag = true; int temp = cfg.bright; temp += brDir ? 5 : -5; temp = constrain(temp, 0, 255); cfg.bright = temp; brTicks = cfg.bright / 25; } } else { if (holdFlag) { holdFlag = false; brDir = !brDir; brTicks = 0; DEBUG("Bright set to: "); DEBUGLN(cfg.bright); sendToSlaves(2, cfg.bright); EE_updateCfg(); } } #endif } ================================================ FILE: firmware/GyverLamp2/data.h ================================================ // -------------- ВНУТР. КОНСТАНТЫ --------------- #define GL_ADC_NONE 1 #define GL_ADC_BRI 2 #define GL_ADC_MIC 3 #define GL_ADC_BOTH 4 #define GL_TYPE_STRIP 1 #define GL_TYPE_ZIG 2 #define GL_TYPE_PARAL 3 #define GL_ADV_NONE 1 #define GL_ADV_VOL 2 #define GL_ADV_LOW 3 #define GL_ADV_HIGH 4 #define GL_ADV_CLOCK 5 #define GL_REACT_BRI 1 #define GL_REACT_SCL 2 #define GL_REACT_LEN 3 #define GL_SLAVE 0 #define GL_MASTER 1 #define MAX_PRESETS 40 // макс количество режимов // ------------------- МАКРО -------------------- #ifdef DEBUG_SERIAL_LAMP #define DEBUGLN(x) Serial.println(x) #define DEBUG(x) Serial.print(x) #else #define DEBUGLN(x) #define DEBUG(x) #endif #define FOR_i(x,y) for (int i = (x); i < (y); i++) #define FOR_j(x,y) for (int j = (x); j < (y); j++) #define FOR_k(x,y) for (int k = (x); k < (y); k++) #define CUR_PRES preset[cfg.curPreset] byte scaleFF(byte x, byte b) { return ((uint16_t)x * (b + 1)) >> 8; } int mapFF(byte x, byte min, byte max) { return (((max - min) * x + (min << 8) + 1) >> 8); } const char OTAhost[] = "http://ota.alexgyver.ru/"; const char *OTAfile[] = { "GL2_latest.bin", "com_300.bin", "com_900.bin", "esp1_300.bin", "esp1_900.bin", "module_300.bin", "module_900.bin", }; const char NTPserver[] = "pool.ntp.org"; //"pool.ntp.org" //"europe.pool.ntp.org" //"ntp1.stratum2.ru" //"ntp2.stratum2.ru" //"ntp.msk-ix.ru" #define PAL_SIZE 49 struct Palette { byte size = 1; byte strip[16 * 3]; }; #define CFG_SIZE 12 struct Config { byte bright = 100; // яркость byte adcMode = 1; // режим ацп (1 выкл, 2 ярк, 3 муз) byte minBright = 0; // мин яркость byte maxBright = 255; // макс яркость byte rotation = 0; // смена режимов: 0 ручная, 1 авто byte rotRnd = 0; // тип автосмены: 0 в порядке, 1 рандом byte rotPeriod = 1; // период смены (1,5..) byte deviceType = 2; // 1 лента, 2 зигзаг, 3 параллел byte maxCur = 5; // макс ток (мА/100) byte workFrom = 0; // часы работы (0,1.. 23) byte workTo = 0; // часы работы (0,1.. 23) byte matrix = 1; // тип матрицы 1.. 8 int16_t length = 16; // длина ленты int16_t width = 16; // ширина матрицы byte GMT = 16; // часовой пояс +13 uint32_t cityID = 1; // city ID bool mqtt = 0; // mqtt char mqttID[32]; // char mqttHost[32]; // int mqttPort = 0; // char mqttLogin[16]; // char mqttPass[16]; // byte state = 1; // состояние 0 выкл, 1 вкл byte group = 1; // группа девайса (1-10) byte role = 0; // 0 slave, 1 master byte WiFimode = 0; // 0 AP, 1 local byte presetAmount = 1; // количество режимов byte manualOff = 0; // выключали вручную? int8_t curPreset = 0; // текущий режим int16_t minLight = 0; // мин освещённость int16_t maxLight = 1023;// макс освещённость char ssid[32]; // логин wifi char pass[32]; // пароль wifi byte version = GL_VERSION; byte update = 0; }; #define PRES_SIZE 13 struct Preset { byte effect = 1; // тип эффекта (1,2...) ВЫЧЕСТЬ 1 byte fadeBright = 0; // флаг на свою яркость (0/1) byte bright = 100; // своя яркость (0.. 255) byte advMode = 1; // дополнительно (1,2...) ВЫЧЕСТЬ 1 byte soundReact = 1; // реакция на звук (1,2...) ВЫЧЕСТЬ 1 byte min = 0; // мин сигнал светомузыки (0.. 255) byte max = 0; // макс сигнал светомузыки (0.. 255) byte speed = 200; // скорость (0.. 255) byte palette = 2; // палитра (1,2...) ВЫЧЕСТЬ 1 byte scale = 100; // масштаб (0.. 255) byte fromCenter = 0; // эффект из центра (0/1) byte color = 0; // цвет (0.. 255) byte fromPal = 0; // из палитры (0/1) }; #define DAWN_SIZE 24 struct Dawn { byte state[7] = {0, 0, 0, 0, 0, 0, 0}; // (1/0) byte hour[7] = {0, 0, 0, 0, 0, 0, 0}; // (0.. 59) byte minute[7] = {0, 0, 0, 0, 0, 0, 0}; // (0.. 59) byte bright = 100; // (0.. 255) byte time = 1; // (5,10,15,20..) byte post = 1; // (5,10,15,20..) }; /* - Каждые 5 минут лампа AP отправляет время (день час минута) на Local лампы всех ролей в сети с ней (GL,6,день,час,мин) - Если включен АЦП, Мастер отправляет своей группе данные с него на каждой итерации отрисовки эффектов (GL,1,длина,масштаб,яркость) - Установка времени с мобилы - получают все роли АР и Local (не получившие ntp) - Каждую секунду устройства шлют посылку GL_ONL */ ================================================ FILE: firmware/GyverLamp2/eeprom.ino ================================================ bool EEcfgFlag = false; bool EEdawnFlag = false; bool EEpresetFlag = false; bool EEpalFlag = false; void EE_startup() { // старт епром EEPROM.begin(1000); // старт епром delay(100); if (EEPROM.read(0) != EE_KEY) { EEPROM.write(0, EE_KEY); EEPROM.put(1, cfg); EEPROM.put(sizeof(cfg) + 1, dawn); EEPROM.put(sizeof(cfg) + sizeof(dawn) + 1, pal); EEPROM.put(sizeof(cfg) + sizeof(dawn) + sizeof(pal) + 1, preset); EEPROM.commit(); blink16(CRGB::Magenta); DEBUGLN("First start"); } EEPROM.get(1, cfg); EEPROM.get(sizeof(cfg) + 1, dawn); EEPROM.get(sizeof(cfg) + sizeof(dawn) + 1, pal); EEPROM.get(sizeof(cfg) + sizeof(dawn) + sizeof(pal) + 1, preset); DEBUG("EEPR size: "); DEBUGLN(sizeof(cfg) + sizeof(dawn) + sizeof(pal) + sizeof(preset) + 1); // запускаем всё if (cfg.deviceType == GL_TYPE_STRIP) { if (cfg.length > MAX_LEDS) cfg.length = MAX_LEDS; cfg.width = 1; } if (cfg.length * cfg.width > MAX_LEDS) cfg.width = MAX_LEDS / cfg.length; FastLED.setMaxPowerInVoltsAndMilliamps(STRIP_VOLT, cfg.maxCur * 100); updPal(); } void EE_updateCfg() { EEcfgFlag = true; EEtmr.restart(); } void EE_updateDawn() { EEdawnFlag = true; EEtmr.restart(); } void EE_updatePreset() { EEpresetFlag = true; EEtmr.restart(); } void EE_updatePal() { EEpalFlag = true; EEtmr.restart(); } void checkEEupdate() { if (EEtmr.isReady()) { if (EEcfgFlag || EEdawnFlag || EEpresetFlag) { if (EEcfgFlag) { EEcfgFlag = false; EEPROM.put(1, cfg); DEBUGLN("save cfg"); } if (EEdawnFlag) { EEdawnFlag = false; EEPROM.put(sizeof(cfg) + 1, dawn); DEBUGLN("save dawn"); } if (EEpalFlag) { EEpalFlag = false; EEPROM.put(sizeof(cfg) + sizeof(dawn) + 1, pal); DEBUGLN("save pal"); } if (EEpresetFlag) { EEpresetFlag = false; EEPROM.put(sizeof(cfg) + sizeof(dawn) + sizeof(pal) + 1, preset); DEBUGLN("save preset"); } EEPROM.commit(); } EEtmr.stop(); } } void EE_updCfgRst() { EE_updCfg(); delay(100); ESP.restart(); } void EE_updCfg() { EEPROM.put(1, cfg); EEPROM.commit(); } ================================================ FILE: firmware/GyverLamp2/effects.ino ================================================ void effectsRoutine() { static byte prevEff = 255; if (!effTmr.isReady()) return; if (dawnTmr.running() || postDawn.running()) { FastLED.setBrightness(255); byte thisColor = dawnTmr.getLength8(); if (postDawn.running()) thisColor = 255; fill_solid(leds, MAX_LEDS, ColorFromPalette(HeatColors_p, thisColor, scaleFF(thisColor, dawn.bright), LINEARBLEND)); drawClock(cfg.length / 2 - 4, 100, 0); FastLED.show(); if (dawnTmr.isReady()) { dawnTmr.stop(); postDawn.setInterval(dawn.post * 60000ul); postDawn.restart(); } if (postDawn.isReady()) { postDawn.stop(); FastLED.clear(); FastLED.show(); } return; } if (!cfg.state) return; int thisLength = getLength(); byte thisScale = getScale(); byte thisBright = getBright(); if (musicMode() || briMode()) { // музыка или яркость if (cfg.role) { // мастер отправляет static uint32_t tmr = 0; if ((millis() - tmr >= musicMode() ? 60 : 1000) && millis() - udpTmr >= 1000) { sendUDP(7, thisLength, thisScale, thisBright); tmr = millis(); } } else { // слейв получает if (millis() - gotADCtmr < 4000) { // есть сигнал с мастера thisLength = udpLength; thisScale = udpScale; thisBright = udpBright; } } } if (turnoffTmr.running()) thisBright = scaleFF(thisBright, 255 - turnoffTmr.getLength8()); else if (blinkTmr.runningStop()) thisBright = scaleFF(thisBright, blinkTmr.getLength8()); if (turnoffTmr.isReady()) { turnoffTmr.stop(); setPower(0); return; } FastLED.setBrightness(thisBright); if (prevEff != CUR_PRES.effect) { // смена эффекта FastLED.clear(); prevEff = CUR_PRES.effect; loading = true; } yield(); // =================================================== ЭФФЕКТЫ =================================================== switch (CUR_PRES.effect) { case 1: // =================================== ПЕРЛИН =================================== if (cfg.deviceType > 1) { FOR_j(0, cfg.length) { FOR_i(0, cfg.width) { setPix(i, j, ColorFromPalette(paletteArr[CUR_PRES.palette - 1], scalePal(inoise8( i * (thisScale / 5) - cfg.width * (thisScale / 5) / 2, j * (thisScale / 5) - cfg.length * (thisScale / 5) / 2, (now.weekMs >> 1) * CUR_PRES.speed / 255)), 255, LINEARBLEND)); } } } else { FOR_i(0, cfg.length) { leds[i] = ColorFromPalette(paletteArr[CUR_PRES.palette - 1], scalePal(inoise8(i * (thisScale / 5) - cfg.length * (thisScale / 5) / 2, (now.weekMs >> 1) * CUR_PRES.speed / 255)), 255, LINEARBLEND); } } break; case 2: // ==================================== ЦВЕТ ==================================== { fill_solid(leds, cfg.length * cfg.width, CHSV(CUR_PRES.color, thisScale, 30)); CRGB thisColor = CHSV(CUR_PRES.color, thisScale, thisBright); if (CUR_PRES.fromCenter) { fillStrip(cfg.length / 2, cfg.length / 2 + thisLength / 2, thisColor); fillStrip(cfg.length / 2 - thisLength / 2, cfg.length / 2, thisColor); } else { fillStrip(0, thisLength, thisColor); } } break; case 3: // ================================= СМЕНА ЦВЕТА ================================= { CRGB thisColor = ColorFromPalette(paletteArr[CUR_PRES.palette - 1], scalePal((now.weekMs >> 5) * CUR_PRES.speed / 255), 10, LINEARBLEND); fill_solid(leds, cfg.length * cfg.width, thisColor); thisColor = ColorFromPalette(paletteArr[CUR_PRES.palette - 1], scalePal((now.weekMs >> 5) * CUR_PRES.speed / 255), thisBright, LINEARBLEND); if (CUR_PRES.fromCenter) { fillStrip(cfg.length / 2, cfg.length / 2 + thisLength / 2, thisColor); fillStrip(cfg.length / 2 - thisLength / 2, cfg.length / 2, thisColor); } else { fillStrip(0, thisLength, thisColor); } } break; case 4: // ================================== ГРАДИЕНТ ================================== if (CUR_PRES.fromCenter) { FOR_i(cfg.length / 2, cfg.length) { byte bright = 255; if (CUR_PRES.soundReact == GL_REACT_LEN) bright = (i < cfg.length / 2 + thisLength / 2) ? (thisBright) : (10); CRGB thisColor = ColorFromPalette( paletteArr[CUR_PRES.palette - 1], // (x*1.9 + 25) / 255 - быстрый мап 0..255 в 0.1..2 scalePal((i * (thisScale * 1.9 + 25) / cfg.length) + ((now.weekMs >> 3) * (CUR_PRES.speed - 128) / 128)), bright, LINEARBLEND); if (cfg.deviceType > 1) fillRow(i, thisColor); else leds[i] = thisColor; } if (cfg.deviceType > 1) FOR_i(0, cfg.length / 2) fillRow(i, leds[(cfg.length - i)*cfg.width - 1]); else FOR_i(0, cfg.length / 2) leds[i] = leds[cfg.length - i - 1]; } else { FOR_i(0, cfg.length) { byte bright = 255; if (CUR_PRES.soundReact == GL_REACT_LEN) bright = (i < thisLength) ? (thisBright) : (10); CRGB thisColor = ColorFromPalette( paletteArr[CUR_PRES.palette - 1], // (x*1.9 + 25) / 255 - быстрый мап 0..255 в 0.1..2 scalePal((i * (thisScale * 1.9 + 25) / cfg.length) + ((now.weekMs >> 3) * (CUR_PRES.speed - 128) / 128)), bright, LINEARBLEND); if (cfg.deviceType > 1) fillRow(i, thisColor); else leds[i] = thisColor; } } break; case 5: // =================================== ЧАСТИЦЫ =================================== FOR_i(0, cfg.length * cfg.width) leds[i].fadeToBlackBy(70); { uint16_t rndVal = 0; byte amount = (thisScale >> 3) + 1; FOR_i(0, amount) { rndVal = rndVal * 2053 + 13849; // random2053 алгоритм int homeX = inoise16(i * 100000000ul + (now.weekMs << 3) * CUR_PRES.speed / 255); homeX = map(homeX, 15000, 50000, 0, cfg.length); int offsX = inoise8(i * 2500 + (now.weekMs >> 1) * CUR_PRES.speed / 255) - 128; offsX = cfg.length / 2 * offsX / 128; int thisX = homeX + offsX; if (cfg.deviceType > 1) { int homeY = inoise16(i * 100000000ul + 2000000000ul + (now.weekMs << 3) * CUR_PRES.speed / 255); homeY = map(homeY, 15000, 50000, 0, cfg.width); int offsY = inoise8(i * 2500 + 30000 + (now.weekMs >> 1) * CUR_PRES.speed / 255) - 128; offsY = cfg.length / 2 * offsY / 128; int thisY = homeY + offsY; setPix(thisX, thisY, CUR_PRES.fromPal ? ColorFromPalette(paletteArr[CUR_PRES.palette - 1], scalePal(i * 255 / amount), 255, LINEARBLEND) : CHSV(CUR_PRES.color, 255, 255) ); } else { setLED(thisX, CUR_PRES.fromPal ? ColorFromPalette(paletteArr[CUR_PRES.palette - 1], scalePal(i * 255 / amount), 255, LINEARBLEND) : CHSV(CUR_PRES.color, 255, 255) ); } } } break; case 6: // ==================================== ОГОНЬ ==================================== if (cfg.deviceType > 1) { // 2D огонь fireRoutine(CUR_PRES.speed / 2); } else { // 1D огонь FastLED.clear(); static byte heat[MAX_LEDS]; CRGBPalette16 gPal; if (CUR_PRES.color < 5) gPal = HeatColors_p; else gPal = CRGBPalette16(CRGB::Black, CHSV(CUR_PRES.color, 255, 255), CRGB::White); if (CUR_PRES.fromCenter) thisLength /= 2; for (int i = 0; i < thisLength; i++) heat[i] = qsub8(heat[i], random8(0, ((((255 - thisScale) / 2 + 20) * 10) / thisLength) + 2)); for (int k = thisLength - 1; k >= 2; k--) heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; if (random8() < 120 ) { int y = random8(7); heat[y] = qadd8(heat[y], random8(160, 255)); } if (CUR_PRES.fromCenter) { for (int j = 0; j < thisLength; j++) leds[cfg.length / 2 + j] = ColorFromPalette(gPal, scale8(heat[j], 240)); FOR_i(0, cfg.length / 2) leds[i] = leds[cfg.length - i - 1]; } else { for (int j = 0; j < thisLength; j++) leds[j] = ColorFromPalette(gPal, scale8(heat[j], 240)); } } break; case 7: // ==================================== ОГОНЬ 2020 ==================================== FastLED.clear(); if (cfg.deviceType > 1) { // 2D огонь fire2020(CUR_PRES.scale, thisLength); } else { // 1D огонь static byte heat[MAX_LEDS]; if (CUR_PRES.fromCenter) thisLength /= 2; for (int i = 0; i < thisLength; i++) heat[i] = qsub8(heat[i], random8(0, ((((255 - thisScale) / 2 + 20) * 10) / thisLength) + 2)); for (int k = thisLength - 1; k >= 2; k--) heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; if (random8() < 120 ) { int y = random8(7); heat[y] = qadd8(heat[y], random8(160, 255)); } if (CUR_PRES.fromCenter) { for (int j = 0; j < thisLength; j++) leds[cfg.length / 2 + j] = ColorFromPalette(paletteArr[CUR_PRES.palette - 1], scale8(heat[j], 240)); FOR_i(0, cfg.length / 2) leds[i] = leds[cfg.length - i - 1]; } else { for (int j = 0; j < thisLength; j++) leds[j] = ColorFromPalette(paletteArr[CUR_PRES.palette - 1], scale8(heat[j], 240)); } } break; case 8: // ================================== КОНФЕТТИ ================================== { byte amount = (thisScale >> 3) + 1; FOR_i(0, amount) { int x = random(0, cfg.length * cfg.width); if (leds[x] == CRGB(0, 0, 0)) leds[x] = CUR_PRES.fromPal ? ColorFromPalette(paletteArr[CUR_PRES.palette - 1], scalePal(i * 255 / amount), 255, LINEARBLEND) : CHSV(CUR_PRES.color, 255, 255); } FOR_i(0, cfg.length * cfg.width) { if (leds[i].r >= 10 || leds[i].g >= 10 || leds[i].b >= 10) leds[i].fadeToBlackBy(CUR_PRES.speed / 2 + 1); else leds[i] = 0; } } break; case 9: // =================================== СМЕРЧ =================================== FastLED.clear(); FOR_k(0, (thisScale >> 5) + 1) { FOR_i(0, cfg.length) { //byte thisPos = inoise8(i * 10 - (now.weekMs >> 1) * CUR_PRES.speed / 255, k * 10000); byte thisPos = inoise8(i * 10 + (now.weekMs >> 3) * CUR_PRES.speed / 255 + k * 10000, (now.weekMs >> 1) * CUR_PRES.speed / 255); thisPos = map(thisPos, 50, 200, 0, cfg.width); byte scale = 4; FOR_j(0, scale) { CRGB color = ColorFromPalette(paletteArr[CUR_PRES.palette - 1], scalePal(j * 255 / scale), (255 - j * 255 / (scale - 1)), LINEARBLEND); if (j == 0) { setPixOverlap(thisPos, i, color); } else { setPixOverlap(thisPos - j, i, color); setPixOverlap(thisPos + j, i, color); } } } } break; case 10: // =================================== ЧАСЫ =================================== FastLED.clear(); drawClock(mapFF(CUR_PRES.scale, 0, cfg.length - 7), (CUR_PRES.speed < 10) ? 0 : (255 - CUR_PRES.speed), CHSV(CUR_PRES.color, 255, 255)); break; case 11: // ================================= ПОГОДА ================================== break; } if (CUR_PRES.advMode == GL_ADV_CLOCK && CUR_PRES.effect != 9) drawClock(mapFF(CUR_PRES.scale, 0, cfg.length - 7), 100, 0); // выводим нажатия кнопки if (btnClicks > 0) fill_solid(leds, btnClicks, CRGB::White); if (brTicks > 0) fill_solid(leds, brTicks, CRGB::Cyan); yield(); FastLED.show(); } // ==================================================================================================================== bool musicMode() { return ((cfg.adcMode == GL_ADC_MIC || cfg.adcMode == GL_ADC_BOTH) && (CUR_PRES.advMode > 1 && CUR_PRES.advMode <= 4)); } bool briMode() { return (cfg.adcMode == GL_ADC_BRI || cfg.adcMode == GL_ADC_BOTH); } byte getBright() { int maxBr = cfg.bright; // макс яркость из конфига byte fadeBr = 255; if (CUR_PRES.fadeBright) fadeBr = CUR_PRES.bright; // ограничен вручную if (briMode()) { // ----> датчик света или оба maxBr = constrain(phot.getFil(), cfg.minLight, cfg.maxLight); if (cfg.minLight != cfg.maxLight) maxBr = map(maxBr, cfg.minLight, cfg.maxLight, cfg.minBright, cfg.maxBright); } if (musicMode() && // светомузыка вкл CUR_PRES.soundReact == GL_REACT_BRI) { // режим яркости fadeBr = mapFF(getSoundVol(), CUR_PRES.min, CUR_PRES.max); // громкость в 0-255 } return scaleFF(maxBr, fadeBr); } int getLength() { if (musicMode() // светомузыка вкл && CUR_PRES.soundReact == GL_REACT_LEN // режим длины ) //return mapFF(getSoundVol(), 0, cfg.length); return mapFF(getSoundVol(), scaleFF(cfg.length, CUR_PRES.min), scaleFF(cfg.length, CUR_PRES.max)); else return cfg.length; } byte getScale() { if (musicMode() // светомузыка вкл && CUR_PRES.soundReact == GL_REACT_SCL // режим масштаба ) return mapFF(getSoundVol(), CUR_PRES.min, CUR_PRES.max); else return CUR_PRES.scale; } void fillStrip(int from, int to, CRGB color) { if (cfg.deviceType > 1) { FOR_i(from, to) { FOR_j(0, cfg.width) leds[getPix(j, i)] = color; } } else { FOR_i(from, to) leds[i] = color; } } void fillRow(int row, CRGB color) { FOR_i(cfg.width * row, cfg.width * (row + 1)) leds[i] = color; } void updPal() { for (int i = 0; i < 16; i++) { paletteArr[0][i] = CRGB(pal.strip[i * 3], pal.strip[i * 3 + 1], pal.strip[i * 3 + 2]); } if (pal.size < 16) paletteArr[0][pal.size] = paletteArr[0][0]; } byte scalePal(byte val) { if (CUR_PRES.palette == 1) val = val * pal.size / 16; return val; } void setPix(int x, int y, CRGB color) { if (y >= 0 && y < cfg.length && x >= 0 && x < cfg.width) leds[getPix(x, y)] = color; } void setPixOverlap(int x, int y, CRGB color) { if (y < 0) y += cfg.length; if (x < 0) x += cfg.width; if (y >= cfg.length) y -= cfg.length; if (x >= cfg.width) x -= cfg.width; setPix(x, y, color); } void setLED(int x, CRGB color) { if (x >= 0 && x < cfg.length) leds[x] = color; } uint32_t getPixColor(int x, int y) { int thisPix = getPix(x, y); if (thisPix < 0 || thisPix >= MAX_LEDS) return 0; return (((uint32_t)leds[thisPix].r << 16) | ((long)leds[thisPix].g << 8 ) | (long)leds[thisPix].b); } // получить номер пикселя в ленте по координатам uint16_t getPix(int x, int y) { int matrixW; if (cfg.matrix == 2 || cfg.matrix == 4 || cfg.matrix == 6 || cfg.matrix == 8) matrixW = cfg.length; else matrixW = cfg.width; int thisX, thisY; switch (cfg.matrix) { case 1: thisX = x; thisY = y; break; case 2: thisX = y; thisY = x; break; case 3: thisX = x; thisY = (cfg.length - y - 1); break; case 4: thisX = (cfg.length - y - 1); thisY = x; break; case 5: thisX = (cfg.width - x - 1); thisY = (cfg.length - y - 1); break; case 6: thisX = (cfg.length - y - 1); thisY = (cfg.width - x - 1); break; case 7: thisX = (cfg.width - x - 1); thisY = y; break; case 8: thisX = y; thisY = (cfg.width - x - 1); break; } if ( !(thisY & 1) || (cfg.deviceType - 2) ) return (thisY * matrixW + thisX); // чётная строка else return (thisY * matrixW + matrixW - thisX - 1); // нечётная строка } /* целочисленный мап y = ( (y1 - y2) * x + (x1y2 - x2y1) ) / (x1-x2) y = ( (y2 - y1) * x + 255 * y1 ) / 255 (x + 128) / 255 -> 0.5-2 (x*5 + 51) / 255 -> 0.2-5 (x*1.9 + 25) / 255 -> 0.1-1 */ ================================================ FILE: firmware/GyverLamp2/fastRandom.h ================================================ #ifndef FastRandom_h #define FastRandom_h #include class FastRandom { public: // установить сид void setSeed(uint16_t seed) { _seed = seed; } uint16_t get() { _seed = (_seed * 2053ul) + 13849; return _seed; } uint16_t get(uint16_t max) { return ((uint32_t)max * get()) >> 16; } uint16_t get(uint16_t min, uint16_t max) { return (get(max - min) + min); } private: uint16_t _seed; }; #endif ================================================ FILE: firmware/GyverLamp2/fire2020.ino ================================================ // ============= Огонь 2020 =============== // (c) SottNick //сильно по мотивам https://pastebin.com/RG0QGzfK //Perlin noise fire procedure by Yaroslaw Turbin //https://www.reddit.com/r/FastLED/comments/hgu16i/my_fire_effect_implementation_based_on_perlin/ void fire2020(byte scale, int len) { static uint8_t deltaValue; static uint8_t deltaHue; static uint8_t step; static uint8_t shiftHue[50]; static float trackingObjectPosX[100]; static float trackingObjectPosY[100]; static uint16_t ff_x, ff_y, ff_z; if (loading) { loading = false; //deltaValue = (((scale - 1U) % 11U + 1U) << 4U) - 8U; // ширина языков пламени (масштаб шума Перлина) deltaValue = map(scale, 0, 255, 8, 168); deltaHue = map(deltaValue, 8U, 168U, 8U, 84U); // высота языков пламени должна уменьшаться не так быстро, как ширина step = map(255U - deltaValue, 87U, 247U, 4U, 32U); // вероятность смещения искорки по оси ИКС for (uint8_t j = 0; j < cfg.length; j++) { shiftHue[j] = (cfg.length - 1 - j) * 255 / (cfg.length - 1); // init colorfade table } for (uint8_t i = 0; i < cfg.width / 8; i++) { trackingObjectPosY[i] = random8(cfg.length); trackingObjectPosX[i] = random8(cfg.width); } } for (uint8_t i = 0; i < cfg.width; i++) { for (uint8_t j = 0; j < len; j++) { leds[getPix(i, len - 1U - j)] = ColorFromPalette(paletteArr[CUR_PRES.palette - 1], scalePal(qsub8(inoise8(i * deltaValue, (j + ff_y + random8(2)) * deltaHue, ff_z), shiftHue[j])), 255U); } } //вставляем искорки из отдельного массива for (uint8_t i = 0; i < cfg.width / 8; i++) { if (trackingObjectPosY[i] > 3U) { leds[getPix(trackingObjectPosX[i], trackingObjectPosY[i])] = leds[getPix(trackingObjectPosX[i], 3U)]; leds[getPix(trackingObjectPosX[i], trackingObjectPosY[i])].fadeToBlackBy( trackingObjectPosY[i] * 2U ); } trackingObjectPosY[i]++; if (trackingObjectPosY[i] >= len) { trackingObjectPosY[i] = random8(4U); trackingObjectPosX[i] = random8(cfg.width); } if (!random8(step)) trackingObjectPosX[i] = (cfg.width + (uint8_t)trackingObjectPosX[i] + 1U - random8(3U)) % cfg.width; } ff_y++; if (ff_y & 0x01) ff_z++; } ================================================ FILE: firmware/GyverLamp2/fire2D.ino ================================================ const unsigned char valueMask[11][16] PROGMEM = { {8 , 0 , 0 , 0 , 0 , 0 , 0 , 8 , 8 , 0 , 0 , 0 , 0 , 0 , 0 , 8 }, {16 , 0 , 0 , 0 , 0 , 0 , 0 , 16 , 16 , 0 , 0 , 0 , 0 , 0 , 0 , 16 }, {32 , 0 , 0 , 0 , 0 , 0 , 0 , 32 , 32 , 0 , 0 , 0 , 0 , 0 , 0 , 32 }, {64 , 0 , 0 , 0 , 0 , 0 , 0 , 64 , 64 , 0 , 0 , 0 , 0 , 0 , 0 , 64 }, {96 , 32 , 0 , 0 , 0 , 0 , 32 , 96 , 96 , 32 , 0 , 0 , 0 , 0 , 32 , 96 }, {128, 64 , 32 , 0 , 0 , 32 , 64 , 128, 128, 64 , 32 , 0 , 0 , 32 , 64 , 128}, {160, 96 , 64 , 32 , 32 , 64 , 96 , 160, 160, 96 , 64 , 32 , 32 , 64 , 96 , 160}, {192, 128, 96 , 64 , 64 , 96 , 128, 192, 192, 128, 96 , 64 , 64 , 96 , 128, 192}, {255, 160, 128, 96 , 96 , 128, 160, 255, 255, 160, 128, 96 , 96 , 128, 160, 255}, {255, 192, 160, 128, 128, 160, 192, 255, 255, 192, 160, 128, 128, 160, 192, 255}, {255, 220, 185, 150, 150, 185, 220, 255, 255, 220, 185, 150, 150, 185, 220, 255}, }; const unsigned char hueMask[11][16] PROGMEM = { {8 , 16, 32, 36, 36, 32, 16, 8 , 8 , 16, 32, 36, 36, 32, 16, 8 }, {5 , 14, 29, 31, 31, 29, 14, 5 , 5 , 14, 29, 31, 31, 29, 14, 5 }, {1 , 11, 19, 25, 25, 22, 11, 1 , 1 , 11, 19, 25, 25, 22, 11, 1 }, {1 , 8 , 13, 19, 25, 19, 8 , 1 , 1 , 8 , 13, 19, 25, 19, 8 , 1 }, {1 , 8 , 13, 16, 19, 16, 8 , 1 , 1 , 8 , 13, 16, 19, 16, 8 , 1 }, {1 , 5 , 11, 13, 13, 13, 5 , 1 , 1 , 5 , 11, 13, 13, 13, 5 , 1 }, {1 , 5 , 11, 11, 11, 11, 5 , 1 , 1 , 5 , 11, 11, 11, 11, 5 , 1 }, {0 , 1 , 5 , 8 , 8 , 5 , 1 , 0 , 0 , 1 , 5 , 8 , 8 , 5 , 1 , 0 }, {0 , 0 , 1 , 5 , 5 , 1 , 0 , 0 , 0 , 0 , 1 , 5 , 5 , 1 , 0 , 0 }, {0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 }, {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, }; byte fireLine[100]; void fireRoutine(byte speed) { static byte count = 0; if (count >= 100) { shiftUp(); FOR_i(0, cfg.width) fireLine[i] = random(64, 255); count = 0; } drawFrame(count); count += speed; } void shiftUp() { for (int y = cfg.length - 1; y > 0; y--) { for (int x = 0; x < cfg.width; x++) { int newX = x; if (x > 15) newX = x - 15; if (y > 10) continue; matrixValue[y][newX] = matrixValue[y - 1][newX]; } } for (int x = 0; x < cfg.width; x++) { int newX = x; if (x > 15) newX = x - 15; matrixValue[0][newX] = fireLine[newX]; } } void drawFrame(int pcnt) { int nextv; for (int y = cfg.length - 1; y > 0; y--) { for (byte x = 0; x < cfg.width; x++) { int newX = x; if (x > 15) newX = x - 15; if (y < 11) { nextv = (((100.0 - pcnt) * matrixValue[y][newX] + pcnt * matrixValue[y - 1][newX]) / 100.0) - pgm_read_byte(&(valueMask[y][newX])); leds[getPix(x, y)] = CHSV( CUR_PRES.color + pgm_read_byte(&(hueMask[y][newX])), // H 255, // S (uint8_t)max(0, nextv) // V ); } else if (y == 11) { if (random8(0, 20) == 0 && getPixColor(x, y - 1) != 0) setPix(x, y, getPixColor(x, y - 1)); else setPix(x, y, 0); } else { // старая версия для яркости if (getPixColor(x, y - 1) > 0) setPix(x, y, getPixColor(x, y - 1)); else setPix(x, y, 0); } } } for (int x = 0; x < cfg.width; x++) { int newX = x; if (x > 15) newX = x - 15; leds[getPix(newX, 0)] = CHSV( CUR_PRES.color + pgm_read_byte(&(hueMask[0][newX])), // H 255, // S (uint8_t)(((100.0 - pcnt) * matrixValue[0][newX] + pcnt * fireLine[newX]) / 100.0) // V ); } } ================================================ FILE: firmware/GyverLamp2/mString.h ================================================ #ifndef mString_h #define mString_h #include char* mUtoa(uint32_t value, char *buffer, bool clear = 1); char* mLtoa(int32_t value, char *buffer, bool clear = 1); char* mFtoa(double value, int8_t decimals, char *buffer); char* mUtoa(uint32_t value, char *buffer, bool clear) { buffer += 11; if (clear) *--buffer = 0; do { *--buffer = value % 10 + '0'; value /= 10; } while (value != 0); return buffer; } char* mLtoa(int32_t value, char *buffer, bool clear) { bool minus = value < 0; if (minus) value = -value; buffer = mUtoa(value, buffer, clear); if (minus) *--buffer = '-'; return buffer; } char* mFtoa(double value, int8_t decimals, char *buffer) { int32_t mant = (int32_t)value; value -= mant; uint32_t exp = 1; while (decimals--) exp *= 10; exp *= (float)value; /*buffer += 9; buffer = mUtoa(exp, buffer); --buffer = '.'; buffer -= 11; buffer = mLtoa(mant, buffer, 0);*/ buffer = ltoa(mant, buffer, DEC); byte len = strlen(buffer); *(buffer + len++) = '.'; ltoa(exp, buffer + len++, DEC); return buffer; } class mString { public: char* buf; int size = 0; uint16_t length() { return strlen(buf); } void clear() { buf[0] = NULL; } // constructor mString(char* buffer, int newSize = -1) { buf = buffer; size = newSize; } /*mString (const char c) { //init(); add(c); } mString (const char* data) { //init(); add(data); } mString (const __FlashStringHelper *data) { //init(); add(data); } mString (uint32_t value) { //init(); add(value); } mString (int32_t value) { //init(); add(value); } mString (uint16_t value) { //init(); add(value); } mString (int16_t value) { //init(); add(value); } mString (uint8_t value) { //init(); add(value); } mString (int8_t value) { //init(); add(value); } mString (double value, byte dec = 2) { //init(); add(value, dec); }*/ // add mString& add(const char c) { byte len = length(); if (size != -1 && len + 1 >= size) return *this; buf[len++] = c; buf[len++] = NULL; return *this; } mString& add(const char* data) { /*byte len = length(); do { buf[len] = *(data++); } while (buf[len++] != 0);*/ if (size != -1 && length() + strlen(data) >= size) return *this; strcpy(buf + length(), data); return *this; } mString& add(const __FlashStringHelper *data) { PGM_P p = reinterpret_cast(data); if (size != -1 && length() + strlen_P(p) >= size) return *this; strcpy_P(buf + length(), p); return *this; /*do { buf[len] = (char)pgm_read_byte_near(p++); } while (buf[len++] != 0); */ } mString& add(uint32_t value) { char vBuf[11]; utoa(value, vBuf, DEC); return add(vBuf); } mString& add(uint16_t value) { return add((uint32_t)value); } mString& add(uint8_t value) { return add((uint32_t)value); } mString& add(int32_t value) { char vBuf[11]; ltoa(value, vBuf, DEC); return add(vBuf); } mString& add(int16_t value) { return add((int32_t)value); } mString& add(int8_t value) { return add((int32_t)value); } mString& add(double value, int8_t dec = 2) { char vBuf[20]; mFtoa(value, dec, vBuf); return add(vBuf); } /*mString& add(mString data) { return add(data.buf); }*/ // add += mString& operator += (const char c) { return add(c); } mString& operator += (const char* data) { return add(data); } mString& operator += (const __FlashStringHelper *data) { return add(data); } mString& operator += (uint32_t value) { return add(value); } mString& operator += (int32_t value) { return add(value); } mString& operator += (uint16_t value) { return add(value); } mString& operator += (int16_t value) { return add(value); } mString& operator += (uint8_t value) { return add(value); } mString& operator += (int8_t value) { return add(value); } mString& operator += (double value) { return add(value); } /*mString& operator += (mString data) { return add(data); }*/ // + mString operator + (const char c) { return mString(*this) += c; } mString operator + (const char* data) { return mString(*this) += data; } mString operator + (const __FlashStringHelper *data) { return mString(*this) += data; } mString operator + (uint32_t value) { return mString(*this) += value; } mString operator + (int32_t value) { return mString(*this) += value; } mString operator + (uint16_t value) { return mString(*this) += value; } mString operator + (int16_t value) { return mString(*this) += value; } mString operator + (uint8_t value) { return mString(*this) += value; } mString operator + (int8_t value) { return mString(*this) += value; } mString operator + (double value) { return mString(*this) += value; } /*mString operator + (mString data) { return mString(*this) += data; }*/ // assign mString& operator = (const char c) { clear(); return add(c); } mString& operator = (const char* data) { clear(); return add(data); } mString& operator = (const __FlashStringHelper *data) { clear(); return add(data); } mString& operator = (uint32_t value) { clear(); return add(value); } mString& operator = (int32_t value) { clear(); return add(value); } mString& operator = (uint16_t value) { clear(); return add(value); } mString& operator = (int16_t value) { clear(); return add(value); } mString& operator = (uint8_t value) { clear(); return add(value); } mString& operator = (int8_t value) { clear(); return add(value); } mString& operator = (double value) { clear(); return add(value); } /*mString& operator = (mString data) { clear(); return add(data); }*/ // compare bool operator == (const char c) { return (buf[0] == c && buf[1] == 0); } bool operator == (const char* data) { return !strcmp(buf, data); } bool operator == (uint32_t value) { char valBuf[11]; return !strcmp(buf, utoa(value, valBuf, DEC)); } bool operator == (int32_t value) { char valBuf[11]; return !strcmp(buf, ltoa(value, valBuf, DEC)); } bool operator == (float value) { char valBuf[20]; return !strcmp(buf, mFtoa(value, 2, valBuf)); } /*bool operator == (mString data) { return (buf == data.buf); }*/ // convert & parse char operator [] (uint16_t index) const { return buf[index];//(index < size ? buf[index] : 0); } char& operator [] (uint16_t index) { return buf[index]; } uint32_t toInt() { return atoi(buf); } float toFloat() { return atof(buf); } const char* c_str() { return buf; } bool startsWith(const char *data) { return strlen(data) == strspn(buf, data); } int indexOf(char ch, uint16_t fromIndex = 0) { if (fromIndex >= length()) return -1; const char* temp = strchr(buf + fromIndex, ch); if (temp == NULL) return -1; return temp - buf; } int parseBytes(byte* data, int len, char div = ',', char ter = NULL) { int b = 0, c = 0; data[b] = 0; while (true) { if (buf[c] == div) { b++; c++; if (b == len) return b; data[b] = 0; continue; } if (buf[c] == ter || b == len) return b + 1; data[b] *= 10; data[b] += buf[c] - '0'; c++; } } int parseInts(int* data, int len, char div = ',', char ter = NULL) { int b = 0, c = 0; data[b] = 0; while (true) { if (buf[c] == div) { b++; c++; if (b == len) return b; data[b] = 0; continue; } if (buf[c] == ter || b == len) return b + 1; data[b] *= 10; data[b] += buf[c] - '0'; c++; } } private: }; #endif ================================================ FILE: firmware/GyverLamp2/palettes.h ================================================ #include // лента // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ CRGBPalette16 customPal; DEFINE_GRADIENT_PALETTE( Fire_gp ) { 0, 0, 0, 0, 128, 255, 0, 0, 224, 255, 255, 0, 255, 255, 255, 255 }; DEFINE_GRADIENT_PALETTE( Sunset_Real_gp ) { 0, 120, 0, 0, 22, 179, 22, 0, 51, 255, 104, 0, 85, 167, 22, 18, 135, 100, 0, 103, 198, 16, 0, 130, 255, 0, 0, 160 }; DEFINE_GRADIENT_PALETTE( dkbluered_gp ) { 0, 1, 0, 4, 8, 1, 0, 13, 17, 1, 0, 29, 25, 1, 0, 52, 33, 1, 0, 83, 42, 1, 0, 123, 51, 1, 0, 174, 59, 1, 0, 235, 68, 1, 2, 255, 76, 4, 17, 255, 84, 16, 45, 255, 93, 37, 82, 255, 102, 69, 127, 255, 110, 120, 168, 255, 119, 182, 217, 255, 127, 255, 255, 255, 135, 255, 217, 184, 144, 255, 168, 123, 153, 255, 127, 73, 161, 255, 82, 40, 170, 255, 45, 18, 178, 255, 17, 5, 186, 255, 2, 1, 195, 234, 0, 1, 204, 171, 0, 1, 212, 120, 0, 1, 221, 79, 0, 1, 229, 48, 0, 1, 237, 26, 0, 1, 246, 12, 0, 1, 255, 4, 0, 1 }; DEFINE_GRADIENT_PALETTE( Optimus_Prime_gp ) { 0, 5, 16, 18, 25, 5, 16, 18, 51, 7, 25, 39, 76, 8, 38, 71, 102, 64, 99, 106, 127, 194, 189, 151, 153, 182, 63, 42, 178, 167, 6, 2, 204, 100, 3, 1, 229, 53, 1, 1, 255, 53, 1, 1 }; DEFINE_GRADIENT_PALETTE( warmGrad_gp ) { 0, 252, 252, 172, 25, 239, 255, 61, 53, 247, 45, 17, 76, 197, 82, 19, 96, 239, 255, 61, 124, 83, 4, 1, 153, 247, 45, 17, 214, 23, 15, 17, 255, 1, 1, 1 }; DEFINE_GRADIENT_PALETTE( coldGrad_gp ) { 0, 66, 186, 192, 43, 1, 22, 71, 79, 2, 104, 142, 117, 66, 186, 192, 147, 2, 104, 142, 186, 1, 22, 71, 224, 2, 104, 142, 255, 4, 27, 28 }; DEFINE_GRADIENT_PALETTE( hotGrad_gp ) { 0, 157, 21, 2, 35, 229, 244, 16, 73, 255, 44, 7, 107, 142, 7, 1, 153, 229, 244, 16, 206, 142, 7, 1, 255, 135, 36, 0 }; DEFINE_GRADIENT_PALETTE( pinkGrad_gp ) { 0, 249, 32, 145, 28, 208, 1, 7, 43, 249, 1, 19, 56, 126, 152, 10, 73, 234, 23, 84, 89, 224, 45, 119, 107, 232, 127, 158, 127, 244, 13, 89, 150, 188, 6, 52, 175, 177, 70, 14, 221, 194, 1, 8, 255, 112, 0, 1 }; DEFINE_GRADIENT_PALETTE( comfy_gp ) { 0, 255, 255, 45, 43, 208, 93, 1, 137, 224, 1, 242, 181, 159, 1, 29, 255, 63, 4, 68 }; DEFINE_GRADIENT_PALETTE( cyperpunk_gp ) { 0, 3, 6, 72, 38, 12, 50, 188, 109, 217, 35, 1, 135, 242, 175, 12, 178, 161, 32, 87, 255, 24, 6, 108 }; DEFINE_GRADIENT_PALETTE( girl_gp ) { 0, 103, 1, 10, 33, 109, 1, 12, 76, 159, 5, 48, 119, 175, 55, 103, 127, 175, 55, 103, 178, 159, 5, 48, 221, 109, 1, 12, 255, 103, 1, 10 }; DEFINE_GRADIENT_PALETTE( xmas_gp ) { 0, 0, 12, 0, 40, 0, 55, 0, 66, 1, 117, 2, 77, 1, 84, 1, 81, 0, 55, 0, 119, 0, 12, 0, 153, 42, 0, 0, 181, 121, 0, 0, 204, 255, 12, 8, 224, 121, 0, 0, 244, 42, 0, 0, 255, 42, 0, 0 }; DEFINE_GRADIENT_PALETTE( acid_gp ) { 0, 0, 12, 0, 61, 153, 239, 112, 127, 0, 12, 0, 165, 106, 239, 2, 196, 167, 229, 71, 229, 106, 239, 2, 255, 0, 12, 0 }; DEFINE_GRADIENT_PALETTE( blueSmoke_gp ) { 0, 0, 0, 0, 12, 1, 1, 3, 53, 8, 1, 22, 80, 4, 6, 89, 119, 2, 25, 216, 145, 7, 10, 99, 186, 15, 2, 31, 233, 2, 1, 5, 255, 0, 0, 0 }; DEFINE_GRADIENT_PALETTE( gummy_gp ) { 0, 8, 47, 5, 31, 77, 122, 6, 63, 249, 237, 7, 95, 232, 51, 1, 127, 215, 0, 1, 159, 47, 1, 3, 191, 1, 7, 16, 223, 52, 22, 6, 255, 239, 45, 1, }; DEFINE_GRADIENT_PALETTE( leo_gp ) { 0, 0, 0, 0, 16, 0, 0, 0, 32, 0, 0, 0, 18, 0, 0, 0, 64, 16, 8, 0, 80, 80, 40, 0, 96, 16, 8, 0, 112, 0, 0, 0, 128, 0, 0, 0, 144, 0, 0, 0, 160, 0, 0, 0, 176, 0, 0, 0, 192, 0, 0, 0, 208, 0, 0, 0, 224, 0, 0, 0, 240, 0, 0, 0, 255, 0, 0, 0, }; DEFINE_GRADIENT_PALETTE ( aurora_gp ) { 0, 17, 177, 13, //Greenish 64, 121, 242, 5, //Greenish 128, 25, 173, 121, //Turquoise 192, 250, 77, 127, //Pink 255, 171, 101, 221 //Purple }; const TProgmemRGBPalette16 WoodFireColors_p PROGMEM = {CRGB::Black, 0x330e00, 0x661c00, 0x992900, 0xcc3700, CRGB::OrangeRed, 0xff5800, 0xff6b00, 0xff7f00, 0xff9200, CRGB::Orange, 0xffaf00, 0xffb900, 0xffc300, 0xffcd00, CRGB::Gold}; //* рыжий const TProgmemRGBPalette16 NormalFire_p PROGMEM = {CRGB::Black, 0x330000, 0x660000, 0x990000, 0xcc0000, CRGB::Red, 0xff0c00, 0xff1800, 0xff2400, 0xff3000, 0xff3c00, 0xff4800, 0xff5400, 0xff6000, 0xff6c00, 0xff7800}; // красный const TProgmemRGBPalette16 LithiumFireColors_p PROGMEM = {CRGB::Black, 0x240707, 0x470e0e, 0x6b1414, 0x8e1b1b, CRGB::FireBrick, 0xc14244, 0xd16166, 0xe08187, 0xf0a0a9, CRGB::Pink, 0xff9ec0, 0xff7bb5, 0xff59a9, 0xff369e, CRGB::DeepPink}; //* пастель const TProgmemRGBPalette16 SodiumFireColors_p PROGMEM = {CRGB::Black, 0x332100, 0x664200, 0x996300, 0xcc8400, CRGB::Orange, 0xffaf00, 0xffb900, 0xffc300, 0xffcd00, CRGB::Gold, 0xf8cd06, 0xf0c30d, 0xe9b913, 0xe1af1a, CRGB::Goldenrod}; //* Yellow const TProgmemRGBPalette16 CopperFireColors_p PROGMEM = {CRGB::Black, 0x001a00, 0x003300, 0x004d00, 0x006600, CRGB::Green, 0x239909, 0x45b313, 0x68cc1c, 0x8ae626, CRGB::GreenYellow, 0x94f530, 0x7ceb30, 0x63e131, 0x4bd731, CRGB::LimeGreen}; //* Green const TProgmemRGBPalette16 AlcoholFireColors_p PROGMEM = {CRGB::Black, 0x000033, 0x000066, 0x000099, 0x0000cc, CRGB::Blue, 0x0026ff, 0x004cff, 0x0073ff, 0x0099ff, CRGB::DeepSkyBlue, 0x1bc2fe, 0x36c5fd, 0x51c8fc, 0x6ccbfb, CRGB::LightSkyBlue}; //* Blue CRGBPalette16 paletteArr[] = { customPal, HeatColors_p, Fire_gp, WoodFireColors_p, NormalFire_p, LithiumFireColors_p, SodiumFireColors_p, CopperFireColors_p, AlcoholFireColors_p, LavaColors_p, PartyColors_p, RainbowColors_p, RainbowStripeColors_p, CloudColors_p, OceanColors_p, ForestColors_p, Sunset_Real_gp, dkbluered_gp, Optimus_Prime_gp, warmGrad_gp, coldGrad_gp, hotGrad_gp, pinkGrad_gp, comfy_gp, cyperpunk_gp, girl_gp, xmas_gp, acid_gp, blueSmoke_gp, gummy_gp, leo_gp, aurora_gp, }; ================================================ FILE: firmware/GyverLamp2/parsing.ino ================================================ char buf[UDP_TX_PACKET_MAX_SIZE + 1]; void parsing() { if (Udp.parsePacket()) { int n = Udp.read(buf, UDP_TX_PACKET_MAX_SIZE); buf[n] = NULL; // ПРЕ-ПАРСИНГ (для данных АЦП) if (buf[0] != 'G' || buf[1] != 'L' || buf[2] != ',') return; // защита от не наших данных if (buf[3] == '7') { // АЦП GL,7, if (!cfg.role) { // принимаем данные ацп если слейв int data[3]; mString ints(buf + 5); ints.parseInts(data, 3); udpLength = data[0]; udpScale = data[1]; udpBright = data[2]; effTmr.force(); // форсируем отрисовку эффекта gotADCtmr = millis(); } return; // выходим } if (millis() - udpTmr < 500) return; // принимаем остальные посылки не чаще 2 раз в секунду udpTmr = millis(); DEBUGLN(buf); // пакет вида ,<тип>,<дата1>,<дата2>... // ПАРСИНГ byte data[MAX_PRESETS * PRES_SIZE + 10]; memset(data, 0, MAX_PRESETS * PRES_SIZE + 10); int count = 0; char *str, *p = buf; char *ssid, *pass; while ((str = strtok_r(p, ",", &p)) != NULL) { uint32_t thisInt = atoi(str); data[count++] = (byte)thisInt; // парс байтов // парс "тяжёлых" данных if (data[1] == 0) { if (count == 4) ssid = str; if (count == 5) pass = str; } if (data[1] == 1) { if (count == 15) cfg.length = thisInt; if (count == 16) cfg.width = thisInt; if (count == 17) cfg.GMT = byte(thisInt); if (count == 18) cfg.cityID = thisInt; if (count == 19) cfg.mqtt = byte(thisInt); if (count == 20) strcpy(cfg.mqttID, str); if (count == 21) strcpy(cfg.mqttHost, str); if (count == 22) cfg.mqttPort = thisInt; if (count == 23) strcpy(cfg.mqttLogin, str); if (count == 24) strcpy(cfg.mqttPass, str); } } // тип 0 - control, 1 - config, 2 - effects, 3 - dawn, 4 - from master, 5 - palette, 6 - time switch (data[1]) { case 0: DEBUGLN("Control"); blinkTmr.restart(); if (!cfg.state && data[2] != 1) return; // если лампа выключена и это не команда на включение - не обрабатываем switch (data[2]) { case 0: controlHandler(0); break; // выкл case 1: controlHandler(1); break; // вкл case 2: cfg.minLight = phot.getRaw(); break; // мин яркость case 3: cfg.maxLight = phot.getRaw(); break; // макс яркость case 4: changePreset(-1); break; // пред пресет case 5: changePreset(1); break; // след пресет case 6: setPreset(data[3] - 1); break; // конкретный пресет data[3] case 7: cfg.WiFimode = data[3]; EE_updCfgRst(); break; // смена режима WiFi case 8: cfg.role = data[3]; break; // смена роли case 9: cfg.group = data[3]; restartUDP(); break; // смена группы case 10: // установка настроек WiFi strcpy(cfg.ssid, ssid); strcpy(cfg.pass, pass); break; case 11: EE_updCfgRst(); break; // рестарт case 12: if (gotNTP) { // OTA обновление, если есть интернет cfg.update = 1; EE_updCfg(); FastLED.clear(); FastLED.show(); char OTA[60]; mString ota(OTA); ota.clear(); ota += OTAhost; ota += OTAfile[data[3]]; DEBUG("Update to "); DEBUGLN(OTA); delay(100); WiFiClient client; ESPhttpUpdate.update(client, OTA); } break; case 13: // выключить через if (data[3] == 0) turnoffTmr.stop(); else { DEBUGLN("Fade"); fadeDown((uint32_t)data[3] * 60000ul); } break; } if (data[2] < 7) setTime(data[3], data[4], data[5], data[6]); EE_updCfg(); break; case 1: DEBUGLN("Config"); blinkTmr.restart(); FOR_i(0, CFG_SIZE) { *((byte*)&cfg + i) = data[i + 2]; // загоняем в структуру } setTime(data[CFG_SIZE + 10 + 2], data[CFG_SIZE + 10 + 3], data[CFG_SIZE + 10 + 4], data[CFG_SIZE + 10 + 5]); if (cfg.deviceType == GL_TYPE_STRIP) { if (cfg.length > MAX_LEDS) cfg.length = MAX_LEDS; cfg.width = 1; } if (cfg.length * cfg.width > MAX_LEDS) cfg.width = MAX_LEDS / cfg.length; ntp.setTimeOffset((cfg.GMT - 13) * 3600); FastLED.setMaxPowerInVoltsAndMilliamps(STRIP_VOLT, cfg.maxCur * 100); if (cfg.adcMode == GL_ADC_BRI) switchToPhot(); else if (cfg.adcMode == GL_ADC_MIC) switchToMic(); else disableADC(); EE_updCfg(); break; case 2: DEBUGLN("Preset"); { cfg.presetAmount = data[2]; // кол-во режимов FOR_j(0, cfg.presetAmount) { FOR_i(0, PRES_SIZE) { *((byte*)&preset + j * PRES_SIZE + i) = data[j * PRES_SIZE + i + 3]; // загоняем в структуру } } //if (!cfg.rotation) setPreset(data[cfg.presetAmount * PRES_SIZE + 3] - 1); byte dataStart = cfg.presetAmount * PRES_SIZE + 3; setPreset(data[dataStart] - 1); setTime(data[dataStart + 1], data[dataStart + 2], data[dataStart + 3], data[dataStart + 4]); EE_updatePreset(); //presetRotation(true); // форсировать смену режима holdPresTmr.restart(); loading = true; } break; case 3: DEBUGLN("Dawn"); blinkTmr.restart(); FOR_i(0, DAWN_SIZE) { *((byte*)&dawn + i) = data[i + 2]; // загоняем в структуру } setTime(data[DAWN_SIZE + 2], data[DAWN_SIZE + 3], data[DAWN_SIZE + 4], data[DAWN_SIZE + 5]); EE_updateDawn(); break; case 4: DEBUGLN("From master"); if (cfg.role == GL_SLAVE) { switch (data[2]) { case 0: fade(data[3]); break; // вкл выкл case 1: setPreset(data[3]); break; // пресет case 2: cfg.bright = data[3]; break; // яркость } EE_updateCfg(); } break; case 5: DEBUGLN("Palette"); blinkTmr.restart(); FOR_i(0, PAL_SIZE) { *((byte*)&pal + i) = data[i + 2]; // загоняем в структуру } setTime(data[PAL_SIZE + 2], data[PAL_SIZE + 3], data[PAL_SIZE + 4], data[PAL_SIZE + 5]); updPal(); EE_updatePal(); break; case 6: DEBUGLN("Time from AP"); if (cfg.WiFimode && !gotNTP) { // время для local устройств в сети AP лампы (не получили время из интернета) now.day = data[2]; now.hour = data[3]; now.min = data[4]; now.sec = 0; now.setMs(0); DEBUGLN("Got time from master"); } break; } FastLED.clear(); // на всякий случай } } void sendToSlaves(byte data1, byte data2) { if (cfg.role == GL_MASTER) { char reply[15]; mString packet(reply); packet.clear(); packet = packet + "GL,4," + data1 + ',' + data2; DEBUG("Sending to Slaves: "); DEBUGLN(reply); FOR_i(0, 4) { sendUDP(reply); delay(8); } } } ================================================ FILE: firmware/GyverLamp2/presetManager.ino ================================================ void presetRotation(bool force) { if (holdPresTmr.runningStop()) return; if (cfg.rotation && (now.newMin() || force)) { // если автосмена и новая минута if (cfg.rotRnd) { // случайная cfg.curPreset = trnd.fromMin(cfg.rotPeriod, cfg.presetAmount); DEBUG("Rnd changed to "); DEBUGLN(cfg.curPreset); } else { // по порядку cfg.curPreset = ((trnd.getMin() / cfg.rotPeriod) % cfg.presetAmount); DEBUG("In order changed to "); DEBUGLN(cfg.curPreset); } } } void changePreset(int dir) { //if (!cfg.rotation) { // ручная смена cfg.curPreset += dir; if (cfg.curPreset >= cfg.presetAmount) cfg.curPreset = 0; if (cfg.curPreset < 0) cfg.curPreset = cfg.presetAmount - 1; holdPresTmr.restart(); DEBUG("Preset changed to "); DEBUGLN(cfg.curPreset); //} } void setPreset(byte pres) { //if (!cfg.rotation) { // ручная смена cfg.curPreset = constrain(pres, 0, cfg.presetAmount - 1); holdPresTmr.restart(); DEBUG("Preset set to "); DEBUGLN(cfg.curPreset); //} } void controlHandler(bool state) { if (turnoffTmr.running()) { turnoffTmr.stop(); delay(50); FastLED.clear(); FastLED.show(); DEBUGLN("stop off timer"); return; } if (dawnTmr.running() || postDawn.running()) { dawnTmr.stop(); postDawn.stop(); delay(50); FastLED.clear(); FastLED.show(); DEBUGLN("stop dawn timer"); return; } if (state) cfg.manualOff = 0; if (cfg.state && !state) cfg.manualOff = 1; fade(state); } void fade(bool state) { if (cfg.state && !state) fadeDown(600); else setPower(state); } void setPower(bool state) { if (cfg.state != state) EE_updateCfg(); // на сохранение cfg.state = state; if (!state) { delay(100); // чтобы пролететь мин. частоту обновления FastLED.clear(); FastLED.show(); } if (millis() - udpTmr >= 1000) sendToSlaves(0, cfg.state); // пиздец костыль (не отправлять слейвам если команда получена по воздуху) DEBUGLN(state ? "Power on" : "Power off"); } void fadeDown(uint32_t time) { turnoffTmr.setInterval(time); turnoffTmr.restart(); } ================================================ FILE: firmware/GyverLamp2/startup.ino ================================================ void checkButton() { #if (USE_BTN == 1) DEBUGLN(cfg.WiFimode ? "local mode" : "AP mode"); if (btn.isHold()) { // кнопка зажата FastLED.clear(); byte count = 0; bool state = 0; while (btn.state()) { // пока зажата кнопка fill_solid(leds, constrain(count, 0, 8), CRGB::Red); count++; if (count == 9) { // на счёт 9 поднимаем яркость и флаг FastLED.setBrightness(120); state = 1; } else if (count == 16) { // на счёт 16 опускаем флаг выходим state = 0; break; } FastLED.show(); delay(300); } if (state) { DEBUGLN("change mode"); cfg.WiFimode = !cfg.WiFimode; EEPROM.put(0, cfg); EEPROM.commit(); delay(100); ESP.restart(); } } FastLED.setBrightness(50); FastLED.clear(); FastLED.show(); #endif } void checkGroup() { fill_solid(leds, cfg.group, (cfg.WiFimode) ? (CRGB::Blue) : (CRGB::Green)); FastLED.show(); uint32_t tmr = millis(); bool flag = 0; while (millis() - tmr < 3000) { #if (USE_BTN == 1) btn.tick(); if (btn.isClick()) { if (++cfg.group > 10) cfg.group = 1; FastLED.clear(); fill_solid(leds, cfg.group, (cfg.WiFimode) ? (CRGB::Blue) : (CRGB::Green)); FastLED.show(); flag = 1; tmr = millis(); } if (btn.isHold()) { return; } #endif yield(); } if (flag) { EEPROM.put(0, cfg); EEPROM.commit(); } DEBUG("group: "); DEBUGLN(cfg.group); DEBUG("role: "); DEBUGLN(cfg.role); } void startStrip() { FastLED.addLeds(leds, MAX_LEDS).setCorrection(TypicalLEDStrip); FastLED.setMaxPowerInVoltsAndMilliamps(STRIP_VOLT, 500); FastLED.setBrightness(50); FastLED.show(); } void showRGB() { leds[0] = CRGB::Red; leds[1] = CRGB::Green; leds[2] = CRGB::Blue; FastLED.show(); FastLED.clear(); delay(1500); } void startWiFi() { if (!cfg.WiFimode) setupAP(); // режим точки доступа else setupLocal(); // подключаемся к точке restartUDP(); FastLED.clear(); FastLED.show(); } void setupAP() { blink16(CRGB::Yellow); WiFi.disconnect(); WiFi.mode(WIFI_AP); delay(100); WiFi.softAP(AP_NameChar, WiFiPassword); server.begin(); DEBUGLN("Setting AP Mode"); DEBUG("AP IP: "); DEBUGLN(WiFi.softAPIP()); delay(500); } void setupLocal() { if (cfg.ssid[0] == NULL && cfg.pass[0] == NULL) { DEBUGLN("WiFi not configured"); setupAP(); } else { DEBUGLN("Connecting to AP..."); WiFi.softAPdisconnect(); WiFi.disconnect(); WiFi.mode(WIFI_STA); delay(100); uint32_t tmr = millis(); bool connect = false; int8_t count = 0, dir = 1; byte failCount = 0; while (1) { WiFi.begin(cfg.ssid, cfg.pass); while (millis() - tmr < 10000) { if (WiFi.status() == WL_CONNECTED) { connect = true; break; } FastLED.clear(); leds[count] = CRGB::Yellow; FastLED.show(); count += dir; if (count >= 15 || count <= 0) dir *= -1; delay(50); } if (connect) { connTmr.stop(); blink16(CRGB::Green); server.begin(); DEBUG("Connected! Local IP: "); DEBUGLN(WiFi.localIP()); delay(500); return; } else { DEBUGLN("Failed!"); blink16(CRGB::Red); failCount++; tmr = millis(); if (failCount >= 3) { connTmr.restart(); // попробуем позже setupAP(); return; } } } } } void checkUpdate() { if (cfg.update) { // было ОТА обновление if (cfg.version != GL_VERSION) { cfg.version = GL_VERSION; blink16(CRGB::Cyan); DEBUG("Update to"); DEBUGLN(GL_VERSION); } else { blink16(CRGB::Blue); DEBUGLN("Update to current"); } cfg.update = 0; EE_updCfg(); } else { if (cfg.version != GL_VERSION) { cfg.version = GL_VERSION; blink16(CRGB::Cyan); DEBUG("Update to"); DEBUGLN(GL_VERSION); } } } void tryReconnect() { if (connTmr.isReady()) { DEBUGLN("Reconnect"); startWiFi(); } } void misc() { memset(matrixValue, 0, sizeof(matrixValue)); char GLkey[] = GL_KEY; portNum = 17; for (byte i = 0; i < strlen(GLkey); i++) portNum *= GLkey[i]; portNum %= 15000; portNum += 50000; } ================================================ FILE: firmware/GyverLamp2/time.ino ================================================ void setupTime() { ntp.setUpdateInterval(NTP_UPD_PRD * 60000ul / 2); // ставим меньше, так как апдейт вручную ntp.setTimeOffset((cfg.GMT - 13) * 3600l); ntp.setPoolServerName(NTPserver); if (cfg.WiFimode && !connTmr.running()) { // если успешно подключились к WiFi ntp.begin(); if (ntp.update()) gotNTP = true; } } // основной тикер времени void timeTicker() { static timerMillis tmr(30, true); if (tmr.isReady()) { if (cfg.WiFimode && WiFi.status() == WL_CONNECTED && !connTmr.running()) { // если вайфай подключен и это не попытка переподключиться now.sec = ntp.getSeconds(); now.min = ntp.getMinutes(); now.hour = ntp.getHours(); now.day = ntp.getDay(); // вс 0, сб 6 now.weekMs = now.getWeekS() * 1000ul + ntp.getMillis(); now.setMs(ntp.getMillis()); if (now.sec == 0 && now.min % NTP_UPD_PRD == 0 && ntp.update()) gotNTP = true; } else { // если вайфай не подключен now.tick(); // тикаем своим счётчиком } static byte prevSec = 0; if (prevSec != now.sec) { // новая секунда prevSec = now.sec; trnd.update(now.hour, now.min, now.sec); // обновляем рандомайзер if (now.sec == 0) { // новая минута if (now.min % 5 == 0) sendTimeToLocals(); // отправляем время каждые 5 мин if (gotNTP || gotTime) { // если знаем точное время checkWorkTime(); // проверяем расписание checkDawn(); // и рассвет } } } } } void sendTimeToLocals() { if (!cfg.WiFimode) sendUDP(6, now.day, now.hour, now.min); // мы - АР } // установка времени с мобилы void setTime(byte day, byte hour, byte min, byte sec) { if (!cfg.WiFimode || !gotNTP) { // если мы AP или не получили NTP now.day = day; now.hour = hour; now.min = min; now.sec = sec; now.setMs(0); gotTime = true; } } void checkDawn() { if (dawn.state[now.day] && !dawnTmr.running()) { // рассвет включен но не запущен int dawnMinute = dawn.hour[now.day] * 60 + dawn.minute[now.day] - dawn.time; if (dawnMinute < 0) dawnMinute += 1440; if (dawnMinute == now.hour * 60 + now.min) { DEBUG("dawn start "); DEBUGLN(dawn.time * 60000ul); dawnTmr.setInterval(dawn.time * 60000ul); dawnTmr.restart(); } } } void checkWorkTime() { static byte prevState = 2; // для первого запуска byte curState = isWorkTime(now.hour, cfg.workFrom, cfg.workTo); if (prevState != curState) { // переключение расписания prevState = curState; // todo: проверить пересечение с рассветом if (curState && !cfg.state && !cfg.manualOff) fade(1); // нужно включить, а лампа выключена и не выключалась вручную if (!curState && cfg.state) fade(0); // нужно выключить, а лампа включена } } bool isWorkTime(byte t, byte from, byte to) { if (from == to) return 1; else if (from < to) { if (t >= from && t < to) return 1; else return 0; } else { if (t >= from || t < to) return 1; else return 0; } } ================================================ FILE: firmware/GyverLamp2/timeRandom.h ================================================ #ifndef TimeRandom_h #define TimeRandom_h #include class TimeRandom { public: // установить канал (по умолч 0) void setChannel(byte channel) { _c = channel; } // обновить ЧМС void update(byte h, byte m, byte s) { _h = h; _m = m; _s = s; } // количество секунд с начала суток uint32_t getSec() { return (_h * 3600ul + _m * 60 + _s); } // количество минут с начала суток uint32_t getMin() { return (_h * 60 + _m); } // случайное число, обновляется каждые every секунд uint16_t fromSec(int every) { uint16_t s = getSec() / every; uint16_t val = (uint16_t)(_c + 1) * (_h + 1) * (_m + 1) * (s + 1); for (uint16_t i = 0; i < s & 0b1111; i++) val = (val * 2053ul) + 13849; return val; } // случайное число от 0 до max, обновляется каждые every секунд uint16_t fromSec(byte every, uint16_t max) { return ((uint32_t)max * fromSec(every)) >> 16; } // случайное число от min до max, обновляется каждые every секунд uint16_t fromSec(byte every, uint16_t min, uint16_t max) { return (fromSec(every, max - min) + min); } // случайное число, обновляется каждые every минут uint16_t fromMin(int every) { uint16_t m = getMin() / every; uint16_t val = (uint16_t)(_c + 1) * (_h + 1) * (m + 1); for (uint16_t i = 0; i < m & 0b1111; i++) val = (val * 2053ul) + 13849; return val; } // случайное число от 0 до max, обновляется каждые every минут uint16_t fromMin(byte every, uint16_t max) { return ((uint32_t)max * fromMin(every)) >> 16; } // случайное число от min до max, обновляется каждые every минут uint16_t fromMin(byte every, uint16_t min, uint16_t max) { return (fromMin(every, max - min) + min); } private: byte _h = 0, _m = 0, _s = 0, _c = 0; }; #endif ================================================ FILE: firmware/GyverLamp2/timerMillis.h ================================================ class timerMillis { public: timerMillis() {} timerMillis(uint32_t interval, bool active = false) { _interval = interval; reset(); if (active) restart(); else stop(); } void setInterval(uint32_t interval) { _interval = (interval == 0) ? 1 : interval; } boolean isReady() { if (_active && millis() - _tmr >= _interval) { reset(); return true; } return false; } boolean runningStop() { if (_active && millis() - _tmr >= _interval) stop(); return _active; } void force() { _tmr = millis() - _interval; } void reset() { _tmr = millis(); } void restart() { reset(); _active = true; } void stop() { _active = false; } bool running() { return _active; } byte getLength8() { return (_active) ? ((min(uint32_t(millis() - _tmr), _interval)) * 255ul / _interval) : 0; } private: uint32_t _tmr = 0; uint32_t _interval = 0; boolean _active = false; }; ================================================ FILE: firmware/PlatformIO/.gitignore ================================================ .DS_Store .pio .vscode/.browse.c_cpp.db* .vscode/c_cpp_properties.json .vscode/launch.json .vscode/ipch ================================================ FILE: firmware/PlatformIO/.vscode/extensions.json ================================================ { // See http://go.microsoft.com/fwlink/?LinkId=827846 // for the documentation about the extensions.json format "recommendations": [ "platformio.platformio-ide" ] } ================================================ FILE: firmware/PlatformIO/.vscode/settings.json ================================================ { "files.associations": { "*.tcc": "cpp", "deque": "cpp", "list": "cpp", "string": "cpp", "unordered_map": "cpp", "vector": "cpp" } } ================================================ FILE: firmware/PlatformIO/README.md ================================================ # PIO project ### Prerequisites: ``` pio update ``` ### Update over wire: ``` pio run -e debug -t erase pio run -e debug -t upload pio run -e release -t upload ``` ### Listen to serial monitor: ``` pio device monitor ``` ### Update over local network: ``` pio run -e wireless -t upload ``` ================================================ FILE: firmware/PlatformIO/include/README ================================================ This directory is intended for project header files. A header file is a file containing C declarations and macro definitions to be shared between several project source files. You request the use of a header file in your project source file (C, C++, etc) located in `src` folder by including it, with the C preprocessing directive `#include'. ```src/main.c #include "header.h" int main (void) { ... } ``` Including a header file produces the same results as copying the header file into each source file that needs it. Such copying would be time-consuming and error-prone. With a header file, the related declarations appear in only one place. If they need to be changed, they can be changed in one place, and programs that include the header file will automatically use the new version when next recompiled. The header file eliminates the labor of finding and changing all the copies as well as the risk that a failure to find one copy will result in inconsistencies within a program. In C, the usual convention is to give header files names that end with `.h'. It is most portable to use only letters, digits, dashes, and underscores in header file names, and at most one dot. Read more about using header files in official GCC documentation: * Include Syntax * Include Operation * Once-Only Headers * Computed Includes https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html ================================================ FILE: firmware/PlatformIO/lib/README ================================================ This directory is intended for project specific (private) libraries. PlatformIO will compile them to static libraries and link into executable file. The source code of each library should be placed in a an own separate directory ("lib/your_library_name/[here are source files]"). For example, see a structure of the following two libraries `Foo` and `Bar`: |--lib | | | |--Bar | | |--docs | | |--examples | | |--src | | |- Bar.c | | |- Bar.h | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html | | | |--Foo | | |- Foo.c | | |- Foo.h | | | |- README --> THIS FILE | |- platformio.ini |--src |- main.c and a contents of `src/main.c`: ``` #include #include int main (void) { ... } ``` PlatformIO Library Dependency Finder will find automatically dependent libraries scanning project source files. More information about PlatformIO Library Dependency Finder - https://docs.platformio.org/page/librarymanager/ldf.html ================================================ FILE: firmware/PlatformIO/platformio.ini ================================================ ; PlatformIO Project Configuration File ; ; Build options: build flags, source filter ; Upload options: custom upload port, speed and extra flags ; Library options: dependencies, extra library storages ; Advanced options: extra scripting ; ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html [platformio] default_envs = debug [env] platform = espressif8266 board = d1_mini board_build.ldscript = eagle.flash.4m2m.ld board_build.flash_mode = dout framework = arduino upload_speed = 460800 monitor_speed = 115200 lib_deps = fastled/FastLED@^3.4.0 [env:release] [env:debug] build_type = debug build_flags = -D DEBUG_SERIAL_LAMP [env:wireless] upload_protocol = espota upload_port = 192.168.8.164 ================================================ FILE: firmware/PlatformIO/test/README ================================================ This directory is intended for PlatformIO Unit Testing and project tests. Unit Testing is a software testing method by which individual units of source code, sets of one or more MCU program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use. Unit testing finds problems early in the development cycle. More information about PlatformIO Unit Testing: - https://docs.platformio.org/page/plus/unit-testing.html ================================================ FILE: libraries/FastLED-3.4.0/.gitignore ================================================ *.gch *~ /.vscode /docs/html /docs/latex ================================================ FILE: libraries/FastLED-3.4.0/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2013 FastLED Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: libraries/FastLED-3.4.0/PORTING.md ================================================ New platform porting guide ========================== # Fast porting for a new board on existing hardware Sometimes "porting" FastLED simply consists of supplying new pin definitions for the given platform. For example, platforms/avr/fastpin_avr.h contains various pin definitions for all the AVR variant chipsets/boards that FastLED supports. Defining a set of pins involves setting up a set of definitions - for example here's one full set from the avr fastpin file: ``` #elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__) _FL_IO(A); _FL_IO(B); _FL_IO(C); _FL_IO(D); #define MAX_PIN 31 _FL_DEFPIN(0, 0, B); _FL_DEFPIN(1, 1, B); _FL_DEFPIN(2, 2, B); _FL_DEFPIN(3, 3, B); _FL_DEFPIN(4, 4, B); _FL_DEFPIN(5, 5, B); _FL_DEFPIN(6, 6, B); _FL_DEFPIN(7, 7, B); _FL_DEFPIN(8, 0, D); _FL_DEFPIN(9, 1, D); _FL_DEFPIN(10, 2, D); _FL_DEFPIN(11, 3, D); _FL_DEFPIN(12, 4, D); _FL_DEFPIN(13, 5, D); _FL_DEFPIN(14, 6, D); _FL_DEFPIN(15, 7, D); _FL_DEFPIN(16, 0, C); _FL_DEFPIN(17, 1, C); _FL_DEFPIN(18, 2, C); _FL_DEFPIN(19, 3, C); _FL_DEFPIN(20, 4, C); _FL_DEFPIN(21, 5, C); _FL_DEFPIN(22, 6, C); _FL_DEFPIN(23, 7, C); _FL_DEFPIN(24, 0, A); _FL_DEFPIN(25, 1, A); _FL_DEFPIN(26, 2, A); _FL_DEFPIN(27, 3, A); _FL_DEFPIN(28, 4, A); _FL_DEFPIN(29, 5, A); _FL_DEFPIN(30, 6, A); _FL_DEFPIN(31, 7, A); #define HAS_HARDWARE_PIN_SUPPORT 1 ``` The ```_FL_IO``` macro is used to define the port registers for the platform while the ```_FL_DEFPIN``` macro is used to define pins. The parameters to the macro are the pin number, the bit on the port that represents that pin, and the port identifier itself. On some platforms, like the AVR, ports are identified by letter. On other platforms, like arm, ports are identified by number. The ```HAS_HARDWARE_PIN_SUPPORT``` define tells the rest of the FastLED library that there is hardware pin support available. There may be other platform specific defines for things like hardware SPI ports and such. ## Setting up the basic files/folders * Create platform directory (e.g. platforms/arm/kl26) * Create configuration header led_sysdefs_arm_kl26.h: * Define platform flags (like FASTLED_ARM/FASTLED_TEENSY) * Define configuration parameters re: interrupts, or clock doubling * Include extar system header files if needed * Create main platform include, fastled_arm_kl26.h * Include the various other header files as needed * Modify led_sysdefs.h to conditionally include platform sysdefs header file * Modify platforms.h to conditionally include platform fastled header ## Porting fastpin.h The heart of the FastLED library is the fast pin accesss. This is a templated class that provides 1-2 cycle pin access, bypassing digital write and other such things. As such, this will usually be the first bit of the library that you will want to port when moving to a new platform. Once you have FastPIN up and running then you can do some basic work like testing toggles or running bit-bang'd SPI output. There's two low level FastPin classes. There's the base FastPIN template class, and then there is FastPinBB which is for bit-banded access on those MCUs that support bitbanding. Note that the bitband class is optional and primarily useful in the implementation of other functionality internal to the platform. This file is also where you would do the pin to port/bit mapping defines. Explaining how the macros work and should be used is currently beyond the scope of this document. ## Porting fastspi.h This is where you define the low level interface to the hardware SPI system (including a writePixels method that does a bunch of housekeeping for writing led data). Use the fastspi_nop.h file as a reference for the methods that need to be implemented. There are ofteh other useful methods that can help with the internals of the SPI code, I recommend taking a look at how the various platforms implement their SPI classes. ## Porting clockless.h This is where you define the code for the clockless controllers. Across ARM platforms this will usually be fairly similar - though different arm platforms will have different clock sources that you can/should use. ================================================ FILE: libraries/FastLED-3.4.0/README.md ================================================ [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/FastLED/public) [![arduino-library-badge](https://www.ardu-badge.com/badge/FastLED.svg)](https://www.ardu-badge.com/FastLED) IMPORTANT NOTE: For AVR based systems, avr-gcc 4.8.x is supported and tested. This means Arduino 1.6.5 and later. FastLED 3.4 =========== This is a library for easily & efficiently controlling a wide variety of LED chipsets, like the ones sold by adafruit (Neopixel, DotStar, LPD8806), Sparkfun (WS2801), and aliexpress. In addition to writing to the leds, this library also includes a number of functions for high-performing 8bit math for manipulating your RGB values, as well as low level classes for abstracting out access to pins and SPI hardware, while still keeping things as fast as possible. Tested with Arduino up to 1.6.5 from arduino.cc. Quick note for people installing from GitHub repo zips, rename the folder FastLED before copying it to your Arduino/libraries folder. Github likes putting -branchname into the name of the folder, which unfortunately, makes Arduino cranky! We have multiple goals with this library: * Quick start for new developers - hook up your leds and go, no need to think about specifics of the led chipsets being used * Zero pain switching LED chipsets - you get some new leds that the library supports, just change the definition of LEDs you're using, et. voila! Your code is running with the new leds. * High performance - with features like zero cost global brightness scaling, high performance 8-bit math for RGB manipulation, and some of the fastest bit-bang'd SPI support around, FastLED wants to keep as many CPU cycles available for your led patterns as possible ## Getting help If you need help with using the library, please consider going to the reddit community first, which is at http://fastled.io/r (or https://reddit.com/r/FastLED) - there are hundreds of people in that group and many times you will get a quicker answer to your question there, as you will be likely to run into other people who have had the same issue. If you run into bugs with the library (compilation failures, the library doing the wrong thing), or if you'd like to request that we support a particular platform or LED chipset, then please open an issue at http://fastled.io/issues and we will try to figure out what is going wrong. ## Simple example How quickly can you get up and running with the library? Here's a simple blink program: #include "FastLED.h" #define NUM_LEDS 60 CRGB leds[NUM_LEDS]; void setup() { FastLED.addLeds(leds, NUM_LEDS); } void loop() { leds[0] = CRGB::White; FastLED.show(); delay(30); leds[0] = CRGB::Black; FastLED.show(); delay(30); } ## Supported LED chipsets Here's a list of all the LED chipsets are supported. More details on the led chipsets are included *TODO: Link to wiki page* * Adafruit's DotStars - AKA the APA102 * Adafruit's Neopixel - aka the WS2812B (also WS2811/WS2812/WS2813, also supported in lo-speed mode) - a 3 wire addressable led chipset * TM1809/4 - 3 wire chipset, cheaply available on aliexpress.com * TM1803 - 3 wire chipset, sold by radio shack * UCS1903 - another 3 wire led chipset, cheap * GW6205 - another 3 wire led chipset * LPD8806 - SPI based chipset, very high speed * WS2801 - SPI based chipset, cheap and widely available * SM16716 - SPI based chipset * APA102 - SPI based chipset * P9813 - aka Cool Neon's Total Control Lighting * DMX - send rgb data out over DMX using arduino DMX libraries * SmartMatrix panels - needs the SmartMatrix library - https://github.com/pixelmatix/SmartMatrix * LPD6803 - SPI based chpiset, chip CMODE pin must be set to 1 (inside oscillator mode) HL1606, and "595"-style shift registers are no longer supported by the library. The older Version 1 of the library ("FastSPI_LED") has support for these, but is missing many of the advanced features of current versions and is no longer being maintained. ## Supported platforms Right now the library is supported on a variety of arduino compatable platforms. If it's ARM or AVR and uses the arduino software (or a modified version of it to build) then it is likely supported. Note that we have a long list of upcoming platforms to support, so if you don't see what you're looking for here, ask, it may be on the roadmap (or may already be supported). N.B. at the moment we are only supporting the stock compilers that ship with the arduino software. Support for upgraded compilers, as well as using AVR studio and skipping the arduino entirely, should be coming in a near future release. * Arduino & compatibles - straight up arduino devices, uno, duo, leonardo, mega, nano, etc... * Arduino Yún * Adafruit Trinket & Gemma - Trinket Pro may be supported, but haven't tested to confirm yet * Teensy 2, Teensy++ 2, Teensy 3.0, Teensy 3.1/3.2, Teensy LC, Teensy 3.5, Teensy 3.6, and Teensy 4.0 - arduino compataible from pjrc.com with some extra goodies (note the teensy 3, 3.1, and LC are ARM, not AVR!) * Arduino Due and the digistump DigiX * RFDuino * SparkCore * Arduino Zero * ESP8266 using the arduino board definitions from http://arduino.esp8266.com/stable/package_esp8266com_index.json - please be sure to also read https://github.com/FastLED/FastLED/wiki/ESP8266-notes for information specific to the 8266. * The wino board - http://wino-board.com * ESP32 based boards What types of platforms are we thinking about supporting in the future? Here's a short list: ChipKit32, Maple, Beagleboard ## What about that name? Wait, what happend to FastSPI_LED and FastSPI_LED2? The library was initially named FastSPI_LED because it was focused on very fast and efficient SPI access. However, since then, the library has expanded to support a number of LED chipsets that don't use SPI, as well as a number of math and utility functions for LED processing across the board. We decided that the name FastLED more accurately represents the totality of what the library provides, everything fast, for LEDs. ## For more information Check out the official site http://fastled.io for links to documentation, issues, and news *TODO* - get candy ================================================ FILE: libraries/FastLED-3.4.0/component.mk ================================================ COMPONENT_ADD_INCLUDEDIRS := ./src src/platforms/esp/32 COMPONENT_SRCDIRS := ./src src/platforms/esp/32 ================================================ FILE: libraries/FastLED-3.4.0/docs/Doxyfile ================================================ # Doxyfile 1.8.18 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. # # All text after a single hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the configuration # file that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # https://www.gnu.org/software/libiconv/ for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded by # double-quotes, unless you are using Doxywizard) that should identify the # project for which the documentation is generated. This name is used in the # title of most generated pages and in a few other places. # The default value is: My Project. PROJECT_NAME = FastLED # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. PROJECT_NUMBER = 3.3.3 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. OUTPUT_DIRECTORY = ../docs # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and # will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes # performance problems for the file system. # The default value is: NO. CREATE_SUBDIRS = NO # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode # U+3044. # The default value is: NO. ALLOW_UNICODE_NAMES = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, # Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), # Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, # Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, # Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, # Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, # Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English # The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all generated output in the proper direction. # Possible values are: None, LTR, RTL and Context. # The default value is: None. OUTPUT_TEXT_DIRECTION = None # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. # The default value is: YES. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief # description of a member or function before the detailed description # # Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. # The default value is: YES. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator that is # used to form the text in various listings. Each string in this list, if found # as the leading text of the brief description, will be stripped from the text # and the result, after processing the whole list, is used as the annotated # text. Otherwise, the brief description is used as-is. If left blank, the # following values are used ($name is automatically replaced with the name of # the entity):The $name class, The $name widget, The $name file, is, provides, # specifies, contains, represents, a, an and the. ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # doxygen will generate a detailed section even if there is only a brief # description. # The default value is: NO. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. # The default value is: NO. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path # before files name in the file list and in the header files. If set to NO the # shortest path that makes the file name unique will be used # The default value is: YES. FULL_PATH_NAMES = YES # The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. # Stripping is only done if one of the specified strings matches the left-hand # part of the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the path to # strip. # # Note that you can specify absolute paths here, but also relative paths, which # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which # header file to include in order to use a class. If left blank only the name of # the header file containing the class definition is used. Otherwise one should # specify the list of include paths that are normally passed to the compiler # using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't # support long names like on DOS, Mac, or CD-ROM. # The default value is: NO. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the # first line (until the first dot) of a Javadoc-style comment as the brief # description. If set to NO, the Javadoc-style will behave just like regular Qt- # style comments (thus requiring an explicit @brief command for a brief # description.) # The default value is: NO. JAVADOC_AUTOBRIEF = YES # If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line # such as # /*************** # as being the beginning of a Javadoc-style comment "banner". If set to NO, the # Javadoc-style will behave just like regular comments and it will not be # interpreted by doxygen. # The default value is: NO. JAVADOC_BANNER = NO # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus # requiring an explicit \brief command for a brief description.) # The default value is: NO. QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a # multi-line C++ special comment block (i.e. a block of //! or /// comments) as # a brief description. This used to be the default behavior. The new default is # to treat a multi-line C++ comment block as a detailed description. Set this # tag to YES if you prefer the old behavior instead. # # Note that setting this tag to YES also means that rational rose comments are # not recognized any more. # The default value is: NO. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new # page for each member. If set to NO, the documentation of a member will be part # of the file/class/namespace that contains it. # The default value is: NO. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen # uses this value to replace tabs by spaces in code fragments. # Minimum value: 1, maximum value: 16, default value: 4. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that act as commands in # the documentation. An alias has the form: # name=value # For example adding # "sideeffect=@par Side Effects:\n" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert # newlines (in the resulting output). You can put ^^ in the value part of an # alias to insert a newline as if a physical newline was in the original file. # When you need a literal { or } or , in the value part of an alias you have to # escape them by means of a backslash (\), this can lead to conflicts with the # commands \{ and \} for these it is advised to use the version @{ and @} or use # a double escape (\\{ and \\}) ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all # members will be omitted, etc. # The default value is: NO. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or # Python sources only. Doxygen will then generate output that is more tailored # for that language. For instance, namespaces will be presented as packages, # qualified scopes will look different, etc. # The default value is: NO. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources. Doxygen will then generate output that is tailored for Fortran. # The default value is: NO. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for VHDL. # The default value is: NO. OPTIMIZE_OUTPUT_VHDL = NO # Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice # sources only. Doxygen will then generate output that is more tailored for that # language. For instance, namespaces will be presented as modules, types will be # separated into more groups, etc. # The default value is: NO. OPTIMIZE_OUTPUT_SLICE = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and # language is one of the parsers supported by doxygen: IDL, Java, JavaScript, # Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL, # Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: # FortranFree, unknown formatted Fortran: Fortran. In the later case the parser # tries to guess whether the code is fixed or free formatted code, this is the # default for Fortran type files). For instance to make doxygen treat .inc files # as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise # the files are not read by doxygen. EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable # documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. # The default value is: YES. MARKDOWN_SUPPORT = YES # When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up # to that level are automatically included in the table of contents, even if # they do not have an id attribute. # Note: This feature currently applies only to Markdown headings. # Minimum value: 0, maximum value: 99, default value: 5. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. TOC_INCLUDE_HEADINGS = 5 # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. # The default value is: YES. AUTOLINK_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should set this # tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); # versus func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. # The default value is: NO. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. # The default value is: NO. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: # https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate # getter and setter methods for a property. Setting this option to YES will make # doxygen to replace the get and set methods by a property in the documentation. # This will only work if the methods are indeed getting or setting a simple # type. If this is not the case, or you want to show the methods anyway, you # should set this option to NO. # The default value is: YES. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. # The default value is: NO. DISTRIBUTE_GROUP_DOC = NO # If one adds a struct or class to a group and this option is enabled, then also # any nested class or struct is added to the same group. By default this option # is disabled and one has to add nested compounds explicitly via \ingroup. # The default value is: NO. GROUP_NESTED_COMPOUNDS = NO # Set the SUBGROUPING tag to YES to allow class member groups of the same type # (for instance a group of public functions) to be put as a subgroup of that # type (e.g. under the Public Functions section). Set it to NO to prevent # subgrouping. Alternatively, this can be done per class using the # \nosubgrouping command. # The default value is: YES. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions # are shown inside the group in which they are included (e.g. using \ingroup) # instead of on a separate page (for HTML and Man pages) or section (for LaTeX # and RTF). # # Note that this feature does not work in combination with # SEPARATE_MEMBER_PAGES. # The default value is: NO. INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions # with only public data fields or simple typedef fields will be shown inline in # the documentation of the scope in which they are defined (i.e. file, # namespace, or group documentation), provided this scope is documented. If set # to NO, structs, classes, and unions are shown on a separate page (for HTML and # Man pages) or section (for LaTeX and RTF). # The default value is: NO. INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or # enum is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically be # useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. # The default value is: NO. TYPEDEF_HIDES_STRUCT = NO # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can be # an expensive process and often the same symbol appears multiple times in the # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small # doxygen will become slower. If the cache is too large, memory is wasted. The # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 # symbols. At the end of a run doxygen will report the cache usage and suggest # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in # documentation are documented, even if no documentation was available. Private # class members and static file members will be hidden unless the # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. # Note: This will also disable the warnings about undocumented members that are # normally produced when WARNINGS is set to YES. # The default value is: NO. EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # be included in the documentation. # The default value is: NO. EXTRACT_PRIVATE = NO # If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual # methods of a class will be included in the documentation. # The default value is: NO. EXTRACT_PRIV_VIRTUAL = NO # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES, all static members of a file will be # included in the documentation. # The default value is: NO. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined # locally in source files will be included in the documentation. If set to NO, # only classes defined in header files are included. Does not have any effect # for Java sources. # The default value is: YES. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. If set to YES, local methods, # which are defined in the implementation section but not in the interface are # included in the documentation. If set to NO, only methods in the interface are # included. # The default value is: NO. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base name of # the file that contains the anonymous namespace. By default anonymous namespace # are hidden. # The default value is: NO. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation # section is generated. This option has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO, these classes will be included in the various overviews. This option # has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend # declarations. If set to NO, these declarations will be included in the # documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any # documentation blocks found inside the body of a function. If set to NO, these # blocks will be appended to the function's detailed documentation block. # The default value is: NO. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation that is typed after a # \internal command is included. If the tag is set to NO then the documentation # will be excluded. Set it to YES to include the internal documentation. # The default value is: NO. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file # names in lower-case letters. If set to YES, upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # (including Cygwin) ands Mac users are advised to set this option to NO. # The default value is: system dependent. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with # their full class and namespace scopes in the documentation. If set to YES, the # scope will be hidden. # The default value is: NO. HIDE_SCOPE_NAMES = NO # If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will # append additional text to a page's title, such as Class Reference. If set to # YES the compound reference will be hidden. # The default value is: NO. HIDE_COMPOUND_REFERENCE= NO # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. SHOW_INCLUDE_FILES = YES # If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each # grouped member an include statement to the documentation, telling the reader # which file to include in order to use the member. # The default value is: NO. SHOW_GROUPED_MEMB_INC = NO # If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include # files with double quotes in the documentation rather than with sharp brackets. # The default value is: NO. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the # documentation for inline members. # The default value is: YES. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the # (detailed) documentation of file and class members alphabetically by member # name. If set to NO, the members will appear in declaration order. # The default value is: YES. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # descriptions of file, namespace and class members alphabetically by member # name. If set to NO, the members will appear in declaration order. Note that # this will also influence the order of the classes in the class list. # The default value is: NO. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the # (brief and detailed) documentation of class members so that constructors and # destructors are listed first. If set to NO the constructors will appear in the # respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. # Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief # member documentation. # Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting # detailed member documentation. # The default value is: NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy # of group names into alphabetical order. If set to NO the group names will # appear in their defined order. # The default value is: NO. SORT_GROUP_NAMES = YES # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by # fully-qualified names, including namespaces. If set to NO, the class list will # be sorted only by class name, not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the alphabetical # list. # The default value is: NO. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper # type resolution of all parameters of a function it will reject a match between # the prototype and the implementation of a member function even if there is # only one candidate or it is obvious which candidate to choose by doing a # simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still # accept a match between prototype and implementation in such cases. # The default value is: NO. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo # list. This list is created by putting \todo commands in the documentation. # The default value is: YES. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test # list. This list is created by putting \test commands in the documentation. # The default value is: YES. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug # list. This list is created by putting \bug commands in the documentation. # The default value is: YES. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) # the deprecated list. This list is created by putting \deprecated commands in # the documentation. # The default value is: YES. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional documentation # sections, marked by \if ... \endif and \cond # ... \endcond blocks. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the # initial value of a variable or macro / define can have for it to appear in the # documentation. If the initializer consists of more lines than specified here # it will be hidden. Use a value of 0 to hide initializers completely. The # appearance of the value of individual variables and macros / defines can be # controlled using \showinitializer or \hideinitializer command in the # documentation regardless of this setting. # Minimum value: 0, maximum value: 10000, default value: 30. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at # the bottom of the documentation of classes and structs. If set to YES, the # list will mention the files that were used to generate the documentation. # The default value is: YES. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. This # will remove the Files entry from the Quick Index and from the Folder Tree View # (if specified). # The default value is: YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces # page. This will remove the Namespaces entry from the Quick Index and from the # Folder Tree View (if specified). # The default value is: YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command command input-file, where command is the value of the # FILE_VERSION_FILTER tag, and input-file is the name of an input file provided # by doxygen. Whatever the program writes to standard output is used as the file # version. For an example see the documentation. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml # will be used as the name of the layout file. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool # to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. CITE_BIB_FILES = #--------------------------------------------------------------------------- # Configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated to # standard output by doxygen. If QUIET is set to YES this implies that the # messages are off. # The default value is: NO. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated to standard error (stderr) by doxygen. If WARNINGS is set to YES # this implies that the warnings are on. # # Tip: Turn warnings on while writing the documentation. # The default value is: YES. WARNINGS = YES # If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag # will automatically be disabled. # The default value is: YES. WARN_IF_UNDOCUMENTED = YES # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some parameters # in a documented function, or documenting parameters that don't exist or using # markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return # value. If set to NO, doxygen will only warn about wrong or incomplete # parameter documentation, but not about the absence of documentation. If # EXTRACT_ALL is set to YES then this flag will automatically be disabled. # The default value is: NO. WARN_NO_PARAMDOC = NO # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when # a warning is encountered. # The default value is: NO. WARN_AS_ERROR = NO # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard # error (stderr). WARN_LOGFILE = #--------------------------------------------------------------------------- # Configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag is used to specify the files and/or directories that contain # documented source files. You may enter file names like myfile.cpp or # directories like /usr/src/myproject. Separate the files or directories with # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. INPUT = ../ ../lib8tion # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv # documentation (see: https://www.gnu.org/software/libiconv/) for the list of # possible encodings. # The default value is: UTF-8. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # read by doxygen. # # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, # *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), # *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen # C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, # *.vhdl, *.ucf, *.qsf and *.ice. FILE_PATTERNS = # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. # The default value is: NO. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. # The default value is: NO. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or directories # that contain example code fragments that are included (see the \include # command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and # *.h) to filter out the source-files in the directories. If left blank all # files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude commands # irrespective of the value of the RECURSIVE tag. # The default value is: NO. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or directories # that contain images that are to be included in the documentation (see the # \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command: # # # # where is the value of the INPUT_FILTER tag, and is the # name of an input file. Doxygen will then use the output that the filter # program writes to standard output. If FILTER_PATTERNS is specified, this tag # will be ignored. # # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: pattern=filter # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will also be used to filter the input files that are used for # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). # The default value is: NO. FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) and # it is also possible to disable source filtering for a specific pattern using # *.ext= (so without naming a filter). # This tag requires that the tag FILTER_SOURCE_FILES is set to YES. FILTER_SOURCE_PATTERNS = # If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that # is part of the input, its contents will be placed on the main page # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will be # generated. Documented entities will be cross-referenced with these sources. # # Note: To get rid of all source code in the generated output, make sure that # also VERBATIM_HEADERS is set to NO. # The default value is: NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. # The default value is: NO. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any # special comment blocks from generated source code fragments. Normal C, C++ and # Fortran comments will always remain visible. # The default value is: YES. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented # entity all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES then for each documented function # all documented entities called/used by that function will be listed. # The default value is: NO. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set # to YES then the hyperlinks from functions in REFERENCES_RELATION and # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will # link to the documentation. # The default value is: YES. REFERENCES_LINK_SOURCE = YES # If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the # source code will show a tooltip with additional information such as prototype, # brief description and links to the definition and documentation. Since this # will make the HTML file larger and loading of large files a bit slower, you # can opt to disable this feature. # The default value is: YES. # This tag requires that the tag SOURCE_BROWSER is set to YES. SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system # (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global # - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # # Doxygen will invoke htags (and that will in turn invoke gtags), so these # tools must be available from the command line (i.e. in the search path). # # The result: instead of the source browser generated by doxygen, the links to # source code will now point to the output of htags. # The default value is: NO. # This tag requires that the tag SOURCE_BROWSER is set to YES. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a # verbatim copy of the header file for each class for which an include is # specified. Set to NO to disable this. # See also: Section \class. # The default value is: YES. VERBATIM_HEADERS = YES # If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the # clang parser (see: http://clang.llvm.org/) for more accurate parsing at the # cost of reduced performance. This can be particularly helpful with template # rich C++ code for which doxygen's built-in parser lacks the necessary type # information. # Note: The availability of this option depends on whether or not doxygen was # generated with the -Duse_libclang=ON option for CMake. # The default value is: NO. CLANG_ASSISTED_PARSING = NO # If clang assisted parsing is enabled you can provide the compiler with command # line options that you would normally use when invoking the compiler. Note that # the include paths will already be set by doxygen for the files and directories # specified with INPUT and INCLUDE_PATH. # This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. CLANG_OPTIONS = # If clang assisted parsing is enabled you can provide the clang parser with the # path to the compilation database (see: # http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files # were built. This is equivalent to specifying the "-p" option to a clang tool, # such as clang-check. These options will then be passed to the parser. # Note: The availability of this option depends on whether or not doxygen was # generated with the -Duse_libclang=ON option for CMake. CLANG_DATABASE_PATH = #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all # compounds will be generated. Enable this if the project contains a lot of # classes, structs, unions or interfaces. # The default value is: YES. ALPHABETICAL_INDEX = YES # The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in # which the alphabetical index list will be split. # Minimum value: 1, maximum value: 20, default value: 5. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored # while generating the index headers. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output # The default value is: YES. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). # The default value is: .html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a user-defined HTML header file for # each generated HTML page. If the tag is left blank doxygen will generate a # standard header. # # To get valid HTML the header file that includes any scripts and style sheets # that doxygen needs, which is dependent on the configuration options used (e.g. # the setting GENERATE_TREEVIEW). It is highly recommended to start with a # default header using # doxygen -w html new_header.html new_footer.html new_stylesheet.css # YourConfigFile # and then modify the file new_header.html. See also section "Doxygen usage" # for information on how to generate the default header that doxygen normally # uses. # Note: The header is subject to change so you typically have to regenerate the # default header when upgrading to a newer version of doxygen. For a description # of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard # footer. See HTML_HEADER for more information on how to generate a default # footer and what special commands can be used inside the footer. See also # section "Doxygen usage" for information on how to generate the default footer # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # sheet that is used by each HTML page. It can be used to fine-tune the look of # the HTML output. If left blank doxygen will generate a default style sheet. # See also section "Doxygen usage" for information on how to generate the style # sheet that doxygen normally uses. # Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as # it is more robust and this tag (HTML_STYLESHEET) will in the future become # obsolete. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined # cascading style sheets that are included after the standard style sheets # created by doxygen. Using this option one can overrule certain style aspects. # This is preferred over using HTML_STYLESHEET since it does not replace the # standard style sheet and is therefore more robust against future updates. # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the # list). For an example see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that the # files will be copied as-is; there are no commands or markers available. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see # https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors # in the HTML output. For a value of 0 the output will use grayscales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the # luminance component of the colors in the HTML output. Values below 100 # gradually make the output lighter, whereas values above 100 make the output # darker. The value divided by 100 is the actual gamma applied, so 80 represents # a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not # change the gamma. # Minimum value: 40, maximum value: 240, default value: 80. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this # to YES can help to show when doxygen was last run and thus if the # documentation is up to date. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = YES # If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML # documentation will contain a main index with vertical navigation menus that # are dynamically created via JavaScript. If disabled, the navigation index will # consists of multiple levels of tabs that are statically embedded in every HTML # page. Disable this option to support browsers that do not have JavaScript, # like the Qt help browser. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_MENUS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_SECTIONS = YES # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand # and collapse entries dynamically later on. Doxygen will expand the tree to # such a level that at most the specified number of entries are visible (unless # a fully collapsed tree already exceeds this amount). So setting the number of # entries 1 will produce a full collapsed tree by default. 0 is a special value # representing an infinite number of entries and will result in a full expanded # tree by default. # Minimum value: 0, maximum value: 9999, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development # environment (see: https://developer.apple.com/xcode/), introduced with OSX # 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at # startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy # genXcode/_index.html for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_DOCSET = NO # This tag determines the name of the docset feed. A documentation feed provides # an umbrella under which multiple documentation sets from a single provider # (such as a company or product suite) can be grouped. # The default value is: Doxygen generated docs. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_FEEDNAME = "Doxygen generated docs" # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_BUNDLE_ID = org.doxygen.Project # The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. # The default value is: org.doxygen.Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. # The default value is: Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop # (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on # Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML # files are now used as the Windows 98 help format, and will replace the old # Windows help format (.hlp) on all Windows platforms in the future. Compressed # HTML files also contain an index, a table of contents, and you can search for # words in the documentation. The HTML workshop also contains a viewer for # compressed HTML files. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_HTMLHELP = NO # The CHM_FILE tag can be used to specify the file name of the resulting .chm # file. You can add a path in front of the file if the result should not be # written to the html output directory. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path # including file name) of the HTML help compiler (hhc.exe). If non-empty, # doxygen will try to run the HTML help compiler on the generated index.hhp. # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated # (YES) or that it should be included in the master .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = NO # The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) # and project file content. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = # The BINARY_TOC flag controls whether a binary table of contents is generated # (YES) or a normal table of contents (NO) in the .chm file. Furthermore it # enables the Previous and Next buttons. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members to # the table of contents of the HTML help documentation and to the tree view. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help # (.qch) of the generated HTML documentation. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify # the file name of the resulting .qch file. The path specified is relative to # the HTML output folder. # This tag requires that the tag GENERATE_QHP is set to YES. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace # (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual # Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual- # folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom # Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom # Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: # https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = # The QHG_LOCATION tag can be used to specify the location of Qt's # qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the # generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be # generated, together with the HTML files, they form an Eclipse help plugin. To # install this plugin and make it available under the help contents menu in # Eclipse, the contents of the directory containing the HTML and XML files needs # to be copied into the plugins directory of eclipse. The name of the directory # within the plugins directory should be the same as the ECLIPSE_DOC_ID value. # After copying Eclipse needs to be restarted before the help appears. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_ECLIPSEHELP = NO # A unique identifier for the Eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have this # name. Each documentation set should have its own identifier. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. ECLIPSE_DOC_ID = org.doxygen.Project # If you want full control over the layout of the generated HTML pages it might # be necessary to disable the index and replace it with your own. The # DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top # of each HTML page. A value of NO enables the index and the value YES disables # it. Since the tabs in the index contain the same information as the navigation # tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. If the tag # value is set to YES, a side panel will be generated containing a tree-like # index structure (just like the one that is generated for HTML Help). For this # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can # further fine-tune the look of the index. As an example, the default style # sheet generated by doxygen has an example that shows how to put an image at # the root of the tree instead of the PROJECT_NAME. Since the tree basically has # the same information as the tab index, you could consider setting # DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = YES # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # # Note that a value of 0 will completely suppress the enum values from appearing # in the overview section. # Minimum value: 0, maximum value: 20, default value: 4. # This tag requires that the tag GENERATE_HTML is set to YES. ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used # to set the initial width (in pixels) of the frame in which the tree is shown. # Minimum value: 0, maximum value: 1500, default value: 250. # This tag requires that the tag GENERATE_HTML is set to YES. TREEVIEW_WIDTH = 250 # If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to # external symbols imported via tag files in a separate window. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. EXT_LINKS_IN_WINDOW = NO # If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg # tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see # https://inkscape.org) to generate formulas as SVG images instead of PNGs for # the HTML output. These images will generally look nicer at scaled resolutions. # Possible values are: png The default and svg Looks nicer but requires the # pdf2svg tool. # The default value is: png. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FORMULA_FORMAT = png # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML # output directory to force them to be regenerated. # Minimum value: 8, maximum value: 50, default value: 10. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # # Note that when changing this option you need to delete any form_*.png files in # the HTML output directory before the changes have effect. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_TRANSPARENT = YES # The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands # to create new LaTeX commands to be used in formulas as building blocks. See # the section "Including formulas" for details. FORMULA_MACROFILE = # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see # https://www.mathjax.org) which uses client side JavaScript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path # to it using the MATHJAX_RELPATH option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: # http://docs.mathjax.org/en/latest/output.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_FORMAT = HTML-CSS # When MathJax is enabled you need to specify the location relative to the HTML # output directory using the MATHJAX_RELPATH option. The destination directory # should contain the MathJax.js script. For instance, if the mathjax directory # is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of # MathJax from https://www.mathjax.org before deployment. # The default value is: https://cdn.jsdelivr.net/npm/mathjax@2. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2 # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site # (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_CODEFILE = # When the SEARCHENGINE tag is enabled doxygen will generate a search box for # the HTML output. The underlying search engine uses javascript and DHTML and # should work on any modern browser. Note that when using HTML help # (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) # there is already a search function so this one should typically be disabled. # For large projects the javascript based search engine can be slow, then # enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to # search using the keyboard; to jump to the search box use + S # (what the is depends on the OS and browser, but it is typically # , /