Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FastAnalogIn FastIO FastPWM SimpleDMA USBDevice mbed
Fork of Pinscape_Controller by
Diff: main.cpp
- Revision:
- 30:6e9902f06f48
- Parent:
- 29:582472d0bc57
- Child:
- 33:d832bcab089e
--- a/main.cpp Fri Sep 25 18:49:53 2015 +0000
+++ b/main.cpp Fri Sep 25 21:28:31 2015 +0000
@@ -610,25 +610,24 @@
else if (val == 129)
{
// 129 = ramp up / ramp down
- if (wizFlashCounter < 128)
- return wizFlashCounter/127.0;
- else
- return (255 - wizFlashCounter)/127.0;
+ return wizFlashCounter < 128
+ ? wizFlashCounter/128.0
+ : (256 - wizFlashCounter)/128.0;
}
else if (val == 130)
{
// 130 = flash on / off
- return (wizFlashCounter < 128 ? 1.0 : 0.0);
+ return wizFlashCounter < 128 ? 1.0 : 0.0;
}
else if (val == 131)
{
// 131 = on / ramp down
- return (255 - wizFlashCounter)/255.0;
+ return wizFlashCounter < 128 ? 1.0 : (255 - wizFlashCounter)/128.0;
}
else if (val == 132)
{
// 132 = ramp up / on
- return wizFlashCounter/255.0;
+ return wizFlashCounter < 128 ? wizFlashCounter/128.0 : 1.0;
}
else
{
