cleanup
This commit is contained in:
parent
1d7f2f368b
commit
baecaf02da
80
src/main.cpp
80
src/main.cpp
@ -13,32 +13,6 @@ extern "C" {
|
|||||||
#define ESP12_LED 2
|
#define ESP12_LED 2
|
||||||
#define NODEMCU_LED 16
|
#define NODEMCU_LED 16
|
||||||
|
|
||||||
|
|
||||||
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
|
// OTA & WEB
|
||||||
#include "wifi_credentials.h"
|
#include "wifi_credentials.h"
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
@ -57,6 +31,9 @@ void timerCallback(void *pArg)
|
|||||||
const char* ssid = STASSID;
|
const char* ssid = STASSID;
|
||||||
const char* password = STAPSK;
|
const char* password = STAPSK;
|
||||||
|
|
||||||
|
os_timer_t timer1;
|
||||||
|
int timer_arg;
|
||||||
|
|
||||||
void setup_webserver();
|
void setup_webserver();
|
||||||
void setup_ota();
|
void setup_ota();
|
||||||
void setup_pwm_pca9685();
|
void setup_pwm_pca9685();
|
||||||
@ -106,21 +83,6 @@ void handleNotFound() {
|
|||||||
|
|
||||||
|
|
||||||
void setup_webserver() {
|
void setup_webserver() {
|
||||||
pinMode(led, OUTPUT);
|
|
||||||
digitalWrite(led, 0);
|
|
||||||
Serial.println("");
|
|
||||||
|
|
||||||
// Wait for connection
|
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
|
||||||
delay(500);
|
|
||||||
Serial.print(".");
|
|
||||||
}
|
|
||||||
|
|
||||||
Serial.println("");
|
|
||||||
Serial.print("Connected to ");
|
|
||||||
Serial.println(ssid);
|
|
||||||
Serial.print("IP address: ");
|
|
||||||
Serial.println(WiFi.localIP());
|
|
||||||
|
|
||||||
server.on("/", handleRootGz);
|
server.on("/", handleRootGz);
|
||||||
server.on("/style.css", handleCssGz);
|
server.on("/style.css", handleCssGz);
|
||||||
@ -182,6 +144,23 @@ void setup_pwm_pca9685() {
|
|||||||
Serial.println(pwmController.getChannelPWM(0)); // Should output 2048, which is 128 << 4
|
Serial.println(pwmController.getChannelPWM(0)); // Should output 2048, which is 128 << 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 timer_callback(void *pArg)
|
||||||
|
{
|
||||||
|
*((int *) pArg) += 1;
|
||||||
|
|
||||||
|
ledsequence(direction, onoff, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
#ifdef WITH_DEBUGGING_ON
|
#ifdef WITH_DEBUGGING_ON
|
||||||
Serial.begin(460800);
|
Serial.begin(460800);
|
||||||
@ -207,9 +186,24 @@ void setup() {
|
|||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
os_timer_setfn(&Timer1, timerCallback, &c);
|
pinMode(led, OUTPUT);
|
||||||
os_timer_arm(&Timer1, 1, true);
|
digitalWrite(led, 0);
|
||||||
|
Serial.println("");
|
||||||
|
|
||||||
|
// Wait for connection
|
||||||
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
|
delay(500);
|
||||||
|
Serial.print(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
Serial.println("");
|
||||||
|
Serial.print("Connected to ");
|
||||||
|
Serial.println(ssid);
|
||||||
|
Serial.print("IP address: ");
|
||||||
|
Serial.println(WiFi.localIP());
|
||||||
|
|
||||||
|
os_timer_setfn(&timer1, timer_callback, &timer_arg);
|
||||||
|
os_timer_arm(&timer1, 1, true);
|
||||||
|
|
||||||
Serial.println("Ready");
|
Serial.println("Ready");
|
||||||
Serial.print("IP address: ");
|
Serial.print("IP address: ");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user