24 Commits
Author SHA1 Message Date
Simon Schmidt b51cce709a added test 2021-06-22 15:33:48 +02:00
schmidtsi76327 09aff91b31 Merge branch 'master' of https://git.efi.th-nuernberg.de/gitea/schmidtsi76327/ESP8266_Treppenlicht 2021-06-21 15:35:20 +02:00
schmidtsi76327 36fd363d67 new 2021-06-21 15:32:38 +02:00
bartschdo76253 ee72092a3a Merge branch 'master' of https://git.efi.th-nuernberg.de/gitea/schmidtsi76327/ESP8266_Treppenlicht 2021-06-21 14:19:10 +02:00
schmidtsi76327 a66ab2b1d0 add doku.txt 2021-06-21 13:11:24 +02:00
bartschdo76253 6a7f2e6a4e led dimm via timer 2021-06-21 13:11:18 +02:00
schmidtsi76327 49f9c9c217 added software timer 2021-06-21 12:26:52 +02:00
bartschdo76253 61d6cde899 Merge branch 'master' of https://git.efi.th-nuernberg.de/gitea/schmidtsi76327/ESP8266_Treppenlicht 2021-06-21 11:10:55 +02:00
bartschdo76253 65e922b090 ledsequence updated 2021-06-21 11:10:01 +02:00
schmidtsi76327 461c887ddf Merge branch 'master' of https://git.efi.th-nuernberg.de/gitea/schmidtsi76327/ESP8266_Treppenlicht 2021-06-21 10:54:30 +02:00
schmidtsi76327 e7cf45c45e added favicon ... 2021-06-21 10:54:28 +02:00
bartschdo76253 055a6193df Merge branch 'master' of https://git.efi.th-nuernberg.de/gitea/schmidtsi76327/ESP8266_Treppenlicht 2021-06-21 10:53:49 +02:00
bartschdo76253 c6e288280e added ledsequence 2021-06-21 10:48:27 +02:00
schmidtsi76327 d0b824963b add webtest.cmd for python testing of webserver 2021-06-21 09:55:03 +02:00
schmidtsi76327 407581451b d 2021-06-21 09:44:30 +02:00
schmidtsi76327 5443800b40 reorganize main.cpp 2021-06-21 09:43:06 +02:00
schmidtsi76327 769e132baa „templ_platformio_ini“ ändern 2021-06-21 07:23:28 +00:00
schmidtsi76327 b5a5257a37 „template_platformio.ini“ ändern 2021-06-21 07:22:36 +00:00
schmidtsi76327 f317600d03 „platformio.ini“ ändern 2021-06-21 07:18:02 +00:00
schmidtsi76327 306d9721c4 delete wierd gzip 2021-06-21 09:14:10 +02:00
schmidtsi76327 71e5c47852 modify 2021-06-21 09:12:15 +02:00
schmidtsi76327 29e130b837 changed gitignore 2021-06-21 09:08:04 +02:00
schmidtsi76327 36fb748f6d Merge branch 'master' of https://git.efi.th-nuernberg.de/gitea/schmidtsi76327/ESP8266_Treppenlicht 2021-06-21 09:07:04 +02:00
schmidtsi76327 d4584f57e8 changed gitignore 2021-06-21 09:06:24 +02:00
17 changed files with 384 additions and 5726 deletions

No files matched your search

+3 -5
View File
@@ -1,7 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
.vscode
platformio.ini
include/wifi_credentials.h
platformio.ini
include/*.gz.h
+7 -7
View File
@@ -1,7 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
+11 -1
View File
@@ -1,5 +1,15 @@
{
"files.associations": {
"random": "cpp"
"random": "cpp",
"array": "cpp",
"*.tcc": "cpp",
"deque": "cpp",
"list": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"string_view": "cpp",
"memory": "cpp",
"ranges": "cpp"
}
}
+23 -2
View File
@@ -17,5 +17,26 @@ https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html
```
##### platformio.ini
change IP of esp8266 accordingly
IP gets printed on Serial Monitor after first Upload
see templ_platformio_ini
```ini
[env:<BOARD>]
platform = espressif8266
board = <BOARD>
framework = arduino
monitor_speed = 115200
extra_scripts = pre:extra_script.py
; stuff for OTA
; https://docs.platformio.org/en/latest/platforms/espressif8266.html#over-the-air-ota-update
upload_protocol = espota
upload_port = <IPADRESS>
upload_flags =
--port=8266
--auth=admin
lib_deps =
ottowinter/PCA9685 16-Channel PWM Driver Module Library @ 1.2.9
```
+3
View File
@@ -0,0 +1,3 @@
Hardware Timer didnt work https://github.com/khoih-prog/ESP8266TimerInterrupt#why-using-isr-based-hardware-timer-interrupt-is-better
=> Software Timer https://ullisroboterseite.de/esp8266-timing.html#timer
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

+33 -16
View File
@@ -1,23 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My test page</title>
<link href="http://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
<link href="styles/style.css" rel="stylesheet" type="text/css">
<title>ESP8266 Treppenlicht</title>
<!-- main style sheet -->
<link href="/favicon.png" rel="icon" type="image/png" sizes="16x16">
<link href="/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Mozilla is cool</h1>
<p>At Mozilla, we’re a global community of</p>
<ul> <!-- changed to list in the tutorial -->
<li>technologists</li>
<li>thinkers</li>
<li>builders</li>
</ul>
<p>working together to keep the Internet alive and accessible, so people worldwide can be informed contributors and creators of the Web. We believe this act of human collaboration across an open platform is essential to individual growth and our collective future.</p>
<p>Read the <a href="https://www.mozilla.org/en-US/about/manifesto/">Mozilla Manifesto</a> to learn even more about the values and principles that guide the pursuit of our mission.</p>
<div class="topbar">
ESP8266 Treppenlicht Controller
</div>
<div class="control">
<div class="brightness">
</div>
<div class="onoff">
toggle all
<label id="l_onoff"></label>
<label class="switch">
<input type="checkbox">
<span class="slider round"></span>
</label>
</div>
<div class="pwm">
<label id="label_pwm"></label>
<input type="range" min="1" max="100" value="50" class="rangeslider" id="range1">
</div>
<div class="timer">
<label id="label_timer"></label>
<input type="range" min="1" max="100" value="50" class="rangeslider" id="timer_range">
</div>
</div>
</body>
<script src="/input.js"></script>
</html>
+8
View File
@@ -0,0 +1,8 @@
var slider = document.getElementById("range1");
var output = document.getElementById("l_pwm");
output.innerHTML = slider.value; // Display the default slider value
// Update the current slider value (each time you drag the slider handle)
slider.oninput = function() {
output.innerHTML = this.value;
}
+110 -19
View File
@@ -1,14 +1,22 @@
html {
font-size: 10px;
font-family: 'Open Sans', sans-serif;
font-family: sans-serif, Arial, Helvetica;
background-color: #b3b3b3;
}
.topbar {
padding: 1em;
background-color: #1f1f1f;
h1 {
font-size: 60px;
color: white;
font-size: x-large;
text-align: center;
}
.control {
padding: 1em;
}
p, li {
font-size: 16px;
line-height: 2;
@@ -16,26 +24,109 @@ p, li {
}
html {
background-color: #00539F;
}
body {
width: 600px;
margin: 0 auto;
background-color: #FF9500;
padding: 0 20px 20px 20px;
border: 5px solid black;
border: 1px solid black;
border-radius: 3;
}
h1 {
margin: 0;
padding: 20px 0;
color: #00539F;
text-shadow: 3px 3px 1px black;
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
img {
display: block;
margin: 0 auto;
/* Hide default HTML checkbox */
.switch input {
opacity: 0;
width: 0;
height: 0;
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #04AA6D;
}
input:focus + .slider {
box-shadow: 0 0 1px #04AA6D;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
/* The slider itself */
.rangeslider {
-webkit-appearance: none; /* Override default CSS styles */
appearance: none;
width: 50%; /* Full-width */
height: 34px; /* Specified height */
border-radius: 34px; /* range round corners */
background: #d3d3d3; /* Grey background */
outline: none; /* Remove outline */
opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */
-webkit-transition: .2s; /* 0.2 seconds transition on hover */
transition: opacity .2s;
}
/* Mouse-over effects */
.rangeslider:hover {
opacity: 1; /* Fully shown on mouse-over */
}
/* The slider handle (use -webkit- (Chrome, Opera, Safari, Edge) and -moz- (Firefox) to override default look) */
.rangeslider::-webkit-slider-thumb {
-webkit-appearance: none; /* Override default look */
appearance: none;
width: 26px; /* Set a specific slider handle width */
height: 26px; /* Slider handle height */
border-radius: 50%; /* Round Element */
background: #04AA6D; /* Green background */
cursor: pointer; /* Cursor on hover */
}
.rangeslider::-moz-range-thumb {
width: 26px; /* Set a specific slider handle width */
height: 26px; /* Slider handle height */
background: #04AA6D; /* Green background */
cursor: pointer; /* Cursor on hover */
}
-61
View File
@@ -1,61 +0,0 @@
// filename: index.html.gz.h
#define index_html_gz_len 573
const char index_html_gz[] = {
0x1F, 0x8B, 0x08, 0x00, 0xB4, 0x6E, 0xC7, 0x60, 0x02, 0xFF,
0x8D, 0x53, 0xCB, 0x8E, 0xD4, 0x30, 0x10, 0xBC, 0x23, 0xF1,
0x0F, 0xBD, 0xB9, 0xB2, 0x13, 0x6B, 0x6F, 0x08, 0x65, 0x82,
0x10, 0x70, 0xE0, 0x30, 0x5A, 0xC4, 0x82, 0x10, 0x47, 0xC7,
0xE9, 0x24, 0xD6, 0x38, 0x6E, 0xCB, 0x6E, 0x6F, 0x18, 0x4E,
0xFC, 0x06, 0xBF, 0xC7, 0x97, 0xD0, 0xCE, 0x64, 0x16, 0x56,
0x70, 0xE0, 0x92, 0x87, 0xAB, 0x1F, 0x55, 0xD5, 0xED, 0xE6,
0xEA, 0xCD, 0xED, 0xEB, 0x8F, 0x5F, 0xDE, 0xBF, 0x85, 0x89,
0x67, 0xD7, 0x3E, 0x7D, 0xD2, 0x6C, 0x6F, 0x80, 0x66, 0x42,
0xDD, 0xAF, 0x5F, 0xF2, 0x3D, 0x23, 0x6B, 0x30, 0x93, 0x8E,
0x09, 0x79, 0x5F, 0x65, 0x1E, 0x76, 0xCF, 0xAB, 0x0B, 0xC6,
0x96, 0x1D, 0x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, 0x3E, 0x8F,
0xBD, 0xA6, 0x38, 0x2A, 0xF4, 0xBB, 0x4F, 0x77, 0x4A, 0xC8,
0x65, 0x56, 0x42, 0xD5, 0x0E, 0x72, 0x19, 0x48, 0x55, 0x0F,
0xAB, 0x73, 0xB8, 0x9C, 0x35, 0x4A, 0xB7, 0xEB, 0xB0, 0x51,
0x47, 0x0F, 0xA2, 0xD3, 0xC3, 0x4C, 0x65, 0x65, 0x4A, 0xEA,
0xDA, 0xEB, 0x5E, 0xBB, 0x8C, 0x67, 0x8B, 0x42, 0xB4, 0xDE,
0x58, 0xF1, 0x35, 0x09, 0xA2, 0x19, 0xC6, 0x5C, 0x9C, 0x2D,
0x41, 0x21, 0xC7, 0x94, 0xED, 0xEA, 0x4D, 0x51, 0x32, 0x5B,
0x19, 0x05, 0xF9, 0x8D, 0x7F, 0x19, 0xEE, 0xB6, 0xC2, 0xB2,
0xAB, 0xE7, 0x1B, 0xFD, 0x0B, 0xD0, 0xF5, 0x7E, 0xB7, 0xEB,
0x03, 0x00, 0x00};
-32
View File
@@ -1,32 +0,0 @@
// filename: style.css.gz.h
#define style_css_gz_len 283
const char style_css_gz[] = {
0x1F, 0x8B, 0x08, 0x00, 0xB4, 0x6E, 0xC7, 0x60, 0x02, 0xFF,
0x75, 0x51, 0xC1, 0x8A, 0xC3, 0x20, 0x10, 0xBD, 0x17, 0xFA,
0x0F, 0x03, 0x7B, 0xE8, 0xA5, 0x82, 0x6D, 0x49, 0xA1, 0xF6,
0x9E, 0x6B, 0x0F, 0xFB, 0x05, 0x26, 0x1A, 0x33, 0xAC, 0xD1,
0xA0, 0x96, 0xB6, 0xBB, 0xEC, 0xBF, 0xEF, 0x24, 0xA9, 0x59,
0x4A, 0x76, 0x11, 0x15, 0x9E, 0xEF, 0xBD, 0x79, 0x33, 0xB6,
0xA9, 0xB3, 0xF0, 0xB5, 0x5E, 0x01, 0x34, 0xDE, 0x25, 0x16,
0xF1, 0x53, 0x0B, 0xD8, 0xF1, 0x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x99, 0x6A,
0x28, 0x8C, 0xBD, 0x95, 0xF4, 0x9D, 0x95, 0xF5, 0xE3, 0xF3,
0x1F, 0xCD, 0x92, 0xE2, 0x07, 0x5A, 0x7D, 0xE2, 0xF6, 0x18,
0x02, 0x00, 0x00};
+2
View File
@@ -0,0 +1,2 @@
CD .\include\http
py.exe -m http.server
-44
View File
@@ -1,44 +0,0 @@
// filename: include/http/index.html.gz.h
// uncompressed: index.html, gzip: 622
#define index_html_gz 622
const char index_html_gz[] = {
0x1F, 0x8B, 0x08, 0x00, 0x22, 0x7E, 0xC2, 0x60, 0x02, 0xFF, 0x8D, 0x54, 0xCD, 0x6E, 0xD4, 0x30,
0x10, 0xBE, 0xF3, 0x14, 0x43, 0xAE, 0x74, 0x63, 0xF5, 0x86, 0xAA, 0x6C, 0x10, 0x82, 0x22, 0x71,
0xA8, 0x8A, 0x68, 0x11, 0xE2, 0xE8, 0x38, 0x93, 0xC4, 0xAA, 0xE3, 0xB1, 0xEC, 0x71, 0xB7, 0xCB,
0x89, 0xD7, 0xE0, 0xF5, 0x78, 0x12, 0xC6, 0xCE, 0xB6, 0x2A, 0xEA, 0x85, 0x4B, 0x12, 0xCF, 0xDF,
0xF7, 0x7D, 0x33, 0xE3, 0x74, 0xAF, 0x3F, 0x5E, 0x7F, 0xB8, 0xFD, 0xF1, 0xE5, 0x12, 0x16, 0x5E,
0x5D, 0xFF, 0xAA, 0xDB, 0x5E, 0x00, 0xDD, 0x82, 0x7A, 0x2C, 0x1F, 0xF2, 0xB9, 0x22, 0x6B, 0x30,
0x8B, 0x8E, 0x09, 0x79, 0xDF, 0x64, 0x9E, 0x76, 0x6F, 0x9B, 0x93, 0x8B, 0x2D, 0x3B, 0xEC, 0xAF,
0x8E, 0xC0, 0x98, 0x18, 0x82, 0x9E, 0xB1, 0x53, 0x9B, 0x6D, 0xF3, 0x3B, 0xEB, 0xEF, 0x60, 0x89,
0x38, 0xED, 0x9B, 0x85, 0x39, 0x5C, 0x28, 0x35, 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x8A, 0xA6, 0xCC, 0x39, 0x62, 0xFB, 0x6C, 0x36, 0xA1, 0xFF,
0x2A, 0x5B, 0x56, 0x99, 0x75, 0xFA, 0xD9, 0x9D, 0x48, 0x72, 0x29, 0x0E, 0x87, 0x43, 0xBB, 0x6E,
0xC3, 0x6E, 0x29, 0xCE, 0x0A, 0xFD, 0xEE, 0xDB, 0x8D, 0x12, 0x6A, 0x99, 0x95, 0x10, 0xB5, 0x93,
0xDC, 0x2E, 0x52, 0xCD, 0xD3, 0x42, 0x5E, 0x3D, 0xDA, 0x3A, 0xA5, 0xFB, 0x3A, 0x64, 0xD4, 0xD1,
0x83, 0xA8, 0xF4, 0xB0, 0x52, 0x59, 0x94, 0x92, 0x5A, 0xB1, 0xEE, 0xB5, 0xCB, 0xB8, 0x35, 0x28,
0x44, 0xEB, 0x8D, 0x95, 0xAE, 0x26, 0xF1, 0x68, 0x86, 0x39, 0x97, 0xBE, 0x96, 0xA0, 0x90, 0x63,
0xCA, 0xB6, 0x76, 0xA6, 0xE8, 0x58, 0xAD, 0x0C, 0x82, 0xFC, 0xC6, 0xBE, 0xCC, 0x75, 0xBB, 0x16,
0xB2, 0xFF, 0xF5, 0xEF, 0xF0, 0x17, 0x2C, 0x3C, 0x3D, 0x28, 0x35, 0x04, 0x00, 0x00};
+183 -36
View File
@@ -1,28 +1,68 @@
#include <Arduino.h>
#include <Wire.h>
#include "wifi_credentials.h"
#include "PCA9685.h"
#include <GDBStub.h>
#define ESP12_LED 2
#define NODEMCU_LED 16
extern "C" {
#include "user_interface.h"
}
os_timer_t Timer1; // Verwaltungsstruktur des Timers
int c;
bool toggle = false;
uint32_t m=0;
uint32_t dimmtimer = 0;
uint8_t direction = 1;
uint8_t onoff = 1;
void ledsequence(uint8_t direction, uint8_t onoff, uint8_t factor);
uint8_t softstart_led(uint8_t led, uint16_t startval, uint16_t stopval, uint8_t factor);
void timerCallback(void *pArg)
{
*((int *) pArg) += 1;
ledsequence(direction, onoff, 4);
// Serial.print("[");
// Serial.print(micros()-m);
// Serial.print("] timerCallback\n");
// m = micros();
}
// Änderung
// OTA & WEB
#include "wifi_credentials.h"
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <ESP8266WebServer.h>
#include <WiFiClient.h> // evtl weghauen ?
#include <WiFiClient.h>
#include "index.html.gz.h"
#include "style.css.gz.h"
#include "favicon.png.gz.h"
// images are possible
// maybe check out FS <- SPIFFS
const char* ssid = STASSID;
const char* password = STAPSK;
void setup_webserver();
void setup_ota();
void setup_pwm_pca9685();
void handleRootGz();
void handleCssGz();
void handleNotFound();
const int led = 13;
ESP8266WebServer server(80);
PCA9685 pwmController;
void handleRootGz() {
const char* dataType = "text/html";
@@ -35,7 +75,11 @@ void handleCssGz() {
server.sendHeader(F("Content-Encoding"), F("gzip"));
server.send(200, dataType, (const char*)style_css_gz, style_css_gz_len);
}
void handleFaviconGz() {
const char* dataType = "image/png";
server.sendHeader(F("Content-Encoding"), F("gzip"));
server.send(200, dataType, (const char*)favicon_png_gz, favicon_png_gz_len);
}
void handleNotFound() {
digitalWrite(led, 1);
@@ -74,35 +118,16 @@ void setup_webserver() {
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
//server.on("/", handleRoot);
server.on("/", handleRootGz);
server.on("/styles/style.css", handleCssGz);
server.on("/style.css", handleCssGz);
server.on("/favicon.png", handleFaviconGz);
server.onNotFound(handleNotFound);
server.begin();
Serial.println("HTTP server started");
}
PCA9685 pwmController;
void setup() {
Serial.begin(115200);
Serial.println("Booting");
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Wire.begin(); // Wire must be started first
Wire.setClock(400000); // Supported baud rates are 100kHz, 400kHz, and 1000kHz
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("Connection Failed! Rebooting...");
delay(5000);
ESP.restart();
}
// setup OTA
void setup_ota() {
ArduinoOTA.setPort(8266);
ArduinoOTA.setHostname("ESP_Treppenlicht");
ArduinoOTA.setPassword("admin");
@@ -142,29 +167,151 @@ void setup() {
}
});
ArduinoOTA.begin();
Serial.println("Ready");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
setup_webserver();
}
void setup_pwm_pca9685() {
pwmController.resetDevices(); // Software resets all PCA9685 devices on Wire line
pwmController.init(B000000); // Address pins A5-A0 set to B000000
pwmController.setPWMFrequency(200); // Default is 200Hz, supports 24Hz to 1526Hz
pwmController.setChannelPWM(0, 128 << 4); // Set PWM to 128/255, but in 4096 land
Serial.println(pwmController.getChannelPWM(0)); // Should output 2048, which is 128 << 4
}
Serial.println(pwmController.getChannelPWM(0)); // Should output 2048, which is 128 << 4
void setup() {
Serial.begin(460800);
gdbstub_init();
Serial.println(F("Booting ...."));
pinMode(NODEMCU_LED, OUTPUT);
pinMode(ESP12_LED, OUTPUT);
Wire.begin(); // Wire must be started first
Wire.setClock(400000); // Supported baud rates are 100kHz, 400kHz, and 1000kHz
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("Connection Failed! Rebooting...");
delay(5000);
ESP.restart();
}
os_timer_setfn(&Timer1, timerCallback, &c);
os_timer_arm(&Timer1, 1, true);
Serial.println("Ready");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
setup_ota();
setup_webserver();
setup_pwm_pca9685();
}
uint32_t t;
#define SP_US(_str,_a) Serial.print(_str); Serial.print(" took: "); Serial.print(_a); Serial.println("µs")
#define TIMEIF_US(_str,_f, _l) t=micros(); _f; t=micros()-t; if(t > _l) { SP_US(_str, t); }
uint8_t softstart_led(uint8_t led, uint16_t startval, uint16_t stopval, uint8_t factor){
static uint8_t lastled = 255;
static uint8_t current_pwm = 0;
if(led != lastled){
pwmController.setChannelPWM(led, startval);
lastled = led;
current_pwm = startval;
return 1;
}
if(current_pwm == stopval){
return 0;
}
else if(startval > stopval){
current_pwm -= 1;
}
else {
current_pwm += 1;
}
pwmController.setChannelPWM(led, current_pwm*factor);
return 1;
}
#define LEDCOUNT 16
void ledsequence(uint8_t direction, uint8_t onoff, uint8_t factor){
static int8_t led = 0;
static uint8_t brightness = 0;
static uint8_t lastbrightness = 0;
static uint8_t finish = 1;
static uint32_t status = 0;
uint32_t status_build = 0;
status_build |= direction << 16;
status_build |= onoff << 8;
status_build |= factor;
if(status_build != status){ // check if any parameter changed
finish = 0; // set state unfinished -> start action
if(direction) led = 0; // reset led counter depending of direction
else led = LEDCOUNT-1;
if(onoff){
brightness = 127; // set brightness value depending of on/off
lastbrightness = 0;
}
else{
brightness = 0;
lastbrightness = 127;
}
status = status_build; // set parameter memory
Serial.print("----Status Changed! onoff: ");
Serial.print(onoff);
Serial.print(" dir: ");
Serial.println(direction);
}
if(!finish){ // finish == 0 -> action pending
if(!softstart_led(led,lastbrightness, brightness, factor)){
Serial.print("one LED finished, new set led: ");
Serial.print(led);
Serial.print(" last: ");
Serial.print(lastbrightness);
Serial.print(" curr: ");
Serial.println(brightness);
if(direction){
led++;
if(led >= LEDCOUNT) {
finish = 1;
//lastbrightness = brightness;
}
}
else{
led--;
if(led < 0){
//lastbrightness = brightness;
finish = 1;
}
}
}
}
}
void loop() {
TIMEIF_US("OTA", ArduinoOTA.handle(), 20000);
TIMEIF_US("HTTP", server.handleClient(), 20000);
if(millis() - dimmtimer > 2){
//ledsequence(direction, onoff, 4);
dimmtimer = millis();
}
if(millis() > 25000 && onoff == 1 && direction == 1) onoff = 0;
if(millis() > 35000 && direction == 1){
onoff = 1;
direction = 0;
}
TIMEIF_US("OTA", ArduinoOTA.handle(), 1000);
TIMEIF_US("HTTP", server.handleClient(), 1000);
}
+1 -3
View File
@@ -19,12 +19,10 @@ extra_scripts = pre:extra_script.py
; stuff for OTA
; https://docs.platformio.org/en/latest/platforms/espressif8266.html#over-the-air-ota-update
upload_protocol = espota
upload_port = 192.168.10.94
upload_port = <!! IP ADDRESS !!>
upload_flags =
--port=8266
--auth=admin
lib_deps =
# The exact version
ottowinter/PCA9685 16-Channel PWM Driver Module Library @ 1.2.9
View File
Whitespace-only changes.