1
0

gamma factor 2.7; add dim feature

This commit is contained in:
2019-03-28 21:54:26 -04:00
parent aa3761eb4d
commit 5652b8b087
2 changed files with 26 additions and 28 deletions

View File

@@ -1,20 +1,20 @@
#define GAMMA_CORRECTION { \
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, \
3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, \
6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, \
11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 17, 17, \
18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, \
26, 27, 28, 28, 29, 30, 30, 31, 32, 33, 33, 34, 35, 36, 36, 37, \
38, 39, 40, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 51, \
52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, \
70, 71, 73, 74, 75, 76, 78, 79, 80, 82, 83, 84, 86, 87, 88, 90, \
91, 93, 94, 96, 97, 99,100,102,103,105,106,108,110,111,113,115, \
116,118,120,121,123,125,127,128,130,132,134,136,138,139,141,143, \
145,147,149,151,153,155,157,159,161,163,165,168,170,172,174,176, \
178,181,183,185,187,190,192,194,197,199,201,204,206,209,211,214, \
216,219,221,224,226,229,232,234,237,240,242,245,248,250,253,255}
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, \
4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, \
7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, \
12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 18, 18, 19, \
19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, \
29, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 40, \
41, 42, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 52, 53, 54, \
56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, \
73, 75, 76, 77, 78, 80, 81, 82, 84, 85, 86, 88, 89, 90, 92, 93, \
95, 96, 98, 99,101,102,104,105,107,108,110,111,113,115,116,118, \
120,121,123,125,126,128,130,132,133,135,137,139,141,142,144,146, \
148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,179, \
181,183,185,187,189,192,194,196,199,201,203,206,208,210,213,215, \
217,220,222,225,227,230,232,235,238,240,243,245,248,251,253,255}
// COMMON SETTINGS
// ----------------------------------------------------------------------------------------------

View File

@@ -136,22 +136,20 @@ class Strip {
uint8_t pin;
uint8_t num_pixels;
unsigned long last;
uint8_t offset = num_pixels;
uint8_t offset = 0;
uint8_t shifting = SHIFTING_REVERSE;
public:
Adafruit_NeoPixel pixel;
uint16_t wait;
char pattern;
uint16_t wait = 0;
uint8_t dim = 1;
char pattern = PATTERN_RAINBOW;
uint8_t amplitude = 0;
Strip(uint8_t led_pin, uint8_t strip_len) {
pattern = PATTERN_RED;
pin = led_pin;
num_pixels = strip_len;
wait = 0;
last = millis();
offset = 0;
pixel = Adafruit_NeoPixel(num_pixels, pin, NEO_GRBW + NEO_KHZ800);
pixel.begin();
}
@@ -222,9 +220,9 @@ class Strip {
pixel.setPixelColor(
get_offset_loc(index),
pixel.Color(
pgm_read_byte(&gamma[red]),
pgm_read_byte(&gamma[green]),
pgm_read_byte(&gamma[blue])
pgm_read_byte(&gamma[red / dim]),
pgm_read_byte(&gamma[green / dim]),
pgm_read_byte(&gamma[blue / dim])
)
);
}
@@ -235,10 +233,10 @@ class Strip {
pixel.setPixelColor(
get_offset_loc(index),
pixel.Color(
pgm_read_byte(&gamma[red]),
pgm_read_byte(&gamma[green]),
pgm_read_byte(&gamma[blue]),
pgm_read_byte(&gamma[white])
pgm_read_byte(&gamma[red / dim]),
pgm_read_byte(&gamma[green / dim]),
pgm_read_byte(&gamma[blue / dim]),
pgm_read_byte(&gamma[white / dim])
)
);
}