├── .devcontainer ├── Dockerfile └── devcontainer.json ├── .github ├── ISSUE_TEMPLATE │ ├── bug.md │ ├── feature_request.md │ └── question.md ├── stale.yml └── workflows │ └── wled-ci.yml ├── .gitignore ├── .gitpod.Dockerfile ├── .gitpod.yml ├── .travis.yml.old ├── .vscode ├── extensions.json └── tasks.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE ├── images ├── Readme.md ├── macbook-pro-space-gray-on-the-wooden-table.jpg ├── walking-with-iphone-x.jpg ├── wled_logo.png ├── wled_logo_akemi.png └── wled_logo_clean.png ├── include └── README ├── installation.md ├── lib └── README ├── package-lock.json ├── package.json ├── pio ├── gzip-firmware.py ├── name-firmware.py ├── obj-dump.py ├── strip-floats.py └── user_config_copy.py ├── platformio.ini ├── platformio_override.ini.sample ├── readme.md ├── test └── README ├── tools └── cdata.js ├── usermods ├── DHT │ ├── platformio_override.ini │ ├── readme.md │ └── usermod_dht.h ├── ESP32_TouchBrightnessControl │ ├── readme.md │ └── usermod_touchbrightness.h ├── EXAMPLE_v2 │ ├── readme.md │ └── usermod_v2_example.h ├── Enclosure_with_OLED_temp_ESP07 │ ├── assets │ │ ├── controller.jpg │ │ ├── pcb.png │ │ └── readme.md │ ├── readme.md │ ├── usermod.cpp │ └── usermod_bme280.cpp ├── Fix_unreachable_netservices_v2 │ ├── readme.md │ └── usermod_Fix_unreachable_netservices.h ├── PIR_sensor_mqtt_v1 │ ├── README.md │ └── usermod.cpp ├── PIR_sensor_switch │ ├── PIR_Highlight_Standby │ ├── readme.md │ └── usermod_PIR_sensor_switch.h ├── QuinLED_Dig_Uno_Temp_MQTT │ ├── readme.md │ └── usermod.cpp ├── TTGO-T-Display │ ├── README.md │ ├── assets │ │ ├── ttgo-tdisplay-enclosure1a.png │ │ ├── ttgo-tdisplay-enclosure2a.png │ │ ├── ttgo-tdisplay-enclosure3a.png │ │ ├── ttgo-tdisplay-enclosure4a.png │ │ └── ttgo_hardware1.png │ ├── platformio_override.ini │ └── usermod.cpp ├── Temperature │ ├── platformio_override.ini │ ├── readme.md │ ├── usermod_temperature.h │ └── usermods_list.cpp ├── UserModv2_SunRiseAndSet │ ├── README.md │ └── UserMod_SunRiseAndSet.h ├── Wemos_D1_mini+Wemos32_mini_shield │ ├── readme.md │ ├── usermod.cpp │ └── usermod_bme280.cpp ├── battery_keypad_controller │ ├── README.md │ ├── assets │ │ ├── bat-key-ctrl-1.jpg │ │ ├── bat-key-ctrl-2.jpg │ │ └── bat-key-ctrl-3.jpg │ └── wled06_usermod.ino ├── blynk_relay_control │ ├── README.md │ └── wled06_usermod.ino ├── buzzer │ └── usermod_v2_buzzer.h ├── esp32_multistrip │ ├── NpbWrapper.h │ ├── README.md │ └── platformio_override.ini ├── mpu6050_imu │ ├── readme.md │ └── usermod_mpu6050_imu.h ├── mqtt_switch_v2 │ ├── README.md │ └── usermod_mqtt_switch.h ├── photoresistor_sensor_mqtt_v1 │ ├── README.md │ └── usermod.cpp ├── project_cars_shiftlight │ ├── readme.md │ └── wled06_usermod.ino ├── quinled_digquad_preassembled_unofficial_v0.1 │ ├── README.md │ ├── images │ │ ├── json-temp.png │ │ ├── params.png │ │ └── pio-screenshot.png │ └── platformio_override.ini ├── readme.md ├── rotary_encoder_change_brightness │ ├── usermod.cpp │ └── usermode_rotary_set.h ├── rotary_encoder_change_effect │ └── wled06_usermod.ino ├── sensors_to_mqtt │ ├── readme.md │ └── usermod_v2_SensorsToMqtt.h ├── ssd1306_i2c_oled_u8g2 │ ├── README.md │ ├── assets │ │ └── hw_connection.png │ └── wled06_usermod.ino ├── stairway_wipe_basic │ ├── readme.md │ ├── stairway-wipe-usermod-v2.h │ └── wled06_usermod.ino ├── usermod_v2_auto_save │ ├── readme.md │ └── usermod_v2_auto_save.h ├── usermod_v2_four_line_display │ ├── readme.md │ └── usermod_v2_four_line_display.h ├── usermod_v2_mode_sort │ ├── readme.md │ └── usermod_v2_mode_sort.h ├── usermod_v2_rotary_encoder_ui │ ├── platformio_override.ini.sample │ ├── readme.md │ └── usermod_v2_rotary_encoder_ui.h └── word-clock-matrix │ ├── Word Clock Baffle.stl │ ├── readme.md │ ├── word clock stencil.svg │ └── word-clock-matrix.cpp ├── wled00.sln └── wled00 ├── .vs └── wled00 │ └── v15 │ └── .suo ├── FX.cpp ├── FX.h ├── FX_fcn.cpp ├── NpbWrapper.h ├── __vm ├── .wled00.vsarduino.h ├── Compile.vmps.xml └── Configuration.Release.vmps.xml ├── alexa.cpp ├── blynk.cpp ├── button.cpp ├── cfg.cpp ├── colors.cpp ├── const.h ├── data ├── 404.htm ├── dmxmap.htm ├── edit.htm ├── favicon.ico ├── index.css ├── index.htm ├── index.js ├── iro.js ├── jsontest.htm ├── liveview.htm ├── msg.htm ├── rangetouch.js ├── settings.htm ├── settings_dmx.htm ├── settings_leds.htm ├── settings_sec.htm ├── settings_sync.htm ├── settings_time.htm ├── settings_ui.htm ├── settings_wifi.htm ├── style.css ├── update.htm ├── usermod.htm └── welcome.htm ├── dmx.cpp ├── e131.cpp ├── fcn_declare.h ├── file.cpp ├── html_other.h ├── html_settings.h ├── html_ui.h ├── hue.cpp ├── ir.cpp ├── ir_codes.h ├── json.cpp ├── led.cpp ├── lx_parser.cpp ├── mqtt.cpp ├── my_config_sample.h ├── ntp.cpp ├── overlay.cpp ├── palettes.h ├── pin_manager.cpp ├── playlist.cpp ├── presets.cpp ├── set.cpp ├── src └── dependencies │ ├── async-mqtt-client │ ├── AsyncMqttClient.cpp │ ├── AsyncMqttClient.h │ ├── AsyncMqttClient.hpp │ ├── AsyncMqttClient │ │ ├── Callbacks.hpp │ │ ├── DisconnectReasons.hpp │ │ ├── Flags.hpp │ │ ├── Helpers.hpp │ │ ├── MessageProperties.hpp │ │ ├── Packets │ │ │ ├── ConnAckPacket.cpp │ │ │ ├── ConnAckPacket.hpp │ │ │ ├── Packet.hpp │ │ │ ├── PingRespPacket.cpp │ │ │ ├── PingRespPacket.hpp │ │ │ ├── PubAckPacket.cpp │ │ │ ├── PubAckPacket.hpp │ │ │ ├── PubCompPacket.cpp │ │ │ ├── PubCompPacket.hpp │ │ │ ├── PubRecPacket.cpp │ │ │ ├── PubRecPacket.hpp │ │ │ ├── PubRelPacket.cpp │ │ │ ├── PubRelPacket.hpp │ │ │ ├── PublishPacket.cpp │ │ │ ├── PublishPacket.hpp │ │ │ ├── SubAckPacket.cpp │ │ │ ├── SubAckPacket.hpp │ │ │ ├── UnsubAckPacket.cpp │ │ │ └── UnsubAckPacket.hpp │ │ ├── ParsingInformation.hpp │ │ └── Storage.hpp │ ├── LICENSE │ └── README.md │ ├── blynk │ ├── Blynk │ │ ├── BlynkApi.h │ │ ├── BlynkApiArduino.h │ │ ├── BlynkArduinoClient.h │ │ ├── BlynkConfig.h │ │ ├── BlynkDateTime.h │ │ ├── BlynkDebug.cpp │ │ ├── BlynkDebug.h │ │ ├── BlynkDetectDevice.h │ │ ├── BlynkEveryN.h │ │ ├── BlynkFifo.h │ │ ├── BlynkHandlers.cpp │ │ ├── BlynkHandlers.h │ │ ├── BlynkParam.h │ │ ├── BlynkProtocol.h │ │ ├── BlynkProtocolDefs.h │ │ ├── BlynkTemplates.h │ │ ├── BlynkTimer.cpp │ │ ├── BlynkTimer.h │ │ ├── BlynkUtility.h │ │ ├── BlynkWiFiCommon.h │ │ ├── BlynkWidgetBase.h │ │ └── utility.cpp │ ├── BlynkSimpleEsp.cpp │ ├── BlynkSimpleEsp.h │ └── LICENSE.txt │ ├── dmx │ ├── ESPDMX.cpp │ └── ESPDMX.h │ ├── e131 │ ├── ESPAsyncE131.cpp │ └── ESPAsyncE131.h │ ├── espalexa │ ├── Espalexa.h │ ├── EspalexaDevice.cpp │ ├── EspalexaDevice.h │ └── LICENSE │ ├── json │ ├── ArduinoJson-v6.h │ └── AsyncJson-v6.h │ ├── network │ ├── Network.cpp │ └── Network.h │ ├── time │ ├── DateStrings.cpp │ ├── LICENSE.txt │ ├── Readme.txt │ ├── Time.cpp │ ├── TimeLib.h │ ├── library.json │ └── library.properties │ ├── timezone │ ├── LICENSE.md │ ├── ReadMe.md │ ├── Timezone.cpp │ └── Timezone.h │ └── ws2812fx │ ├── LICENSE.txt │ └── readme.txt ├── tv_colors.h ├── udp.cpp ├── um_manager.cpp ├── usermod.cpp ├── usermod_v2_empty.h ├── usermods_list.cpp ├── wled.cpp ├── wled.h ├── wled00.ino ├── wled00.vcxproj ├── wled00.vcxproj.filters ├── wled00.vcxproj.user ├── wled_eeprom.cpp ├── wled_serial.cpp ├── wled_server.cpp ├── ws.cpp └── xml.cpp /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.148.1/containers/python-3/.devcontainer/base.Dockerfile 2 | 3 | # [Choice] Python version: 3, 3.9, 3.8, 3.7, 3.6 4 | ARG VARIANT="3" 5 | FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} 6 | 7 | # [Option] Install Node.js 8 | ARG INSTALL_NODE="true" 9 | ARG NODE_VERSION="lts/*" 10 | RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi 11 | 12 | # [Optional] If your pip requirements rarely change, uncomment this section to add them to the image. 13 | # COPY requirements.txt /tmp/pip-tmp/ 14 | # RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ 15 | # && rm -rf /tmp/pip-tmp 16 | 17 | # [Optional] Uncomment this section to install additional OS packages. 18 | # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ 19 | # && apt-get -y install --no-install-recommends 20 | 21 | # [Optional] Uncomment this line to install global node packages. 22 | # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 23 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Python 3", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "context": "..", 6 | "args": { 7 | // Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9 8 | "VARIANT": "3", 9 | // Options 10 | "INSTALL_NODE": "true", 11 | "NODE_VERSION": "lts/*" 12 | } 13 | }, 14 | 15 | // Set *default* container specific settings.json values on container create. 16 | "settings": { 17 | "terminal.integrated.shell.linux": "/bin/bash", 18 | "python.pythonPath": "/usr/local/bin/python", 19 | "python.linting.enabled": true, 20 | "python.linting.pylintEnabled": true, 21 | "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", 22 | "python.formatting.blackPath": "/usr/local/py-utils/bin/black", 23 | "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", 24 | "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", 25 | "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", 26 | "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", 27 | "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", 28 | "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", 29 | "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint" 30 | }, 31 | 32 | // Add the IDs of extensions you want installed when the container is created. 33 | "extensions": [ 34 | "ms-python.python", 35 | "platformio.platformio-ide" 36 | ], 37 | 38 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 39 | // "forwardPorts": [], 40 | 41 | // Use 'postCreateCommand' to run commands after the container is created. 42 | "postCreateCommand": "npm install", 43 | 44 | // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 45 | "remoteUser": "vscode" 46 | } 47 | 48 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug 3 | about: Noticed an issue with your lights? 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. Please quickly search existing issues first! 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior, if consistently possible 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **WLED version** 20 | - Board: [e.g. Wemos D1, ESP32 dev] 21 | - Version [e.g. 0.10.0, dev200603] 22 | - Format [e.g. Binary, self-compiled] 23 | 24 | **Additional context** 25 | Anything else you'd like to say about the problem? 26 | 27 | Thank you for your help! 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an improvement idea for WLED! 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | 22 | Thank you for your ideas for making WLED better! 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Have a question about using WLED? 4 | title: '' 5 | labels: question 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Take a look at the wiki and FAQ, perhaps your question is already answered!** 11 | [FAQ](https://github.com/Aircoookie/WLED/wiki/FAQ) 12 | 13 | **Please consider asking your question on the WLED forum or Discord** 14 | [Forum](https://wled.discourse.group/) 15 | [Discord](https://discord.gg/KuqP7NE) 16 | [What to post where?](https://github.com/Aircoookie/WLED/issues/658) 17 | 18 | **If you do not like to use these platforms, delete this template and ask away!** 19 | Please keep in mind though that the issue section is generally not the preferred place for general questions. 20 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 120 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - keep 9 | - enhancement 10 | - confirmed 11 | # Label to use when marking an issue as stale 12 | staleLabel: stale 13 | # Comment to post when marking an issue as stale. Set to `false` to disable 14 | markComment: > 15 | Hey! This issue has been open for quite some time without any new comments now. 16 | It will be closed automatically in a week if no further activity occurs. 17 | 18 | Thank you for using WLED! 19 | # Comment to post when closing a stale issue. Set to `false` to disable 20 | closeComment: false 21 | -------------------------------------------------------------------------------- /.github/workflows/wled-ci.yml: -------------------------------------------------------------------------------- 1 | name: PlatformIO CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Cache pip 13 | uses: actions/cache@v2 14 | with: 15 | path: ~/.cache/pip 16 | key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} 17 | restore-keys: | 18 | ${{ runner.os }}-pip- 19 | - name: Cache PlatformIO 20 | uses: actions/cache@v2 21 | with: 22 | path: ~/.platformio 23 | key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} 24 | - name: Set up Python 25 | uses: actions/setup-python@v2 26 | - name: Install PlatformIO 27 | run: | 28 | python -m pip install --upgrade pip 29 | pip install --upgrade platformio 30 | - name: Run PlatformIO 31 | run: pio run -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .cache 3 | .pioenvs 4 | .piolibdeps 5 | .vscode 6 | !.vscode/extensions.json 7 | /wled00/Release 8 | /wled00/extLibs 9 | /platformio_override.ini 10 | /wled00/my_config.h 11 | /build_output 12 | .DS_Store 13 | .gitignore 14 | .clang-format 15 | node_modules 16 | -------------------------------------------------------------------------------- /.gitpod.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gitpod/workspace-full 2 | 3 | USER gitpod 4 | 5 | RUN pip3 install -U platformio 6 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | tasks: 2 | - command: platformio run 3 | 4 | image: 5 | file: .gitpod.Dockerfile 6 | 7 | vscode: 8 | extensions: 9 | - ms-vscode.cpptools@0.26.3:u3GsZ5PK12Ddr79vh4TWgQ== 10 | - eamodio.gitlens@10.2.1:e0IYyp0efFqVsrZwsIe8CA== 11 | - Atishay-Jain.All-Autocomplete@0.0.23:fbZNfSpnd8XkAHGfAPS2rA== 12 | - 2gua.rainbow-brackets@0.0.6:Tbu8dTz0i+/bgcKQTQ5b8g== 13 | -------------------------------------------------------------------------------- /.travis.yml.old: -------------------------------------------------------------------------------- 1 | # Continuous Integration (CI) is the practice, in software 2 | # engineering, of merging all developer working copies with a shared mainline 3 | # several times a day < https://docs.platformio.org/page/ci/index.html > 4 | # 5 | # Documentation: 6 | # 7 | # * Travis CI Embedded Builds with PlatformIO 8 | # < https://docs.travis-ci.com/user/integration/platformio/ > 9 | # 10 | # * PlatformIO integration with Travis CI 11 | # < https://docs.platformio.org/page/ci/travis.html > 12 | # 13 | # * User Guide for `platformio ci` command 14 | # < https://docs.platformio.org/page/userguide/cmd_ci.html > 15 | # 16 | # 17 | # Please choose one of the following templates (proposed below) and uncomment 18 | # it (remove "# " before each line) or use own configuration according to the 19 | # Travis CI documentation (see above). 20 | # 21 | # * Test the Travis config here: 22 | # < https://config.travis-ci.com/explore > 23 | # 24 | 25 | language: python 26 | python: 27 | # - "2.7" 28 | - "3.5" 29 | os: linux 30 | cache: 31 | bundler: true 32 | ccache: true 33 | directories: 34 | - "~/.platformio" 35 | - "~/.buildcache" 36 | env: 37 | - PLATFORMIO_CI_SRC=wled00 38 | install: 39 | - pip install -U platformio 40 | - platformio update 41 | script: 42 | # - platformio ci --project-conf=./platformio.ini 43 | - platformio run -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "Build: HTML and binary", 6 | "dependsOn": [ 7 | "Build: HTML only", 8 | "Build: binary only" 9 | ], 10 | "dependsOrder": "sequence", 11 | "problemMatcher": [ 12 | "$platformio", 13 | ], 14 | }, 15 | { 16 | "type": "PlatformIO", 17 | "label": "Build: binary only", 18 | "task": "Build", 19 | "group": { 20 | "kind": "build", 21 | "isDefault": true, 22 | }, 23 | "problemMatcher": [ 24 | "$platformio" 25 | ], 26 | "presentation": { 27 | "panel": "shared" 28 | } 29 | }, 30 | { 31 | "type": "npm", 32 | "script": "build", 33 | "group": "build", 34 | "problemMatcher": [], 35 | "label": "Build: HTML only", 36 | "detail": "npm run build", 37 | "presentation": { 38 | "panel": "shared" 39 | } 40 | } 41 | ] 42 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Christian Schwinne 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /images/Readme.md: -------------------------------------------------------------------------------- 1 | ### Additional Logos 2 | 3 | Additional awesome logos for WLED can be found here [Aircoookie/Akemi](https://github.com/Aircoookie/Akemi). 4 | 5 | 6 | -------------------------------------------------------------------------------- /images/macbook-pro-space-gray-on-the-wooden-table.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/images/macbook-pro-space-gray-on-the-wooden-table.jpg -------------------------------------------------------------------------------- /images/walking-with-iphone-x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/images/walking-with-iphone-x.jpg -------------------------------------------------------------------------------- /images/wled_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/images/wled_logo.png -------------------------------------------------------------------------------- /images/wled_logo_akemi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/images/wled_logo_akemi.png -------------------------------------------------------------------------------- /images/wled_logo_clean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/images/wled_logo_clean.png -------------------------------------------------------------------------------- /include/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project header files. 3 | 4 | A header file is a file containing C declarations and macro definitions 5 | to be shared between several project source files. You request the use of a 6 | header file in your project source file (C, C++, etc) located in `src` folder 7 | by including it, with the C preprocessing directive `#include'. 8 | 9 | ```src/main.c 10 | 11 | #include "header.h" 12 | 13 | int main (void) 14 | { 15 | ... 16 | } 17 | ``` 18 | 19 | Including a header file produces the same results as copying the header file 20 | into each source file that needs it. Such copying would be time-consuming 21 | and error-prone. With a header file, the related declarations appear 22 | in only one place. If they need to be changed, they can be changed in one 23 | place, and programs that include the header file will automatically use the 24 | new version when next recompiled. The header file eliminates the labor of 25 | finding and changing all the copies as well as the risk that a failure to 26 | find one copy will result in inconsistencies within a program. 27 | 28 | In C, the usual convention is to give header files names that end with `.h'. 29 | It is most portable to use only letters, digits, dashes, and underscores in 30 | header file names, and at most one dot. 31 | 32 | Read more about using header files in official GCC documentation: 33 | 34 | * Include Syntax 35 | * Include Operation 36 | * Once-Only Headers 37 | * Computed Includes 38 | 39 | https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html 40 | -------------------------------------------------------------------------------- /installation.md: -------------------------------------------------------------------------------- 1 | How to build and install the multi pin mod 2 | 3 | You have to use platformio to get this compiled correctly: 4 | 5 | (I'm using windows 10, but these tools are all cross platform:) 6 | 7 | Prereqs: 8 | 1. Install Python 9 | 2. Install git 10 | 3. Install Visual Studio Code 11 | 4. Reboot 12 | 5. Install PlatformIO Extension inside Visual Studio code 13 | 6. Clone the multipin fork repo: 14 | 15 | ``` 16 | cd ~ 17 | git clone https://github.com/peacepenguin/WLED 18 | ``` 19 | 20 | Now inside Visual Studio Code, click the PlatformIO option in the left menu. 21 | From PlatformIO home, click "Open Project" Browse to the WLED code downloaded from git. 22 | In Linux: "/home/username/WLED" or Windows: "c:\users\username\WLED" 23 | 24 | In the file: /wled00/NpbWrapper.h adjust these params to match your setup: 25 | 26 | ``` 27 | NUM_STRIPS # set this value to the total # of pins you want to output on 28 | 29 | STRIP1_PIN # set what GPIO pin to output on for each strip 30 | STRIP2_PIN # 31 | ... 32 | 33 | STRIP1_LEDCOUNT # total leds attached to STRIP1's gpio pin 34 | STRIP2_LEDCOUNT # total leds attached to STRIP2's gpio pin 35 | ... 36 | 37 | ``` 38 | 39 | Then click the Project Tasks section of Platformio, click "Upload" to build and upload to your ESP32, assuming its attached via serial. 40 | 41 | Configure WLED as normal, make sure to set the WEB gui's LED quantity to match your Total LED count in the system. Then save and reboot the ESP32. Use WLED as normal. 42 | 43 | Note: 8-pin is possible on ESP32. 2-pin is possible on ESP8622. 44 | 45 | If using ESP8622 you must adjust the PIXELMETHOD params for the 2-pins you can use: 46 | ``` 47 | STRIP1_PIXELMETHOD NeoEsp8266Uart1Ws2812xMethod 48 | STRIP2_PIXELMETHOD NeoEsp8266DmaWs2812xMethod 49 | ``` 50 | 51 | Then configure /platformio.ini for your specific board type. Comment out the default_envs = esp32dev, and set default_envs to your board. 52 | Example: 53 | ``` 54 | ; default_envs = esp32dev 55 | default_envs = d1_mini_ota 56 | ``` 57 | 58 | ADVANCED USAGE: 59 | 60 | For mixed GRB / RGB strips on different pins. You need to adjust the color order for specific strips in the code itself. 61 | 62 | Example to change only strip 4's color order from the default GRB that most common ws2812 led's operate at into RGB color order. 63 | 64 | Find the strip 4 set color code in the NpbWrapper.h file: 65 | ``` 66 | _pGrb4->SetPixelColor((indexPixel -= STRIP4_STARTLED), RgbColor(col.R,col.G,col.B)); 67 | ``` 68 | Change the color order after "RgbColor(" 69 | 70 | From this: 71 | ``` 72 | RgbColor(col.R,col.G,col.B)) 73 | ``` 74 | Into this: 75 | ``` 76 | RgbColor(col.G,col.R,col.B)) 77 | ``` 78 | 79 | -------------------------------------------------------------------------------- /lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in a an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wled", 3 | "version": "0.11.1", 4 | "description": "Tools for WLED project", 5 | "main": "tools/cdata.js", 6 | "directories": { 7 | "lib": "lib", 8 | "test": "test" 9 | }, 10 | "scripts": { 11 | "build": "node tools/cdata.js", 12 | "dev": "nodemon -e js,html,htm,css,png,jpg,gif,ico,js -w tools/ -w wled00/data/ -x node tools/cdata.js" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/Aircoookie/WLED.git" 17 | }, 18 | "author": "", 19 | "license": "ISC", 20 | "bugs": { 21 | "url": "https://github.com/Aircoookie/WLED/issues" 22 | }, 23 | "homepage": "https://github.com/Aircoookie/WLED#readme", 24 | "dependencies": { 25 | "clean-css": "^4.2.3", 26 | "html-minifier-terser": "^5.1.1", 27 | "inliner": "^1.13.1", 28 | "nodemon": "^2.0.4", 29 | "zlib": "^1.0.5" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /pio/gzip-firmware.py: -------------------------------------------------------------------------------- 1 | Import('env') 2 | import os 3 | import shutil 4 | import gzip 5 | 6 | OUTPUT_DIR = "build_output{}".format(os.path.sep) 7 | 8 | def bin_gzip(source, target, env): 9 | variant = str(target[0]).split(os.path.sep)[2] 10 | 11 | # create string with location and file names based on variant 12 | bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant) 13 | gzip_file = "{}firmware{}{}.bin.gz".format(OUTPUT_DIR, os.path.sep, variant) 14 | 15 | # check if new target files exist and remove if necessary 16 | if os.path.isfile(gzip_file): os.remove(gzip_file) 17 | 18 | # write gzip firmware file 19 | with open(bin_file,"rb") as fp: 20 | with gzip.open(gzip_file, "wb", compresslevel = 9) as f: 21 | shutil.copyfileobj(fp, f) 22 | 23 | env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_gzip]) 24 | -------------------------------------------------------------------------------- /pio/name-firmware.py: -------------------------------------------------------------------------------- 1 | Import('env') 2 | import os 3 | import shutil 4 | 5 | OUTPUT_DIR = "build_output{}".format(os.path.sep) 6 | 7 | def bin_rename_copy(source, target, env): 8 | variant = str(target[0]).split(os.path.sep)[2] 9 | 10 | # check if output directories exist and create if necessary 11 | if not os.path.isdir(OUTPUT_DIR): 12 | os.mkdir(OUTPUT_DIR) 13 | 14 | for d in ['firmware', 'map']: 15 | if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)): 16 | os.mkdir("{}{}".format(OUTPUT_DIR, d)) 17 | 18 | # create string with location and file names based on variant 19 | map_file = "{}map{}{}.map".format(OUTPUT_DIR, os.path.sep, variant) 20 | bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant) 21 | 22 | # check if new target files exist and remove if necessary 23 | for f in [map_file, bin_file]: 24 | if os.path.isfile(f): 25 | os.remove(f) 26 | 27 | # copy firmware.bin to firmware/.bin 28 | shutil.copy(str(target[0]), bin_file) 29 | 30 | # copy firmware.map to map/.map 31 | if os.path.isfile("firmware.map"): 32 | shutil.move("firmware.map", map_file) 33 | 34 | env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_rename_copy]) 35 | -------------------------------------------------------------------------------- /pio/obj-dump.py: -------------------------------------------------------------------------------- 1 | # Little convenience script to get an object dump 2 | 3 | Import('env') 4 | 5 | def obj_dump_after_elf(source, target, env): 6 | print("Create firmware.asm") 7 | env.Execute("xtensa-lx106-elf-objdump "+ "-D " + str(target[0]) + " > "+ "${PROGNAME}.asm") 8 | 9 | env.AddPostAction("$BUILD_DIR/${PROGNAME}.elf", [obj_dump_after_elf]) 10 | -------------------------------------------------------------------------------- /pio/strip-floats.py: -------------------------------------------------------------------------------- 1 | Import('env') 2 | 3 | # 4 | # Dump build environment (for debug) 5 | #print env.Dump() 6 | # 7 | 8 | flags = " ".join(env['LINKFLAGS']) 9 | flags = flags.replace("-u _printf_float", "") 10 | flags = flags.replace("-u _scanf_float", "") 11 | newflags = flags.split() 12 | 13 | env.Replace( 14 | LINKFLAGS=newflags 15 | ) -------------------------------------------------------------------------------- /pio/user_config_copy.py: -------------------------------------------------------------------------------- 1 | Import('env') 2 | import os 3 | import shutil 4 | 5 | # copy WLED00/my_config_sample.h to WLED00/my_config.h 6 | if os.path.isfile("wled00/my_config.h"): 7 | print ("*** use existing my_config.h ***") 8 | else: 9 | shutil.copy("wled00/my_config_sample.h", "wled00/my_config.h") 10 | -------------------------------------------------------------------------------- /platformio_override.ini.sample: -------------------------------------------------------------------------------- 1 | # Example PlatformIO Project Configuration Override 2 | # ------------------------------------------------------------------------------ 3 | # Copy to platformio_override.ini to activate overrides 4 | # ------------------------------------------------------------------------------ 5 | # Please visit documentation: https://docs.platformio.org/page/projectconf.html 6 | 7 | [platformio] 8 | default_envs = WLED_tasmota_1M 9 | 10 | [env:WLED_tasmota_1M] 11 | board = esp01_1m 12 | platform = ${common.platform_wled_default} 13 | platform_packages = ${common.platform_packages} 14 | board_build.ldscript = ${common.ldscript_1m128k} 15 | build_unflags = ${common.build_unflags} 16 | build_flags = ${common.build_flags_esp8266} 17 | ; ********************************************************************* 18 | ; *** Use custom settings from file my_config.h 19 | -DWLED_USE_MY_CONFIG 20 | ; ********************************************************************* 21 | ; -D WLED_DISABLE_OTA 22 | ; -D WLED_DISABLE_ALEXA 23 | ; -D WLED_DISABLE_BLYNK 24 | ; -D WLED_DISABLE_CRONIXIE 25 | ; -D WLED_DISABLE_HUESYNC 26 | ; -D WLED_DISABLE_INFRARED 27 | ; -D WLED_DISABLE_WEBSOCKETS 28 | ; PIN defines - uncomment and change, if needed: 29 | ; -D LEDPIN=2 30 | ; -D BTNPIN=0 31 | ; -D TOUCHPIN=T0 32 | ; -D IRPIN=4 33 | ; -D RLYPIN=12 34 | ; -D RLYMDE=1 35 | ; digital LED strip types - uncomment only one ! - this will disable WS281x / SK681x support 36 | ; -D USE_APA102 37 | ; -D USE_WS2801 38 | ; -D USE_LPD8806 39 | ; PIN defines for 2 wire LEDs 40 | -D CLKPIN=0 41 | -D DATAPIN=2 42 | ; to drive analog LED strips (aka 5050), uncomment the following 43 | ; PWM pins 5,12,13,15 are used with Magic Home LED Controller (default) 44 | -D WLED_USE_ANALOG_LEDS 45 | ; for the H801 controller (PINs 15,13,12,14 (W2 = 04)) uncomment this 46 | ; -D WLED_USE_H801 47 | ; for the BW-LT11 controller (PINs 12,4,14,5 ) uncomment this 48 | ; -D WLED_USE_BWLT11 49 | ; and to enable channel 5 for RGBW-CT led strips this 50 | ; -D WLED_USE_5CH_LEDS 51 | -------------------------------------------------------------------------------- /test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PIO Unit Testing and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PIO Unit Testing: 11 | - https://docs.platformio.org/page/plus/unit-testing.html 12 | -------------------------------------------------------------------------------- /usermods/DHT/platformio_override.ini: -------------------------------------------------------------------------------- 1 | ; Options 2 | ; ------- 3 | ; USERMOD_DHT - define this to have this user mod included wled00\usermods_list.cpp 4 | ; USERMOD_DHT_DHTTYPE - DHT model: 11, 21, 22 for DHT11, DHT21, or DHT22, defaults to 22/DHT22 5 | ; USERMOD_DHT_PIN - pin to which DTH is connected, defaults to Q2 pin on QuinLed Dig-Uno's board 6 | ; USERMOD_DHT_CELSIUS - define this to report temperatures in degrees celsious, otherwise fahrenheit will be reported 7 | ; USERMOD_DHT_MEASUREMENT_INTERVAL - the number of milliseconds between measurements, defaults to 60 seconds 8 | ; USERMOD_DHT_FIRST_MEASUREMENT_AT - the number of milliseconds after boot to take first measurement, defaults to 90 seconds 9 | ; USERMOD_DHT_STATS - For debug, report delay stats 10 | 11 | [env:d1_mini_usermod_dht_C] 12 | extends = env:d1_mini 13 | build_flags = ${env:d1_mini.build_flags} -D USERMOD_DHT -D USERMOD_DHT_CELSIUS 14 | lib_deps = ${env.lib_deps} 15 | https://github.com/alwynallan/DHT_nonblocking 16 | 17 | [env:custom32_LEDPIN_16_usermod_dht_C] 18 | extends = env:custom32_LEDPIN_16 19 | build_flags = ${env:custom32_LEDPIN_16.build_flags} -D USERMOD_DHT -D USERMOD_DHT_CELSIUS -D USERMOD_DHT_STATS 20 | lib_deps = ${env.lib_deps} 21 | https://github.com/alwynallan/DHT_nonblocking 22 | 23 | -------------------------------------------------------------------------------- /usermods/DHT/readme.md: -------------------------------------------------------------------------------- 1 | # DHT Temperature/Humidity sensor usermod 2 | 3 | This usermod will read from an attached DHT22 or DHT11 humidity and temperature sensor. 4 | The sensor readings are displayed in the Info section of the web UI. 5 | 6 | If sensor is not detected after a while (10 update intervals), this usermod will be disabled. 7 | 8 | ## Installation 9 | 10 | Copy the example `platformio_override.ini` to the root directory. This file should be placed in the same directory as `platformio.ini`. 11 | 12 | ### Define Your Options 13 | 14 | * `USERMOD_DHT` - define this to have this user mod included wled00\usermods_list.cpp 15 | * `USERMOD_DHT_DHTTYPE` - DHT model: 11, 21, 22 for DHT11, DHT21, or DHT22, defaults to 22/DHT22 16 | * `USERMOD_DHT_PIN` - pin to which DTH is connected, defaults to Q2 pin on QuinLed Dig-Uno's board 17 | * `USERMOD_DHT_CELSIUS` - define this to report temperatures in degrees celsious, otherwise fahrenheit will be reported 18 | * `USERMOD_DHT_MEASUREMENT_INTERVAL` - the number of milliseconds between measurements, defaults to 60 seconds 19 | * `USERMOD_DHT_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 90 seconds 20 | * `USERMOD_DHT_STATS` - For debug, report delay stats 21 | 22 | ## Project link 23 | 24 | * [QuinLED-Dig-Uno](https://quinled.info/2018/09/15/quinled-dig-uno/) - Project link 25 | 26 | ### PlatformIO requirements 27 | 28 | If you are using `platformio_override.ini`, you should be able to refresh the task list and see your custom task, for example `env:d1_mini_usermod_dht_C`. If not, you can add the libraries and dependencies into `platformio.ini` as you see fit. 29 | 30 | 31 | ## Change Log 32 | 33 | 2020-02-04 34 | * Change default QuinLed pin to Q2 35 | * Instead of trying to keep updates at constant cadence, space readings out by measurement interval; hope this helps to avoid occasional bursts of readings with errors 36 | * Add some more (optional) stats 37 | 2020-02-03 38 | * Due to poor readouts on ESP32 with previous DHT library, rewrote to use https://github.com/alwynallan/DHT_nonblocking 39 | * The new library serializes/delays up to 5ms for the sensor readout 40 | 2020-02-02 41 | * Created 42 | -------------------------------------------------------------------------------- /usermods/ESP32_TouchBrightnessControl/readme.md: -------------------------------------------------------------------------------- 1 | # ESP32 Touch Brightness Control 2 | 3 | Toggle On/Off with a long press (800ms) 4 | Switch through 5 brightness levels (defined in usermod_touchbrightness.h, values 0-255) with a short (100ms) touch 5 | 6 | ## Installation 7 | 8 | Copy 'usermod_touchbrightness.h' to the wled00 directory. 9 | in 'usermod_list.cpp' add this: 10 | 11 | > #include "usermod_touchbrightness.h" 12 | above "void registerUsermods()" 13 | 14 | and 15 | 16 | > usermods.add(new TouchBrightnessControl()); 17 | inside the "registerUsermods()" function 18 | 19 | 20 | -------------------------------------------------------------------------------- /usermods/ESP32_TouchBrightnessControl/usermod_touchbrightness.h: -------------------------------------------------------------------------------- 1 | // 2 | // usermod_touchbrightness.h 3 | // github.com/aircoookie/WLED 4 | // 5 | // Created by Justin Kühner on 14.09.2020. 6 | // Copyright © 2020 NeariX. All rights reserved. 7 | // https://github.com/NeariX67/ 8 | // Discord: @NeariX#4799 9 | 10 | 11 | #pragma once 12 | 13 | #include "wled.h" 14 | 15 | #define threshold 40 //Increase value if touches falsely accur. Decrease value if actual touches are not recognized 16 | #define touchPin T0 //T0 = D4 / GPIO4 17 | 18 | //Define the 5 brightness levels 19 | //Long press to turn off / on 20 | #define brightness1 51 21 | #define brightness2 102 22 | #define brightness3 153 23 | #define brightness4 204 24 | #define brightness5 255 25 | 26 | 27 | #ifdef ESP32 28 | 29 | 30 | class TouchBrightnessControl : public Usermod { 31 | private: 32 | unsigned long lastTime = 0; //Interval 33 | unsigned long lastTouch = 0; //Timestamp of last Touch 34 | unsigned long lastRelease = 0; //Timestamp of last Touch release 35 | boolean released = true; //current Touch state (touched/released) 36 | uint16_t touchReading = 0; //sensor reading, maybe use uint8_t??? 37 | uint16_t touchDuration = 0; //duration of last touch 38 | public: 39 | 40 | void setup() { 41 | lastTouch = millis(); 42 | lastRelease = millis(); 43 | lastTime = millis(); 44 | } 45 | 46 | void loop() { 47 | if (millis() - lastTime >= 50) { //Check every 50ms if a touch occurs 48 | lastTime = millis(); 49 | touchReading = touchRead(touchPin); //Read touch sensor on pin T0 (GPIO4 / D4) 50 | 51 | if(touchReading < threshold && released) { //Touch started 52 | released = false; 53 | lastTouch = millis(); 54 | } 55 | else if(touchReading >= threshold && !released) { //Touch released 56 | released = true; 57 | lastRelease = millis(); 58 | touchDuration = lastRelease - lastTouch; //Calculate duration 59 | } 60 | 61 | //Serial.println(touchDuration); 62 | 63 | if(touchDuration >= 800 && released) { //Toggle power if button press is longer than 800ms 64 | touchDuration = 0; //Reset touch duration to avoid multiple actions on same touch 65 | toggleOnOff(); 66 | colorUpdated(2); //Refresh values 67 | } 68 | else if(touchDuration >= 100 && released) { //Switch to next brightness if touch is between 100 and 800ms 69 | touchDuration = 0; //Reset touch duration to avoid multiple actions on same touch 70 | if(bri < brightness1) { 71 | bri = brightness1; 72 | } else if(bri >= brightness1 && bri < brightness2) { 73 | bri = brightness2; 74 | } else if(bri >= brightness2 && bri < brightness3) { 75 | bri = brightness3; 76 | } else if(bri >= brightness3 && bri < brightness4) { 77 | bri = brightness4; 78 | } else if(bri >= brightness4 && bri < brightness5) { 79 | bri = brightness5; 80 | } else if(bri >= brightness5) { 81 | bri = brightness1; 82 | } 83 | colorUpdated(2); //Refresh values 84 | } 85 | 86 | } 87 | } 88 | }; 89 | #endif 90 | -------------------------------------------------------------------------------- /usermods/EXAMPLE_v2/readme.md: -------------------------------------------------------------------------------- 1 | # Usermods API v2 example usermod 2 | 3 | In this usermod file you can find the documentation on how to take advantage of the new version 2 usermods! 4 | 5 | ## Installation 6 | 7 | Copy `usermod_v2_example.h` to the wled00 directory. 8 | Uncomment the corresponding lines in `usermods_list.cpp` and compile! 9 | _(You shouldn't need to actually install this, it does nothing useful)_ 10 | 11 | -------------------------------------------------------------------------------- /usermods/Enclosure_with_OLED_temp_ESP07/assets/controller.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/Enclosure_with_OLED_temp_ESP07/assets/controller.jpg -------------------------------------------------------------------------------- /usermods/Enclosure_with_OLED_temp_ESP07/assets/pcb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/Enclosure_with_OLED_temp_ESP07/assets/pcb.png -------------------------------------------------------------------------------- /usermods/Enclosure_with_OLED_temp_ESP07/assets/readme.md: -------------------------------------------------------------------------------- 1 | # Enclosure and PCB 2 | 3 | ## IP67 rated enclosure 4 | ![Enclosure](controller.jpg) 5 | 6 | ## PCB 7 | ![PCB](pcb.png) 8 | -------------------------------------------------------------------------------- /usermods/Enclosure_with_OLED_temp_ESP07/readme.md: -------------------------------------------------------------------------------- 1 | # Almost universal controller board for outdoor applications 2 | This usermod is using ideas from @mrVanboy and @400killer 3 | 4 | Installation of file: Copy and replace file in wled00 directory. 5 | 6 | For BME280 sensor use usermod_bme280.cpp. Copy to wled00 and rename to usermod.cpp 7 | 8 | ## Project repository 9 | - [Original repository](https://github.com/srg74/Controller-for-WLED-firmware) - Main controller repository 10 | ## Features 11 | - SSD1306 128x32 and 128x64 I2C OLED display 12 | - On screen IP address, SSID and controller status (e.g. ON or OFF, recent effect) 13 | - Auto display shutoff for saving display lifetime 14 | - Dallas temperature sensor 15 | - Reporting temperature to MQTT broker 16 | 17 | ## Hardware 18 | ![Hardware connection](assets/controller.jpg) 19 | 20 | ## Functionality checked with 21 | - ESP-07S 22 | - PlatformIO 23 | - SSD1306 128x32 I2C OLED display 24 | - DS18B20 (temperature sensor) 25 | - BME280 (temperature, humidity and pressure sensor) 26 | - KY-022 (infrared receiver) 27 | - Push button (N.O. momentary switch) 28 | 29 | For Dallas sensor uncomment `U8g2@~2.27.3`,`DallasTemperature@~3.8.0`,`OneWire@~2.3.5 under` `[common]` section in `platformio.ini`: 30 | ```ini 31 | # platformio.ini 32 | ... 33 | [platformio] 34 | ... 35 | default_envs = esp07 36 | ; default_envs = d1_mini 37 | ... 38 | [common] 39 | ... 40 | lib_deps_external = 41 | ... 42 | #For use SSD1306 OLED display uncomment following 43 | U8g2@~2.27.3 44 | #For Dallas sensor uncomment following 2 lines 45 | DallasTemperature@~3.8.0 46 | OneWire@~2.3.5 47 | ... 48 | ``` 49 | 50 | For BME280 sensor uncomment `U8g2@~2.27.3`,`BME280@~3.0.0 under` `[common]` section in `platformio.ini`: 51 | ```ini 52 | # platformio.ini 53 | ... 54 | [platformio] 55 | ... 56 | default_envs = esp07 57 | ; default_envs = d1_mini 58 | ... 59 | [common] 60 | ... 61 | lib_deps_external = 62 | ... 63 | #For use SSD1306 OLED display uncomment following 64 | U8g2@~2.27.3 65 | #For BME280 sensor uncomment following 66 | BME280@~3.0.0 67 | ... 68 | ``` 69 | -------------------------------------------------------------------------------- /usermods/Fix_unreachable_netservices_v2/readme.md: -------------------------------------------------------------------------------- 1 | # Fix unreachable net services V2 2 | 3 | **Attention: This usermod compiles only for ESP8266** 4 | 5 | This usermod-v2 modification performs a ping request to the local IP address every 60 seconds. By this procedure the net services of WLED remains accessible in some problematic WLAN environments. 6 | 7 | The modification works with static or DHCP IP address configuration. 8 | 9 | _Story:_ 10 | 11 | Unfortunately, with all ESP projects where a web server or other network services are running, I have the problem that after some time the web server is no longer accessible. Now I found out that the connection is at least reestablished when a ping request is executed by the device. 12 | 13 | With this modification, in the worst case, the network functions are not available for 60 seconds until the next ping request. 14 | 15 | ## Webinterface 16 | 17 | The number of pings and reconnects is displayed on the info page in the web interface. 18 | The ping delay can be changed. Changes persist after a reboot. 19 | 20 | ## JSON API 21 | 22 | The usermod supports the following state changes: 23 | 24 | | JSON key | Value range | Description | 25 | |-------------|------------------|---------------------------------| 26 | | PingDelayMs | 5000 to 18000000 | Deactivdate/activate the sensor | 27 | 28 | Changes also persist after a reboot. 29 | 30 | ## Installation 31 | 32 | 1. Copy the file `usermod_Fix_unreachable_netservices.h` to the `wled00` directory. 33 | 2. Register the usermod by adding `#include "usermod_Fix_unreachable_netservices.h"` in the top and `registerUsermod(new FixUnreachableNetServices());` in the bottom of `usermods_list.cpp`. 34 | 35 | Example **usermods_list.cpp**: 36 | 37 | ```cpp 38 | #include "wled.h" 39 | /* 40 | * Register your v2 usermods here! 41 | * (for v1 usermods using just usermod.cpp, you can ignore this file) 42 | */ 43 | 44 | /* 45 | * Add/uncomment your usermod filename here (and once more below) 46 | * || || || 47 | * \/ \/ \/ 48 | */ 49 | //#include "usermod_v2_example.h" 50 | //#include "usermod_temperature.h" 51 | //#include "usermod_v2_empty.h" 52 | #include "usermod_Fix_unreachable_netservices.h" 53 | 54 | void registerUsermods() 55 | { 56 | /* 57 | * Add your usermod class name here 58 | * || || || 59 | * \/ \/ \/ 60 | */ 61 | //usermods.add(new MyExampleUsermod()); 62 | //usermods.add(new UsermodTemperature()); 63 | //usermods.add(new UsermodRenameMe()); 64 | usermods.add(new FixUnreachableNetServices()); 65 | 66 | } 67 | ``` 68 | 69 | Hopefully I can help someone with that - @gegu 70 | -------------------------------------------------------------------------------- /usermods/PIR_sensor_mqtt_v1/README.md: -------------------------------------------------------------------------------- 1 | # PIR sensor with MQTT 2 | 3 | This simple usermod allows attaching a PIR sensor like the AM312 and publish the readings over MQTT. A message is sent when motion is detected as well as when motion has stopped. 4 | 5 | This usermod has only been tested with the AM312 sensor though should work for any other PIR sensor. Note that this does not control the LED strip directly, it only publishes MQTT readings for use with other integrations like Home Assistant. 6 | 7 | ## Installation 8 | 9 | Copy and replace the file `usermod.cpp` in wled00 directory. 10 | -------------------------------------------------------------------------------- /usermods/PIR_sensor_mqtt_v1/usermod.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | /* 3 | * This v1 usermod file allows you to add own functionality to WLED more easily 4 | * See: https://github.com/Aircoookie/WLED/wiki/Add-own-functionality 5 | * EEPROM bytes 2750+ are reserved for your custom use case. (if you extend #define EEPSIZE in const.h) 6 | * If you just need 8 bytes, use 2551-2559 (you do not need to increase EEPSIZE) 7 | * 8 | * Consider the v2 usermod API if you need a more advanced feature set! 9 | */ 10 | 11 | //Use userVar0 and userVar1 (API calls &U0=,&U1=, uint16_t) 12 | 13 | // PIR sensor pin 14 | const int MOTION_PIN = 16; 15 | // MQTT topic for sensor values 16 | const char MQTT_TOPIC[] = "/motion"; 17 | 18 | int prevState = LOW; 19 | 20 | //gets called once at boot. Do all initialization that doesn't depend on network here 21 | void userSetup() 22 | { 23 | pinMode(MOTION_PIN, INPUT); 24 | } 25 | 26 | //gets called every time WiFi is (re-)connected. Initialize own network interfaces here 27 | void userConnected() 28 | { 29 | 30 | } 31 | 32 | void publishMqtt(String state) 33 | { 34 | //Check if MQTT Connected, otherwise it will crash the 8266 35 | if (mqtt != nullptr){ 36 | char subuf[38]; 37 | strcpy(subuf, mqttDeviceTopic); 38 | strcat(subuf, MQTT_TOPIC); 39 | mqtt->publish(subuf, 0, true, state.c_str()); 40 | } 41 | } 42 | 43 | //loop. You can use "if (WLED_CONNECTED)" to check for successful connection 44 | void userLoop() 45 | { 46 | if (digitalRead(MOTION_PIN) == HIGH && prevState == LOW) { // Motion detected 47 | publishMqtt("ON"); 48 | prevState = HIGH; 49 | } 50 | if (digitalRead(MOTION_PIN) == LOW && prevState == HIGH) { // Motion stopped 51 | publishMqtt("OFF"); 52 | prevState = LOW; 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /usermods/QuinLED_Dig_Uno_Temp_MQTT/readme.md: -------------------------------------------------------------------------------- 1 | # QuinLED Dig Uno board 2 | 3 | These files allow WLED 0.9.1 to report the temp sensor on the Quinled board to MQTT. I use it to report the board temp to Home Assistant via MQTT, so it will send notifications if something happens and the board start to heat up. 4 | This code uses Aircookie's WLED software. It has a premade file for user modifications. I use it to publish the temperature from the dallas temperature sensor on the Quinled board. The entries for the top of the WLED00 file, initializes the required libraries, and variables for the sensor. The .ino file waits for 60 seconds, and checks to see if the MQTT server is connected (thanks Aircoookie). It then poles the sensor, and published it using the MQTT service already running, using the main topic programmed in the WLED UI. 5 | 6 | Installation of file: Copy and replace file in wled00 directory 7 | 8 | ## Project link 9 | 10 | * [QuinLED-Dig-Uno](https://quinled.info/2018/09/15/quinled-dig-uno/) - Project link 11 | 12 | ### Platformio requirements 13 | 14 | Uncomment `DallasTemperature@~3.8.0`,`OneWire@~2.3.5 under` `[common]` section in `platformio.ini`: 15 | 16 | ```ini 17 | # platformio.ini 18 | ... 19 | [platformio] 20 | ... 21 | ; default_envs = esp07 22 | default_envs = d1_mini 23 | ... 24 | [common] 25 | ... 26 | lib_deps_external = 27 | ... 28 | #For use SSD1306 OLED display uncomment following 29 | U8g2@~2.27.3 30 | #For Dallas sensor uncomment following 2 lines 31 | DallasTemperature@~3.8.0 32 | OneWire@~2.3.5 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /usermods/QuinLED_Dig_Uno_Temp_MQTT/usermod.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "wled.h" 3 | //Intiating code for QuinLED Dig-Uno temp sensor 4 | //Uncomment Celsius if that is your prefered temperature scale 5 | #include //Dallastemperature sensor 6 | #ifdef ARDUINO_ARCH_ESP32 //ESP32 boards 7 | OneWire oneWire(18); 8 | #else //ESP8266 boards 9 | OneWire oneWire(14); 10 | #endif 11 | DallasTemperature sensor(&oneWire); 12 | long temptimer = millis(); 13 | long lastMeasure = 0; 14 | #define Celsius // Show temperature mesaurement in Celcius otherwise is in Fahrenheit 15 | void userSetup() 16 | { 17 | // Start the DS18B20 sensor 18 | sensor.begin(); 19 | } 20 | 21 | //gets called every time WiFi is (re-)connected. Initialize own network interfaces here 22 | void userConnected() 23 | { 24 | 25 | } 26 | 27 | void userLoop() 28 | { 29 | temptimer = millis(); 30 | 31 | // Timer to publishe new temperature every 60 seconds 32 | if (temptimer - lastMeasure > 60000) { 33 | lastMeasure = temptimer; 34 | 35 | //Check if MQTT Connected, otherwise it will crash the 8266 36 | if (mqtt != nullptr){ 37 | sensor.requestTemperatures(); 38 | 39 | //Gets prefered temperature scale based on selection in definitions section 40 | #ifdef Celsius 41 | float board_temperature = sensor.getTempCByIndex(0); 42 | #else 43 | float board_temperature = sensors.getTempFByIndex(0); 44 | #endif 45 | 46 | //Create character string populated with user defined device topic from the UI, and the read temperature. Then publish to MQTT server. 47 | char subuf[38]; 48 | strcpy(subuf, mqttDeviceTopic); 49 | strcat(subuf, "/temperature"); 50 | mqtt->publish(subuf, 0, true, String(board_temperature).c_str()); 51 | return;} 52 | return;} 53 | return; 54 | } 55 | -------------------------------------------------------------------------------- /usermods/TTGO-T-Display/assets/ttgo-tdisplay-enclosure1a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/TTGO-T-Display/assets/ttgo-tdisplay-enclosure1a.png -------------------------------------------------------------------------------- /usermods/TTGO-T-Display/assets/ttgo-tdisplay-enclosure2a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/TTGO-T-Display/assets/ttgo-tdisplay-enclosure2a.png -------------------------------------------------------------------------------- /usermods/TTGO-T-Display/assets/ttgo-tdisplay-enclosure3a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/TTGO-T-Display/assets/ttgo-tdisplay-enclosure3a.png -------------------------------------------------------------------------------- /usermods/TTGO-T-Display/assets/ttgo-tdisplay-enclosure4a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/TTGO-T-Display/assets/ttgo-tdisplay-enclosure4a.png -------------------------------------------------------------------------------- /usermods/TTGO-T-Display/assets/ttgo_hardware1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/TTGO-T-Display/assets/ttgo_hardware1.png -------------------------------------------------------------------------------- /usermods/TTGO-T-Display/platformio_override.ini: -------------------------------------------------------------------------------- 1 | [env:esp32dev] 2 | build_flags = ${common.build_flags_esp32} 3 | ; PIN defines - uncomment and change, if needed: 4 | ; -D LEDPIN=2 5 | -D BTNPIN=35 6 | ; -D IRPIN=4 7 | ; -D RLYPIN=12 8 | ; -D RLYMDE=1 9 | -------------------------------------------------------------------------------- /usermods/Temperature/platformio_override.ini: -------------------------------------------------------------------------------- 1 | ; Options 2 | ; ------- 3 | ; USERMOD_DALLASTEMPERATURE - define this to have this user mod included wled00\usermods_list.cpp 4 | ; USERMOD_DALLASTEMPERATURE_CELSIUS - define this to report temperatures in degrees celsius, otherwise fahrenheit will be reported 5 | ; USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL - the number of milliseconds between measurements, defaults to 60 seconds 6 | ; USERMOD_DALLASTEMPERATURE_FIRST_MEASUREMENT_AT - the number of milliseconds after boot to take first measurement, defaults to 20 seconds 7 | ; 8 | [env:d1_mini_usermod_dallas_temperature_C] 9 | extends = env:d1_mini 10 | build_flags = ${common.build_flags_esp8266} -D USERMOD_DALLASTEMPERATURE -D USERMOD_DALLASTEMPERATURE_CELSIUS 11 | lib_deps = ${env.lib_deps} 12 | milesburton/DallasTemperature@^3.9.0 13 | OneWire@~2.3.5 14 | -------------------------------------------------------------------------------- /usermods/Temperature/readme.md: -------------------------------------------------------------------------------- 1 | # Temperature usermod 2 | 3 | Based on the excellent `QuinLED_Dig_Uno_Temp_MQTT` by srg74 and 400killer! 4 | This usermod will read from an attached DS18B20 temperature sensor (as available on the QuinLED Dig-Uno) 5 | The temperature is displayed both in the Info section of the web UI as well as published to the `/temperature` MQTT topic if enabled. 6 | This usermod will be expanded with support for different sensor types in the future. 7 | 8 | If temperature sensor is not detected during boot, this usermod will be disabled. 9 | 10 | ## Installation 11 | 12 | Copy the example `platformio_override.ini` to the root directory. This file should be placed in the same directory as `platformio.ini`. 13 | 14 | ### Define Your Options 15 | 16 | * `USERMOD_DALLASTEMPERATURE` - define this to have this user mod included wled00\usermods_list.cpp 17 | * `USERMOD_DALLASTEMPERATURE_CELSIUS` - define this to report temperatures in degrees celsious, otherwise fahrenheit will be reported 18 | * `USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL` - the number of milliseconds between measurements, defaults to 60 seconds 19 | * `USERMOD_DALLASTEMPERATURE_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 20 seconds 20 | 21 | ## Project link 22 | 23 | * [QuinLED-Dig-Uno](https://quinled.info/2018/09/15/quinled-dig-uno/) - Project link 24 | 25 | ### PlatformIO requirements 26 | 27 | If you are using `platformio_override.ini`, you should be able to refresh the task list and see your custom task, for example `env:d1_mini_usermod_dallas_temperature_C`. 28 | 29 | 30 | If you are not using `platformio_override.ini`, you might have to uncomment `DallasTemperature@~3.8.0`,`OneWire@~2.3.5 under` `[common]` section in `platformio.ini`: 31 | 32 | ```ini 33 | # platformio.ini 34 | ... 35 | [platformio] 36 | ... 37 | ; default_envs = esp07 38 | default_envs = d1_mini 39 | ... 40 | [common] 41 | ... 42 | lib_deps_external = 43 | ... 44 | #For use SSD1306 OLED display uncomment following 45 | U8g2@~2.27.3 46 | #For Dallas sensor uncomment following 2 lines 47 | DallasTemperature@~3.8.0 48 | OneWire@~2.3.5 49 | ... 50 | ``` 51 | 52 | ## Change Log 53 | 54 | 2020-09-12 55 | * Changed to use async, non-blocking implementation 56 | * Do not report low temperatures that indicate an error to mqtt 57 | * Disable plugin if temperature sensor not detected 58 | * Report the number of seconds until the first read in the info screen instead of sensor error -------------------------------------------------------------------------------- /usermods/Temperature/usermods_list.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | /* 3 | * Register your v2 usermods here! 4 | */ 5 | 6 | /* 7 | * Add/uncomment your usermod filename here (and once more below) 8 | * || || || 9 | * \/ \/ \/ 10 | */ 11 | //#include "usermod_v2_example.h" 12 | #ifdef USERMOD_DALLASTEMPERATURE 13 | #include "../usermods/Temperature/usermod_temperature.h" 14 | #endif 15 | 16 | //#include "usermod_v2_empty.h" 17 | 18 | void registerUsermods() 19 | { 20 | /* 21 | * Add your usermod class name here 22 | * || || || 23 | * \/ \/ \/ 24 | */ 25 | //usermods.add(new MyExampleUsermod()); 26 | #ifdef USERMOD_DALLASTEMPERATURE 27 | usermods.add(new UsermodTemperature()); 28 | #endif 29 | 30 | //usermods.add(new UsermodRenameMe()); 31 | } -------------------------------------------------------------------------------- /usermods/UserModv2_SunRiseAndSet/README.md: -------------------------------------------------------------------------------- 1 | WLED v2 UserMod for running macros at sunrise and sunset. 2 | 3 | At the time of this text, this user mod requires code to be changed to set certain variables: 4 | 1. To reflect the user's graphical location (latitude/longitude) used for calculating apparent sunrise/sunset 5 | 2. To specify which macros will be run at sunrise and/or sunset. (defaults to 15 at sunrise and 16 at sunset) 6 | 3. To optionally provide an offset from sunrise/sunset, in minutes (max of +/- 2 hours), when the macro will be run. 7 | 8 | In addition, WLED must be configured to get time from NTP (and the time must be retrieved via NTP.) 9 | 10 | Please open the UserMod_SunRiseAndSet.h file for instructions on what needs to be changed, where to copy files, etc. 11 | 12 | If this usermod proves useful enough, the code might eventually be updated to allow prompting for the required information 13 | via the web interface and to store settings in EEPROM instead of hard-coding in the .h file. 14 | 15 | This usermod has only been tested on the esp32dev platform, but there's no reason it wouldn't work on other platforms. 16 | -------------------------------------------------------------------------------- /usermods/Wemos_D1_mini+Wemos32_mini_shield/readme.md: -------------------------------------------------------------------------------- 1 | # Wemos D1 mini and Wemos32 mini shield 2 | - Installation of file: Copy and replace file in wled00 directory 3 | - For BME280 sensor use usermod_bme280.cpp. Copy to wled00 and rename to usermod.cpp 4 | - Added third choice of controller Heltec WiFi-Kit-8. Totally DIY but with OLED display. 5 | ## Project repository 6 | - [Original repository](https://github.com/srg74/WLED-wemos-shield) - WLED Wemos shield repository 7 | - [Wemos shield project Wiki](https://github.com/srg74/WLED-wemos-shield/wiki) 8 | - [Precompiled WLED firmware](https://github.com/srg74/WLED-wemos-shield/tree/master/resources/Firmware) 9 | ## Features 10 | - SSD1306 128x32 or 128x64 I2C OLED display 11 | - On screen IP address, SSID and controller status (e.g. ON or OFF, recent effect) 12 | - Auto display shutoff for saving display lifetime 13 | - Dallas temperature sensor 14 | - Reporting temperature to MQTT broker 15 | - Relay for energy saving 16 | 17 | ## Hardware 18 | ![Shield](https://github.com/srg74/WLED-wemos-shield/blob/master/resources/Images/Assembly_8.jpg) 19 | 20 | ## Functionality checked with 21 | 22 | - Wemos D1 mini original v3.1 and clones 23 | - Wemos32 mini 24 | - PlatformIO 25 | - SSD1306 128x32 I2C OLED display 26 | - DS18B20 (temperature sensor) 27 | - BME280 (temperature, humidity and pressure sensor) 28 | - Push button (N.O. momentary switch) 29 | 30 | ### Platformio requirements 31 | 32 | For Dallas sensor uncomment `U8g2@~2.27.3`,`DallasTemperature@~3.8.0`,`OneWire@~2.3.5 under` `[common]` section in `platformio.ini`: 33 | ```ini 34 | # platformio.ini 35 | ... 36 | [platformio] 37 | ... 38 | ; default_envs = esp07 39 | default_envs = d1_mini 40 | ... 41 | [common] 42 | ... 43 | lib_deps_external = 44 | ... 45 | #For use SSD1306 OLED display uncomment following 46 | U8g2@~2.27.3 47 | #For Dallas sensor uncomment following 2 lines 48 | DallasTemperature@~3.8.0 49 | OneWire@~2.3.5 50 | ... 51 | ``` 52 | 53 | For BME280 sensor uncomment `U8g2@~2.27.3`,`BME280@~3.0.0 under` `[common]` section in `platformio.ini`: 54 | ```ini 55 | # platformio.ini 56 | ... 57 | [platformio] 58 | ... 59 | ; default_envs = esp07 60 | default_envs = d1_mini 61 | ... 62 | [common] 63 | ... 64 | lib_deps_external = 65 | ... 66 | #For use SSD1306 OLED display uncomment following 67 | U8g2@~2.27.3 68 | #For BME280 sensor uncomment following 69 | BME280@~3.0.0 70 | ... 71 | ``` 72 | -------------------------------------------------------------------------------- /usermods/battery_keypad_controller/README.md: -------------------------------------------------------------------------------- 1 | # Battery powered controller with keypad 2 | 3 | I'm using this controller for a festival totem. Runs on 3 18650 Cells, can deliver >5A current. 4 | 5 | Via keypad one can select 8 presets, change effect, effect speed, effect intensity and palette. Brightness can be 6 | adjusted with a potentiometer. 7 | 8 | ## Pictures 9 | 10 | ![bat-key-ctrl-1](assets/bat-key-ctrl-1.jpg) 11 | ![bat-key-ctrl-2](assets/bat-key-ctrl-2.jpg) 12 | ![bat-key-ctrl-3](assets/bat-key-ctrl-3.jpg) 13 | -------------------------------------------------------------------------------- /usermods/battery_keypad_controller/assets/bat-key-ctrl-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/battery_keypad_controller/assets/bat-key-ctrl-1.jpg -------------------------------------------------------------------------------- /usermods/battery_keypad_controller/assets/bat-key-ctrl-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/battery_keypad_controller/assets/bat-key-ctrl-2.jpg -------------------------------------------------------------------------------- /usermods/battery_keypad_controller/assets/bat-key-ctrl-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/battery_keypad_controller/assets/bat-key-ctrl-3.jpg -------------------------------------------------------------------------------- /usermods/blynk_relay_control/README.md: -------------------------------------------------------------------------------- 1 | # Blynk controllable relay 2 | This usermod allows controlling a relay state from the user variables. It also allows the user variables to be set over Blynk. 3 | 4 | Optionally, the servo can have a reset timer to go back to it's default state after an interval. This interval is set through userVar1. 5 | 6 | ## Instalation 7 | 8 | Replace the WLED06_usermod.ino file in Aircoookies WLED folder with the one here. 9 | 10 | ## Customizations 11 | 12 | Update the following parameters in WLED06_usermod.ino to configure the mod's behavior: 13 | 14 | ```cpp 15 | //Which pin is the relay connected to 16 | #define RELAY_PIN 5 17 | //Which pin state should the relay default to 18 | #define RELAY_PIN_DEFAULT LOW 19 | //If >0 The controller returns to RELAY_PIN_DEFAULT after this time in milliseconds 20 | #define RELAY_PIN_TIMER_DEFAULT 3000 21 | 22 | //Blynk virtual pin for controlling relay 23 | #define BLYNK_USER_VAR0_PIN V9 24 | //Blynk virtual pin for controlling relay timer 25 | #define BLYNK_USER_VAR1_PIN V10 26 | //Number of milliseconds between updating blynk 27 | #define BLYNK_RELAY_UPDATE_INTERVAL 5000 28 | ``` 29 | -------------------------------------------------------------------------------- /usermods/buzzer/usermod_v2_buzzer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "wled.h" 4 | #include "Arduino.h" 5 | 6 | #include 7 | 8 | #define USERMOD_ID_BUZZER 900 9 | #ifndef USERMOD_BUZZER_PIN 10 | #define USERMOD_BUZZER_PIN GPIO_NUM_32 11 | #endif 12 | 13 | /* 14 | * Usermods allow you to add own functionality to WLED more easily 15 | * See: https://github.com/Aircoookie/WLED/wiki/Add-own-functionality 16 | * 17 | * Using a usermod: 18 | * 1. Copy the usermod into the sketch folder (same folder as wled00.ino) 19 | * 2. Register the usermod by adding #include "usermod_filename.h" in the top and registerUsermod(new MyUsermodClass()) in the bottom of usermods_list.cpp 20 | */ 21 | 22 | class BuzzerUsermod : public Usermod { 23 | private: 24 | unsigned long lastTime_ = 0; 25 | unsigned long delay_ = 0; 26 | std::deque> sequence_ {}; 27 | public: 28 | /* 29 | * setup() is called once at boot. WiFi is not yet connected at this point. 30 | * You can use it to initialize variables, sensors or similar. 31 | */ 32 | void setup() { 33 | // Setup the pin, and default to LOW 34 | pinMode(USERMOD_BUZZER_PIN, OUTPUT); 35 | digitalWrite(USERMOD_BUZZER_PIN, LOW); 36 | 37 | // Beep on startup 38 | sequence_.push_back({ HIGH, 50 }); 39 | sequence_.push_back({ LOW, 0 }); 40 | } 41 | 42 | 43 | /* 44 | * connected() is called every time the WiFi is (re)connected 45 | * Use it to initialize network interfaces 46 | */ 47 | void connected() { 48 | // Double beep on WiFi 49 | sequence_.push_back({ LOW, 100 }); 50 | sequence_.push_back({ HIGH, 50 }); 51 | sequence_.push_back({ LOW, 30 }); 52 | sequence_.push_back({ HIGH, 50 }); 53 | sequence_.push_back({ LOW, 0 }); 54 | } 55 | 56 | /* 57 | * loop() is called continuously. Here you can check for events, read sensors, etc. 58 | */ 59 | void loop() { 60 | if (sequence_.size() < 1) return; // Wait until there is a sequence 61 | if (millis() - lastTime_ <= delay_) return; // Wait until delay has elapsed 62 | 63 | auto event = sequence_.front(); 64 | sequence_.pop_front(); 65 | 66 | digitalWrite(USERMOD_BUZZER_PIN, event.first); 67 | delay_ = event.second; 68 | 69 | lastTime_ = millis(); 70 | } 71 | 72 | 73 | /* 74 | * getId() allows you to optionally give your V2 usermod an unique ID (please define it in const.h!). 75 | * This could be used in the future for the system to determine whether your usermod is installed. 76 | */ 77 | uint16_t getId() 78 | { 79 | return USERMOD_ID_BUZZER; 80 | } 81 | }; -------------------------------------------------------------------------------- /usermods/esp32_multistrip/README.md: -------------------------------------------------------------------------------- 1 | # esp32_multistrip 2 | 3 | This usermod enables up to 8 data pins to be used from an esp32 module to drive separate LED strands. This only works with one-wire LEDs like the WS2812. 4 | 5 | The esp32 RMT hardware is used for data output. See here for hardware driver implementation details: https://github.com/Makuna/NeoPixelBus/wiki/ESP32-NeoMethods#neoesp32rmt-methods 6 | 7 | Pass the following variables to the compiler as build flags: 8 | 9 | - `ESP32_MULTISTRIP` 10 | - Define this to use usermod NpbWrapper.h instead of default one in WLED. 11 | - `NUM_STRIPS` 12 | - Number of strips in use 13 | - `PIXEL_COUNTS` 14 | - List of pixel counts in each strip 15 | - `DATA_PINS` 16 | - List of data pins each strip is attached to. There may be board-specific restrictions on which pins can be used for RTM. 17 | 18 | From the perspective of WLED software, the LEDs are addressed as one long strand. The modified NbpWrapper.h file addresses the appropriate strand from the overall LED index based on the number of LEDs defined in each strand. 19 | 20 | See `platformio_override.ini` for example configuration. 21 | 22 | Tested on low cost ESP-WROOM-32 dev boards from Amazon, such as those sold by KeeYees. 23 | -------------------------------------------------------------------------------- /usermods/esp32_multistrip/platformio_override.ini: -------------------------------------------------------------------------------- 1 | ; Example platformio_override.ini that shows how to configure your environment to use the multistrip usermod. 2 | ; Copy this file to the base wled directory that contains platformio.ini. 3 | ; Multistrip requires ESP32 because it has many more pins that can be used as LED outputs. 4 | ; Need to define NUM_STRIPS, PIXEL_COUNTS, and DATA_PINS as shown below. 5 | 6 | [platformio] 7 | default_envs = esp32_multistrip 8 | 9 | [env:esp32_multistrip] 10 | extends=env:esp32dev 11 | build_flags = ${env:esp32dev.build_flags} 12 | -D ESP32_MULTISTRIP ; define this variable to use ESP32_MULTISTRIP usermod 13 | -D NUM_STRIPS=4 ; number of pixel strips in use 14 | -D PIXEL_COUNTS="50, 50, 50, 50" ; number of pixels in each strip 15 | -D DATA_PINS="25, 26, 32, 33" ; esp32 pins used for each pixel strip. available pins depends on esp32 module. 16 | -------------------------------------------------------------------------------- /usermods/mpu6050_imu/readme.md: -------------------------------------------------------------------------------- 1 | # MPU-6050 Six-Axis (Gyro + Accelerometer) Driver 2 | 3 | This usermod-v2 modification allows the connection of a MPU-6050 IMU sensor to 4 | allow for effects that are controlled by the orientation or motion of the WLED Device. 5 | 6 | The MPU6050 has a built in "Digital Motion Processor" which does a lot of the heavy 7 | lifting in integrating the gyro and accel measurements to get potentially more 8 | useful gravity vector and orientation output. 9 | 10 | It is pretty straightforward to comment out some of the variables being read off the device if they're not needed to save CPU/Mem/Bandwidth. 11 | 12 | _Story:_ 13 | 14 | As a memento to a long trip I was on, I built an icosahedron globe. I put lights inside to indicate cities I travelled to. 15 | 16 | I wanted to integrate an IMU to allow either on-board, or off-board effects that would 17 | react to the globes orientation. See the blog post on building it or a video demo . 18 | 19 | ## Adding Dependencies 20 | 21 | I2Cdev and MPU6050 must be installed. 22 | 23 | To install them, add I2Cdevlib-MPU6050@fbde122cc5 to lib_deps in the platformio.ini file. 24 | 25 | You also need to change lib_compat_mode from strict to soft in platformio.ini (This ignores that I2Cdevlib-MPU6050 doesn't list platform compatibility) 26 | 27 | For example: 28 | 29 | ``` 30 | lib_compat_mode = soft 31 | lib_deps = 32 | FastLED@3.3.2 33 | NeoPixelBus@2.5.7 34 | ESPAsyncTCP@1.2.0 35 | ESPAsyncUDP@697c75a025 36 | AsyncTCP@1.0.3 37 | Esp Async WebServer@1.2.0 38 | IRremoteESP8266@2.7.3 39 | I2Cdevlib-MPU6050@fbde122cc5 40 | ``` 41 | 42 | ## Wiring 43 | 44 | The connections needed to the MPU6050 are as follows: 45 | ``` 46 | VCC VU (5V USB) Not available on all boards so use 3.3V if needed. 47 | GND G Ground 48 | SCL D1 (GPIO05) I2C clock 49 | SDA D2 (GPIO04) I2C data 50 | XDA not connected 51 | XCL not connected 52 | AD0 not connected 53 | INT D8 (GPIO15) Interrupt pin 54 | ``` 55 | 56 | You could probably modify the code not to need an interrupt, but I used the 57 | setup directly from the example. 58 | 59 | ## JSON API 60 | 61 | This code adds: 62 | ```json 63 | "u":{ 64 | "IMU":{ 65 | "Quat": [w, x, y, z], 66 | "Euler": [psi, theta, phi], 67 | "Gyro": [x, y, z], 68 | "Accel": [x, y, z], 69 | "RealAccel": [x, y, z], 70 | "WorldAccel": [x, y, z], 71 | "Gravity": [x, y, z], 72 | "Orientation": [yaw, pitch, roll] 73 | } 74 | } 75 | ``` 76 | to the info object 77 | 78 | ## Usermod installation 79 | 80 | 1. Copy the file `usermod_mpu6050_imu.h` to the `wled00` directory. 81 | 2. Register the usermod by adding `#include "usermod_mpu6050_imu.h.h"` in the top and `registerUsermod(new MPU6050Driver());` in the bottom of `usermods_list.cpp`. 82 | 83 | Example **usermods_list.cpp**: 84 | 85 | ```cpp 86 | #include "wled.h" 87 | 88 | #include "usermod_mpu6050_imu.h" 89 | 90 | void registerUsermods() 91 | { 92 | usermods.add(new MPU6050Driver()); 93 | } 94 | ``` 95 | -------------------------------------------------------------------------------- /usermods/mqtt_switch_v2/README.md: -------------------------------------------------------------------------------- 1 | # MQTT controllable switches 2 | This usermod allows controlling switches (e.g. relays) via MQTT. 3 | 4 | ## Usermod installation 5 | 6 | 1. Copy the file `usermod_mqtt_switch.h` to the `wled00` directory. 7 | 2. Register the usermod by adding `#include "usermod_mqtt_switch.h"` in the top and `registerUsermod(new UsermodMqttSwitch());` in the bottom of `usermods_list.cpp`. 8 | 9 | 10 | Example `usermods_list.cpp`: 11 | 12 | ``` 13 | #include "wled.h" 14 | #include "usermod_mqtt_switch.h" 15 | 16 | void registerUsermods() 17 | { 18 | usermods.add(new UsermodMqttSwitch()); 19 | } 20 | ``` 21 | 22 | ## Define pins 23 | Add a define for MQTTSWITCHPINS to platformio_override.ini. 24 | The following example defines 3 switches connected to the GPIO pins 13, 5 and 2: 25 | 26 | ``` 27 | [env:livingroom] 28 | board = esp12e 29 | platform = ${common.platform_wled_default} 30 | board_build.ldscript = ${common.ldscript_4m1m} 31 | build_flags = ${common.build_flags_esp8266} 32 | -D LEDPIN=3 33 | -D BTNPIN=4 34 | -D RLYPIN=12 35 | -D RLYMDE=1 36 | -D STATUSPIN=15 37 | -D MQTTSWITCHPINS="13, 5, 2" 38 | ``` 39 | 40 | Pins can be inverted by setting `MQTTSWITCHINVERT`. For example `-D MQTTSWITCHINVERT="false, false, true"` would invert the switch on pin 2 in the previous example. 41 | 42 | The default state after booting before any MQTT message can be set by `MQTTSWITCHDEFAULTS`. For example `-D MQTTSWITCHDEFAULTS="ON, OFF, OFF"` would power on the switch on pin 13 and power off switches on pins 5 and 2. 43 | 44 | ## MQTT topics 45 | This usermod listens on `[mqttDeviceTopic]/switch/0/set` (where 0 is replaced with the index of the switch) for commands. Anything starting with `ON` turns on the switch, everything else turns it off. 46 | Feedback about the current state is provided at `[mqttDeviceTopic]/switch/0/state`. 47 | 48 | ### Home Assistant auto-discovery 49 | Auto-discovery information is automatically published and you shoudn't have to do anything to register the switches in Home Assistant. 50 | 51 | -------------------------------------------------------------------------------- /usermods/photoresistor_sensor_mqtt_v1/README.md: -------------------------------------------------------------------------------- 1 | # Photoresister sensor with MQTT 2 | 3 | This simple usermod allows attaching a photoresistor sensor like the KY-018 and publish the readings in percentage over MQTT. The frequency of MQTT messages can be modified, and there is a threshold value that can be set so that significant changes in the readings can be published immediately instead of waiting for the next update. This was found to be a good compromise between spamming MQTT messages and delayed updates. 4 | 5 | I also found it useful to limit the frequency of analog pin reads because otherwise the board hangs. 6 | 7 | This usermod has only been tested with the KY-018 sensor though should work for any other analog pin sensor. Note that this does not control the LED strip directly, it only publishes MQTT readings for use with other integrations like Home Assistant. 8 | 9 | ## Installation 10 | 11 | Copy and replace the file `usermod.cpp` in wled00 directory. 12 | -------------------------------------------------------------------------------- /usermods/photoresistor_sensor_mqtt_v1/usermod.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | /* 3 | * This v1 usermod file allows you to add own functionality to WLED more easily 4 | * See: https://github.com/Aircoookie/WLED/wiki/Add-own-functionality 5 | * EEPROM bytes 2750+ are reserved for your custom use case. (if you extend #define EEPSIZE in const.h) 6 | * If you just need 8 bytes, use 2551-2559 (you do not need to increase EEPSIZE) 7 | * 8 | * Consider the v2 usermod API if you need a more advanced feature set! 9 | */ 10 | 11 | //Use userVar0 and userVar1 (API calls &U0=,&U1=, uint16_t) 12 | 13 | const int LIGHT_PIN = A0; // define analog pin 14 | const long UPDATE_MS = 30000; // Upper threshold between mqtt messages 15 | const char MQTT_TOPIC[] = "/light"; // MQTT topic for sensor values 16 | const int CHANGE_THRESHOLD = 5; // Change threshold in percentage to send before UPDATE_MS 17 | 18 | // variables 19 | long lastTime = 0; 20 | long timeDiff = 0; 21 | long readTime = 0; 22 | int lightValue = 0; 23 | float lightPercentage = 0; 24 | float lastPercentage = 0; 25 | 26 | //gets called once at boot. Do all initialization that doesn't depend on network here 27 | void userSetup() 28 | { 29 | pinMode(LIGHT_PIN, INPUT); 30 | } 31 | 32 | //gets called every time WiFi is (re-)connected. Initialize own network interfaces here 33 | void userConnected() 34 | { 35 | 36 | } 37 | 38 | void publishMqtt(float state) 39 | { 40 | //Check if MQTT Connected, otherwise it will crash the 8266 41 | if (mqtt != nullptr){ 42 | char subuf[38]; 43 | strcpy(subuf, mqttDeviceTopic); 44 | strcat(subuf, MQTT_TOPIC); 45 | mqtt->publish(subuf, 0, true, String(state).c_str()); 46 | } 47 | } 48 | 49 | //loop. You can use "if (WLED_CONNECTED)" to check for successful connection 50 | void userLoop() 51 | { 52 | // Read only every 500ms, otherwise it causes the board to hang 53 | if (millis() - readTime > 500) 54 | { 55 | readTime = millis(); 56 | timeDiff = millis() - lastTime; 57 | 58 | // Convert value to percentage 59 | lightValue = analogRead(LIGHT_PIN); 60 | lightPercentage = ((float)lightValue * -1 + 1024)/(float)1024 *100; 61 | 62 | // Send MQTT message on significant change or after UPDATE_MS 63 | if (abs(lightPercentage - lastPercentage) > CHANGE_THRESHOLD || timeDiff > UPDATE_MS) 64 | { 65 | publishMqtt(lightPercentage); 66 | lastTime = millis(); 67 | lastPercentage = lightPercentage; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /usermods/project_cars_shiftlight/readme.md: -------------------------------------------------------------------------------- 1 | ### Shift Light for Project Cars 2 | 3 | Turn your WLED lights into a rev light and shift indicator for Project Cars. 4 | 5 | It is pretty straight forward to use. 6 | 7 | 1. Make sure, your WLED device and your PC/console are on the same network and can talk to each other 8 | 9 | 2. Go to the gameplay settings menu in PCARS and enable UDP. There are 9 numbers you can choose from. This is the refresh rate. The lower the number, the better. But you might run into problems at faster rates. 10 | 11 | | Number | Updates/Second | 12 | | ------ | -------------- | 13 | | 1 | 60 | 14 | | 2 | 50 | 15 | | 3 | 40 | 16 | | 4 | 30 | 17 | | 5 | 20 | 18 | | 6 | 15 | 19 | | 7 | 10 | 20 | | 8 | 05 | 21 | | 9 | 1 | 22 | 23 | 3. once you enter a race, WLED should automatically shift to PCARS mode. Done. 24 | -------------------------------------------------------------------------------- /usermods/project_cars_shiftlight/wled06_usermod.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Car rev display and shift indicator for Project Cars 3 | * 4 | * This works via the UDP telemetry function. You'll need to enable it in the settings of the game. 5 | * I've had good results with settings around 5 (20 fps). 6 | * 7 | */ 8 | const uint8_t PCARS_dimcolor = 20; 9 | WiFiUDP UDP; 10 | const unsigned int PCARS_localUdpPort = 5606; // local port to listen on 11 | char PCARS_packet[2048]; 12 | 13 | char PCARS_tempChar[2]; // Temporary array for u16 conversion 14 | 15 | u16 PCARS_RPM; 16 | u16 PCARS_maxRPM; 17 | 18 | long PCARS_lastRead = millis() - 2001; 19 | float PCARS_rpmRatio; 20 | 21 | void PCARS_readValues() { 22 | 23 | int PCARS_packetSize = UDP.parsePacket(); 24 | if (PCARS_packetSize) { 25 | int len = UDP.read(PCARS_packet, PCARS_packetSize); 26 | if (len > 0) { 27 | PCARS_packet[len] = 0; 28 | } 29 | if (len == 1367) { // Telemetry packet. Ignoring everything else. 30 | PCARS_lastRead = millis(); 31 | 32 | realtimeLock(realtimeTimeoutMs, REALTIME_MODE_GENERIC); 33 | // current RPM 34 | memcpy(&PCARS_tempChar, &PCARS_packet[124], 2); 35 | PCARS_RPM = (PCARS_tempChar[1] << 8) + PCARS_tempChar[0]; 36 | 37 | // max RPM 38 | memcpy(&PCARS_tempChar, &PCARS_packet[126], 2); 39 | PCARS_maxRPM = (PCARS_tempChar[1] << 8) + PCARS_tempChar[0]; 40 | 41 | if (PCARS_maxRPM) { 42 | PCARS_rpmRatio = constrain((float)PCARS_RPM / (float)PCARS_maxRPM, 0, 1); 43 | } else { 44 | PCARS_rpmRatio = 0.0; 45 | } 46 | } 47 | } 48 | } 49 | void PCARS_buildcolorbars() { 50 | boolean activated = false; 51 | float ledratio = 0; 52 | 53 | for (uint16_t i = 0; i < ledCount; i++) { 54 | if (PCARS_rpmRatio < .95 || (millis() % 100 > 70 )) { 55 | 56 | ledratio = (float)i / (float)ledCount; 57 | if (ledratio < PCARS_rpmRatio) { 58 | activated = true; 59 | } else { 60 | activated = false; 61 | } 62 | if (ledratio > 0.66) { 63 | setRealtimePixel(i, 0, 0, PCARS_dimcolor + ((255 - PCARS_dimcolor)*activated), 0); 64 | } else if (ledratio > 0.33) { 65 | setRealtimePixel(i, PCARS_dimcolor + ((255 - PCARS_dimcolor)*activated), 0, 0, 0); 66 | } else { 67 | setRealtimePixel(i, 0, PCARS_dimcolor + ((255 - PCARS_dimcolor)*activated), 0, 0); 68 | } 69 | } 70 | else { 71 | setRealtimePixel(i, 0, 0, 0, 0); 72 | 73 | } 74 | } 75 | colorUpdated(5); 76 | strip.show(); 77 | } 78 | 79 | void userSetup() 80 | { 81 | UDP.begin(PCARS_localUdpPort); 82 | } 83 | 84 | void userConnected() 85 | { 86 | // new wifi, who dis? 87 | } 88 | 89 | void userLoop() 90 | { 91 | PCARS_readValues(); 92 | if (PCARS_lastRead > millis() - 2000) { 93 | PCARS_buildcolorbars(); 94 | } 95 | } -------------------------------------------------------------------------------- /usermods/quinled_digquad_preassembled_unofficial_v0.1/README.md: -------------------------------------------------------------------------------- 1 | # QuinLED-Dig-Quad Preassembled Unofficial Build 2 | 3 | This usermod targets the [Preassembled QuinLED-Dig-Quad](https://quinled.info/pre-assembled-quinled-dig-quad/). Tested on board revision v1r6b, 4 | and includes the following features: 5 | 6 | * **Multi-channel Support** - enabling use of LED1, LED2, LED3, LED4 pins to work using segments 7 | * **Temperature Sensor Support** - pulls readings from the built-in temperature sensor and adds the reading to the *Info* page in the UI 8 | 9 | ## Background 10 | 11 | As a starting point, you should check out this awesome video from Quindor: [How to compile WLED yourself](https://quinled.info/2020/12/22/livestream-wled-compile/). The usermod you are reading now just provides some shortcuts for parts of what were covered in that video. 12 | 13 | ## Build Firmware with Multi-channel and Temp Support 14 | 15 | 1. Copy the `platformio_override.ini` file to the project's root directory 16 | 1. If using VS Code with the PlatformIO plugin like in the video, you will now see this new project task listed in the PLATFORMIO panel at the bottom as `env:QL-DigQuad-Pre-v0.1` (you probably need to hit the refresh button) 17 | 18 | 19 | 20 | 1. Edit this file from the root directory as needed: 21 | 22 | 23 | 24 | * `PIXEL_COUNTS` may need to be adjusted for your set-up. E.g. I have lots of LEDs in Channel 1, but that's probably unusual for most 25 | * `DATA_PINS` may need to be changed to "16,3,1,26" instead of "16,1,3,26" apparently depending on the board revision or some such 26 | 27 | 1. Build the mod (e.g. click `Build` from the project task circled above) and update your firmware using the `QL-DigQuad-Pre-v0.1` file, e.g. using _Manual OTA_ from the Config menu. Based on the video and my own experience, you might need to build twice 🤷‍♂️. 28 | 29 | ## Observing Temperature 30 | 31 | Hopefully you can now see the Temperature listed in the Info page. If not, use Chrome Developer Tools to find the current temperature 32 | 33 | 1. Open the Developer Tools Console 34 | 2. Enter `lastinfo.u.Temperature` to view the Temperature array 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /usermods/quinled_digquad_preassembled_unofficial_v0.1/images/json-temp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/quinled_digquad_preassembled_unofficial_v0.1/images/json-temp.png -------------------------------------------------------------------------------- /usermods/quinled_digquad_preassembled_unofficial_v0.1/images/params.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/quinled_digquad_preassembled_unofficial_v0.1/images/params.png -------------------------------------------------------------------------------- /usermods/quinled_digquad_preassembled_unofficial_v0.1/images/pio-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/quinled_digquad_preassembled_unofficial_v0.1/images/pio-screenshot.png -------------------------------------------------------------------------------- /usermods/quinled_digquad_preassembled_unofficial_v0.1/platformio_override.ini: -------------------------------------------------------------------------------- 1 | ; QuinLED-Dig-Quad Preassembled Unofficial 2 | 3 | [env:QL-DigQuad-Pre-v0.1] 4 | extends = env:esp32dev 5 | build_flags = ${common.build_flags_esp32} 6 | -D ESP32_MULTISTRIP 7 | -D NUM_STRIPS=4 8 | -D PIXEL_COUNTS="600, 300, 300, 300" 9 | -D DATA_PINS="16,1,3,26" 10 | -D RLYPIN=19 11 | -D BTNPIN=17 12 | -D USERMOD_DALLASTEMPERATURE 13 | -D USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL=10000 14 | lib_deps = ${env.lib_deps} 15 | milesburton/DallasTemperature@^3.9.0 16 | OneWire@~2.3.5 -------------------------------------------------------------------------------- /usermods/readme.md: -------------------------------------------------------------------------------- 1 | ### Usermods 2 | 3 | This folder serves as a repository for usermods (custom `usermod.cpp` files)! 4 | 5 | If you have created an usermod that you believe is useful (for example to support a particular sensor, display, feature...), feel free to contribute by opening a pull request! 6 | 7 | In order for other people to be able to have fun with your usermod, please keep these points in mind: 8 | 9 | - Create a folder in this folder with a descriptive name (for example `usermod_ds18b20_temp_sensor_mqtt`) 10 | - Include your custom files 11 | - If your usermod requires changes to other WLED files, please write a `readme.md` outlining the steps one has to take to use the usermod 12 | - Create a pull request! 13 | - If your feature is useful for the majority of WLED users, I will consider adding it to the base code! 14 | 15 | While I do my best to not break too much, keep in mind that as WLED is being updated, usermods might break. 16 | I am not actively maintaining any usermod in this directory, that is your responsibility as the creator of the usermod. 17 | 18 | For new usermods, I would recommend trying out the new v2 usermod API, which allows installing multiple usermods at once and new functions! 19 | You can take a look at `EXAMPLE_v2` for some documentation and at `Temperature` for a completed v2 usermod! 20 | 21 | Thank you for your help :) 22 | -------------------------------------------------------------------------------- /usermods/rotary_encoder_change_brightness/usermod.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | /* 3 | * This file allows you to add own functionality to WLED more easily 4 | * See: https://github.com/Aircoookie/WLED/wiki/Add-own-functionality 5 | * EEPROM bytes 2750+ are reserved for your custom use case. (if you extend #define EEPSIZE in const.h) 6 | * bytes 2400+ are currently ununsed, but might be used for future wled features 7 | */ 8 | 9 | //Use userVar0 and userVar1 (API calls &U0=,&U1=, uint16_t) 10 | 11 | /* 12 | ** Rotary Encoder Example 13 | ** Use the Sparkfun Rotary Encoder to vary brightness of LED 14 | ** 15 | ** Sample the encoder at 500Hz using the millis() function 16 | */ 17 | 18 | int fadeAmount = 5; // how many points to fade the Neopixel with each step 19 | unsigned long currentTime; 20 | unsigned long loopTime; 21 | const int pinA = D6; // DT from encoder 22 | const int pinB = D7; // CLK from encoder 23 | 24 | unsigned char Enc_A; 25 | unsigned char Enc_B; 26 | unsigned char Enc_A_prev = 0; 27 | 28 | //gets called once at boot. Do all initialization that doesn't depend on network here 29 | void userSetup() { 30 | pinMode(pinA, INPUT_PULLUP); 31 | pinMode(pinB, INPUT_PULLUP); 32 | currentTime = millis(); 33 | loopTime = currentTime; 34 | } 35 | 36 | //gets called every time WiFi is (re-)connected. Initialize own network interfaces here 37 | void userConnected() { 38 | } 39 | 40 | //loop. You can use "if (WLED_CONNECTED)" to check for successful connection 41 | void userLoop() { 42 | currentTime = millis(); // get the current elapsed time 43 | if(currentTime >= (loopTime + 2)) // 2ms since last check of encoder = 500Hz 44 | { 45 | int Enc_A = digitalRead(pinA); // Read encoder pins 46 | int Enc_B = digitalRead(pinB); 47 | if((! Enc_A) && (Enc_A_prev)) { // A has gone from high to low 48 | if(Enc_B == HIGH) { // B is high so clockwise 49 | if(bri + fadeAmount <= 255) bri += fadeAmount; // increase the brightness, dont go over 255 50 | 51 | } else if (Enc_B == LOW) { // B is low so counter-clockwise 52 | if(bri - fadeAmount >= 0) bri -= fadeAmount; // decrease the brightness, dont go below 0 53 | } 54 | } 55 | Enc_A_prev = Enc_A; // Store value of A for next time 56 | loopTime = currentTime; // Updates loopTime 57 | 58 | //call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification) 59 | // 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa 60 | colorUpdated(6); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /usermods/rotary_encoder_change_effect/wled06_usermod.ino: -------------------------------------------------------------------------------- 1 | //Use userVar0 and userVar1 (API calls &U0=,&U1=, uint16_t) 2 | 3 | long lastTime = 0; 4 | int delayMs = 10; 5 | const int pinA = D6; //data 6 | const int pinB = D7; //clk 7 | int oldA = LOW; 8 | 9 | //gets called once at boot. Do all initialization that doesn't depend on network here 10 | void userSetup() { 11 | pinMode(pinA, INPUT_PULLUP); 12 | pinMode(pinB, INPUT_PULLUP); 13 | } 14 | 15 | //gets called every time WiFi is (re-)connected. Initialize own network interfaces here 16 | void userConnected() { 17 | } 18 | 19 | //loop. You can use "if (WLED_CONNECTED)" to check for successful connection 20 | void userLoop() { 21 | if (millis()-lastTime > delayMs) { 22 | int A = digitalRead(pinA); 23 | int B = digitalRead(pinB); 24 | 25 | if (oldA == LOW && A == HIGH) { 26 | if (oldB == HIGH) { 27 | // bri += 10; 28 | // if (bri > 250) bri = 10; 29 | effectCurrent += 1; 30 | if (effectCurrent >= MODE_COUNT) effectCurrent = 0; 31 | } 32 | else { 33 | // bri -= 10; 34 | // if (bri < 10) bri = 250; 35 | effectCurrent -= 1; 36 | if (effectCurrent < 0) effectCurrent = (MODE_COUNT-1); 37 | } 38 | oldA = A; 39 | 40 | //call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification) 41 | // 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa 42 | colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED); 43 | lastTime = millis(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /usermods/sensors_to_mqtt/readme.md: -------------------------------------------------------------------------------- 1 | # Sensors To Home Assistant (or mqtt) 2 | 3 | This usermod will publish values of the BMP280, CCS811 and Si7021 sensors to Home Assistant via MQTT. 4 | 5 | Its using home assistant automatic device discovery feature. 6 | 7 | The use of Home Assistant is not mandatory; it will publish the sensor values via MQTT just fine without it. 8 | 9 | Its resusing the mqtt connection set in the WLED web user interface. 10 | 11 | ## Maintainer 12 | 13 | twitter.com/mpronk89 14 | 15 | ## Features 16 | 17 | - Reads BMP280, CCS811 and Si7021 senors 18 | - Publishes via MQTT, configured via webui of wled 19 | - Announces device in Home Assistant for easy setup 20 | - Efficient energy usage 21 | - Updates every 60 seconds 22 | 23 | ## Example mqtt topics: 24 | 25 | `$mqttDeviceTopic` is set in webui of WLED! 26 | 27 | ``` 28 | temperature: $mqttDeviceTopic/temperature 29 | pressure: $mqttDeviceTopic/pressure 30 | humidity: $mqttDeviceTopic/humidity 31 | tvoc: $mqttDeviceTopic/tvoc 32 | eCO2: $mqttDeviceTopic/eco2 33 | IAQ: $mqttDeviceTopic/iaq 34 | ``` 35 | 36 | # Installation 37 | 38 | ## Hardware 39 | 40 | ### Requirements 41 | 42 | 1. BMP280/CCS811/Si7021 sensor. E.g. https://aliexpress.com/item/32979998543.html 43 | 2. A microcontroller which can talk i2c, e.g. esp32 44 | 45 | ### installation 46 | 47 | Attach the sensor to the i2c interface. 48 | 49 | Default PINs esp32: 50 | 51 | ``` 52 | SCL_PIN = 22; 53 | SDA_PIN = 21; 54 | ``` 55 | 56 | Default PINs ESP8266: 57 | 58 | ``` 59 | SCL_PIN = 5; 60 | SDA_PIN = 4; 61 | ``` 62 | 63 | ## Enable in WLED 64 | 65 | 1. Copy `usermod_v2_SensorsToMqtt.h` into the `wled00` directory. 66 | 2. Add to `build_flags` in platformio.ini: 67 | 68 | ``` 69 | -D USERMOD_SENSORSTOMQTT 70 | ``` 71 | 72 | 3. And add to `lib_deps` in platformio.ini: 73 | 74 | ``` 75 | adafruit/Adafruit BMP280 Library @ 2.1.0 76 | adafruit/Adafruit CCS811 Library @ 1.0.4 77 | adafruit/Adafruit Si7021 Library @ 1.4.0 78 | ``` 79 | 80 | The #ifdefs in `usermods_list.cpp` should do the rest :) 81 | 82 | # Credits 83 | 84 | - Aircoookie for making WLED 85 | - Other usermod creators for example code 86 | - Bouke_Regnerus for https://community.home-assistant.io/t/example-indoor-air-quality-text-sensor-using-ccs811-sensor/125854 87 | - You, for reading this 88 | -------------------------------------------------------------------------------- /usermods/ssd1306_i2c_oled_u8g2/README.md: -------------------------------------------------------------------------------- 1 | # SSD1306 128x32 OLED via I2C with u8g2 2 | This usermod allows to connect 128x32 Oled display to WLED controlled and show 3 | the next information: 4 | - Current SSID 5 | - IP address if obtained 6 | * in AP mode and turned off lightning AP password is shown 7 | - Current effect 8 | - Current palette 9 | - On/Off icon (sun/moon) 10 | 11 | ## Hardware 12 | ![Hardware connection](assets/hw_connection.png) 13 | 14 | ## Requirements 15 | Functionality checked with: 16 | - commit 095429a7df4f9e2b34dd464f7bbfd068df6558eb 17 | - Wemos d1 mini 18 | - PlatformIO 19 | - Generic SSD1306 128x32 I2C OLED display from aliexpress 20 | 21 | ### Platformio 22 | Add `U8g2@~2.27.2` dependency to `lib_deps_external` under `[common]` section in `platformio.ini`: 23 | ```ini 24 | # platformio.ini 25 | ... 26 | [common] 27 | ... 28 | lib_deps_external = 29 | ... 30 | U8g2@~2.27.2 31 | ... 32 | ``` 33 | 34 | ### Arduino IDE 35 | Install library `U8g2 by oliver` in `Tools | Include Library | Manage libraries` menu. -------------------------------------------------------------------------------- /usermods/ssd1306_i2c_oled_u8g2/assets/hw_connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/ssd1306_i2c_oled_u8g2/assets/hw_connection.png -------------------------------------------------------------------------------- /usermods/stairway_wipe_basic/readme.md: -------------------------------------------------------------------------------- 1 | ### Stairway lighting 2 | 3 | Quick usermod to accomplish something similar to [this video](https://www.youtube.com/watch?v=NHkju5ncC4A). 4 | 5 | This usermod allows you to add a lightstrip alongside or on the steps of a staircase. 6 | When the `userVar0` variable is set, the LEDs will gradually turn on in a Wipe effect. 7 | Both directions are supported by setting userVar0 to 1 and 2, respectively (HTTP API commands `U0=1` and `U0=2`). 8 | 9 | After the Wipe is complete, the light will either stay on (Solid effect) indefinitely or after `userVar1` seconds have elapsed. 10 | If userVar0 is updated (e.g. by triggering a second sensor) the light will slowly fade off. 11 | This could be extended to also run a Wipe effect in reverse order to turn the LEDs back off. 12 | 13 | This is just a basic version to accomplish this using HTTP API calls `U0` and `U1` and/or macros. 14 | It should be easy to adapt this code however to interface with motion sensors or other input devices. -------------------------------------------------------------------------------- /usermods/usermod_v2_auto_save/readme.md: -------------------------------------------------------------------------------- 1 | # Auto Save 2 | 3 | v2 Usermod to automatically save settings 4 | to preset number AUTOSAVE_PRESET_NUM after a change to any of 5 | 6 | * brightness 7 | * effect speed 8 | * effect intensity 9 | * mode (effect) 10 | * palette 11 | 12 | but it will wait for AUTOSAVE_SETTLE_MS milliseconds, a "settle" 13 | period in case there are other changes (any change will 14 | extend the "settle" window). 15 | 16 | It will additionally load preset AUTOSAVE_PRESET_NUM at startup. 17 | during the first `loop()`. Reasoning below. 18 | 19 | AutoSaveUsermod is standalone, but if FourLineDisplayUsermod is installed, it will notify the user of the saved changes. 20 | 21 | Note: I don't love that WLED doesn't respect the brightness of the preset being auto loaded, so the AutoSaveUsermod will set the AUTOSAVE_PRESET_NUM preset in the first loop, so brightness IS honored. This means WLED will effectively ignore Default brightness and Apply N preset at boot when the AutoSaveUsermod is installed. 22 | 23 | ## Installation 24 | 25 | Copy and update the example `platformio_override.ini.sample` 26 | from the Rotary Encoder UI usermode folder to the root directory of your particular build. 27 | This file should be placed in the same directory as `platformio.ini`. 28 | 29 | ### Define Your Options 30 | 31 | * `USERMOD_AUTO_SAVE` - define this to have this the Auto Save usermod included wled00\usermods_list.cpp 32 | * `USERMOD_FOUR_LINE_DISLAY` - define this to have this the Four Line Display mod included wled00\usermods_list.cpp - also tells this usermod that the display is available (see the Four Line Display usermod `readme.md` for more details) 33 | * `AUTOSAVE_SETTLE_MS` - Minimum time to wave before auto saving, defaults to 10000 (10s) 34 | * `AUTOSAVE_PRESET_NUM` - Preset number to auto-save to, auto-load at startup from, defaults to 99 35 | 36 | ### PlatformIO requirements 37 | 38 | No special requirements. 39 | 40 | Note: the Four Line Display usermod requires the libraries `U8g2` and `Wire`. 41 | 42 | ## Change Log 43 | 44 | 2021-02 45 | * First public release 46 | -------------------------------------------------------------------------------- /usermods/usermod_v2_four_line_display/readme.md: -------------------------------------------------------------------------------- 1 | # Rotary Encoder UI Usermod 2 | 3 | First, thanks to the authors of the ssd11306_i2c_oled_u8g2 mod. 4 | 5 | This usermod provides a four line display using either 6 | 128x32 or 128x64 OLED displays. 7 | It's can operate independently, but starts to provide 8 | a relatively complete on-device UI when paired with the 9 | Rotary Encoder UI usermod. I strongly encourage you to use 10 | them together. 11 | 12 | [See the pair of usermods in action](https://www.youtube.com/watch?v=tITQY80rIOA) 13 | 14 | ## Installation 15 | 16 | Copy and update the example `platformio_override.ini.sample` 17 | from the Rotary Encoder UI usermode folder to the root directory of your particular build. 18 | This file should be placed in the same directory as `platformio.ini`. 19 | 20 | ### Define Your Options 21 | 22 | * `USERMOD_FOUR_LINE_DISLAY` - define this to have this the Four Line Display mod included wled00\usermods_list.cpp - also tells Rotary Encoder usermod, if installed, that the display is available 23 | * `FLD_PIN_SCL` - The display SCL pin, defaults to 5 24 | * `FLD_PIN_SDA` - The display SDA pin, defaults to 4 25 | * `FLIP_MODE` - Set to 0 or 1 26 | * `LINE_HEIGHT` - Set to 1 or 2 27 | 28 | There are other `#define` values in the Usermod that might be of interest. 29 | 30 | ### PlatformIO requirements 31 | 32 | This usermod requires the `U8g2` and `Wire` libraries. See the 33 | `platformio_override.ini.sample` found in the Rotary Encoder 34 | UI usermod folder for how to include these using `platformio_override.ini`. 35 | 36 | ## Change Log 37 | 38 | 2021-02 39 | * First public release 40 | -------------------------------------------------------------------------------- /usermods/usermod_v2_mode_sort/readme.md: -------------------------------------------------------------------------------- 1 | # Mode Sort 2 | 3 | v2 usermod that provides data about modes and 4 | palettes to other usermods. Notably it provides: 5 | * A direct method for a mode or palette name 6 | * Ability to retrieve mode and palette names in 7 | alphabetical order 8 | 9 | ```char **getModesQStrings()``` 10 | 11 | Provides an array of char* (pointers) to the names of the 12 | palettes within JSON_mode_names, in the same order as 13 | JSON_mode_names. These strings end in double quote (") 14 | (or \0 if there is a problem). 15 | 16 | ```byte *getModesAlphaIndexes()``` 17 | 18 | An array of byte designating the indexes of names of the 19 | modes in alphabetical order. "Solid" will always remain 20 | at the front of the list. 21 | 22 | ```char **getPalettesQStrings()``` 23 | 24 | Provides an array of char* (pointers) to the names of the 25 | palettes within JSON_palette_names, in the same order as 26 | JSON_palette_names. These strings end in double quote (") 27 | (or \0 if there is a problem). 28 | 29 | ```byte *getPalettesAlphaIndexes()``` 30 | 31 | An array of byte designating the indexes of names of the 32 | palettes in alphabetical order. "Default" and those 33 | starting with "(" will always remain at the front of the list. 34 | -------------------------------------------------------------------------------- /usermods/usermod_v2_rotary_encoder_ui/platformio_override.ini.sample: -------------------------------------------------------------------------------- 1 | [platformio] 2 | default_envs = d1_mini 3 | ; default_envs = esp32dev 4 | 5 | [env:esp32dev] 6 | board = esp32dev 7 | platform = espressif32@2.0 8 | build_unflags = ${common.build_unflags} 9 | build_flags = 10 | ${common.build_flags_esp32} 11 | -D USERMOD_MODE_SORT 12 | -D USERMOD_FOUR_LINE_DISLAY -D FLD_PIN_SCL=22 -D FLD_PIN_SDA=21 13 | -D USERMOD_ROTARY_ENCODER_UI -D ENCODER_DT_PIN=18 -D ENCODER_CLK_PIN=5 -D ENCODER_SW_PIN=19 14 | -D USERMOD_AUTO_SAVE -D AUTOSAVE_PRESET_NUM=1 15 | -D LEDPIN=16 -D BTNPIN=13 16 | upload_speed = 460800 17 | lib_ignore = 18 | ESPAsyncTCP 19 | ESPAsyncUDP 20 | 21 | [env:d1_mini] 22 | board = d1_mini 23 | platform = ${common.platform_wled_default} 24 | platform_packages = ${common.platform_packages} 25 | upload_speed = 460800 26 | board_build.ldscript = ${common.ldscript_4m1m} 27 | build_unflags = ${common.build_unflags} 28 | build_flags = 29 | ${common.build_flags_esp8266} 30 | -D USERMOD_MODE_SORT 31 | -D USERMOD_FOUR_LINE_DISLAY -D FLD_PIN_SCL=5 -D FLD_PIN_SDA=4 32 | -D USERMOD_ROTARY_ENCODER_UI -D ENCODER_DT_PIN=12 -D ENCODER_CLK_PIN=14 -D ENCODER_SW_PIN=13 33 | -D USERMOD_AUTO_SAVE -D AUTOSAVE_PRESET_NUM=1 34 | -D LEDPIN=3 -D BTNPIN=0 35 | monitor_filters = esp8266_exception_decoder 36 | 37 | [env] 38 | lib_deps = 39 | fastled/FastLED @ 3.3.2 40 | NeoPixelBus @ 2.6.0 41 | ESPAsyncTCP @ 1.2.0 42 | ESPAsyncUDP 43 | AsyncTCP @ 1.0.3 44 | IRremoteESP8266 @ 2.7.3 45 | https://github.com/lorol/LITTLEFS.git 46 | https://github.com/Aircoookie/ESPAsyncWebServer.git @ ~2.0.0 47 | U8g2@~2.27.2 48 | Wire 49 | -------------------------------------------------------------------------------- /usermods/usermod_v2_rotary_encoder_ui/readme.md: -------------------------------------------------------------------------------- 1 | # Rotary Encoder UI Usermod 2 | 3 | First, thanks to the authors of other Rotary Encoder usermods. 4 | 5 | This usermod starts to provide a relatively complete on-device 6 | UI when paired with the Four Line Display usermod. I strongly 7 | encourage you to try them together. 8 | 9 | [See the pair of usermods in action](https://www.youtube.com/watch?v=tITQY80rIOA) 10 | 11 | ## Installation 12 | 13 | Copy and update the example `platformio_override.ini.sample` to the root directory of your particular build. 14 | This file should be placed in the same directory as `platformio.ini`. 15 | 16 | ### Define Your Options 17 | 18 | * `USERMOD_ROTARY_ENCODER_UI` - define this to have this user mod included wled00\usermods_list.cpp 19 | * `USERMOD_FOUR_LINE_DISLAY` - define this to have this the Four Line Display mod included wled00\usermods_list.cpp - also tells this usermod that the display is available (see the Four Line Display usermod `readme.md` for more details) 20 | * `ENCODER_DT_PIN` - The encoders DT pin, defaults to 12 21 | * `ENCODER_CLK_PIN` - The encoders CLK pin, defaults to 14 22 | * `ENCODER_SW_PIN` - The encoders SW pin, defaults to 13 23 | 24 | ### PlatformIO requirements 25 | 26 | No special requirements. 27 | 28 | Note: the Four Line Display usermod requires the libraries `U8g2` and `Wire`. 29 | 30 | ## Change Log 31 | 32 | 2021-02 33 | * First public release 34 | -------------------------------------------------------------------------------- /usermods/word-clock-matrix/Word Clock Baffle.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/usermods/word-clock-matrix/Word Clock Baffle.stl -------------------------------------------------------------------------------- /usermods/word-clock-matrix/readme.md: -------------------------------------------------------------------------------- 1 | ## Word clock usermod 2 | 3 | By @bwente 4 | 5 | See https://www.hackster.io/bwente/word-clock-with-just-two-components-073834 for the hardware guide! 6 | Includes a customizable feature to lower the brightness at night. 7 | -------------------------------------------------------------------------------- /wled00.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28010.2046 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wled00", "wled00\wled00.vcxproj", "{C5F80730-F44F-4478-BDAE-6634EFC2CA88}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Debug|x86.ActiveCfg = Debug|Win32 15 | {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Debug|x86.Build.0 = Debug|Win32 16 | {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Release|x86.ActiveCfg = Release|Win32 17 | {C5F80730-F44F-4478-BDAE-6634EFC2CA88}.Release|x86.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {9A679C2B-61D3-400B-B96F-06E604E9CED2} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /wled00/.vs/wled00/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/wled00/.vs/wled00/v15/.suo -------------------------------------------------------------------------------- /wled00/alexa.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | 3 | /* 4 | * Alexa Voice On/Off/Brightness/Color Control. Emulates a Philips Hue bridge to Alexa. 5 | * 6 | * This was put together from these two excellent projects: 7 | * https://github.com/kakopappa/arduino-esp8266-alexa-wemo-switch 8 | * https://github.com/probonopd/ESP8266HueEmulator 9 | */ 10 | #include "src/dependencies/espalexa/EspalexaDevice.h" 11 | 12 | #ifndef WLED_DISABLE_ALEXA 13 | void onAlexaChange(EspalexaDevice* dev); 14 | 15 | void alexaInit() 16 | { 17 | if (alexaEnabled && WLED_CONNECTED) 18 | { 19 | if (espalexaDevice == nullptr) //only init once 20 | { 21 | espalexaDevice = new EspalexaDevice(alexaInvocationName, onAlexaChange, EspalexaDeviceType::extendedcolor); 22 | espalexa.addDevice(espalexaDevice); 23 | espalexa.begin(&server); 24 | } else { 25 | espalexaDevice->setName(alexaInvocationName); 26 | } 27 | } 28 | } 29 | 30 | void handleAlexa() 31 | { 32 | if (!alexaEnabled || !WLED_CONNECTED) return; 33 | espalexa.loop(); 34 | } 35 | 36 | void onAlexaChange(EspalexaDevice* dev) 37 | { 38 | EspalexaDeviceProperty m = espalexaDevice->getLastChangedProperty(); 39 | 40 | if (m == EspalexaDeviceProperty::on) 41 | { 42 | if (!macroAlexaOn) 43 | { 44 | if (bri == 0) 45 | { 46 | bri = briLast; 47 | colorUpdated(NOTIFIER_CALL_MODE_ALEXA); 48 | } 49 | } else applyPreset(macroAlexaOn); 50 | } else if (m == EspalexaDeviceProperty::off) 51 | { 52 | if (!macroAlexaOff) 53 | { 54 | if (bri > 0) 55 | { 56 | briLast = bri; 57 | bri = 0; 58 | colorUpdated(NOTIFIER_CALL_MODE_ALEXA); 59 | } 60 | } else applyPreset(macroAlexaOff); 61 | } else if (m == EspalexaDeviceProperty::bri) 62 | { 63 | bri = espalexaDevice->getValue(); 64 | colorUpdated(NOTIFIER_CALL_MODE_ALEXA); 65 | } else //color 66 | { 67 | if (espalexaDevice->getColorMode() == EspalexaColorMode::ct) //shade of white 68 | { 69 | uint16_t ct = espalexaDevice->getCt(); 70 | if (useRGBW) 71 | { 72 | switch (ct) { //these values empirically look good on RGBW 73 | case 199: col[0]=255; col[1]=255; col[2]=255; col[3]=255; break; 74 | case 234: col[0]=127; col[1]=127; col[2]=127; col[3]=255; break; 75 | case 284: col[0]= 0; col[1]= 0; col[2]= 0; col[3]=255; break; 76 | case 350: col[0]=130; col[1]= 90; col[2]= 0; col[3]=255; break; 77 | case 383: col[0]=255; col[1]=153; col[2]= 0; col[3]=255; break; 78 | } 79 | } else { 80 | colorCTtoRGB(ct, col); 81 | } 82 | } else { 83 | uint32_t color = espalexaDevice->getRGB(); 84 | 85 | col[0] = ((color >> 16) & 0xFF); 86 | col[1] = ((color >> 8) & 0xFF); 87 | col[2] = ( color & 0xFF); 88 | col[3] = 0; 89 | } 90 | colorUpdated(NOTIFIER_CALL_MODE_ALEXA); 91 | } 92 | } 93 | 94 | 95 | #else 96 | void alexaInit(){} 97 | void handleAlexa(){} 98 | #endif 99 | -------------------------------------------------------------------------------- /wled00/blynk.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | #include "src/dependencies/blynk/Blynk/BlynkHandlers.h" 3 | 4 | /* 5 | * Remote light control with the free Blynk app 6 | */ 7 | 8 | uint16_t blHue = 0; 9 | byte blSat = 255; 10 | 11 | void initBlynk(const char *auth, const char *host, uint16_t port) 12 | { 13 | #ifndef WLED_DISABLE_BLYNK 14 | if (!WLED_CONNECTED) return; 15 | blynkEnabled = (auth[0] != 0); 16 | if (blynkEnabled) Blynk.config(auth, host, port); 17 | #endif 18 | } 19 | 20 | void handleBlynk() 21 | { 22 | #ifndef WLED_DISABLE_BLYNK 23 | if (WLED_CONNECTED && blynkEnabled) 24 | Blynk.run(); 25 | #endif 26 | } 27 | 28 | void updateBlynk() 29 | { 30 | #ifndef WLED_DISABLE_BLYNK 31 | if (!WLED_CONNECTED) return; 32 | Blynk.virtualWrite(V0, bri); 33 | //we need a RGB -> HSB convert here 34 | Blynk.virtualWrite(V3, bri? 1:0); 35 | Blynk.virtualWrite(V4, effectCurrent); 36 | Blynk.virtualWrite(V5, effectSpeed); 37 | Blynk.virtualWrite(V6, effectIntensity); 38 | Blynk.virtualWrite(V7, nightlightActive); 39 | Blynk.virtualWrite(V8, notifyDirect); 40 | #endif 41 | } 42 | 43 | #ifndef WLED_DISABLE_BLYNK 44 | BLYNK_WRITE(V0) 45 | { 46 | bri = param.asInt();//bri 47 | colorUpdated(NOTIFIER_CALL_MODE_BLYNK); 48 | } 49 | 50 | BLYNK_WRITE(V1) 51 | { 52 | blHue = param.asInt();//hue 53 | colorHStoRGB(blHue*10,blSat,(false)? colSec:col); 54 | colorUpdated(NOTIFIER_CALL_MODE_BLYNK); 55 | } 56 | 57 | BLYNK_WRITE(V2) 58 | { 59 | blSat = param.asInt();//sat 60 | colorHStoRGB(blHue*10,blSat,(false)? colSec:col); 61 | colorUpdated(NOTIFIER_CALL_MODE_BLYNK); 62 | } 63 | 64 | BLYNK_WRITE(V3) 65 | { 66 | bool on = (param.asInt()>0); 67 | if (!on != !bri) {toggleOnOff(); colorUpdated(NOTIFIER_CALL_MODE_BLYNK);} 68 | } 69 | 70 | BLYNK_WRITE(V4) 71 | { 72 | effectCurrent = param.asInt()-1;//fx 73 | colorUpdated(NOTIFIER_CALL_MODE_BLYNK); 74 | } 75 | 76 | BLYNK_WRITE(V5) 77 | { 78 | effectSpeed = param.asInt();//sx 79 | colorUpdated(NOTIFIER_CALL_MODE_BLYNK); 80 | } 81 | 82 | BLYNK_WRITE(V6) 83 | { 84 | effectIntensity = param.asInt();//ix 85 | colorUpdated(NOTIFIER_CALL_MODE_BLYNK); 86 | } 87 | 88 | BLYNK_WRITE(V7) 89 | { 90 | nightlightActive = (param.asInt()>0); 91 | } 92 | 93 | BLYNK_WRITE(V8) 94 | { 95 | notifyDirect = (param.asInt()>0); //send notifications 96 | } 97 | #endif 98 | -------------------------------------------------------------------------------- /wled00/data/404.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Not found 8 | 40 | 41 | 42 | 43 |

