├── doc
├── .gitkeep
├── pcb_2.0_1024.webp
├── pcb_2.0_2048.webp
├── PCA9685-module.webp
├── esp32_devkit_v1.webp
├── pcb_20_soldered_1024.webp
├── pcb_20_soldered_2048.webp
├── prototype_on_breadboard_2048.webp
└── prototype_on_breadboard_full.webp
├── calc-light-dimcurve
├── .gitignore
├── package.json
├── README.md
├── index.js
└── yarn.lock
├── test-artnet-sender
├── .gitignore
├── README.md
├── index.artnet.js
├── package.json
├── index.e131.js
└── yarn.lock
├── .markdownlint.config
├── .clang-format
├── test-ws-server
├── .gitignore
├── package.json
├── index.js
└── index.html
├── .gitignore
├── frontend
├── .gitignore
├── README.md
├── .idea
│ └── jsLibraryMappings.xml
├── src
│ ├── index.scss
│ ├── 0050_utils.js
│ ├── 0200_websocketclient.js
│ ├── index.html
│ ├── 0900_app.js
│ └── 0100_sliders.js
├── package.json
├── gulpfile.js
└── vendor
│ └── 200_jquery.rsSliderLens.css
├── src
├── webapp
│ └── index.html.gz
├── util
│ ├── color.h
│ ├── utils.h
│ ├── multitimer.h
│ ├── dimcurve.h
│ ├── logger.h
│ ├── jsonparser.h
│ ├── multitimer.cpp
│ ├── logger.cpp
│ └── jsonparser.cpp
├── statistic.h
├── hardware
│ ├── pwm.h
│ ├── statusled.h
│ ├── fram.h
│ ├── fm24c04.h
│ ├── pwm.cpp
│ ├── statusled.cpp
│ ├── fram.cpp
│ └── fm24c04.cpp
├── state.h
├── net
│ ├── ota.h
│ ├── websocket.h
│ ├── wifistate.h
│ ├── mqtt.h
│ ├── artnet.cpp
│ ├── reconnector.h
│ ├── artnet.h
│ ├── ota.cpp
│ ├── websocket.cpp
│ ├── mqtt.cpp
│ ├── wifistate.cpp
│ └── reconnector.cpp
├── config
│ ├── configserver.h
│ ├── configserver_menu.json
│ ├── config.h
│ ├── config.cpp
│ └── configserver.cpp
├── statistic.cpp
└── state.cpp
├── partitions_custom.csv
├── .github
└── workflows
│ └── main.yml
├── .travis.yml
├── platformio.ini
├── test-ws-client
└── index.html
└── README.md
/doc/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/calc-light-dimcurve/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
--------------------------------------------------------------------------------
/test-artnet-sender/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
--------------------------------------------------------------------------------
/.markdownlint.config:
--------------------------------------------------------------------------------
1 | {
2 | "MD033": false
3 | }
--------------------------------------------------------------------------------
/.clang-format:
--------------------------------------------------------------------------------
1 | BasedOnStyle: Google
2 | ColumnLimit: 140
--------------------------------------------------------------------------------
/test-ws-server/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | node_modules
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .pio
3 | .vscode
4 |
5 | src/webapp
6 |
--------------------------------------------------------------------------------
/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | node_modules
3 | dist
4 | yarn-error.log
5 |
--------------------------------------------------------------------------------
/doc/pcb_2.0_1024.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zebrajaeger/esp32-led-dimmer/HEAD/doc/pcb_2.0_1024.webp
--------------------------------------------------------------------------------
/doc/pcb_2.0_2048.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zebrajaeger/esp32-led-dimmer/HEAD/doc/pcb_2.0_2048.webp
--------------------------------------------------------------------------------
/doc/PCA9685-module.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zebrajaeger/esp32-led-dimmer/HEAD/doc/PCA9685-module.webp
--------------------------------------------------------------------------------
/doc/esp32_devkit_v1.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zebrajaeger/esp32-led-dimmer/HEAD/doc/esp32_devkit_v1.webp
--------------------------------------------------------------------------------
/src/webapp/index.html.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zebrajaeger/esp32-led-dimmer/HEAD/src/webapp/index.html.gz
--------------------------------------------------------------------------------
/doc/pcb_20_soldered_1024.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zebrajaeger/esp32-led-dimmer/HEAD/doc/pcb_20_soldered_1024.webp
--------------------------------------------------------------------------------
/doc/pcb_20_soldered_2048.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zebrajaeger/esp32-led-dimmer/HEAD/doc/pcb_20_soldered_2048.webp
--------------------------------------------------------------------------------
/doc/prototype_on_breadboard_2048.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zebrajaeger/esp32-led-dimmer/HEAD/doc/prototype_on_breadboard_2048.webp
--------------------------------------------------------------------------------
/doc/prototype_on_breadboard_full.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zebrajaeger/esp32-led-dimmer/HEAD/doc/prototype_on_breadboard_full.webp
--------------------------------------------------------------------------------
/frontend/README.md:
--------------------------------------------------------------------------------
1 | # ESP-Led-Dimmer Frontend
2 |
3 | ## install
4 |
5 | - install npm
6 | - install yarn global
7 | - run "yarn install"
8 |
9 | ## Build
10 |
11 | - run "yarn build"
12 |
--------------------------------------------------------------------------------
/frontend/.idea/jsLibraryMappings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/util/color.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | uint8_t rgbToWhite(uint16_t r, uint16_t g, uint16_t b) {
6 | r = r * 30; // 255 = 7650
7 | g = g * 59; // 255 = 15045
8 | b = b * 11; // 255 = 2805
9 | return (r + g + b) / 100;
10 | }
--------------------------------------------------------------------------------
/partitions_custom.csv:
--------------------------------------------------------------------------------
1 | # Name, Type, SubType, Offset, Size, Flags
2 | nvs, data, nvs, 0x9000, 0x5000,
3 | otadata, data, ota, 0xe000, 0x2000,
4 | app0, app, ota_0, 0x10000, 0x1E0000,
5 | app1, app, ota_1, 0x1F0000,0x1E0000,
6 | spiffs, data, spiffs, 0x3D0000,0x030000,
7 |
--------------------------------------------------------------------------------
/calc-light-dimcurve/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "calc-light-dimvalue",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon index.js"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "nodemon": "^2.0.20"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/calc-light-dimcurve/README.md:
--------------------------------------------------------------------------------
1 | # Test Artnet Sender
2 |
3 | ## Install
4 |
5 | * Requires [NodeJs](https://nodejs.org/)
6 | * Run in this directory
7 |
8 | npm install
9 |
10 | ## Execute
11 |
12 | * Open
13 |
14 | index.js
15 | and change the host to the IP or hostname of your node
16 | * Run
17 |
18 | npm start
19 |
--------------------------------------------------------------------------------
/test-artnet-sender/README.md:
--------------------------------------------------------------------------------
1 | # Test Artnet Sender
2 |
3 | ## Install
4 |
5 | * Requires [NodeJs](https://nodejs.org/)
6 | * Run in this directory
7 |
8 | npm install
9 |
10 | ## Execute
11 |
12 | * Open
13 |
14 | index.js
15 | and change the host to the IP or hostname of your node
16 | * Run
17 |
18 | npm start
19 |
--------------------------------------------------------------------------------
/test-ws-server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test-ws-server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "s": "node index.js"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.17.1",
13 | "open": "^7.0.0",
14 | "ws": "^7.2.1"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/test-artnet-sender/index.artnet.js:
--------------------------------------------------------------------------------
1 | const artnet = require('artnet')({
2 | host: '192.168.178.34'
3 | });
4 |
5 | function send() {
6 | let data = new Array(16);
7 | data.fill(0);
8 | for(let i=0; i<16;++i){
9 |
10 | data[i] = Math.random() * 256;
11 | // data[i] = i*16;
12 | }
13 | console.log("SEND", data);
14 | artnet.set(1, 0, data);
15 | }
16 |
17 | setInterval(send, 50)
18 |
--------------------------------------------------------------------------------
/test-artnet-sender/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test-artnet-sender",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.e131.js",
6 | "scripts": {
7 | "start": "nodemon index.e131.js"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "artnet": "1.4.0",
13 | "broadcast-address": "1.0.2",
14 | "e131": "^1.1.3",
15 | "nodemon": "^2.0.20"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on: [push]
4 |
5 | jobs:
6 | build:
7 | name: Main
8 | runs-on: ubuntu-latest
9 | steps:
10 | - uses: actions/checkout@master
11 | - name: Setup Python
12 | uses: actions/setup-python@master
13 | with:
14 | python-version: '3.x'
15 | - name: Install Platform IO
16 | run: |
17 | python -m pip install --upgrade pip
18 | pip install -U platformio
19 | - name: Build
20 | run: platformio run
21 |
--------------------------------------------------------------------------------
/frontend/src/index.scss:
--------------------------------------------------------------------------------
1 |
2 | body {
3 | background-color: #d1d1d1;
4 | }
5 |
6 | input {
7 | width: 40px;
8 | height: 300px;
9 | }
10 |
11 | section {
12 | display: inline-block;
13 | padding: 5px;
14 | margin:2px;
15 | background-color: #202020;
16 | box-shadow: 5px 5px 5px 0px rgba(0,0,0,0.33);
17 | }
18 |
19 | .sliderlens {
20 | border: 1px solid gray;
21 | margin: 0 10px;
22 | }
23 |
24 | .range, // range outside the handle
25 | .handle .range { // range inside the handle
26 | background: linear-gradient(to top, black 0%, yellow 80%, white 100%);
27 | }
28 |
29 | .slider-wrapper {
30 | display: inline-block;
31 | padding: 0 5px;
32 | margin: 0;
33 |
34 | .label {
35 | width:40px;
36 | text-align: center;
37 | margin: 5px 13px;
38 | color: #eeeeee;
39 | font-family: "Arial";
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "frontend",
3 | "version": "1.0.0",
4 | "description": "Frontend for ESP32-Led-Dimmer",
5 | "main": "index.js",
6 | "scripts": {
7 | "build": "gulp",
8 | "develop": "gulp develop"
9 | },
10 | "author": "Lars Brandt",
11 | "license": "LGPL-3.0-or-later",
12 | "dependencies": {
13 | },
14 | "devDependencies": {
15 | "browser-sync": "^2.26.7",
16 | "commander": "^4.0.1",
17 | "del": "^5.1.0",
18 | "gulp": "4.0.2",
19 | "gulp-clean": "^0.4.0",
20 | "gulp-clean-css": "^4.2.0",
21 | "gulp-concat": "^2.6.1",
22 | "gulp-gzip": "^1.4.2",
23 | "gulp-html-replace": "^1.6.2",
24 | "gulp-htmlmin": "^5.0.1",
25 | "gulp-livereload": "^4.0.2",
26 | "gulp-manifest3": "^0.1.2",
27 | "gulp-plumber": "^1.2.1",
28 | "gulp-sass": "^4.0.2",
29 | "gulp-sourcemaps": "^2.6.5",
30 | "gulp-terser": "^1.2.0",
31 | "http-proxy": "^1.18.0",
32 | "merge-stream": "^2.0.0",
33 | "mime-types": "^2.1.25",
34 | "node-sass": "^4.13.0",
35 | "readable-stream": "^3.4.0",
36 | "recursive-readdir": "^2.2.2"
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/test-ws-server/index.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 | const path = require('path');
3 |
4 | const express = require('express')();
5 | const WebSocket = require('ws');
6 |
7 | const open = require('open');
8 |
9 | let channels = new Array(16);
10 | channels.fill(1024);
11 |
12 | // http-server
13 | express.get('/', function (req, res) {
14 | res.sendFile(path.join(__dirname, 'index.html'));
15 | });
16 | express.listen(80);
17 |
18 |
19 | // WS Server
20 | const wss = new WebSocket.Server({port: 81});
21 | wss.on('connection', ws => {
22 | console.log('WS connected');
23 |
24 | let timerHandler = setInterval(() => {
25 | console.log("WS SEND");
26 | ws.send(JSON.stringify(channels));
27 | }, 2000);
28 |
29 | ws.on('message', message => {
30 | console.log('WS received: %s', message);
31 | ws.send(JSON.stringify(channels));
32 | });
33 |
34 | ws.on('close', function close() {
35 | console.log('WS disconnected');
36 | clearInterval(timerHandler);
37 | });
38 |
39 | });
40 |
41 | console.log("STARTED");
42 | open('http://localhost:80');
43 |
--------------------------------------------------------------------------------
/frontend/src/0050_utils.js:
--------------------------------------------------------------------------------
1 | const utils = {};
2 |
3 | utils.init = () => {
4 | // nothing to do
5 | };
6 |
7 | // thx to https://gist.github.com/jed/982883
8 | utils.hex = function () {
9 | let hex = [];
10 |
11 | for (let i = 0; i < 256; i++) {
12 | hex[i] = (i < 16 ? '0' : '') + (i).toString(16);
13 | }
14 | return hex;
15 | }();
16 |
17 | utils.uuid = () => {
18 | let r = crypto.getRandomValues(new Uint8Array(16));
19 |
20 | r[6] = r[6] & 0x0f | 0x40;
21 | r[8] = r[8] & 0x3f | 0x80;
22 |
23 | return (
24 | utils.hex[r[0]] +
25 | utils.hex[r[1]] +
26 | utils.hex[r[2]] +
27 | utils.hex[r[3]] +
28 | "-" +
29 | utils.hex[r[4]] +
30 | utils.hex[r[5]] +
31 | "-" +
32 | utils.hex[r[6]] +
33 | utils.hex[r[7]] +
34 | "-" +
35 | utils.hex[r[8]] +
36 | utils.hex[r[9]] +
37 | "-" +
38 | utils.hex[r[10]] +
39 | utils.hex[r[11]] +
40 | utils.hex[r[12]] +
41 | utils.hex[r[13]] +
42 | utils.hex[r[14]] +
43 | utils.hex[r[15]]
44 | );
45 | };
46 |
--------------------------------------------------------------------------------
/src/statistic.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the ESP32-LED-Dimmer distribution (https://github.com/zebrajaeger/esp32-led-dimmer).
3 | * Copyright (c) 2019 Lars Brandt.
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, version 3.
8 | *
9 | * This program is distributed in the hope that it will be useful, but
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 |
19 | #include
20 |
21 | #include "util/logger.h"
22 |
23 | class Statistic {
24 | public:
25 | Statistic();
26 | bool begin(uint64_t periodMs = 10000);
27 | void loop();
28 |
29 | private:
30 | Logger LOG;
31 | void printStatistic();
32 | uint64_t lastMeasurementTime_;
33 | uint64_t loopCount_;
34 | uint64_t period_;
35 | };
--------------------------------------------------------------------------------
/src/util/utils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the ESP32-LED-Dimmer distribution (https://github.com/zebrajaeger/esp32-led-dimmer).
3 | * Copyright (c) 2019 Lars Brandt.
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, version 3.
8 | *
9 | * This program is distributed in the hope that it will be useful, but
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include
21 |
22 | #include
23 |
24 | class Utils {
25 | public:
26 | static String createId() {
27 | char id[20];
28 | uint8_t mac[6];
29 | WiFi.macAddress(mac);
30 | sprintf(id, "esp32-%02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
31 | return id;
32 | }
33 | };
--------------------------------------------------------------------------------
/calc-light-dimcurve/index.js:
--------------------------------------------------------------------------------
1 | // https://www.mikrocontroller.net/articles/LED-Fading
2 |
3 | const offset = 150;
4 | const pwmResoluteion = 4096;
5 | const steps = 256;
6 |
7 | const y0 = calc(0, offset);
8 | const yn = calc(steps - 1, offset);
9 |
10 | pwm();
11 |
12 | function pwm() {
13 | console.log(`// steps: ${steps}, offset: ${offset}, pwmResolution: ${pwmResoluteion}`);
14 | console.log('const uint16_t pwmtable_16[256] PROGMEM = {');
15 | let line = '';
16 | const valuesPerLine = 16;
17 | count = 0;
18 | for (let i = 0; i < steps; ++i) {
19 | ++count;
20 | const f = 1 - (i / steps);
21 | const y = calc(i, offset) - (y0 * f);
22 | line += y.toFixed()
23 | // line += i;
24 | if (i !== steps - 1) {
25 | line += ', '
26 | }
27 | if (count == valuesPerLine) {
28 | count = 0;
29 | console.log(line);
30 | line = '';
31 | }
32 | }
33 | if (line.length > 0) {
34 | console.log(line);
35 | }
36 | console.log('};');
37 | }
38 |
39 | function calc(i, off) {
40 | const x = i + off;
41 | const last = steps + off;
42 | return Math.pow(2, Math.log2(pwmResoluteion - 1) * (x + 1) / (last));
43 | }
--------------------------------------------------------------------------------
/src/hardware/pwm.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the ESP32-LED-Dimmer distribution (https://github.com/zebrajaeger/esp32-led-dimmer).
3 | * Copyright (c) 2019 Lars Brandt.
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, version 3.
8 | *
9 | * This program is distributed in the hope that it will be useful, but
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include
21 |
22 | #include
23 |
24 | class PWM {
25 | public:
26 | PWM();
27 | bool begin();
28 | uint16_t setFrequency(uint16_t frequency);
29 | void setChannelValue(uint8_t channel, uint16_t value);
30 | void setChannelValue8(uint8_t channel, uint8_t value);
31 | void setChannelValueLog(uint8_t channel, uint8_t value);
32 |
33 | private:
34 | FaBoPWM faboPWM_;
35 | };
--------------------------------------------------------------------------------
/src/state.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the ESP32-LED-Dimmer distribution (https://github.com/zebrajaeger/esp32-led-dimmer).
3 | * Copyright (c) 2019 Lars Brandt.
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, version 3.
8 | *
9 | * This program is distributed in the hope that it will be useful, but
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include
21 |
22 | #include
23 |
24 | #include "util/logger.h"
25 |
26 | class State {
27 | public:
28 | State();
29 | uint16_t getFrequency() const;
30 | void setFrequency(uint16_t frequency);
31 |
32 | uint16_t getChannelValue(uint8_t channel) const;
33 | void setChannelValue(uint8_t channel, uint16_t value);
34 | void dump();
35 |
36 | protected:
37 | uint16_t frequency_;
38 | uint16_t channels_[16];
39 |
40 | private:
41 | Logger LOG;
42 | };
--------------------------------------------------------------------------------
/test-artnet-sender/index.e131.js:
--------------------------------------------------------------------------------
1 | var e131 = require('e131');
2 |
3 | const l = 30; // RGB Mode
4 | // const l = 10; // white mode
5 | // var client = new e131.Client('192.168.178.23');
6 | var client = new e131.Client('192.168.178.34');
7 | var packet = client.createPacket(l); // we want 8 RGB (x3) slots
8 | var slotsData = packet.getSlotsData();
9 | packet.setSourceName('test E1.31 client');
10 | packet.setUniverse(0x01); // make universe number consistent with the client
11 | packet.setOption(packet.Options.PREVIEW, true); // don't really change any fixture
12 | packet.setPriority(packet.DEFAULT_PRIORITY); // not strictly needed, done automatically
13 |
14 | setRGB(0, 255, 0, 0);
15 | setRGB(1, 0, 255, 0);
16 | setRGB(2, 0, 0, 255);
17 | setRGB(5, 255, 255, 255);
18 | //cycleColor()
19 | staticColor()
20 |
21 | function setRGB(index, r, g, b) {
22 | const i = index * 3;
23 | slotsData[i] = r;
24 | slotsData[i + 1] = g;
25 | slotsData[i + 2] = b;
26 | }
27 |
28 | function staticColor() {
29 | client.send(packet, function () {
30 | setTimeout(staticColor, 500);
31 | });
32 | }
33 |
34 | function cycleColor() {
35 | let first = slotsData[0];
36 | for (let i = 1; i < l; ++i) {
37 | slotsData[i - 1] = slotsData[i];
38 | }
39 | slotsData[l - 1] = first;
40 | client.send(packet, function () {
41 | setTimeout(cycleColor, 50);
42 | });
43 | }
--------------------------------------------------------------------------------
/src/util/multitimer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the ESP32-LED-Dimmer distribution (https://github.com/zebrajaeger/esp32-led-dimmer).
3 | * Copyright (c) 2019 Lars Brandt.
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, version 3.
8 | *
9 | * This program is distributed in the hope that it will be useful, but
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include
21 | #include