Split flash duration into segments.

Needed to reduce CPU usage while flashing is active
This commit is contained in:
Travis Nickles 2017-09-19 21:13:46 -05:00
parent 98c1a9ff41
commit ac4e940605
2 changed files with 5 additions and 3 deletions

View File

@ -123,7 +123,8 @@ namespace DS4Windows
{ {
if (elapsed < PULSE_FLASH_DURATION) if (elapsed < PULSE_FLASH_DURATION)
{ {
ratio = 100.0 * (elapsed / (double)PULSE_FLASH_DURATION); elapsed = elapsed / 40;
ratio = 100.0 * (elapsed / ((double)PULSE_FLASH_DURATION * 0.025));
} }
else else
{ {
@ -135,7 +136,8 @@ namespace DS4Windows
{ {
if (elapsed < PULSE_FLASH_DURATION) if (elapsed < PULSE_FLASH_DURATION)
{ {
ratio = (0 - 100.0) * (elapsed / (double)PULSE_FLASH_DURATION) + 100.0; elapsed = elapsed / 40;
ratio = (0 - 100.0) * (elapsed / ((double)PULSE_FLASH_DURATION * 0.025)) + 100.0;
} }
else else
{ {

View File

@ -1,4 +1,4 @@
# TODO # TODO
* Check why flashing LED code consumes one CPU core ~~* Check why flashing LED code consumes one CPU core~~