404 Not Found

44 | Akemi does not know where you are headed...

45 | 46 | 47 | -------------------------------------------------------------------------------- /wled00/data/dmxmap.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | DMX Map 4 | 27 | 28 |
...
-------------------------------------------------------------------------------- /wled00/data/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peacepenguin/WLED/ad4bfc884526df87e0db7d60bffcd63b8940e4ff/wled00/data/favicon.ico -------------------------------------------------------------------------------- /wled00/data/jsontest.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | JSON client 5 | 59 | 60 | 61 | 62 |
63 |

JSON API test tool

64 |

URL:

65 | 66 |
67 | 68 | 69 |
70 |

Body:

71 | 72 |

Response:

73 | 74 |
75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /wled00/data/liveview.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | WLED Live Preview 8 | 20 | 21 | 22 |
23 | 63 | 64 | -------------------------------------------------------------------------------- /wled00/data/msg.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | WLED Message 7 | 8 | 29 | 30 | 31 | 32 |

Sample Message.

33 | Sample Detail. 34 | 35 | 36 | -------------------------------------------------------------------------------- /wled00/data/settings.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WLED Settings 5 | 27 | 36 | 37 | 38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | 46 | -------------------------------------------------------------------------------- /wled00/data/settings_dmx.htm: -------------------------------------------------------------------------------- 1 | 2 | DMX Settings 3 | 34 | 37 | 38 | 39 |
40 |
41 |
42 |

