|
|
|
|
|
|
|
|
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) brightness = 127; // set brightness value depending of on/off |
|
|
|
|
|
else brightness = 0; |
|
|
|
|
|
|
|
|
if(onoff){ |
|
|
|
|
|
brightness = 127; // set brightness value depending of on/off |
|
|
|
|
|
lastbrightness = 0; |
|
|
|
|
|
} |
|
|
|
|
|
else{ |
|
|
|
|
|
brightness = 0; |
|
|
|
|
|
lastbrightness = 127; |
|
|
|
|
|
} |
|
|
status = status_build; // set parameter memory |
|
|
status = status_build; // set parameter memory |
|
|
Serial.println("----Status Changed!"); |
|
|
|
|
|
|
|
|
Serial.print("----Status Changed! onoff: "); |
|
|
|
|
|
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)){ |
|
|
|
|
|
|
|
|
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; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void loop() { |
|
|
void loop() { |
|
|
<<<<<<< HEAD |
|
|
|
|
|
static uint32_t dimmtimer = 0; |
|
|
|
|
|
/* static uint8_t led = 0; |
|
|
|
|
|
static uint16_t brightness = 127; |
|
|
|
|
|
static uint16_t lastbrightness = 0; |
|
|
|
|
|
|
|
|
|
|
|
if(millis() - dimmtimer > 2){ |
|
|
|
|
|
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(); |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint32_t dimmtimer = 0; |
|
|
static uint8_t direction = 1; |
|
|
static uint8_t direction = 1; |
|
|
static uint8_t onoff = 1; |
|
|
static uint8_t onoff = 1; |
|
|
|
|
|
|
|
|
if(millis() - dimmtimer > 2){ |
|
|
if(millis() - dimmtimer > 2){ |
|
|
ledsequence(direction, onoff, 4); |
|
|
ledsequence(direction, onoff, 4); |
|
|
|
|
|
dimmtimer = millis(); |
|
|
|
|
|
} |
|
|
|
|
|
if(millis() > 25000 && onoff == 1 && direction == 1) onoff = 0; |
|
|
|
|
|
if(millis() > 35000 && direction == 1){ |
|
|
|
|
|
onoff = 1; |
|
|
|
|
|
direction = 0; |
|
|
} |
|
|
} |
|
|
if(millis() > 25000) onoff = 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 |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |