26 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
schmidtsi76327 caff8a7e56 meine Änderung 2021-06-14 16:59:22 +02:00
schmidtsi76327 03d9f87159 added gzip for webpage and preprocessor timing wrapper 2021-06-11 00:01:04 +02:00
15 changed files with 446 additions and 106 deletions

No files matched your search

+3 -5
View File
@@ -1,7 +1,5 @@
.pio .pio
.vscode/.browse.c_cpp.db* .vscode
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
include/wifi_credentials.h
platformio.ini platformio.ini
include/wifi_credentials.h
include/*.gz.h
+15
View File
@@ -0,0 +1,15 @@
{
"files.associations": {
"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 ##### platformio.ini
change IP of esp8266 accordingly see templ_platformio_ini
IP gets printed on Serial Monitor after first Upload
```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
+29 -15
View File
@@ -1,20 +1,34 @@
import os import os, gzip
# https://www.mischianti.org/2020/10/26/web-server-with-esp8266-and-esp32-byte-array-gzipped-pages-and-spiffs-2/
# https://stackoverflow.com/questions/49449430/python-bytes-to-c-array-like-xxd-program/49450004 def convert_to_gzip(src, out, f):
def bytes_to_c_arr(data, lowercase=True): input_file = f'{src}{f}'
return [format(b, '#04x' if lowercase else '#04X') for b in data] output_file = f'{out}{f}.gz.h'
output_charp = f'{f.replace(".", "_")}_gz'
src = 'include/http' top = ''
out = 'include' with open(input_file, 'rb') as f_in:
gz = gzip.compress(f_in.read())
gzlen = len(gz)
top += f'// filename: {f}.gz.h\n'
top += f'#define {output_charp}_len {gzlen}\n'
top += f'const char {output_charp}[] = '
top += '{'
with open(output_file, 'wb') as f_out:
for i, b in enumerate(gz):
if not i%10:
top += '\n '
top += f'0x{b:02X}, '
top = top[:-2]
top += '};'
f_out.write(top.encode(encoding='utf-8'))
src='include/http/'
out='include/'
for f in os.listdir(src): for f in os.listdir(src):
with open(f'{src}/{f}', 'rb') as f_in: convert_to_gzip(src, out, f)
with open(f'{out}/{f}.h', 'wb') as f_out:
buf = 'const char {}[] = {{{}}};'.format(
f.replace('.', '_'),
', '.join(bytes_to_c_arr(f_in.read()))
)
f_out.write(buf.encode(encoding='ascii'))
Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

+33 -12
View File
@@ -1,19 +1,40 @@
<!DOCTYPE html>
<html> <html>
<head> <head>
<meta http-equiv='refresh' content='5' /> <title>ESP8266 Treppenlicht</title>
<title>ESP8266 Demo</title> <!-- main style sheet -->
<style> <link href="/favicon.png" rel="icon" type="image/png" sizes="16x16">
body { <link href="/style.css" rel="stylesheet" type="text/css">
background-color: #cccccc;
font-family: Arial, Helvetica, Sans-Serif;
Color: #000088;
}
</style>
</head>
</head>
<body> <body>
<h1>Hello from ESP8266!</h1> <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> </body>
<script src="/input.js"></script>
</html> </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;
}
+132
View File
@@ -0,0 +1,132 @@
html {
font-size: 10px;
font-family: sans-serif, Arial, Helvetica;
background-color: #b3b3b3;
}
.topbar {
padding: 1em;
background-color: #1f1f1f;
color: white;
font-size: x-large;
text-align: center;
}
.control {
padding: 1em;
}
p, li {
font-size: 16px;
line-height: 2;
letter-spacing: 1px;
}
body {
margin: 0 auto;
border: 1px solid black;
border-radius: 3;
}
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
/* 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 */
}
-1
View File
@@ -1 +0,0 @@
const char index_html[] = {0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0x0d, 0x0a, 0x0d, 0x0a, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x6d, 0x65, 0x74, 0x61, 0x20, 0x68, 0x74, 0x74, 0x70, 0x2d, 0x65, 0x71, 0x75, 0x69, 0x76, 0x3d, 0x27, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x27, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x3d, 0x27, 0x35, 0x27, 0x20, 0x2f, 0x3e, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0x45, 0x53, 0x50, 0x38, 0x32, 0x36, 0x36, 0x20, 0x44, 0x65, 0x6d, 0x6f, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x3e, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x7b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x3b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x20, 0x41, 0x72, 0x69, 0x61, 0x6c, 0x2c, 0x20, 0x48, 0x65, 0x6c, 0x76, 0x65, 0x74, 0x69, 0x63, 0x61, 0x2c, 0x20, 0x53, 0x61, 0x6e, 0x73, 0x2d, 0x53, 0x65, 0x72, 0x69, 0x66, 0x3b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23, 0x30, 0x30, 0x30, 0x30, 0x38, 0x38, 0x3b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x3e, 0x0d, 0x0a, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, 0x0d, 0x0a, 0x0d, 0x0a, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x68, 0x31, 0x3e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x45, 0x53, 0x50, 0x38, 0x32, 0x36, 0x36, 0x21, 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0x0d, 0x0a, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x0d, 0x0a, 0x0d, 0x0a, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e};
+2
View File
@@ -0,0 +1,2 @@
CD .\include\http
py.exe -m http.server
+197 -68
View File
@@ -2,33 +2,83 @@
#include <Wire.h> #include <Wire.h>
#include "PCA9685.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();
}
// OTA & WEB
#include "wifi_credentials.h"
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h> #include <WiFiUdp.h>
#include <ArduinoOTA.h> #include <ArduinoOTA.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h> #include <ESP8266WebServer.h>
#include <ESP8266mDNS.h> #include <WiFiClient.h>
#include "wifi_credentials.h" #include "index.html.gz.h"
#include "style.css.gz.h"
#include "index.html.h" #include "favicon.png.gz.h"
// images are possible
// maybe check out FS <- SPIFFS
const char* ssid = STASSID; const char* ssid = STASSID;
const char* password = STAPSK; const char* password = STAPSK;
void setup_webserver();
void setup_ota();
void setup_pwm_pca9685();
void handleRootGz();
void handleCssGz();
void handleNotFound();
const int led = 13; const int led = 13;
ESP8266WebServer server(80); ESP8266WebServer server(80);
PCA9685 pwmController;
void handleRoot() { void handleRootGz() {
digitalWrite(led, 1); const char* dataType = "text/html";
// char temp[sizeof(index_html)]; server.sendHeader(F("Content-Encoding"), F("gzip"));
// snprintf(temp, sizeof(index_html), index_html); server.send(200, dataType, (const char*)index_html_gz, index_html_gz_len);
}
server.send(200, "text/html", index_html); void handleCssGz() {
digitalWrite(led, 0); const char* dataType = "text/css";
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() { void handleNotFound() {
@@ -68,39 +118,16 @@ void setup_webserver() {
Serial.print("IP address: "); Serial.print("IP address: ");
Serial.println(WiFi.localIP()); Serial.println(WiFi.localIP());
if (MDNS.begin("esp8266")) { server.on("/", handleRootGz);
Serial.println("MDNS responder started"); server.on("/style.css", handleCssGz);
} server.on("/favicon.png", handleFaviconGz);
server.on("/", handleRoot);
server.on("/inline", []() {
server.send(200, "text/plain", "this works as well");
});
server.onNotFound(handleNotFound); server.onNotFound(handleNotFound);
server.begin(); server.begin();
Serial.println("HTTP server started"); Serial.println("HTTP server started");
} }
void setup_ota() {
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
ArduinoOTA.setPort(8266); ArduinoOTA.setPort(8266);
ArduinoOTA.setHostname("ESP_Treppenlicht"); ArduinoOTA.setHostname("ESP_Treppenlicht");
ArduinoOTA.setPassword("admin"); ArduinoOTA.setPassword("admin");
@@ -140,49 +167,151 @@ void setup() {
} }
}); });
ArduinoOTA.begin(); 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.resetDevices(); // Software resets all PCA9685 devices on Wire line
pwmController.init(B000000); // Address pins A5-A0 set to B000000 pwmController.init(B000000); // Address pins A5-A0 set to B000000
pwmController.setPWMFrequency(200); // Default is 200Hz, supports 24Hz to 1526Hz 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);
unsigned long i = 0; Serial.println("Ready");
unsigned long a = 0; Serial.print("IP address: ");
unsigned long s = 0; Serial.println(WiFi.localIP());
float ard_ota_time = 0;
float server_handle = 0; 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() { void loop() {
a = micros();
ArduinoOTA.handle();
ard_ota_time += micros()-a;
s = micros();
server.handleClient();
server_handle += micros()-s;
if(++i >= 10000) {
Serial.print("Mittlere Laufzeit\tOTA: ");
Serial.print(ard_ota_time/10000.0);
Serial.print("µs\tHTTP: ");
Serial.print(server_handle/10000.0);
Serial.println("µs");
ard_ota_time = 0; if(millis() - dimmtimer > 2){
server_handle = 0; //ledsequence(direction, onoff, 4);
i = 0; 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 ; stuff for OTA
; https://docs.platformio.org/en/latest/platforms/espressif8266.html#over-the-air-ota-update ; https://docs.platformio.org/en/latest/platforms/espressif8266.html#over-the-air-ota-update
upload_protocol = espota upload_protocol = espota
upload_port = 192.168.10.94 upload_port = <!! IP ADDRESS !!>
upload_flags = upload_flags =
--port=8266 --port=8266
--auth=admin --auth=admin
lib_deps = lib_deps =
# The exact version
ottowinter/PCA9685 16-Channel PWM Driver Module Library @ 1.2.9 ottowinter/PCA9685 16-Channel PWM Driver Module Library @ 1.2.9
View File
Whitespace-only changes.