|
|
@@ -20,12 +20,10 @@ uint8_t Treppe::softstart_led(uint8_t led, uint16_t startval, uint16_t stopval){ |
|
|
|
pwmController.setChannelPWM(led, (uint16_t)startval); |
|
|
|
lastled = led; |
|
|
|
current_pwm = startval; |
|
|
|
stepsize = 20*abs(stopval - startval)/(float)time_per_stair; // only valid at 1ms function call interval |
|
|
|
stepsize = INT_TIME*abs(stopval - startval)/(float)time_per_stair; // only valid at 1ms function call interval |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
if(current_pwm > stopval - stepsize && current_pwm < stopval + stepsize) return 0; |
|
|
|
// todo: duty cycle zero! |
|
|
|
if(startval > stopval){ |
|
|
|
current_pwm -= stepsize; |
|
|
|
} |
|
|
@@ -34,6 +32,10 @@ uint8_t Treppe::softstart_led(uint8_t led, uint16_t startval, uint16_t stopval){ |
|
|
|
} |
|
|
|
Serial.println((uint16_t)current_pwm); |
|
|
|
pwmController.setChannelPWM(led, (uint16_t)current_pwm); |
|
|
|
if(current_pwm > stopval - stepsize && current_pwm < stopval + stepsize){ |
|
|
|
if(stopval == 0) pwmController.setChannelPWM(led, 0); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|