Imma firin ma lazer (if it has DMX support)

43 | 44 | Proxy Universe from E1.31 to DMX (0=disabled)
45 | This will disable the LED data output to DMX configurable below

46 | Number of fixtures is taken from LED config page
47 | 48 | Channels per fixture (15 max):
49 | Start channel:
50 | Spacing between start channels: [ info ]
51 | 52 |
53 | DMX fixtures start LED: 54 |

Channel functions

55 |
56 |
57 |
58 | 59 | 60 | -------------------------------------------------------------------------------- /wled00/data/settings_sec.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Misc Settings 7 | 25 | 28 | 29 | 30 |
31 |
32 |
33 |

Security & Update setup

34 | Lock wireless (OTA) software update:
35 | Passphrase:
36 | To enable OTA, for security reasons you need to also enter the correct password!
37 | The password should be changed when OTA is enabled.
38 | Disable OTA when not in use, otherwise an attacker can reflash device software!
39 | Settings on this page are only changable if OTA lock is disabled!
40 | Deny access to WiFi settings if locked:

41 | Factory reset:
42 | All EEPROM content (settings) will be erased.

43 | HTTP traffic is unencrypted. An attacker in the same network can intercept form data! 44 |

Software Update

45 |
46 | Enable ArduinoOTA:
47 |

