mirror of https://github.com/arendst/Tasmota.git
Better gamma curve
This commit is contained in:
parent
179c08c109
commit
3f9018658c
|
@ -171,7 +171,8 @@ typedef struct gamma_table_t {
|
|||
} gamma_table_t;
|
||||
|
||||
const gamma_table_t gamma_table[] = { // don't put in PROGMEM for performance reasons
|
||||
{ 3, 0 },
|
||||
{ 1, 1 },
|
||||
{ 4, 1 },
|
||||
{ 209, 13 },
|
||||
{ 312, 41 },
|
||||
{ 457, 106 },
|
||||
|
@ -196,46 +197,46 @@ const gamma_table_t gamma_table_fast[] = {
|
|||
// 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, 2, 2, 2, 2, 2, 2, 2,
|
||||
// 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3,
|
||||
// 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
|
||||
// 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11,
|
||||
// 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 17, 18,
|
||||
// 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6,
|
||||
// 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11,
|
||||
// 11, 12, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 17, 18,
|
||||
// 18, 19, 19, 20, 20, 21, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25,
|
||||
// 25, 26, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 36, 37, 38,
|
||||
// 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50, 51, 52, 53,
|
||||
// 54, 55, 56, 57, 58, 59, 60, 61, 61, 62, 63, 64, 65, 66, 68, 69,
|
||||
// 71, 72, 73, 75, 76, 78, 79, 80, 82, 83, 85, 86, 87, 88, 90, 91,
|
||||
// 54, 55, 56, 57, 58, 59, 60, 61, 61, 62, 63, 64, 65, 67, 68, 69,
|
||||
// 71, 72, 73, 75, 76, 78, 79, 80, 82, 83, 85, 86, 87, 89, 90, 91,
|
||||
// 93, 94, 95, 97, 98,100,101,102,104,105,107,108,109,111,112,114,
|
||||
// 116,118,120,121,123,125,127,129,131,133,135,137,139,141,142,144,
|
||||
// 116,118,120,122,124,125,127,129,131,133,135,137,139,141,143,144,
|
||||
// 146,148,150,152,154,156,158,160,162,164,166,168,170,171,173,175,
|
||||
// 177,180,182,185,187,190,192,195,197,200,202,205,207,210,212,215,
|
||||
// 217,220,222,225,227,230,233,235,238,240,243,245,248,250,253,255
|
||||
// 178,180,183,185,188,190,193,195,198,200,203,205,208,210,213,215,
|
||||
// 218,220,223,225,228,230,233,235,238,240,243,245,248,250,253,255
|
||||
//
|
||||
// and for 10 bits output:
|
||||
// 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4,
|
||||
// 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8,
|
||||
// 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
|
||||
// 12, 12, 13, 13, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
|
||||
// 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 44,
|
||||
// 46, 47, 49, 51, 53, 54, 56, 58, 60, 62, 63, 65, 67, 69, 70, 72,
|
||||
// 74, 76, 78, 79, 81, 83, 85, 86, 88, 90, 92, 94, 95, 97, 99, 101,
|
||||
// 12, 12, 13, 13, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25,
|
||||
// 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43,
|
||||
// 45, 47, 49, 50, 52, 54, 56, 58, 59, 61, 63, 65, 67, 68, 70, 72,
|
||||
// 74, 76, 77, 79, 81, 83, 84, 86, 88, 90, 92, 93, 95, 97, 99, 101,
|
||||
// 102, 104, 106, 110, 113, 117, 121, 124, 128, 132, 135, 139, 143, 146, 150, 154,
|
||||
// 158, 162, 166, 169, 173, 177, 180, 184, 188, 191, 195, 199, 202, 206, 210, 213,
|
||||
// 217, 221, 224, 228, 232, 235, 239, 243, 246, 250, 254, 257, 261, 266, 272, 277,
|
||||
// 283, 288, 294, 300, 305, 311, 316, 322, 327, 333, 339, 344, 350, 355, 361, 366,
|
||||
// 372, 378, 383, 389, 394, 400, 405, 411, 417, 422, 428, 433, 439, 444, 450, 457,
|
||||
// 464, 472, 480, 487, 495, 503, 510, 518, 525, 533, 541, 548, 556, 564, 571, 579,
|
||||
// 587, 594, 602, 609, 617, 627, 634, 642, 650, 657, 665, 672, 680, 688, 695, 703,
|
||||
// 712, 722, 732, 742, 752, 762, 772, 782, 792, 802, 812, 822, 832, 842, 852, 862,
|
||||
// 872, 882, 892, 902, 912, 923, 933, 943, 953, 963, 973, 983, 993,1003,1013,1023
|
||||
// 217, 221, 224, 228, 232, 235, 239, 243, 246, 250, 254, 257, 261, 267, 272, 278,
|
||||
// 283, 289, 294, 300, 305, 311, 317, 322, 328, 333, 339, 344, 350, 356, 361, 367,
|
||||
// 372, 378, 383, 389, 394, 400, 406, 411, 417, 422, 428, 433, 439, 444, 450, 458,
|
||||
// 465, 473, 480, 488, 496, 503, 511, 518, 526, 534, 541, 549, 557, 564, 572, 579,
|
||||
// 587, 595, 602, 610, 617, 627, 635, 642, 650, 657, 665, 673, 680, 688, 695, 703,
|
||||
// 713, 723, 733, 743, 753, 763, 773, 783, 793, 803, 813, 823, 833, 843, 853, 863,
|
||||
// 873, 883, 893, 903, 913, 923, 933, 943, 953, 963, 973, 983, 993,1003,1013,1023
|
||||
//
|
||||
// Output for Dimmer 0..100 values
|
||||
// 0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9,
|
||||
// 10, 10, 11, 12, 12, 13, 16, 18, 21, 23, 26, 29, 32, 34, 37,
|
||||
// 40, 44, 49, 53, 58, 62, 67, 70, 76, 79, 85, 90, 94, 99,102,
|
||||
// 10, 10, 11, 12, 12, 13, 15, 17, 21, 23, 26, 28, 31, 34, 37,
|
||||
// 40, 43, 49, 52, 58, 61, 67, 70, 76, 79, 84, 90, 93, 99,102,
|
||||
// 110,117,128,135,146,158,166,177,184,195,202,213,221,232,239,
|
||||
// 250,261,272,288,300,316,327,344,355,372,389,400,417,428,444,
|
||||
// 457,480,495,518,533,556,579,594,617,634,657,672,695,712,742,
|
||||
// 772,792,822,842,872,892,923,943,973,993,1023
|
||||
// 250,261,272,289,300,317,328,344,356,372,389,400,417,428,444,
|
||||
// 458,480,496,518,534,557,579,595,617,635,657,673,695,713,743,
|
||||
// 773,793,823,843,873,893,923,943,973,993,1023
|
||||
|
||||
struct LIGHT {
|
||||
uint32_t strip_timer_counter = 0; // Bars and Gradient
|
||||
|
@ -1103,8 +1104,8 @@ uint16_t ledGamma_internal(uint16_t v, const struct gamma_table_t *gt_ptr) {
|
|||
if (v <= to_src) {
|
||||
return changeUIntScale(v, from_src, to_src, from_gamma, to_gamma);
|
||||
}
|
||||
from_src = to_src + 1;
|
||||
from_gamma = to_gamma + 1;
|
||||
from_src = to_src;
|
||||
from_gamma = to_gamma;
|
||||
}
|
||||
}
|
||||
// 10_10 bits, fast fade mode
|
||||
|
|
Loading…
Reference in New Issue