arduino: Change cmin[] semantics - pwm level of channel level 1, not 0

Should eliminate dim red light for black pixels.
This commit is contained in:
Petr Baudis 2012-08-19 23:38:24 +02:00
parent ac8e6cd3a9
commit b809208b60
3 changed files with 5 additions and 3 deletions

View file

@ -1,5 +1,7 @@
#include "../ledbar.h" #include "../ledbar.h"
/* FIXME: cmin[] is not handled properly here, it's the level of 1, not 0. */
class Ledbar lb[NUM_TLCS]; class Ledbar lb[NUM_TLCS];
int c[cpinsets][CH]; int c[cpinsets][CH];

View file

@ -28,7 +28,7 @@ void loop()
while (!Serial.available()); while (!Serial.available());
unsigned char s = Serial.read(); unsigned char s = Serial.read();
//c[led][i] = s; //c[led][i] = s;
c[led][i] = map(s, 0, 255, cmin[led][i], cmax[led][i]); c[led][i] = s == 0 ? 0 : map(s, 1, 255, cmin[led][i], cmax[led][i]);
//Serial.print(c[led][i], DEC); //Serial.print(c[led][i], DEC);
//Serial.print(" "); //Serial.print(" ");
} }

View file

@ -97,7 +97,7 @@ const int cpin[LEDS_PER_TLC * NUM_TLCS][CH] = {
#define cpinsets (sizeof(cpin)/sizeof(cpin[0])) #define cpinsets (sizeof(cpin)/sizeof(cpin[0]))
/* cca 2.7ohm resistor per channel */ /* cca 2.7ohm resistor per channel */
const int cmin[cpinsets][CH] = { const int cmin[cpinsets][CH] = { // level of 1 (not 0!)
{ 4, 0, 0 }, /* box 1 */ { 4, 0, 0 }, /* box 1 */
{ 5, 0, 0 }, /* box 2 */ { 5, 0, 0 }, /* box 2 */
{ 5, 0, 0 }, /* box 3 */ { 5, 0, 0 }, /* box 3 */
@ -122,7 +122,7 @@ const int cmin[cpinsets][CH] = {
{ 5, 0, 0 }, /* box 19 */ { 5, 0, 0 }, /* box 19 */
{ 5, 0, 0 }, /* box 20 */ { 5, 0, 0 }, /* box 20 */
}; };
const int cmax[cpinsets][CH] = { const int cmax[cpinsets][CH] = { // level of 255
{ 120, 250, 190 }, /* box 11 */ { 120, 250, 190 }, /* box 11 */
{ 100, 250, 180 }, /* box 2 */ { 100, 250, 180 }, /* box 2 */
{ 100, 250, 180 }, /* box 3 */ { 100, 250, 180 }, /* box 3 */