About

48 | WLED version ##VERSION##

49 | Contributors, dependencies and special thanks
50 | A huge thank you to everyone who helped me create WLED!

51 | (c) 2016-2021 Christian Schwinne
52 | Licensed under the MIT license

53 | Server message: Response error!
54 | 55 |
56 | 57 | -------------------------------------------------------------------------------- /wled00/data/settings_wifi.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | WiFi Settings 7 | 21 | 24 | 25 | 26 |
27 |
28 |
29 |

WiFi setup

30 |

Connect to existing network

31 | Network name (SSID, empty to not connect):

32 | Network password:

33 | Static IP (leave at 0.0.0.0 for DHCP):
34 | . 35 | . 36 | . 37 |
38 | Static gateway:
39 | . 40 | . 41 | . 42 |
43 | Static subnet mask:
44 | . 45 | . 46 | . 47 |
48 | mDNS address (leave empty for no mDNS):
49 | http:// .local
50 | Client IP: Not connected
51 |

Configure Access Point

52 | AP SSID (leave empty for no AP):

53 | Hide AP name:
54 | AP password (leave empty for open):

55 | Access Point WiFi channel:
56 | AP opens: 57 |
62 | AP IP: Not active
63 |

Experimental

64 | Disable WiFi sleep:
65 | Can help with connectivity issues.
66 | Do not enable if WiFi is working correctly, increases power consumption.
67 |
68 |

