Compare commits
No commits in common. "61d6cde8992300cb98b8bf1ff5400cd4c7848d23" and "461c887ddf49a2ad88c8d3ae1af85f0c7dcb3e70" have entirely different histories.
61d6cde899
...
461c887ddf
63
src/main.cpp
63
src/main.cpp
@ -221,20 +221,10 @@ void ledsequence(uint8_t direction, uint8_t onoff, uint8_t factor){
|
|||||||
finish = 0; // set state unfinished -> start action
|
finish = 0; // set state unfinished -> start action
|
||||||
if(direction) led = 0; // reset led counter depending of direction
|
if(direction) led = 0; // reset led counter depending of direction
|
||||||
else led = LEDCOUNT-1;
|
else led = LEDCOUNT-1;
|
||||||
if(onoff){
|
if(onoff) brightness = 127; // set brightness value depending of on/off
|
||||||
brightness = 127; // set brightness value depending of on/off
|
else brightness = 0;
|
||||||
lastbrightness = 0;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
brightness = 0;
|
|
||||||
lastbrightness = 127;
|
|
||||||
}
|
|
||||||
status = status_build; // set parameter memory
|
status = status_build; // set parameter memory
|
||||||
Serial.print("----Status Changed! onoff: ");
|
Serial.println("----Status Changed!");
|
||||||
Serial.print(onoff);
|
|
||||||
Serial.print(" dir: ");
|
|
||||||
Serial.println(direction);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if(!finish){ // finish == 0 -> action pending
|
if(!finish){ // finish == 0 -> action pending
|
||||||
if(!softstart_led(led,lastbrightness, brightness, factor)){
|
if(!softstart_led(led,lastbrightness, brightness, factor)){
|
||||||
@ -248,13 +238,13 @@ void ledsequence(uint8_t direction, uint8_t onoff, uint8_t factor){
|
|||||||
led++;
|
led++;
|
||||||
if(led >= LEDCOUNT) {
|
if(led >= LEDCOUNT) {
|
||||||
finish = 1;
|
finish = 1;
|
||||||
//lastbrightness = brightness;
|
lastbrightness = brightness;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
led--;
|
led--;
|
||||||
if(led < 0){
|
if(led < 0){
|
||||||
//lastbrightness = brightness;
|
lastbrightness = brightness;
|
||||||
finish = 1;
|
finish = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,25 +254,46 @@ void ledsequence(uint8_t direction, uint8_t onoff, uint8_t factor){
|
|||||||
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
<<<<<<< HEAD
|
||||||
static uint32_t dimmtimer = 0;
|
static uint32_t dimmtimer = 0;
|
||||||
static uint8_t direction = 1;
|
/* static uint8_t led = 0;
|
||||||
static uint8_t onoff = 1;
|
static uint16_t brightness = 127;
|
||||||
|
static uint16_t lastbrightness = 0;
|
||||||
|
|
||||||
if(millis() - dimmtimer > 2){
|
if(millis() - dimmtimer > 2){
|
||||||
ledsequence(direction, onoff, 4);
|
if(softstart_led(led, lastbrightness, brightness)){
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(led < LEDCOUNT-1) led++;
|
||||||
|
else {
|
||||||
|
led = 0;
|
||||||
|
uint16_t mem = lastbrightness;
|
||||||
|
lastbrightness = brightness;
|
||||||
|
brightness = mem;
|
||||||
|
}
|
||||||
|
softstart_led((led), lastbrightness, brightness);
|
||||||
|
}
|
||||||
|
if(led >= LEDCOUNT){
|
||||||
|
//led = 0;
|
||||||
|
//uint16_t mem = lastbrightness;
|
||||||
|
//lastbrightness = brightness;
|
||||||
|
// brightness = mem;
|
||||||
|
}
|
||||||
dimmtimer = millis();
|
dimmtimer = millis();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
static uint8_t direction = 1;
|
||||||
|
static uint8_t onoff = 1;
|
||||||
|
if(millis() - dimmtimer > 2){
|
||||||
|
ledsequence(direction, onoff, 4);
|
||||||
}
|
}
|
||||||
if(millis() > 25000 && onoff == 1 && direction == 1) onoff = 0;
|
if(millis() > 25000) onoff = 0;
|
||||||
if(millis() > 35000 && direction == 1){
|
|
||||||
onoff = 1;
|
|
||||||
direction = 0;
|
|
||||||
}
|
|
||||||
TIMEIF_US("OTA", ArduinoOTA.handle(), 20000);
|
TIMEIF_US("OTA", ArduinoOTA.handle(), 20000);
|
||||||
TIMEIF_US("HTTP", server.handleClient(), 20000);
|
TIMEIF_US("HTTP", server.handleClient(), 20000);
|
||||||
|
=======
|
||||||
TIMEIF_US("OTA", ArduinoOTA.handle(), 1000);
|
TIMEIF_US("OTA", ArduinoOTA.handle(), 1000);
|
||||||
|
|
||||||
TIMEIF_US("HTTP", server.handleClient(), 1000);
|
TIMEIF_US("HTTP", server.handleClient(), 1000);
|
||||||
|
>>>>>>> d0b824963bd79fc436b4b312e49b48081860d8d4
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user