Ethernet Type

69 |

74 |
75 | 76 |
77 | 78 | -------------------------------------------------------------------------------- /wled00/data/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Verdana, sans-serif; 3 | text-align: center; 4 | background: #222; 5 | color: #fff; 6 | line-height: 200%; 7 | margin: 0; 8 | } 9 | hr { 10 | border-color: #666; 11 | } 12 | button { 13 | background: #333; 14 | color: #fff; 15 | font-family: Verdana, sans-serif; 16 | border: 0.3ch solid #333; 17 | display: inline-block; 18 | font-size: 20px; 19 | margin: 8px; 20 | margin-top: 12px; 21 | } 22 | .helpB { 23 | text-align: left; 24 | position: absolute; 25 | width: 60px; 26 | } 27 | input { 28 | background: #333; 29 | color: #fff; 30 | font-family: Verdana, sans-serif; 31 | border: 0.5ch solid #333; 32 | } 33 | input[type="number"] { 34 | width: 4em; 35 | } 36 | select { 37 | background: #333; 38 | color: #fff; 39 | font-family: Verdana, sans-serif; 40 | border: 0.5ch solid #333; 41 | } 42 | td { 43 | padding: 2px; 44 | } 45 | .d5 { 46 | width: 4.5em !important; 47 | } 48 | -------------------------------------------------------------------------------- /wled00/data/update.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | WLED Update 7 | 10 | 38 | 39 | 40 | 41 |

WLED Software Update

42 |
43 | Installed version: ##VERSION##
44 | Download the latest binary: 45 |
46 |
47 |
48 |
49 |
Updating...
Please do not close or refresh the page :)
50 | 51 | 52 | -------------------------------------------------------------------------------- /wled00/data/usermod.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | No usermod custom web page set. 5 | 6 | -------------------------------------------------------------------------------- /wled00/data/welcome.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Welcome! 8 | 51 | 52 | 53 | 54 |
55 |

Welcome to WLED!

56 |

Thank you for installing my application!

57 | Next steps:

58 | Connect the module to your local WiFi here!
59 |
60 | Just trying this out in AP mode?
61 |
62 |
63 | 64 | -------------------------------------------------------------------------------- /wled00/dmx.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | 3 | /* 4 | * Support for DMX via MAX485. 5 | * Change the output pin in src/dependencies/ESPDMX.cpp if needed. 6 | * Library from: 7 | * https://github.com/Rickgg/ESP-Dmx 8 | */ 9 | 10 | #ifdef WLED_ENABLE_DMX 11 | 12 | void handleDMX() 13 | { 14 | // don't act, when in DMX Proxy mode 15 | if (e131ProxyUniverse != 0) return; 16 | 17 | // TODO: calculate brightness manually if no shutter channel is set 18 | 19 | uint8_t brightness = strip.getBrightness(); 20 | 21 | for (int i = DMXStartLED; i < ledCount; i++) { // uses the amount of LEDs as fixture count 22 | 23 | uint32_t in = strip.getPixelColor(i); // get the colors for the individual fixtures as suggested by Aircoookie in issue #462 24 | byte w = in >> 24 & 0xFF; 25 | byte r = in >> 16 & 0xFF; 26 | byte g = in >> 8 & 0xFF; 27 | byte b = in & 0xFF; 28 | 29 | int DMXFixtureStart = DMXStart + (DMXGap * (i - DMXStartLED)); 30 | for (int j = 0; j < DMXChannels; j++) { 31 | int DMXAddr = DMXFixtureStart + j; 32 | switch (DMXFixtureMap[j]) { 33 | case 0: // Set this channel to 0. Good way to tell strobe- and fade-functions to fuck right off. 34 | dmx.write(DMXAddr, 0); 35 | break; 36 | case 1: // Red 37 | dmx.write(DMXAddr, r); 38 | break; 39 | case 2: // Green 40 | dmx.write(DMXAddr, g); 41 | break; 42 | case 3: // Blue 43 | dmx.write(DMXAddr, b); 44 | break; 45 | case 4: // White 46 | dmx.write(DMXAddr, w); 47 | break; 48 | case 5: // Shutter channel. Controls the brightness. 49 | dmx.write(DMXAddr, brightness); 50 | break; 51 | case 6: // Sets this channel to 255. Like 0, but more wholesome. 52 | dmx.write(DMXAddr, 255); 53 | break; 54 | } 55 | } 56 | } 57 | 58 | dmx.update(); // update the DMX bus 59 | } 60 | 61 | void initDMX() { 62 | dmx.init(512); // initialize with bus length 63 | } 64 | 65 | #if (LEDPIN == 2) 66 | #pragma message "Pin conflict compiling with DMX and LEDs on pin 2. Please set a different LEDPIN." 67 | #endif 68 | 69 | #else 70 | void handleDMX() {} 71 | void initDMX() {} 72 | #endif 73 | -------------------------------------------------------------------------------- /wled00/lx_parser.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | 3 | /* 4 | * Parser for Loxone formats 5 | */ 6 | bool parseLx(int lxValue, byte rgbw[4]) 7 | { 8 | #ifdef WLED_ENABLE_LOXONE 9 | DEBUG_PRINT(F("LX: Lox = ")); 10 | DEBUG_PRINTLN(lxValue); 11 | 12 | bool ok = false; 13 | float lxRed = 0, lxGreen = 0, lxBlue = 0; 14 | 15 | if (lxValue < 200000000) { 16 | // Loxone RGB 17 | ok = true; 18 | lxRed = round((lxValue % 1000) * 2.55); 19 | lxGreen = round(((lxValue / 1000) % 1000) * 2.55); 20 | lxBlue = round(((lxValue / 1000000) % 1000) * 2.55); 21 | } else if ((lxValue >= 200000000) && (lxValue <= 201006500)) { 22 | // Loxone Lumitech 23 | ok = true; 24 | float tmpBri = floor((lxValue - 200000000) / 10000); ; 25 | uint16_t ct = (lxValue - 200000000) - (((uint8_t)tmpBri) * 10000); 26 | float temp = 0; 27 | 28 | tmpBri *= 2.55; 29 | constrain(tmpBri, 0, 255); 30 | 31 | colorKtoRGB(ct, rgbw); 32 | lxRed = rgbw[0]; lxGreen = rgbw[1]; lxBlue = rgbw[2]; 33 | 34 | lxRed *= (tmpBri/255); 35 | lxGreen *= (tmpBri/255); 36 | lxBlue *= (tmpBri/255); 37 | } 38 | 39 | if (ok) { 40 | rgbw[0] = (uint8_t) constrain(lxRed, 0, 255); 41 | rgbw[1] = (uint8_t) constrain(lxGreen, 0, 255); 42 | rgbw[2] = (uint8_t) constrain(lxBlue, 0, 255); 43 | rgbw[3] = 0; 44 | return true; 45 | } 46 | #endif 47 | return false; 48 | } 49 | 50 | void parseLxJson(int lxValue, byte segId, bool secondary) 51 | { 52 | if (secondary) { 53 | DEBUG_PRINT(F("LY: Lox secondary = ")); 54 | } else { 55 | DEBUG_PRINT(F("LX: Lox primary = ")); 56 | } 57 | DEBUG_PRINTLN(lxValue); 58 | byte rgbw[] = {0,0,0,0}; 59 | if (parseLx(lxValue, rgbw)) { 60 | if (bri == 0) { 61 | DEBUG_PRINTLN(F("LX: turn on")); 62 | toggleOnOff(); 63 | } 64 | bri = 255; 65 | nightlightActive = false; //always disable nightlight when toggling 66 | if (segId == strip.getMainSegmentId()) { 67 | DEBUG_PRINTLN(F("LX: main segment")); 68 | if (secondary) for (byte i = 0; i < 4; i++) colSec[i] = rgbw[i]; 69 | else for (byte i = 0; i < 4; i++) col[i] = rgbw[i]; 70 | } else { 71 | DEBUG_PRINT(F("LX: segment ")); 72 | DEBUG_PRINTLN(segId); 73 | strip.getSegment(segId).setColor(secondary, ((rgbw[3] << 24) | ((rgbw[0]&0xFF) << 16) | ((rgbw[1]&0xFF) << 8) | ((rgbw[2]&0xFF))), segId); 74 | } 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /wled00/my_config_sample.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* 4 | * Welcome! 5 | * You can use the file "my_config.h" to make changes to the way WLED is compiled! 6 | * It is possible to enable and disable certain features as well as set defaults for some runtime changeable settings. 7 | * 8 | * How to use: 9 | * PlatformIO: Just compile the unmodified code once! The file "my_config.h" will be generated automatically and now you can make your changes. 10 | * 11 | * ArduinoIDE: Make a copy of this file and name it "my_config.h". Go to wled.h and uncomment "#define WLED_USE_MY_CONFIG" in the top of the file. 12 | * 13 | * DO NOT make changes to the "my_config_sample.h" file directly! Your changes will not be applied. 14 | */ 15 | 16 | // force the compiler to show a warning to confirm that this file is included 17 | #warning **** my_config.h: Settings from this file are honored **** 18 | 19 | /* Uncomment to use your WIFI settings as defaults 20 | //WARNING: this will hardcode these as the default even after a factory reset 21 | #define CLIENT_SSID "Your_SSID" 22 | #define CLIENT_PASS "Your_Password" 23 | */ 24 | 25 | //#define MAX_LEDS 1500 //Maximum total LEDs. More than 1500 might create a low memory situation on ESP8266. -------------------------------------------------------------------------------- /wled00/pin_manager.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | 3 | /* 4 | * Registers pins so there is no attempt for two interfaces to use the same pin 5 | */ 6 | 7 | void PinManagerClass::deallocatePin(byte gpio) 8 | { 9 | if (!isPinOk(gpio, false)) return; 10 | 11 | byte by = gpio >> 3; 12 | byte bi = gpio - 8*by; 13 | bitWrite(pinAlloc[by], bi, false); 14 | } 15 | 16 | bool PinManagerClass::allocatePin(byte gpio, bool output) 17 | { 18 | if (!isPinOk(gpio, output)) return false; 19 | if (isPinAllocated(gpio)) { 20 | DEBUG_PRINT(F("Attempted duplicate allocation of pin ")); 21 | DEBUG_PRINTLN(gpio); 22 | return false; 23 | } 24 | 25 | byte by = gpio >> 3; 26 | byte bi = gpio - 8*by; 27 | bitWrite(pinAlloc[by], bi, true); 28 | 29 | return true; 30 | } 31 | 32 | bool PinManagerClass::isPinAllocated(byte gpio) 33 | { 34 | if (!isPinOk(gpio, false)) return true; 35 | 36 | byte by = gpio >> 3; 37 | byte bi = gpio - 8*by; 38 | return bitRead(pinAlloc[by], bi); 39 | } 40 | 41 | bool PinManagerClass::isPinOk(byte gpio, bool output) 42 | { 43 | if (gpio < 6) return true; 44 | if (gpio < 12) return false; //SPI flash pins 45 | 46 | #ifdef ESP8266 47 | if (gpio < 17) return true; 48 | #else //ESP32 49 | if (gpio < 34) return true; 50 | if (gpio < 40 && !output) return true; //34-39 input only 51 | #endif 52 | 53 | return false; 54 | } -------------------------------------------------------------------------------- /wled00/playlist.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | 3 | /* 4 | * Handles playlists, timed sequences of presets 5 | */ 6 | 7 | typedef struct PlaylistEntry { 8 | uint8_t preset; 9 | uint16_t dur; 10 | uint16_t tr; 11 | } ple; 12 | 13 | byte playlistRepeat = 1; 14 | byte playlistEndPreset = 0; 15 | 16 | uint8_t* playlistEntries; 17 | 18 | byte playlistLen; 19 | int8_t playlistIndex = -1; 20 | 21 | uint16_t playlistEntryDur = 0; 22 | 23 | void loadPlaylist(JsonObject playlistObj) { 24 | delete playlistEntries; 25 | playlistIndex = -1; playlistEntryDur = 0; 26 | JsonArray presets = playlistObj["ps"]; 27 | playlistLen = presets.size(); 28 | if (playlistLen == 0) return; 29 | if (playlistLen > 100) playlistLen = 100; 30 | uint16_t dataSize = sizeof(ple) * playlistLen; 31 | playlistEntries = new byte[dataSize]; 32 | PlaylistEntry* entries = reinterpret_cast(playlistEntries); 33 | 34 | byte it = 0; 35 | for (int ps : presets) { 36 | if (it >= playlistLen) break; 37 | entries[it].preset = ps; 38 | it++; 39 | } 40 | 41 | it = 0; 42 | JsonArray durations = playlistObj["dur"]; 43 | if (durations.isNull()) { 44 | entries[0].dur = playlistObj["dur"] | 100; 45 | it = 1; 46 | } else { 47 | for (int dur : durations) { 48 | if (it >= playlistLen) break; 49 | entries[it].dur = dur; 50 | it++; 51 | } 52 | } 53 | for (int i = it; i < playlistLen; i++) entries[i].dur = entries[it -1].dur; 54 | 55 | it = 0; 56 | JsonArray tr = playlistObj["transition"]; 57 | if (tr.isNull()) { 58 | entries[0].tr = playlistObj["transition"] | (transitionDelay / 100); 59 | it = 1; 60 | } else { 61 | for (int transition : tr) { 62 | if (it >= playlistLen) break; 63 | entries[it].tr = transition; 64 | it++; 65 | } 66 | } 67 | for (int i = it; i < playlistLen; i++) entries[i].tr = entries[it -1].tr; 68 | 69 | playlistRepeat = playlistObj[F("repeat")] | 0; 70 | playlistEndPreset = playlistObj[F("end")] | 0; 71 | 72 | currentPlaylist = 0; //TODO here we need the preset ID where the playlist is saved 73 | } 74 | 75 | void handlePlaylist() 76 | { 77 | if (currentPlaylist < 0 || playlistEntries == nullptr || presetCyclingEnabled) return; 78 | 79 | if (millis() - presetCycledTime > (100*playlistEntryDur)) 80 | { 81 | presetCycledTime = millis(); 82 | if (bri == 0 || nightlightActive) return; 83 | 84 | playlistIndex++; 85 | if (playlistIndex >= playlistLen) { 86 | playlistIndex = 0; 87 | if (playlistRepeat == 1) { //stop 88 | currentPlaylist = -1; 89 | delete playlistEntries; 90 | playlistEntries = nullptr; 91 | if (playlistEndPreset) applyPreset(playlistEndPreset); 92 | return; 93 | } 94 | if (playlistRepeat > 1) playlistRepeat--; 95 | } 96 | 97 | PlaylistEntry* entries = reinterpret_cast(playlistEntries); 98 | 99 | jsonTransitionOnce = true; 100 | transitionDelayTemp = entries[playlistIndex].tr * 100; 101 | 102 | applyPreset(entries[playlistIndex].preset); 103 | playlistEntryDur = entries[playlistIndex].dur; 104 | if (playlistEntryDur == 0) playlistEntryDur = 10; 105 | } 106 | } -------------------------------------------------------------------------------- /wled00/presets.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | 3 | /* 4 | * Methods to handle saving and loading presets to/from the filesystem 5 | */ 6 | 7 | bool applyPreset(byte index) 8 | { 9 | if (index == 0) return false; 10 | if (fileDoc) { 11 | errorFlag = readObjectFromFileUsingId("/presets.json", index, fileDoc) ? ERR_NONE : ERR_FS_PLOAD; 12 | JsonObject fdo = fileDoc->as(); 13 | if (fdo["ps"] == index) fdo.remove("ps"); //remove load request for same presets to prevent recursive crash 14 | #ifdef WLED_DEBUG_FS 15 | serializeJson(*fileDoc, Serial); 16 | #endif 17 | deserializeState(fdo); 18 | } else { 19 | DEBUGFS_PRINTLN(F("Make read buf")); 20 | DynamicJsonDocument fDoc(JSON_BUFFER_SIZE); 21 | errorFlag = readObjectFromFileUsingId("/presets.json", index, &fDoc) ? ERR_NONE : ERR_FS_PLOAD; 22 | JsonObject fdo = fDoc.as(); 23 | if (fdo["ps"] == index) fdo.remove("ps"); 24 | #ifdef WLED_DEBUG_FS 25 | serializeJson(fDoc, Serial); 26 | #endif 27 | deserializeState(fdo); 28 | } 29 | 30 | if (!errorFlag) { 31 | currentPreset = index; 32 | isPreset = true; 33 | return true; 34 | } 35 | return false; 36 | } 37 | 38 | void savePreset(byte index, bool persist, const char* pname, JsonObject saveobj) 39 | { 40 | if (index == 0 || index > 250) return; 41 | bool docAlloc = (fileDoc != nullptr); 42 | JsonObject sObj = saveobj; 43 | 44 | if (!docAlloc) { 45 | DEBUGFS_PRINTLN(F("Allocating saving buffer")); 46 | DynamicJsonDocument lDoc(JSON_BUFFER_SIZE); 47 | sObj = lDoc.to(); 48 | if (pname) sObj["n"] = pname; 49 | DEBUGFS_PRINTLN(F("Save current state")); 50 | serializeState(sObj, true); 51 | currentPreset = index; 52 | 53 | writeObjectToFileUsingId("/presets.json", index, &lDoc); 54 | } else { //from JSON API 55 | DEBUGFS_PRINTLN(F("Reuse recv buffer")); 56 | sObj.remove(F("psave")); 57 | sObj.remove(F("v")); 58 | 59 | if (!sObj["o"]) { 60 | DEBUGFS_PRINTLN(F("Save current state")); 61 | serializeState(sObj, true, sObj["ib"], sObj["sb"]); 62 | currentPreset = index; 63 | } 64 | sObj.remove("o"); 65 | sObj.remove("ib"); 66 | sObj.remove("sb"); 67 | sObj.remove(F("error")); 68 | sObj.remove(F("time")); 69 | 70 | writeObjectToFileUsingId("/presets.json", index, fileDoc); 71 | } 72 | presetsModifiedTime = now(); //unix time 73 | updateFSInfo(); 74 | } 75 | 76 | void deletePreset(byte index) { 77 | StaticJsonDocument<24> empty; 78 | writeObjectToFileUsingId("/presets.json", index, &empty); 79 | presetsModifiedTime = now(); //unix time 80 | updateFSInfo(); 81 | } -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient.h: -------------------------------------------------------------------------------- 1 | #ifndef SRC_ASYNCMQTTCLIENT_H_ 2 | #define SRC_ASYNCMQTTCLIENT_H_ 3 | 4 | #include "AsyncMqttClient.hpp" 5 | 6 | #endif // SRC_ASYNCMQTTCLIENT_H_ 7 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Callbacks.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "DisconnectReasons.hpp" 6 | #include "MessageProperties.hpp" 7 | 8 | namespace AsyncMqttClientInternals { 9 | // user callbacks 10 | typedef std::function OnConnectUserCallback; 11 | typedef std::function OnDisconnectUserCallback; 12 | typedef std::function OnSubscribeUserCallback; 13 | typedef std::function OnUnsubscribeUserCallback; 14 | typedef std::function OnMessageUserCallback; 15 | typedef std::function OnPublishUserCallback; 16 | 17 | // internal callbacks 18 | typedef std::function OnConnAckInternalCallback; 19 | typedef std::function OnPingRespInternalCallback; 20 | typedef std::function OnSubAckInternalCallback; 21 | typedef std::function OnUnsubAckInternalCallback; 22 | typedef std::function OnMessageInternalCallback; 23 | typedef std::function OnPublishInternalCallback; 24 | typedef std::function OnPubRelInternalCallback; 25 | typedef std::function OnPubAckInternalCallback; 26 | typedef std::function OnPubRecInternalCallback; 27 | typedef std::function OnPubCompInternalCallback; 28 | } // namespace AsyncMqttClientInternals 29 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/DisconnectReasons.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum class AsyncMqttClientDisconnectReason : int8_t { 4 | TCP_DISCONNECTED = 0, 5 | 6 | MQTT_UNACCEPTABLE_PROTOCOL_VERSION = 1, 7 | MQTT_IDENTIFIER_REJECTED = 2, 8 | MQTT_SERVER_UNAVAILABLE = 3, 9 | MQTT_MALFORMED_CREDENTIALS = 4, 10 | MQTT_NOT_AUTHORIZED = 5, 11 | 12 | ESP8266_NOT_ENOUGH_SPACE = 6, 13 | 14 | TLS_BAD_FINGERPRINT = 7 15 | }; 16 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Flags.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace AsyncMqttClientInternals { 4 | constexpr struct { 5 | const uint8_t RESERVED = 0; 6 | const uint8_t CONNECT = 1; 7 | const uint8_t CONNACK = 2; 8 | const uint8_t PUBLISH = 3; 9 | const uint8_t PUBACK = 4; 10 | const uint8_t PUBREC = 5; 11 | const uint8_t PUBREL = 6; 12 | const uint8_t PUBCOMP = 7; 13 | const uint8_t SUBSCRIBE = 8; 14 | const uint8_t SUBACK = 9; 15 | const uint8_t UNSUBSCRIBE = 10; 16 | const uint8_t UNSUBACK = 11; 17 | const uint8_t PINGREQ = 12; 18 | const uint8_t PINGRESP = 13; 19 | const uint8_t DISCONNECT = 14; 20 | const uint8_t RESERVED2 = 1; 21 | } PacketType; 22 | 23 | constexpr struct { 24 | const uint8_t CONNECT_RESERVED = 0x00; 25 | const uint8_t CONNACK_RESERVED = 0x00; 26 | const uint8_t PUBLISH_DUP = 0x08; 27 | const uint8_t PUBLISH_QOS0 = 0x00; 28 | const uint8_t PUBLISH_QOS1 = 0x02; 29 | const uint8_t PUBLISH_QOS2 = 0x04; 30 | const uint8_t PUBLISH_QOSRESERVED = 0x06; 31 | const uint8_t PUBLISH_RETAIN = 0x01; 32 | const uint8_t PUBACK_RESERVED = 0x00; 33 | const uint8_t PUBREC_RESERVED = 0x00; 34 | const uint8_t PUBREL_RESERVED = 0x02; 35 | const uint8_t PUBCOMP_RESERVED = 0x00; 36 | const uint8_t SUBSCRIBE_RESERVED = 0x02; 37 | const uint8_t SUBACK_RESERVED = 0x00; 38 | const uint8_t UNSUBSCRIBE_RESERVED = 0x02; 39 | const uint8_t UNSUBACK_RESERVED = 0x00; 40 | const uint8_t PINGREQ_RESERVED = 0x00; 41 | const uint8_t PINGRESP_RESERVED = 0x00; 42 | const uint8_t DISCONNECT_RESERVED = 0x00; 43 | const uint8_t RESERVED2_RESERVED = 0x00; 44 | } HeaderFlag; 45 | 46 | constexpr struct { 47 | const uint8_t USERNAME = 0x80; 48 | const uint8_t PASSWORD = 0x40; 49 | const uint8_t WILL_RETAIN = 0x20; 50 | const uint8_t WILL_QOS0 = 0x00; 51 | const uint8_t WILL_QOS1 = 0x08; 52 | const uint8_t WILL_QOS2 = 0x10; 53 | const uint8_t WILL = 0x04; 54 | const uint8_t CLEAN_SESSION = 0x02; 55 | const uint8_t RESERVED = 0x00; 56 | } ConnectFlag; 57 | } // namespace AsyncMqttClientInternals 58 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Helpers.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace AsyncMqttClientInternals { 4 | class Helpers { 5 | public: 6 | static uint32_t decodeRemainingLength(char* bytes) { 7 | uint32_t multiplier = 1; 8 | uint32_t value = 0; 9 | uint8_t currentByte = 0; 10 | uint8_t encodedByte; 11 | do { 12 | encodedByte = bytes[currentByte++]; 13 | value += (encodedByte & 127) * multiplier; 14 | multiplier *= 128; 15 | } while ((encodedByte & 128) != 0); 16 | 17 | return value; 18 | } 19 | 20 | static uint8_t encodeRemainingLength(uint32_t remainingLength, char* destination) { 21 | uint8_t currentByte = 0; 22 | uint8_t bytesNeeded = 0; 23 | 24 | do { 25 | uint8_t encodedByte = remainingLength % 128; 26 | remainingLength /= 128; 27 | if (remainingLength > 0) { 28 | encodedByte = encodedByte | 128; 29 | } 30 | 31 | destination[currentByte++] = encodedByte; 32 | bytesNeeded++; 33 | } while (remainingLength > 0); 34 | 35 | return bytesNeeded; 36 | } 37 | }; 38 | } // namespace AsyncMqttClientInternals 39 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/MessageProperties.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct AsyncMqttClientMessageProperties { 4 | uint8_t qos; 5 | bool dup; 6 | bool retain; 7 | }; 8 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/ConnAckPacket.cpp: -------------------------------------------------------------------------------- 1 | #include "ConnAckPacket.hpp" 2 | 3 | using AsyncMqttClientInternals::ConnAckPacket; 4 | 5 | ConnAckPacket::ConnAckPacket(ParsingInformation* parsingInformation, OnConnAckInternalCallback callback) 6 | : _parsingInformation(parsingInformation) 7 | , _callback(callback) 8 | , _bytePosition(0) 9 | , _sessionPresent(false) 10 | , _connectReturnCode(0) { 11 | } 12 | 13 | ConnAckPacket::~ConnAckPacket() { 14 | } 15 | 16 | void ConnAckPacket::parseVariableHeader(char* data, size_t len, size_t* currentBytePosition) { 17 | char currentByte = data[(*currentBytePosition)++]; 18 | if (_bytePosition++ == 0) { 19 | _sessionPresent = (currentByte << 7) >> 7; 20 | } else { 21 | _connectReturnCode = currentByte; 22 | _parsingInformation->bufferState = BufferState::NONE; 23 | _callback(_sessionPresent, _connectReturnCode); 24 | } 25 | } 26 | 27 | void ConnAckPacket::parsePayload(char* data, size_t len, size_t* currentBytePosition) { 28 | (void)data; 29 | (void)currentBytePosition; 30 | } 31 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/ConnAckPacket.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Arduino.h" 4 | #include "Packet.hpp" 5 | #include "../ParsingInformation.hpp" 6 | #include "../Callbacks.hpp" 7 | 8 | namespace AsyncMqttClientInternals { 9 | class ConnAckPacket : public Packet { 10 | public: 11 | explicit ConnAckPacket(ParsingInformation* parsingInformation, OnConnAckInternalCallback callback); 12 | ~ConnAckPacket(); 13 | 14 | void parseVariableHeader(char* data, size_t len, size_t* currentBytePosition); 15 | void parsePayload(char* data, size_t len, size_t* currentBytePosition); 16 | 17 | private: 18 | ParsingInformation* _parsingInformation; 19 | OnConnAckInternalCallback _callback; 20 | 21 | uint8_t _bytePosition; 22 | bool _sessionPresent; 23 | uint8_t _connectReturnCode; 24 | }; 25 | } // namespace AsyncMqttClientInternals 26 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/Packet.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace AsyncMqttClientInternals { 4 | class Packet { 5 | public: 6 | virtual ~Packet() {} 7 | 8 | virtual void parseVariableHeader(char* data, size_t len, size_t* currentBytePosition) = 0; 9 | virtual void parsePayload(char* data, size_t len, size_t* currentBytePosition) = 0; 10 | }; 11 | } // namespace AsyncMqttClientInternals 12 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/PingRespPacket.cpp: -------------------------------------------------------------------------------- 1 | #include "PingRespPacket.hpp" 2 | 3 | using AsyncMqttClientInternals::PingRespPacket; 4 | 5 | PingRespPacket::PingRespPacket(ParsingInformation* parsingInformation, OnPingRespInternalCallback callback) 6 | : _parsingInformation(parsingInformation) 7 | , _callback(callback) { 8 | } 9 | 10 | PingRespPacket::~PingRespPacket() { 11 | } 12 | 13 | void PingRespPacket::parseVariableHeader(char* data, size_t len, size_t* currentBytePosition) { 14 | (void)data; 15 | (void)currentBytePosition; 16 | } 17 | 18 | void PingRespPacket::parsePayload(char* data, size_t len, size_t* currentBytePosition) { 19 | (void)data; 20 | (void)currentBytePosition; 21 | } 22 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/PingRespPacket.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Arduino.h" 4 | #include "Packet.hpp" 5 | #include "../ParsingInformation.hpp" 6 | #include "../Callbacks.hpp" 7 | 8 | namespace AsyncMqttClientInternals { 9 | class PingRespPacket : public Packet { 10 | public: 11 | explicit PingRespPacket(ParsingInformation* parsingInformation, OnPingRespInternalCallback callback); 12 | ~PingRespPacket(); 13 | 14 | void parseVariableHeader(char* data, size_t len, size_t* currentBytePosition); 15 | void parsePayload(char* data, size_t len, size_t* currentBytePosition); 16 | 17 | private: 18 | ParsingInformation* _parsingInformation; 19 | OnPingRespInternalCallback _callback; 20 | }; 21 | } // namespace AsyncMqttClientInternals 22 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/PubAckPacket.cpp: -------------------------------------------------------------------------------- 1 | #include "PubAckPacket.hpp" 2 | 3 | using AsyncMqttClientInternals::PubAckPacket; 4 | 5 | PubAckPacket::PubAckPacket(ParsingInformation* parsingInformation, OnPubAckInternalCallback callback) 6 | : _parsingInformation(parsingInformation) 7 | , _callback(callback) 8 | , _bytePosition(0) 9 | , _packetIdMsb(0) 10 | , _packetId(0) { 11 | } 12 | 13 | PubAckPacket::~PubAckPacket() { 14 | } 15 | 16 | void PubAckPacket::parseVariableHeader(char* data, size_t len, size_t* currentBytePosition) { 17 | char currentByte = data[(*currentBytePosition)++]; 18 | if (_bytePosition++ == 0) { 19 | _packetIdMsb = currentByte; 20 | } else { 21 | _packetId = currentByte | _packetIdMsb << 8; 22 | _parsingInformation->bufferState = BufferState::NONE; 23 | _callback(_packetId); 24 | } 25 | } 26 | 27 | void PubAckPacket::parsePayload(char* data, size_t len, size_t* currentBytePosition) { 28 | (void)data; 29 | (void)currentBytePosition; 30 | } 31 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/PubAckPacket.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Arduino.h" 4 | #include "Packet.hpp" 5 | #include "../ParsingInformation.hpp" 6 | #include "../Callbacks.hpp" 7 | 8 | namespace AsyncMqttClientInternals { 9 | class PubAckPacket : public Packet { 10 | public: 11 | explicit PubAckPacket(ParsingInformation* parsingInformation, OnPubAckInternalCallback callback); 12 | ~PubAckPacket(); 13 | 14 | void parseVariableHeader(char* data, size_t len, size_t* currentBytePosition); 15 | void parsePayload(char* data, size_t len, size_t* currentBytePosition); 16 | 17 | private: 18 | ParsingInformation* _parsingInformation; 19 | OnPubAckInternalCallback _callback; 20 | 21 | uint8_t _bytePosition; 22 | char _packetIdMsb; 23 | uint16_t _packetId; 24 | }; 25 | } // namespace AsyncMqttClientInternals 26 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/PubCompPacket.cpp: -------------------------------------------------------------------------------- 1 | #include "PubCompPacket.hpp" 2 | 3 | using AsyncMqttClientInternals::PubCompPacket; 4 | 5 | PubCompPacket::PubCompPacket(ParsingInformation* parsingInformation, OnPubCompInternalCallback callback) 6 | : _parsingInformation(parsingInformation) 7 | , _callback(callback) 8 | , _bytePosition(0) 9 | , _packetIdMsb(0) 10 | , _packetId(0) { 11 | } 12 | 13 | PubCompPacket::~PubCompPacket() { 14 | } 15 | 16 | void PubCompPacket::parseVariableHeader(char* data, size_t len, size_t* currentBytePosition) { 17 | char currentByte = data[(*currentBytePosition)++]; 18 | if (_bytePosition++ == 0) { 19 | _packetIdMsb = currentByte; 20 | } else { 21 | _packetId = currentByte | _packetIdMsb << 8; 22 | _parsingInformation->bufferState = BufferState::NONE; 23 | _callback(_packetId); 24 | } 25 | } 26 | 27 | void PubCompPacket::parsePayload(char* data, size_t len, size_t* currentBytePosition) { 28 | (void)data; 29 | (void)currentBytePosition; 30 | } 31 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/PubCompPacket.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Arduino.h" 4 | #include "Packet.hpp" 5 | #include "../ParsingInformation.hpp" 6 | #include "../Callbacks.hpp" 7 | 8 | namespace AsyncMqttClientInternals { 9 | class PubCompPacket : public Packet { 10 | public: 11 | explicit PubCompPacket(ParsingInformation* parsingInformation, OnPubCompInternalCallback callback); 12 | ~PubCompPacket(); 13 | 14 | void parseVariableHeader(char* data, size_t len, size_t* currentBytePosition); 15 | void parsePayload(char* data, size_t len, size_t* currentBytePosition); 16 | 17 | private: 18 | ParsingInformation* _parsingInformation; 19 | OnPubCompInternalCallback _callback; 20 | 21 | uint8_t _bytePosition; 22 | char _packetIdMsb; 23 | uint16_t _packetId; 24 | }; 25 | } // namespace AsyncMqttClientInternals 26 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/PubRecPacket.cpp: -------------------------------------------------------------------------------- 1 | #include "PubRecPacket.hpp" 2 | 3 | using AsyncMqttClientInternals::PubRecPacket; 4 | 5 | PubRecPacket::PubRecPacket(ParsingInformation* parsingInformation, OnPubRecInternalCallback callback) 6 | : _parsingInformation(parsingInformation) 7 | , _callback(callback) 8 | , _bytePosition(0) 9 | , _packetIdMsb(0) 10 | , _packetId(0) { 11 | } 12 | 13 | PubRecPacket::~PubRecPacket() { 14 | } 15 | 16 | void PubRecPacket::parseVariableHeader(char* data, size_t len, size_t* currentBytePosition) { 17 | char currentByte = data[(*currentBytePosition)++]; 18 | if (_bytePosition++ == 0) { 19 | _packetIdMsb = currentByte; 20 | } else { 21 | _packetId = currentByte | _packetIdMsb << 8; 22 | _parsingInformation->bufferState = BufferState::NONE; 23 | _callback(_packetId); 24 | } 25 | } 26 | 27 | void PubRecPacket::parsePayload(char* data, size_t len, size_t* currentBytePosition) { 28 | (void)data; 29 | (void)currentBytePosition; 30 | } 31 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/PubRecPacket.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Arduino.h" 4 | #include "Packet.hpp" 5 | #include "../ParsingInformation.hpp" 6 | #include "../Callbacks.hpp" 7 | 8 | namespace AsyncMqttClientInternals { 9 | class PubRecPacket : public Packet { 10 | public: 11 | explicit PubRecPacket(ParsingInformation* parsingInformation, OnPubRecInternalCallback callback); 12 | ~PubRecPacket(); 13 | 14 | void parseVariableHeader(char* data, size_t len, size_t* currentBytePosition); 15 | void parsePayload(char* data, size_t len, size_t* currentBytePosition); 16 | 17 | private: 18 | ParsingInformation* _parsingInformation; 19 | OnPubRecInternalCallback _callback; 20 | 21 | uint8_t _bytePosition; 22 | char _packetIdMsb; 23 | uint16_t _packetId; 24 | }; 25 | } // namespace AsyncMqttClientInternals 26 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/PubRelPacket.cpp: -------------------------------------------------------------------------------- 1 | #include "PubRelPacket.hpp" 2 | 3 | using AsyncMqttClientInternals::PubRelPacket; 4 | 5 | PubRelPacket::PubRelPacket(ParsingInformation* parsingInformation, OnPubRelInternalCallback callback) 6 | : _parsingInformation(parsingInformation) 7 | , _callback(callback) 8 | , _bytePosition(0) 9 | , _packetIdMsb(0) 10 | , _packetId(0) { 11 | } 12 | 13 | PubRelPacket::~PubRelPacket() { 14 | } 15 | 16 | void PubRelPacket::parseVariableHeader(char* data, size_t len, size_t* currentBytePosition) { 17 | char currentByte = data[(*currentBytePosition)++]; 18 | if (_bytePosition++ == 0) { 19 | _packetIdMsb = currentByte; 20 | } else { 21 | _packetId = currentByte | _packetIdMsb << 8; 22 | _parsingInformation->bufferState = BufferState::NONE; 23 | _callback(_packetId); 24 | } 25 | } 26 | 27 | void PubRelPacket::parsePayload(char* data, size_t len, size_t* currentBytePosition) { 28 | (void)data; 29 | (void)currentBytePosition; 30 | } 31 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/PubRelPacket.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Arduino.h" 4 | #include "Packet.hpp" 5 | #include "../ParsingInformation.hpp" 6 | #include "../Callbacks.hpp" 7 | 8 | namespace AsyncMqttClientInternals { 9 | class PubRelPacket : public Packet { 10 | public: 11 | explicit PubRelPacket(ParsingInformation* parsingInformation, OnPubRelInternalCallback callback); 12 | ~PubRelPacket(); 13 | 14 | void parseVariableHeader(char* data, size_t len, size_t* currentBytePosition); 15 | void parsePayload(char* data, size_t len, size_t* currentBytePosition); 16 | 17 | private: 18 | ParsingInformation* _parsingInformation; 19 | OnPubRelInternalCallback _callback; 20 | 21 | uint8_t _bytePosition; 22 | char _packetIdMsb; 23 | uint16_t _packetId; 24 | }; 25 | } // namespace AsyncMqttClientInternals 26 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/PublishPacket.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Arduino.h" 4 | #include "Packet.hpp" 5 | #include "../Flags.hpp" 6 | #include "../ParsingInformation.hpp" 7 | #include "../Callbacks.hpp" 8 | 9 | namespace AsyncMqttClientInternals { 10 | class PublishPacket : public Packet { 11 | public: 12 | explicit PublishPacket(ParsingInformation* parsingInformation, OnMessageInternalCallback dataCallback, OnPublishInternalCallback completeCallback); 13 | ~PublishPacket(); 14 | 15 | void parseVariableHeader(char* data, size_t len, size_t* currentBytePosition); 16 | void parsePayload(char* data, size_t len, size_t* currentBytePosition); 17 | 18 | private: 19 | ParsingInformation* _parsingInformation; 20 | OnMessageInternalCallback _dataCallback; 21 | OnPublishInternalCallback _completeCallback; 22 | 23 | void _preparePayloadHandling(uint32_t payloadLength); 24 | 25 | bool _dup; 26 | uint8_t _qos; 27 | bool _retain; 28 | 29 | uint8_t _bytePosition; 30 | char _topicLengthMsb; 31 | uint16_t _topicLength; 32 | bool _ignore; 33 | char _packetIdMsb; 34 | uint16_t _packetId; 35 | uint32_t _payloadLength; 36 | uint32_t _payloadBytesRead; 37 | }; 38 | } // namespace AsyncMqttClientInternals 39 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/SubAckPacket.cpp: -------------------------------------------------------------------------------- 1 | #include "SubAckPacket.hpp" 2 | 3 | using AsyncMqttClientInternals::SubAckPacket; 4 | 5 | SubAckPacket::SubAckPacket(ParsingInformation* parsingInformation, OnSubAckInternalCallback callback) 6 | : _parsingInformation(parsingInformation) 7 | , _callback(callback) 8 | , _bytePosition(0) 9 | , _packetIdMsb(0) 10 | , _packetId(0) { 11 | } 12 | 13 | SubAckPacket::~SubAckPacket() { 14 | } 15 | 16 | void SubAckPacket::parseVariableHeader(char* data, size_t len, size_t* currentBytePosition) { 17 | char currentByte = data[(*currentBytePosition)++]; 18 | if (_bytePosition++ == 0) { 19 | _packetIdMsb = currentByte; 20 | } else { 21 | _packetId = currentByte | _packetIdMsb << 8; 22 | _parsingInformation->bufferState = BufferState::PAYLOAD; 23 | } 24 | } 25 | 26 | void SubAckPacket::parsePayload(char* data, size_t len, size_t* currentBytePosition) { 27 | char status = data[(*currentBytePosition)++]; 28 | 29 | /* switch (status) { 30 | case 0: 31 | Serial.println("Success QoS 0"); 32 | break; 33 | case 1: 34 | Serial.println("Success QoS 1"); 35 | break; 36 | case 2: 37 | Serial.println("Success QoS 2"); 38 | break; 39 | case 0x80: 40 | Serial.println("Failure"); 41 | break; 42 | } */ 43 | 44 | _parsingInformation->bufferState = BufferState::NONE; 45 | _callback(_packetId, status); 46 | } 47 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/SubAckPacket.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Arduino.h" 4 | #include "Packet.hpp" 5 | #include "../ParsingInformation.hpp" 6 | #include "../Callbacks.hpp" 7 | 8 | namespace AsyncMqttClientInternals { 9 | class SubAckPacket : public Packet { 10 | public: 11 | explicit SubAckPacket(ParsingInformation* parsingInformation, OnSubAckInternalCallback callback); 12 | ~SubAckPacket(); 13 | 14 | void parseVariableHeader(char* data, size_t len, size_t* currentBytePosition); 15 | void parsePayload(char* data, size_t len, size_t* currentBytePosition); 16 | 17 | private: 18 | ParsingInformation* _parsingInformation; 19 | OnSubAckInternalCallback _callback; 20 | 21 | uint8_t _bytePosition; 22 | char _packetIdMsb; 23 | uint16_t _packetId; 24 | }; 25 | } // namespace AsyncMqttClientInternals 26 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/UnsubAckPacket.cpp: -------------------------------------------------------------------------------- 1 | #include "UnsubAckPacket.hpp" 2 | 3 | using AsyncMqttClientInternals::UnsubAckPacket; 4 | 5 | UnsubAckPacket::UnsubAckPacket(ParsingInformation* parsingInformation, OnUnsubAckInternalCallback callback) 6 | : _parsingInformation(parsingInformation) 7 | , _callback(callback) 8 | , _bytePosition(0) 9 | , _packetIdMsb(0) 10 | , _packetId(0) { 11 | } 12 | 13 | UnsubAckPacket::~UnsubAckPacket() { 14 | } 15 | 16 | void UnsubAckPacket::parseVariableHeader(char* data, size_t len, size_t* currentBytePosition) { 17 | char currentByte = data[(*currentBytePosition)++]; 18 | if (_bytePosition++ == 0) { 19 | _packetIdMsb = currentByte; 20 | } else { 21 | _packetId = currentByte | _packetIdMsb << 8; 22 | _parsingInformation->bufferState = BufferState::NONE; 23 | _callback(_packetId); 24 | } 25 | } 26 | 27 | void UnsubAckPacket::parsePayload(char* data, size_t len, size_t* currentBytePosition) { 28 | (void)data; 29 | (void)currentBytePosition; 30 | } 31 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Packets/UnsubAckPacket.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Arduino.h" 4 | #include "Packet.hpp" 5 | #include "../ParsingInformation.hpp" 6 | #include "../Callbacks.hpp" 7 | 8 | namespace AsyncMqttClientInternals { 9 | class UnsubAckPacket : public Packet { 10 | public: 11 | explicit UnsubAckPacket(ParsingInformation* parsingInformation, OnUnsubAckInternalCallback callback); 12 | ~UnsubAckPacket(); 13 | 14 | void parseVariableHeader(char* data, size_t len, size_t* currentBytePosition); 15 | void parsePayload(char* data, size_t len, size_t* currentBytePosition); 16 | 17 | private: 18 | ParsingInformation* _parsingInformation; 19 | OnUnsubAckInternalCallback _callback; 20 | 21 | uint8_t _bytePosition; 22 | char _packetIdMsb; 23 | uint16_t _packetId; 24 | }; 25 | } // namespace AsyncMqttClientInternals 26 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/ParsingInformation.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace AsyncMqttClientInternals { 4 | enum class BufferState : uint8_t { 5 | NONE = 0, 6 | REMAINING_LENGTH = 2, 7 | VARIABLE_HEADER = 3, 8 | PAYLOAD = 4 9 | }; 10 | 11 | struct ParsingInformation { 12 | BufferState bufferState; 13 | 14 | uint16_t maxTopicLength; 15 | char* topicBuffer; 16 | 17 | uint8_t packetType; 18 | uint16_t packetFlags; 19 | uint32_t remainingLength; 20 | }; 21 | } // namespace AsyncMqttClientInternals 22 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/AsyncMqttClient/Storage.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace AsyncMqttClientInternals { 4 | struct PendingPubRel { 5 | uint16_t packetId; 6 | }; 7 | 8 | struct PendingAck { 9 | uint8_t packetType; 10 | uint8_t headerFlag; 11 | uint16_t packetId; 12 | }; 13 | } // namespace AsyncMqttClientInternals 14 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Marvin Roger 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /wled00/src/dependencies/async-mqtt-client/README.md: -------------------------------------------------------------------------------- 1 | Async MQTT client for ESP8266 and ESP32 (Github: https://github.com/marvinroger/async-mqtt-client) 2 | ============================= 3 | 4 | [![Build Status](https://img.shields.io/travis/marvinroger/async-mqtt-client/master.svg?style=flat-square)](https://travis-ci.org/marvinroger/async-mqtt-client) 5 | 6 | An Arduino for ESP8266 and ESP32 asynchronous [MQTT](http://mqtt.org/) client implementation, built on [me-no-dev/ESPAsyncTCP (ESP8266)](https://github.com/me-no-dev/ESPAsyncTCP) | [me-no-dev/AsyncTCP (ESP32)](https://github.com/me-no-dev/AsyncTCP) . 7 | ## Features 8 | 9 | * Compliant with the 3.1.1 version of the protocol 10 | * Fully asynchronous 11 | * Subscribe at QoS 0, 1 and 2 12 | * Publish at QoS 0, 1 and 2 13 | * SSL/TLS support 14 | * Available in the [PlatformIO registry](http://platformio.org/lib/show/346/AsyncMqttClient) 15 | 16 | ## Requirements, installation and usage 17 | 18 | The project is documented in the [/docs folder](docs). 19 | -------------------------------------------------------------------------------- /wled00/src/dependencies/blynk/Blynk/BlynkConfig.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file BlynkConfig.h 3 | * @author Volodymyr Shymanskyy 4 | * @license This project is released under the MIT License (MIT) 5 | * @copyright Copyright (c) 2015 Volodymyr Shymanskyy 6 | * @date Jan 2015 7 | * @brief Configuration of different aspects of library 8 | * 9 | */ 10 | 11 | #ifndef BlynkConfig_h 12 | #define BlynkConfig_h 13 | 14 | #include "BlynkDetectDevice.h" 15 | 16 | /*************************************************** 17 | * Change these settings to match your need 18 | ***************************************************/ 19 | 20 | #define BLYNK_DEFAULT_DOMAIN "blynk-cloud.com" 21 | #define BLYNK_DEFAULT_PORT 80 22 | #define BLYNK_DEFAULT_PORT_SSL 8441 23 | 24 | /*************************************************** 25 | * Professional settings 26 | ***************************************************/ 27 | // Library version. 28 | #define BLYNK_VERSION "0.5.3" 29 | 30 | // Heartbeat period in seconds. 31 | #ifndef BLYNK_HEARTBEAT 32 | #define BLYNK_HEARTBEAT 10 33 | #endif 34 | 35 | // Network timeout in milliseconds. 36 | #ifndef BLYNK_TIMEOUT_MS 37 | #define BLYNK_TIMEOUT_MS 2000UL 38 | #endif 39 | 40 | // Limit the amount of outgoing commands per second. 41 | #ifndef BLYNK_MSG_LIMIT 42 | #define BLYNK_MSG_LIMIT 15 43 | #endif 44 | 45 | // Limit the incoming command length. 46 | #ifndef BLYNK_MAX_READBYTES 47 | #define BLYNK_MAX_READBYTES 256 48 | #endif 49 | 50 | // Limit the outgoing command length. 51 | #ifndef BLYNK_MAX_SENDBYTES 52 | #define BLYNK_MAX_SENDBYTES 128 53 | #endif 54 | 55 | // Uncomment to use Let's Encrypt Root CA 56 | //#define BLYNK_SSL_USE_LETSENCRYPT 57 | 58 | // Uncomment to disable built-in analog and digital operations. 59 | //#define BLYNK_NO_BUILTIN 60 | 61 | // Uncomment to disable providing info about device to the server. 62 | //#define BLYNK_NO_INFO 63 | 64 | // Uncomment to enable debug prints. 65 | //#define BLYNK_DEBUG 66 | 67 | // Uncomment to force-enable 128 virtual pins 68 | //#define BLYNK_USE_128_VPINS 69 | 70 | // Uncomment to disable fancy logo 71 | //#define BLYNK_NO_FANCY_LOGO 72 | 73 | // Uncomment to enable 3D fancy logo 74 | //#define BLYNK_FANCY_LOGO_3D 75 | 76 | // Uncomment to enable experimental functions. 77 | //#define BLYNK_EXPERIMENTAL 78 | 79 | // Uncomment to disable all float/double usage 80 | //#define BLYNK_NO_FLOAT 81 | 82 | // Uncomment to switch to direct-connect mode 83 | //#define BLYNK_USE_DIRECT_CONNECT 84 | 85 | 86 | // Uncomment to append command body to header (uses more RAM) 87 | //#define BLYNK_SEND_ATOMIC 88 | 89 | // Split whole command into chunks (in bytes) 90 | //#define BLYNK_SEND_CHUNK 64 91 | 92 | // Wait after sending each chunk (in milliseconds) 93 | //#define BLYNK_SEND_THROTTLE 10 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /wled00/src/dependencies/blynk/Blynk/BlynkEveryN.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef BLYNKEVERYN_H 3 | #define BLYNKEVERYN_H 4 | 5 | #include "BlynkDebug.h" 6 | 7 | millis_time_t blynk_count_millis() { 8 | const millis_time_t ms = BlynkMillis(); 9 | return ms; 10 | } 11 | 12 | uint16_t blynk_count_seconds16() { 13 | const millis_time_t ms = BlynkMillis(); 14 | return (ms / 1000); 15 | } 16 | 17 | uint16_t blynk_count_minutes16() 18 | { 19 | const millis_time_t ms = BlynkMillis(); 20 | return (ms / (60000L)) & 0xFFFF; 21 | } 22 | 23 | uint8_t blynk_count_hours8() 24 | { 25 | const millis_time_t ms = BlynkMillis(); 26 | return (ms / (3600000L)) & 0xFF; 27 | } 28 | 29 | template 30 | class BlynkPeriodic { 31 | public: 32 | T mPrev; 33 | T mPeriod; 34 | 35 | BlynkPeriodic() { reset(); mPeriod = 1; }; 36 | BlynkPeriodic(T period) { reset(); setPeriod(period); }; 37 | void setPeriod( T period) { mPeriod = period; }; 38 | T getTime() { return (T)(timeGetter()); }; 39 | T getPeriod() { return mPeriod; }; 40 | T getElapsed() { return getTime() - mPrev; } 41 | T getRemaining() { return mPeriod - getElapsed(); } 42 | T getLastTriggerTime() { return mPrev; } 43 | bool ready() { 44 | bool isReady = (getElapsed() >= mPeriod); 45 | if( isReady ) { reset(); } 46 | return isReady; 47 | } 48 | void reset() { mPrev = getTime(); }; 49 | void trigger() { mPrev = getTime() - mPeriod; }; 50 | 51 | operator bool() { return ready(); } 52 | }; 53 | 54 | typedef BlynkPeriodic BlynkEveryNMillis; 55 | typedef BlynkPeriodic BlynkEveryNSeconds; 56 | typedef BlynkPeriodic BlynkEveryNMinutes; 57 | typedef BlynkPeriodic BlynkEveryNHours; 58 | 59 | #define BLYNK_EVERY_N_MILLIS_I(NAME,N) static BlynkEveryNMillis NAME(N); if(NAME) 60 | #define BLYNK_EVERY_N_SECONDS_I(NAME,N) static BlynkEveryNSeconds NAME(N); if(NAME) 61 | #define BLYNK_EVERY_N_MINUTES_I(NAME,N) static BlynkEveryNMinutes NAME(N); if(NAME) 62 | #define BLYNK_EVERY_N_HOURS_I(NAME,N) static BlynkEveryNHours NAME(N); if(NAME) 63 | 64 | #define BLYNK_EVERY_N_MILLIS(N) BLYNK_EVERY_N_MILLIS_I(BLYNK_CONCAT2(PER, __COUNTER__),N) 65 | #define BLYNK_EVERY_N_SECONDS(N) BLYNK_EVERY_N_SECONDS_I(BLYNK_CONCAT2(PER, __COUNTER__),N) 66 | #define BLYNK_EVERY_N_MINUTES(N) BLYNK_EVERY_N_MINUTES_I(BLYNK_CONCAT2(PER, __COUNTER__),N) 67 | #define BLYNK_EVERY_N_HOURS(N) BLYNK_EVERY_N_HOURS_I(BLYNK_CONCAT2(PER, __COUNTER__),N) 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /wled00/src/dependencies/blynk/Blynk/BlynkTemplates.h: -------------------------------------------------------------------------------- 1 | class BlynkStackOnly 2 | { 3 | protected: 4 | BlynkStackOnly() {} 5 | ~BlynkStackOnly() {} 6 | 7 | private: 8 | /// @brief Declared as private to prevent usage of dynamic memory 9 | void* operator new(size_t size); 10 | /// @brief Declared as private to prevent usage of dynamic memory 11 | void operator delete(void *p); 12 | }; 13 | 14 | class BlynkNonCopyable 15 | { 16 | protected: 17 | BlynkNonCopyable(){} 18 | ~BlynkNonCopyable(){} 19 | 20 | private: 21 | /// @brief Declared as private to prevent usage of copy constructor 22 | BlynkNonCopyable(const BlynkNonCopyable&); 23 | /// @brief Declared as private to prevent usage of assignment operator 24 | BlynkNonCopyable& operator=(const BlynkNonCopyable&); 25 | }; 26 | 27 | template 28 | class BlynkSingleton 29 | : public BlynkNonCopyable 30 | { 31 | public: 32 | /** @brief Returns the instance of the singleton type 33 | When called for the first time, the singleton instance will be 34 | created. All subsequent calls will return a reference to the 35 | previously created instance. 36 | @return The singleton instance 37 | */ 38 | static T* instance() 39 | { 40 | static T instance; 41 | return &instance; 42 | } 43 | protected: 44 | BlynkSingleton() {} 45 | ~BlynkSingleton() {} 46 | }; 47 | 48 | -------------------------------------------------------------------------------- /wled00/src/dependencies/blynk/Blynk/BlynkUtility.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file BlynkUtility.h 3 | * @author Volodymyr Shymanskyy 4 | * @license This project is released under the MIT License (MIT) 5 | * @copyright Copyright (c) 2015 Volodymyr Shymanskyy 6 | * @date Jun 2015 7 | * @brief Utility functions 8 | * 9 | */ 10 | 11 | #ifndef BlynkUtility_h 12 | #define BlynkUtility_h 13 | 14 | template 15 | const T& BlynkMin(const T& a, const T& b) 16 | { 17 | return (b < a) ? b : a; 18 | } 19 | 20 | template 21 | const T& BlynkMax(const T& a, const T& b) 22 | { 23 | return (b < a) ? a : b; 24 | } 25 | 26 | 27 | template 28 | T BlynkMathMap(T x, T in_min, T in_max, T out_min, T out_max) 29 | { 30 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 31 | } 32 | 33 | template 34 | T BlynkMathClamp(T val, T low, T high) 35 | { 36 | return (val < low) ? low : ((val > high) ? high : val); 37 | } 38 | 39 | 40 | template 41 | void BlynkAverageSample (T& avg, const T& input) { 42 | avg -= avg/WSIZE; 43 | const T add = input/WSIZE; 44 | // Fix for shorter delays 45 | if (add > 0) 46 | avg += add; 47 | else 48 | avg -= 1; 49 | } 50 | 51 | class BlynkHelperAutoInc { 52 | public: 53 | BlynkHelperAutoInc(uint8_t& counter) : c(counter) { ++c; } 54 | ~BlynkHelperAutoInc() { --c; } 55 | private: 56 | uint8_t& c; 57 | }; 58 | 59 | #define BlynkBitSet(value, bit) ((value) |= (1UL << (bit))) 60 | #define BlynkBitClear(value, bit) ((value) &= ~(1UL << (bit))) 61 | #define BlynkBitRead(value, bit) (((value) >> (bit)) & 0x01) 62 | #define BlynkBitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /wled00/src/dependencies/blynk/Blynk/BlynkWiFiCommon.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file BlynkWiFiCommon.h 3 | * @author Volodymyr Shymanskyy 4 | * @license This project is released under the MIT License (MIT) 5 | * @copyright Copyright (c) 2015 Volodymyr Shymanskyy 6 | * @date Jan 2015 7 | * @brief 8 | * 9 | */ 10 | 11 | #ifndef BlynkWiFiCommon_h 12 | #define BlynkWiFiCommon_h 13 | 14 | #ifndef BLYNK_INFO_CONNECTION 15 | #define BLYNK_INFO_CONNECTION "WiFi" 16 | #endif 17 | 18 | #include "BlynkApiArduino.h" 19 | #include "BlynkProtocol.h" 20 | #include "BlynkArduinoClient.h" 21 | 22 | class BlynkWifiCommon 23 | : public BlynkProtocol 24 | { 25 | typedef BlynkProtocol Base; 26 | public: 27 | BlynkWifiCommon(BlynkArduinoClient& transp) 28 | : Base(transp) 29 | {} 30 | 31 | void connectWiFi(const char* ssid, const char* pass) 32 | { 33 | int status = WL_IDLE_STATUS; 34 | // check for the presence of the shield: 35 | if (WiFi.status() == WL_NO_SHIELD) { 36 | BLYNK_FATAL("WiFi shield not present"); 37 | } 38 | 39 | #ifdef BLYNK_DEBUG 40 | BLYNK_LOG2(BLYNK_F("WiFi firmware: "), WiFi.firmwareVersion()); 41 | #endif 42 | 43 | // attempt to connect to Wifi network: 44 | while (true) { 45 | BLYNK_LOG2(BLYNK_F("Connecting to "), ssid); 46 | if (pass && strlen(pass)) { 47 | status = WiFi.begin((char*)ssid, (char*)pass); 48 | } else { 49 | status = WiFi.begin((char*)ssid); 50 | } 51 | if (status == WL_CONNECTED) { 52 | break; 53 | } else { 54 | BlynkDelay(5000); 55 | } 56 | } 57 | 58 | IPAddress myip = WiFi.localIP(); 59 | BLYNK_LOG_IP("IP: ", myip); 60 | } 61 | 62 | void config(const char* auth, 63 | const char* domain = BLYNK_DEFAULT_DOMAIN, 64 | uint16_t port = BLYNK_DEFAULT_PORT) 65 | { 66 | Base::begin(auth); 67 | this->conn.begin(domain, port); 68 | } 69 | 70 | void config(const char* auth, 71 | IPAddress ip, 72 | uint16_t port = BLYNK_DEFAULT_PORT) 73 | { 74 | Base::begin(auth); 75 | this->conn.begin(ip, port); 76 | } 77 | 78 | void begin(const char* auth, 79 | const char* ssid, 80 | const char* pass, 81 | const char* domain = BLYNK_DEFAULT_DOMAIN, 82 | uint16_t port = BLYNK_DEFAULT_PORT) 83 | { 84 | connectWiFi(ssid, pass); 85 | config(auth, domain, port); 86 | while(this->connect() != true) {} 87 | } 88 | 89 | void begin(const char* auth, 90 | const char* ssid, 91 | const char* pass, 92 | IPAddress ip, 93 | uint16_t port = BLYNK_DEFAULT_PORT) 94 | { 95 | connectWiFi(ssid, pass); 96 | config(auth, ip, port); 97 | while(this->connect() != true) {} 98 | } 99 | 100 | }; 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /wled00/src/dependencies/blynk/Blynk/BlynkWidgetBase.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file BlynkWidgetBase.h 3 | * @author Volodymyr Shymanskyy 4 | * @license This project is released under the MIT License (MIT) 5 | * @copyright Copyright (c) 2016 Volodymyr Shymanskyy 6 | * @date Nov 2016 7 | * @brief 8 | */ 9 | 10 | #ifndef BlynkWidgetBase_h 11 | #define BlynkWidgetBase_h 12 | 13 | #include "BlynkApi.h" 14 | 15 | class BlynkWidgetBase 16 | { 17 | public: 18 | BlynkWidgetBase(uint8_t vPin) : mPin(vPin) {} 19 | void setVPin(uint8_t vPin) { mPin = vPin; } 20 | 21 | void onWrite(BlynkReq BLYNK_UNUSED &request, const BlynkParam BLYNK_UNUSED ¶m) { 22 | BLYNK_LOG1(BLYNK_F("BlynkWidgetBase::onWrite should not be called")); 23 | } 24 | 25 | template 26 | void setLabel(Args... args) { 27 | Blynk.setProperty(mPin, "label", args...); 28 | } 29 | 30 | template 31 | void setColor(Args... args) { 32 | Blynk.setProperty(mPin, "color", args...); 33 | } 34 | 35 | template 36 | void setMin(Args... args) { 37 | Blynk.setProperty(mPin, "min", args...); 38 | } 39 | 40 | template 41 | void setMax(Args... args) { 42 | Blynk.setProperty(mPin, "max", args...); 43 | } 44 | 45 | protected: 46 | uint8_t mPin; 47 | }; 48 | 49 | class BlynkAttachWidgetHelper { 50 | public: 51 | template 52 | explicit BlynkAttachWidgetHelper(T& widget, uint8_t vPin) { 53 | widget.setVPin(vPin); 54 | } 55 | }; 56 | 57 | // Could use __attribute__ ((constructor)), but hope for better portability 58 | #define BLYNK_ATTACH_WIDGET(widget, pin) \ 59 | BlynkAttachWidgetHelper BLYNK_CONCAT2(blnk_widget_helper_, __COUNTER__)((widget), (pin)); \ 60 | BLYNK_WRITE(pin) { (widget).onWrite(request, param); } 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /wled00/src/dependencies/blynk/BlynkSimpleEsp.cpp: -------------------------------------------------------------------------------- 1 | #include "BlynkSimpleEsp.h" 2 | 3 | WiFiClient _blynkWifiClient; 4 | BlynkArduinoClient _blynkTransport(_blynkWifiClient); 5 | BlynkWifi Blynk(_blynkTransport); -------------------------------------------------------------------------------- /wled00/src/dependencies/blynk/BlynkSimpleEsp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file BlynkSimpleEsp32.h 3 | * @author Volodymyr Shymanskyy 4 | * @license This project is released under the MIT License (MIT) 5 | * @copyright Copyright (c) 2015 Volodymyr Shymanskyy 6 | * @date Oct 2016 7 | * @brief 8 | * 9 | */ 10 | 11 | #ifndef BlynkSimpleEsp_h 12 | #define BlynkSimpleEsp_h 13 | 14 | #define BLYNK_SEND_ATOMIC 15 | 16 | #include "Blynk/BlynkApiArduino.h" 17 | #include "Blynk/BlynkProtocol.h" 18 | #include "Blynk/BlynkArduinoClient.h" 19 | #ifdef ARDUINO_ARCH_ESP32 20 | #include 21 | #else 22 | #include 23 | #endif 24 | 25 | class BlynkWifi 26 | : public BlynkProtocol 27 | { 28 | typedef BlynkProtocol Base; 29 | public: 30 | BlynkWifi(BlynkArduinoClient& transp) 31 | : Base(transp) 32 | {} 33 | 34 | void connectWiFi(const char* ssid, const char* pass) 35 | { 36 | BLYNK_LOG2(BLYNK_F("Connecting to "), ssid); 37 | WiFi.mode(WIFI_STA); 38 | if (pass && strlen(pass)) { 39 | WiFi.begin(ssid, pass); 40 | } else { 41 | WiFi.begin(ssid); 42 | } 43 | while (WiFi.status() != WL_CONNECTED) { 44 | BlynkDelay(500); 45 | } 46 | BLYNK_LOG1(BLYNK_F("Connected to WiFi")); 47 | 48 | IPAddress myip = WiFi.localIP(); 49 | BLYNK_LOG_IP("IP: ", myip); 50 | } 51 | 52 | void config(const char* auth, 53 | const char* domain = BLYNK_DEFAULT_DOMAIN, 54 | uint16_t port = BLYNK_DEFAULT_PORT) 55 | { 56 | Base::begin(auth); 57 | this->conn.begin(domain, port); 58 | } 59 | 60 | void config(const char* auth, 61 | IPAddress ip, 62 | uint16_t port = BLYNK_DEFAULT_PORT) 63 | { 64 | Base::begin(auth); 65 | this->conn.begin(ip, port); 66 | } 67 | 68 | void begin(const char* auth, 69 | const char* ssid, 70 | const char* pass, 71 | const char* domain = BLYNK_DEFAULT_DOMAIN, 72 | uint16_t port = BLYNK_DEFAULT_PORT) 73 | { 74 | connectWiFi(ssid, pass); 75 | config(auth, domain, port); 76 | while(this->connect() != true) {} 77 | } 78 | 79 | void begin(const char* auth, 80 | const char* ssid, 81 | const char* pass, 82 | IPAddress ip, 83 | uint16_t port = BLYNK_DEFAULT_PORT) 84 | { 85 | connectWiFi(ssid, pass); 86 | config(auth, ip, port); 87 | while(this->connect() != true) {} 88 | } 89 | 90 | }; 91 | 92 | extern BlynkWifi Blynk; 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /wled00/src/dependencies/blynk/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Volodymyr Shymanskyy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /wled00/src/dependencies/dmx/ESPDMX.cpp: -------------------------------------------------------------------------------- 1 | // - - - - - 2 | // ESPDMX - A Arduino library for sending and receiving DMX using the builtin serial hardware port. 3 | // ESPDMX.cpp: Library implementation file 4 | // 5 | // Copyright (C) 2015 Rick 6 | // This work is licensed under a GNU style license. 7 | // 8 | // Last change: Marcel Seerig 9 | // 10 | // Documentation and samples are available at https://github.com/Rickgg/ESP-Dmx 11 | // - - - - - 12 | 13 | /* ----- LIBRARIES ----- */ 14 | #include 15 | 16 | #include "ESPDMX.h" 17 | 18 | 19 | 20 | #define dmxMaxChannel 512 21 | #define defaultMax 32 22 | 23 | #define DMXSPEED 250000 24 | #define DMXFORMAT SERIAL_8N2 25 | #define BREAKSPEED 83333 26 | #define BREAKFORMAT SERIAL_8N1 27 | 28 | bool dmxStarted = false; 29 | int sendPin = 2; //dafault on ESP8266 30 | 31 | //DMX value array and size. Entry 0 will hold startbyte 32 | uint8_t dmxData[dmxMaxChannel] = {}; 33 | int chanSize; 34 | 35 | 36 | void DMXESPSerial::init() { 37 | chanSize = defaultMax; 38 | 39 | Serial1.begin(DMXSPEED); 40 | pinMode(sendPin, OUTPUT); 41 | dmxStarted = true; 42 | } 43 | 44 | // Set up the DMX-Protocol 45 | void DMXESPSerial::init(int chanQuant) { 46 | 47 | if (chanQuant > dmxMaxChannel || chanQuant <= 0) { 48 | chanQuant = defaultMax; 49 | } 50 | 51 | chanSize = chanQuant; 52 | 53 | Serial1.begin(DMXSPEED); 54 | pinMode(sendPin, OUTPUT); 55 | dmxStarted = true; 56 | } 57 | 58 | // Function to read DMX data 59 | uint8_t DMXESPSerial::read(int Channel) { 60 | if (dmxStarted == false) init(); 61 | 62 | if (Channel < 1) Channel = 1; 63 | if (Channel > dmxMaxChannel) Channel = dmxMaxChannel; 64 | return(dmxData[Channel]); 65 | } 66 | 67 | // Function to send DMX data 68 | void DMXESPSerial::write(int Channel, uint8_t value) { 69 | if (dmxStarted == false) init(); 70 | 71 | if (Channel < 1) Channel = 1; 72 | if (Channel > chanSize) Channel = chanSize; 73 | if (value < 0) value = 0; 74 | if (value > 255) value = 255; 75 | 76 | dmxData[Channel] = value; 77 | } 78 | 79 | void DMXESPSerial::end() { 80 | delete dmxData; 81 | chanSize = 0; 82 | Serial1.end(); 83 | dmxStarted == false; 84 | } 85 | 86 | void DMXESPSerial::update() { 87 | if (dmxStarted == false) init(); 88 | 89 | //Send break 90 | digitalWrite(sendPin, HIGH); 91 | Serial1.begin(BREAKSPEED, BREAKFORMAT); 92 | Serial1.write(0); 93 | Serial1.flush(); 94 | delay(1); 95 | Serial1.end(); 96 | 97 | //send data 98 | Serial1.begin(DMXSPEED, DMXFORMAT); 99 | digitalWrite(sendPin, LOW); 100 | Serial1.write(dmxData, chanSize); 101 | Serial1.flush(); 102 | delay(1); 103 | Serial1.end(); 104 | } 105 | 106 | // Function to update the DMX bus 107 | -------------------------------------------------------------------------------- /wled00/src/dependencies/dmx/ESPDMX.h: -------------------------------------------------------------------------------- 1 | // - - - - - 2 | // ESPDMX - A Arduino library for sending and receiving DMX using the builtin serial hardware port. 3 | // ESPDMX.cpp: Library implementation file 4 | // 5 | // Copyright (C) 2015 Rick 6 | // This work is licensed under a GNU style license. 7 | // 8 | // Last change: Marcel Seerig 9 | // 10 | // Documentation and samples are available at https://github.com/Rickgg/ESP-Dmx 11 | // - - - - - 12 | 13 | #include 14 | 15 | 16 | #ifndef ESPDMX_h 17 | #define ESPDMX_h 18 | 19 | // ---- Methods ---- 20 | 21 | class DMXESPSerial { 22 | public: 23 | void init(); 24 | void init(int MaxChan); 25 | uint8_t read(int Channel); 26 | void write(int channel, uint8_t value); 27 | void update(); 28 | void end(); 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /wled00/src/dependencies/espalexa/EspalexaDevice.h: -------------------------------------------------------------------------------- 1 | #ifndef EspalexaDevice_h 2 | #define EspalexaDevice_h 3 | 4 | #include "Arduino.h" 5 | #include 6 | 7 | class EspalexaDevice; 8 | 9 | typedef std::function BrightnessCallbackFunction; 10 | typedef std::function DeviceCallbackFunction; 11 | typedef std::function ColorCallbackFunction; 12 | 13 | enum class EspalexaColorMode : uint8_t { none = 0, ct = 1, hs = 2, xy = 3 }; 14 | enum class EspalexaDeviceType : uint8_t { onoff = 0, dimmable = 1, whitespectrum = 2, color = 3, extendedcolor = 4 }; 15 | enum class EspalexaDeviceProperty : uint8_t { none = 0, on = 1, off = 2, bri = 3, hs = 4, ct = 5, xy = 6 }; 16 | 17 | class EspalexaDevice { 18 | private: 19 | String _deviceName; 20 | BrightnessCallbackFunction _callback = nullptr; 21 | DeviceCallbackFunction _callbackDev = nullptr; 22 | ColorCallbackFunction _callbackCol = nullptr; 23 | uint8_t _val, _val_last, _sat = 0; 24 | uint16_t _hue = 0, _ct = 0; 25 | float _x = 0.5, _y = 0.5; 26 | uint32_t _rgb = 0; 27 | uint8_t _id = 0; 28 | EspalexaDeviceType _type; 29 | EspalexaDeviceProperty _changed = EspalexaDeviceProperty::none; 30 | EspalexaColorMode _mode = EspalexaColorMode::xy; 31 | 32 | public: 33 | EspalexaDevice(); 34 | ~EspalexaDevice(); 35 | EspalexaDevice(String deviceName, BrightnessCallbackFunction bcb, uint8_t initialValue =0); 36 | EspalexaDevice(String deviceName, DeviceCallbackFunction dcb, EspalexaDeviceType t =EspalexaDeviceType::dimmable, uint8_t initialValue =0); 37 | EspalexaDevice(String deviceName, ColorCallbackFunction ccb, uint8_t initialValue =0); 38 | 39 | String getName(); 40 | uint8_t getId(); 41 | EspalexaDeviceProperty getLastChangedProperty(); 42 | uint8_t getValue(); 43 | uint8_t getPercent(); 44 | uint8_t getDegrees(); 45 | uint16_t getHue(); 46 | uint8_t getSat(); 47 | uint16_t getCt(); 48 | uint32_t getKelvin(); 49 | float getX(); 50 | float getY(); 51 | uint32_t getRGB(); 52 | uint8_t getR(); 53 | uint8_t getG(); 54 | uint8_t getB(); 55 | uint8_t getW(); 56 | EspalexaColorMode getColorMode(); 57 | EspalexaDeviceType getType(); 58 | 59 | void setId(uint8_t id); 60 | void setPropertyChanged(EspalexaDeviceProperty p); 61 | void setValue(uint8_t bri); 62 | void setPercent(uint8_t perc); 63 | void setName(String name); 64 | void setColor(uint16_t ct); 65 | void setColor(uint16_t hue, uint8_t sat); 66 | void setColorXY(float x, float y); 67 | void setColor(uint8_t r, uint8_t g, uint8_t b); 68 | 69 | void doCallback(); 70 | 71 | uint8_t getLastValue(); //last value that was not off (1-255) 72 | }; 73 | 74 | #endif -------------------------------------------------------------------------------- /wled00/src/dependencies/espalexa/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Christian Schwinne 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /wled00/src/dependencies/network/Network.cpp: -------------------------------------------------------------------------------- 1 | #include "Network.h" 2 | 3 | IPAddress NetworkClass::localIP() 4 | { 5 | #if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET) 6 | if (ETH.localIP()[0] != 0) { 7 | return ETH.localIP(); 8 | } 9 | #endif 10 | if (WiFi.localIP()[0] != 0) { 11 | return WiFi.localIP(); 12 | } 13 | return INADDR_NONE; 14 | } 15 | 16 | IPAddress NetworkClass::subnetMask() 17 | { 18 | #if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET) 19 | if (ETH.localIP()[0] != 0) { 20 | return ETH.subnetMask(); 21 | } 22 | #endif 23 | if (WiFi.localIP()[0] != 0) { 24 | return WiFi.subnetMask(); 25 | } 26 | return IPAddress(255, 255, 255, 0); 27 | } 28 | 29 | IPAddress NetworkClass::gatewayIP() 30 | { 31 | #if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET) 32 | if (ETH.localIP()[0] != 0) { 33 | return ETH.gatewayIP(); 34 | } 35 | #endif 36 | if (WiFi.localIP()[0] != 0) { 37 | return WiFi.gatewayIP(); 38 | } 39 | return INADDR_NONE; 40 | } 41 | 42 | bool NetworkClass::isConnected() 43 | { 44 | #if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET) 45 | return (WiFi.localIP()[0] != 0 && WiFi.status() == WL_CONNECTED) || ETH.localIP()[0] != 0; 46 | #else 47 | return (WiFi.localIP()[0] != 0 && WiFi.status() == WL_CONNECTED); 48 | #endif 49 | } 50 | 51 | bool NetworkClass::isEthernet() 52 | { 53 | #if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET) 54 | return (ETH.localIP()[0] != 0); 55 | #endif 56 | return false; 57 | } 58 | 59 | NetworkClass Network; -------------------------------------------------------------------------------- /wled00/src/dependencies/network/Network.h: -------------------------------------------------------------------------------- 1 | #ifdef ESP8266 2 | #include 3 | #else // ESP32 4 | #include 5 | #include 6 | #endif 7 | 8 | #ifndef Network_h 9 | #define Network_h 10 | 11 | class NetworkClass 12 | { 13 | public: 14 | IPAddress localIP(); 15 | IPAddress subnetMask(); 16 | IPAddress gatewayIP(); 17 | bool isConnected(); 18 | bool isEthernet(); 19 | }; 20 | 21 | extern NetworkClass Network; 22 | 23 | #endif -------------------------------------------------------------------------------- /wled00/src/dependencies/time/LICENSE.txt: -------------------------------------------------------------------------------- 1 | https://github.com/PaulStoffregen/Time/ 2 | 3 | time.c - low level time and date functions 4 | Copyright (c) Michael Margolis 2009-2014 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Lesser General Public License for more details. 13 | You should have received a copy of the GNU Lesser General Public 14 | License along with this library; if not, write to the Free Software 15 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 | 17 | 1.0 6 Jan 2010 - initial release 18 | 1.1 12 Feb 2010 - fixed leap year calculation error 19 | 1.2 1 Nov 2010 - fixed setTime bug (thanks to Korman for this) 20 | 1.3 24 Mar 2012 - many edits by Paul Stoffregen: fixed timeStatus() to update 21 | status, updated examples for Arduino 1.0, fixed ARM 22 | compatibility issues, added TimeArduinoDue and TimeTeensy3 23 | examples, add error checking and messages to RTC examples, 24 | add examples to DS1307RTC library. 25 | 1.4 5 Sep 2014 - compatibility with Arduino 1.5.7 26 | -------------------------------------------------------------------------------- /wled00/src/dependencies/time/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Time", 3 | "description": "Time keeping library", 4 | "keywords": "Time, date, hour, minute, second, day, week, month, year, RTC", 5 | "authors": [ 6 | { 7 | "name": "Michael Margolis" 8 | }, 9 | { 10 | "name": "Paul Stoffregen", 11 | "email": "paul@pjrc.com", 12 | "url": "http://www.pjrc.com", 13 | "maintainer": true 14 | } 15 | ], 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/PaulStoffregen/Time" 19 | }, 20 | "version": "1.5", 21 | "homepage": "http://playground.arduino.cc/Code/Time", 22 | "frameworks": "Arduino", 23 | "examples": [ 24 | "examples/*/*.ino" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /wled00/src/dependencies/time/library.properties: -------------------------------------------------------------------------------- 1 | name=Time 2 | version=1.5 3 | author=Michael Margolis 4 | maintainer=Paul Stoffregen 5 | sentence=Timekeeping functionality for Arduino 6 | paragraph=Date and Time functions, with provisions to synchronize to external time sources like GPS and NTP (Internet). This library is often used together with TimeAlarms and DS1307RTC. 7 | category=Timing 8 | url=http://playground.arduino.cc/code/time 9 | architectures=* 10 | 11 | -------------------------------------------------------------------------------- /wled00/src/dependencies/timezone/LICENSE.md: -------------------------------------------------------------------------------- 1 | #Arduino Timezone Library v1.0 2 | https://github.com/JChristensen/Timezone 3 | LICENSE file 4 | Jack Christensen Mar 2012 5 | 6 | ![CC BY-SA](http://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-sa.png) 7 | ##CC BY-SA 8 | Arduino Timezone Library by Jack Christensen is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to: 9 | Creative Commons 10 | 444 Castro Street, Suite 900 11 | Mountain View, CA 94041 12 | -------------------------------------------------------------------------------- /wled00/src/dependencies/timezone/Timezone.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------* 2 | * Arduino Timezone Library v1.0 * 3 | * Jack Christensen Mar 2012 * 4 | * * 5 | * This work is licensed under the Creative Commons Attribution- * 6 | * ShareAlike 3.0 Unported License. To view a copy of this license, * 7 | * visit http://creativecommons.org/licenses/by-sa/3.0/ or send a * 8 | * letter to Creative Commons, 171 Second Street, Suite 300, * 9 | * San Francisco, California, 94105, USA. * 10 | *----------------------------------------------------------------------*/ 11 | 12 | #ifndef Timezone_h 13 | #define Timezone_h 14 | #if ARDUINO >= 100 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | #include "../time/TimeLib.h" //http://www.arduino.cc/playground/Code/Time 21 | 22 | //convenient constants for dstRules 23 | enum week_t {Last, First, Second, Third, Fourth}; 24 | enum dow_t {Sun=1, Mon, Tue, Wed, Thu, Fri, Sat}; 25 | enum month_t {Jan=1, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec}; 26 | 27 | //structure to describe rules for when daylight/summer time begins, 28 | //or when standard time begins. 29 | struct TimeChangeRule 30 | { 31 | uint8_t week; //First, Second, Third, Fourth, or Last week of the month 32 | uint8_t dow; //day of week, 1=Sun, 2=Mon, ... 7=Sat 33 | uint8_t month; //1=Jan, 2=Feb, ... 12=Dec 34 | uint8_t hour; //0-23 35 | int16_t offset; //offset from UTC in minutes 36 | }; 37 | 38 | class Timezone 39 | { 40 | public: 41 | Timezone(TimeChangeRule dstStart, TimeChangeRule stdStart); 42 | Timezone(int address); 43 | time_t toLocal(time_t utc); 44 | time_t toLocal(time_t utc, TimeChangeRule **tcr); 45 | time_t toUTC(time_t local); 46 | boolean utcIsDST(time_t utc); 47 | boolean locIsDST(time_t local); 48 | void readRules(int address); 49 | void writeRules(int address); 50 | 51 | private: 52 | void calcTimeChanges(int yr); 53 | time_t toTime_t(TimeChangeRule r, int yr); 54 | TimeChangeRule _dst; //rule for start of dst or summer time for any year 55 | TimeChangeRule _std; //rule for start of standard time for any year 56 | time_t _dstUTC; //dst start for given/current year, given in UTC 57 | time_t _stdUTC; //std time start for given/current year, given in UTC 58 | time_t _dstLoc; //dst start for given/current year, given in local time 59 | time_t _stdLoc; //std time start for given/current year, given in local time 60 | }; 61 | #endif 62 | -------------------------------------------------------------------------------- /wled00/src/dependencies/ws2812fx/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Harm Aldick 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /wled00/src/dependencies/ws2812fx/readme.txt: -------------------------------------------------------------------------------- 1 | https://github.com/kitesurfer1404/WS2812FX/ 2 | 3 | The WS2812FX implementation was heavily altered and differs from its master branch. 4 | Due to regular changes to the library code it is kept in the source dir for now. 5 | -------------------------------------------------------------------------------- /wled00/um_manager.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | /* 3 | * Registration and management utility for v2 usermods 4 | */ 5 | 6 | //Usermod Manager internals 7 | void UsermodManager::loop() { for (byte i = 0; i < numMods; i++) ums[i]->loop(); } 8 | 9 | void UsermodManager::setup() { for (byte i = 0; i < numMods; i++) ums[i]->setup(); } 10 | void UsermodManager::connected() { for (byte i = 0; i < numMods; i++) ums[i]->connected(); } 11 | 12 | void UsermodManager::addToJsonState(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->addToJsonState(obj); } 13 | void UsermodManager::addToJsonInfo(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->addToJsonInfo(obj); } 14 | void UsermodManager::readFromJsonState(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->readFromJsonState(obj); } 15 | void UsermodManager::addToConfig(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->addToConfig(obj); } 16 | void UsermodManager::readFromConfig(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->readFromConfig(obj); } 17 | 18 | /* 19 | * Enables usermods to lookup another Usermod. 20 | */ 21 | Usermod* UsermodManager::lookup(uint16_t mod_id) { 22 | for (byte i = 0; i < numMods; i++) { 23 | if (ums[i]->getId() == mod_id) { 24 | return ums[i]; 25 | } 26 | } 27 | return nullptr; 28 | } 29 | 30 | bool UsermodManager::add(Usermod* um) 31 | { 32 | if (numMods >= WLED_MAX_USERMODS || um == nullptr) return false; 33 | ums[numMods] = um; 34 | numMods++; 35 | } 36 | 37 | byte UsermodManager::getModCount() {return numMods;} -------------------------------------------------------------------------------- /wled00/usermod.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | /* 3 | * This v1 usermod file allows you to add own functionality to WLED more easily 4 | * See: https://github.com/Aircoookie/WLED/wiki/Add-own-functionality 5 | * EEPROM bytes 2750+ are reserved for your custom use case. (if you extend #define EEPSIZE in const.h) 6 | * If you just need 8 bytes, use 2551-2559 (you do not need to increase EEPSIZE) 7 | * 8 | * Consider the v2 usermod API if you need a more advanced feature set! 9 | */ 10 | 11 | //Use userVar0 and userVar1 (API calls &U0=,&U1=, uint16_t) 12 | 13 | //gets called once at boot. Do all initialization that doesn't depend on network here 14 | void userSetup() 15 | { 16 | 17 | } 18 | 19 | //gets called every time WiFi is (re-)connected. Initialize own network interfaces here 20 | void userConnected() 21 | { 22 | 23 | } 24 | 25 | //loop. You can use "if (WLED_CONNECTED)" to check for successful connection 26 | void userLoop() 27 | { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /wled00/usermod_v2_empty.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "wled.h" 4 | 5 | //This is an empty v2 usermod template. Please see the file usermod_v2_example.h in the EXAMPLE_v2 usermod folder for documentation on the functions you can use! 6 | 7 | class UsermodRenameMe : public Usermod { 8 | private: 9 | 10 | public: 11 | void setup() { 12 | 13 | } 14 | 15 | void loop() { 16 | 17 | } 18 | }; -------------------------------------------------------------------------------- /wled00/usermods_list.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | /* 3 | * Register your v2 usermods here! 4 | * (for v1 usermods using just usermod.cpp, you can ignore this file) 5 | */ 6 | 7 | /* 8 | * Add/uncomment your usermod filename here (and once more below) 9 | * || || || 10 | * \/ \/ \/ 11 | */ 12 | //#include "usermod_v2_example.h" 13 | #ifdef USERMOD_DALLASTEMPERATURE 14 | #include "../usermods/Temperature/usermod_temperature.h" 15 | #endif 16 | //#include "usermod_v2_empty.h" 17 | #ifdef USERMOD_BUZZER 18 | #include "../usermods/buzzer/usermod_v2_buzzer.h" 19 | #endif 20 | #ifdef USERMOD_SENSORSTOMQTT 21 | #include "usermod_v2_SensorsToMqtt.h" 22 | #endif 23 | 24 | #ifdef USERMOD_MODE_SORT 25 | #include "../usermods/usermod_v2_mode_sort/usermod_v2_mode_sort.h" 26 | #endif 27 | #ifdef USERMOD_FOUR_LINE_DISLAY 28 | #include "../usermods/usermod_v2_four_line_display/usermod_v2_four_line_display.h" 29 | #endif 30 | #ifdef USERMOD_ROTARY_ENCODER_UI 31 | #include "../usermods/usermod_v2_rotary_encoder_ui/usermod_v2_rotary_encoder_ui.h" 32 | #endif 33 | #ifdef USERMOD_AUTO_SAVE 34 | #include "../usermods/usermod_v2_auto_save/usermod_v2_auto_save.h" 35 | #endif 36 | 37 | #ifdef USERMOD_DHT 38 | #include "../usermods/DHT/usermod_dht.h" 39 | #endif 40 | 41 | void registerUsermods() 42 | { 43 | /* 44 | * Add your usermod class name here 45 | * || || || 46 | * \/ \/ \/ 47 | */ 48 | //usermods.add(new MyExampleUsermod()); 49 | #ifdef USERMOD_DALLASTEMPERATURE 50 | usermods.add(new UsermodTemperature()); 51 | #endif 52 | //usermods.add(new UsermodRenameMe()); 53 | #ifdef USERMOD_BUZZER 54 | usermods.add(new BuzzerUsermod()); 55 | #endif 56 | #ifdef USERMOD_SENSORSTOMQTT 57 | usermods.add(new UserMod_SensorsToMQTT()); 58 | #endif 59 | 60 | #ifdef USERMOD_MODE_SORT 61 | usermods.add(new ModeSortUsermod()); 62 | #endif 63 | #ifdef USERMOD_FOUR_LINE_DISLAY 64 | usermods.add(new FourLineDisplayUsermod()); 65 | #endif 66 | #ifdef USERMOD_ROTARY_ENCODER_UI 67 | usermods.add(new RotaryEncoderUIUsermod()); 68 | #endif 69 | #ifdef USERMOD_AUTO_SAVE 70 | usermods.add(new AutoSaveUsermod()); 71 | #endif 72 | 73 | #ifdef USERMOD_DHT 74 | usermods.add(new UsermodDHT()); 75 | #endif 76 | } 77 | -------------------------------------------------------------------------------- /wled00/wled00.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * WLED Arduino IDE compatibility file. 3 | * 4 | * Where has everything gone? 5 | * 6 | * In April 2020, the project's structure underwent a major change. 7 | * Global variables are now found in file "wled.h" 8 | * Global function declarations are found in "fcn_declare.h" 9 | * 10 | * Usermod compatibility: Existing wled06_usermod.ino mods should continue to work. Delete usermod.cpp. 11 | * New usermods should use usermod.cpp instead. 12 | */ 13 | #include "wled.h" 14 | 15 | void setup() { 16 | WLED::instance().setup(); 17 | } 18 | 19 | void loop() { 20 | WLED::instance().loop(); 21 | } 22 | -------------------------------------------------------------------------------- /wled00/wled00.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /wled00/wled_serial.cpp: -------------------------------------------------------------------------------- 1 | #include "wled.h" 2 | 3 | /* 4 | * Adalight and TPM2 handler 5 | */ 6 | 7 | enum class AdaState { 8 | Header_A, 9 | Header_d, 10 | Header_a, 11 | Header_CountHi, 12 | Header_CountLo, 13 | Header_CountCheck, 14 | Data_Red, 15 | Data_Green, 16 | Data_Blue, 17 | TPM2_Header_Type, 18 | TPM2_Header_CountHi, 19 | TPM2_Header_CountLo 20 | }; 21 | 22 | void handleSerial() 23 | { 24 | #ifdef WLED_ENABLE_ADALIGHT 25 | static auto state = AdaState::Header_A; 26 | static uint16_t count = 0; 27 | static uint16_t pixel = 0; 28 | static byte check = 0x00; 29 | static byte red = 0x00; 30 | static byte green = 0x00; 31 | 32 | while (Serial.available() > 0) 33 | { 34 | yield(); 35 | byte next = Serial.read(); 36 | switch (state) { 37 | case AdaState::Header_A: 38 | if (next == 'A') state = AdaState::Header_d; 39 | else if (next == 0xC9) { //TPM2 start byte 40 | state = AdaState::TPM2_Header_Type; 41 | } 42 | break; 43 | case AdaState::Header_d: 44 | if (next == 'd') state = AdaState::Header_a; 45 | else state = AdaState::Header_A; 46 | break; 47 | case AdaState::Header_a: 48 | if (next == 'a') state = AdaState::Header_CountHi; 49 | else state = AdaState::Header_A; 50 | break; 51 | case AdaState::Header_CountHi: 52 | pixel = 0; 53 | count = next * 0x100; 54 | check = next; 55 | state = AdaState::Header_CountLo; 56 | break; 57 | case AdaState::Header_CountLo: 58 | count += next + 1; 59 | check = check ^ next ^ 0x55; 60 | state = AdaState::Header_CountCheck; 61 | break; 62 | case AdaState::Header_CountCheck: 63 | if (check == next) state = AdaState::Data_Red; 64 | else state = AdaState::Header_A; 65 | break; 66 | case AdaState::TPM2_Header_Type: 67 | state = AdaState::Header_A; //(unsupported) TPM2 command or invalid type 68 | if (next == 0xDA) state = AdaState::TPM2_Header_CountHi; //TPM2 data 69 | else if (next == 0xAA) Serial.write(0xAC); //TPM2 ping 70 | break; 71 | case AdaState::TPM2_Header_CountHi: 72 | pixel = 0; 73 | count = (next * 0x100) /3; 74 | state = AdaState::TPM2_Header_CountLo; 75 | break; 76 | case AdaState::TPM2_Header_CountLo: 77 | count += next /3; 78 | state = AdaState::Data_Red; 79 | break; 80 | case AdaState::Data_Red: 81 | red = next; 82 | state = AdaState::Data_Green; 83 | break; 84 | case AdaState::Data_Green: 85 | green = next; 86 | state = AdaState::Data_Blue; 87 | break; 88 | case AdaState::Data_Blue: 89 | byte blue = next; 90 | if (!realtimeOverride) setRealtimePixel(pixel++, red, green, blue, 0); 91 | if (--count > 0) state = AdaState::Data_Red; 92 | else { 93 | if (!realtimeMode && bri == 0) strip.setBrightness(briLast); 94 | realtimeLock(realtimeTimeoutMs, REALTIME_MODE_ADALIGHT); 95 | 96 | if (!realtimeOverride) strip.show(); 97 | state = AdaState::Header_A; 98 | } 99 | break; 100 | } 101 | } 102 | #endif 103 | } 104 | --------------------------------------------------------------------------------