87 chars_x = (pixies_x+1) * 2;
110 build_controller( pixie_pin );
214 chars_x = (pixies_x+1) * 2;
231 for( uint16_t i = 0; i <
led_count; i++ ){
237 #if defined( ARDUINO_ARCH_ESP8266 )
239 FastLED.addLeds<WS2811_PORTA,4>( color_map_out, pixies_per_pin * leds_per_pixie ).setCorrection( TypicalLEDStrip );
241 #elif defined( ARDUINO_ARCH_ESP32 )
243 FastLED.addLeds<NEOPIXEL, 13>(
245 ( pixies_per_pin*leds_per_pixie ) * 0,
246 ( pixies_per_pin*leds_per_pixie )
247 ).setCorrection( TypicalLEDStrip );
249 FastLED.addLeds<NEOPIXEL, 12>(
251 ( pixies_per_pin*leds_per_pixie ) * 1,
252 ( pixies_per_pin*leds_per_pixie )
253 ).setCorrection( TypicalLEDStrip );
255 FastLED.addLeds<NEOPIXEL, 14>(
257 ( pixies_per_pin*leds_per_pixie ) * 2,
258 ( pixies_per_pin*leds_per_pixie )
259 ).setCorrection( TypicalLEDStrip );
261 FastLED.addLeds<NEOPIXEL, 27>(
263 ( pixies_per_pin*leds_per_pixie ) * 3,
264 ( pixies_per_pin*leds_per_pixie )
265 ).setCorrection( TypicalLEDStrip );
267 #elif defined( ARDUINO_ARCH_TEENSY_3_X )
269 FastLED.addLeds<WS2811_PORTD,4>( color_map_out, pixies_per_pin * leds_per_pixie ).setCorrection( TypicalLEDStrip );
290 custom_animation =
false;
293 custom_animation =
true;
320 brightness_level = level;
354 correct_gamma = enabled;
368 for(uint8_t i = 0; i < chars_y; i++){
369 justifications[i] = justification;
373 justifications[row] = justification;
433 if(custom_animation ==
false){
450 if(custom_animation ==
false){
472 if(scroll_type == INSTANT){
473 scroll_frame_delay_ms = 0;
474 scroll_hold_ms = 150;
476 else if(scroll_type == SHIFT){
477 scroll_frame_delay_ms = 10;
480 else if(scroll_type == SMOOTH){
481 scroll_frame_delay_ms = 10;
510 if( mode ==
AUTOMATIC && ticker_running ==
false ){
513 #if defined( ARDUINO_ARCH_ESP8266 ) || defined( ARDUINO_ARCH_ESP32 )
514 animate.attach_ms<typeof
this>(
515 round(1000 /
float(FPS)),
516 [](typeof
this _p){ _p->show(); },
525 #elif defined( ARDUINO_ARCH_TEENSY_3_X )
527 [](typeof
this _p){ _p->show(); },
528 round(1000000 /
float(FPS))
533 ticker_running =
true;
535 else if( mode ==
MANUAL && ticker_running ==
true ){
536 #if defined( ARDUINO_ARCH_ESP8266 ) || defined( ARDUINO_ARCH_ESP32 )
538 #elif defined( ARDUINO_ARCH_TEENSY_3_X )
541 ticker_running =
false;
563 color(print_col, x_dest/display_width, y_dest/display_height);
570 uint8_t column = pgm_read_byte( font + ( chr *
font_col_width + x ) );
572 uint16_t row1_index =
xy( x_dest+x, y_dest+0 );
573 uint16_t row2_index =
xy( x_dest+x, y_dest+1 );
574 uint16_t row3_index =
xy( x_dest+x, y_dest+2 );
575 uint16_t row4_index =
xy( x_dest+x, y_dest+3 );
576 uint16_t row5_index =
xy( x_dest+x, y_dest+4 );
577 uint16_t row6_index =
xy( x_dest+x, y_dest+5 );
578 uint16_t row7_index =
xy( x_dest+x, y_dest+6 );
581 mask[row1_index] = qadd8(
mask[row1_index], bit_table[bitRead( column, 0 )] );
582 mask[row2_index] = qadd8(
mask[row2_index], bit_table[bitRead( column, 1 )] );
583 mask[row3_index] = qadd8(
mask[row3_index], bit_table[bitRead( column, 2 )] );
584 mask[row4_index] = qadd8(
mask[row4_index], bit_table[bitRead( column, 3 )] );
585 mask[row5_index] = qadd8(
mask[row5_index], bit_table[bitRead( column, 4 )] );
586 mask[row6_index] = qadd8(
mask[row6_index], bit_table[bitRead( column, 5 )] );
587 mask[row7_index] = qadd8(
mask[row7_index], bit_table[bitRead( column, 6 )] );
604void PixieChroma::add_char( uint8_t bitmap_col_1, uint8_t bitmap_col_2, uint8_t bitmap_col_3, uint8_t bitmap_col_4, uint8_t bitmap_col_5, int16_t x_dest, int16_t y_dest ){
614 row1_index =
xy( x_dest+0, y_dest+0 );
mask[row1_index] = qadd8(
mask[row1_index], bit_table[bitRead( bitmap_col_1,0 )] );
615 row2_index =
xy( x_dest+0, y_dest+1 );
mask[row2_index] = qadd8(
mask[row2_index], bit_table[bitRead( bitmap_col_1,1 )] );
616 row3_index =
xy( x_dest+0, y_dest+2 );
mask[row3_index] = qadd8(
mask[row3_index], bit_table[bitRead( bitmap_col_1,2 )] );
617 row4_index =
xy( x_dest+0, y_dest+3 );
mask[row4_index] = qadd8(
mask[row4_index], bit_table[bitRead( bitmap_col_1,3 )] );
618 row5_index =
xy( x_dest+0, y_dest+4 );
mask[row5_index] = qadd8(
mask[row5_index], bit_table[bitRead( bitmap_col_1,4 )] );
619 row6_index =
xy( x_dest+0, y_dest+5 );
mask[row6_index] = qadd8(
mask[row6_index], bit_table[bitRead( bitmap_col_1,5 )] );
620 row7_index =
xy( x_dest+0, y_dest+6 );
mask[row7_index] = qadd8(
mask[row7_index], bit_table[bitRead( bitmap_col_1,6 )] );
623 row1_index =
xy( x_dest+1, y_dest+0 );
mask[row1_index] = qadd8(
mask[row1_index], bit_table[bitRead( bitmap_col_2,0 )] );
624 row2_index =
xy( x_dest+1, y_dest+1 );
mask[row2_index] = qadd8(
mask[row2_index], bit_table[bitRead( bitmap_col_2,1 )] );
625 row3_index =
xy( x_dest+1, y_dest+2 );
mask[row3_index] = qadd8(
mask[row3_index], bit_table[bitRead( bitmap_col_2,2 )] );
626 row4_index =
xy( x_dest+1, y_dest+3 );
mask[row4_index] = qadd8(
mask[row4_index], bit_table[bitRead( bitmap_col_2,3 )] );
627 row5_index =
xy( x_dest+1, y_dest+4 );
mask[row5_index] = qadd8(
mask[row5_index], bit_table[bitRead( bitmap_col_2,4 )] );
628 row6_index =
xy( x_dest+1, y_dest+5 );
mask[row6_index] = qadd8(
mask[row6_index], bit_table[bitRead( bitmap_col_2,5 )] );
629 row7_index =
xy( x_dest+1, y_dest+6 );
mask[row7_index] = qadd8(
mask[row7_index], bit_table[bitRead( bitmap_col_2,6 )] );
632 row1_index =
xy( x_dest+2, y_dest+0 );
mask[row1_index] = qadd8(
mask[row1_index], bit_table[bitRead( bitmap_col_3,0 )] );
633 row2_index =
xy( x_dest+2, y_dest+1 );
mask[row2_index] = qadd8(
mask[row2_index], bit_table[bitRead( bitmap_col_3,1 )] );
634 row3_index =
xy( x_dest+2, y_dest+2 );
mask[row3_index] = qadd8(
mask[row3_index], bit_table[bitRead( bitmap_col_3,2 )] );
635 row4_index =
xy( x_dest+2, y_dest+3 );
mask[row4_index] = qadd8(
mask[row4_index], bit_table[bitRead( bitmap_col_3,3 )] );
636 row5_index =
xy( x_dest+2, y_dest+4 );
mask[row5_index] = qadd8(
mask[row5_index], bit_table[bitRead( bitmap_col_3,4 )] );
637 row6_index =
xy( x_dest+2, y_dest+5 );
mask[row6_index] = qadd8(
mask[row6_index], bit_table[bitRead( bitmap_col_3,5 )] );
638 row7_index =
xy( x_dest+2, y_dest+6 );
mask[row7_index] = qadd8(
mask[row7_index], bit_table[bitRead( bitmap_col_3,6 )] );
641 row1_index =
xy( x_dest+3, y_dest+0 );
mask[row1_index] = qadd8(
mask[row1_index], bit_table[bitRead( bitmap_col_4,0 )] );
642 row2_index =
xy( x_dest+3, y_dest+1 );
mask[row2_index] = qadd8(
mask[row2_index], bit_table[bitRead( bitmap_col_4,1 )] );
643 row3_index =
xy( x_dest+3, y_dest+2 );
mask[row3_index] = qadd8(
mask[row3_index], bit_table[bitRead( bitmap_col_4,2 )] );
644 row4_index =
xy( x_dest+3, y_dest+3 );
mask[row4_index] = qadd8(
mask[row4_index], bit_table[bitRead( bitmap_col_4,3 )] );
645 row5_index =
xy( x_dest+3, y_dest+4 );
mask[row5_index] = qadd8(
mask[row5_index], bit_table[bitRead( bitmap_col_4,4 )] );
646 row6_index =
xy( x_dest+3, y_dest+5 );
mask[row6_index] = qadd8(
mask[row6_index], bit_table[bitRead( bitmap_col_4,5 )] );
647 row7_index =
xy( x_dest+3, y_dest+6 );
mask[row7_index] = qadd8(
mask[row7_index], bit_table[bitRead( bitmap_col_4,6 )] );
650 row1_index =
xy( x_dest+4, y_dest+0 );
mask[row1_index] = qadd8(
mask[row1_index], bit_table[bitRead( bitmap_col_5,0 )] );
651 row2_index =
xy( x_dest+4, y_dest+1 );
mask[row2_index] = qadd8(
mask[row2_index], bit_table[bitRead( bitmap_col_5,1 )] );
652 row3_index =
xy( x_dest+4, y_dest+2 );
mask[row3_index] = qadd8(
mask[row3_index], bit_table[bitRead( bitmap_col_5,2 )] );
653 row4_index =
xy( x_dest+4, y_dest+3 );
mask[row4_index] = qadd8(
mask[row4_index], bit_table[bitRead( bitmap_col_5,3 )] );
654 row5_index =
xy( x_dest+4, y_dest+4 );
mask[row5_index] = qadd8(
mask[row5_index], bit_table[bitRead( bitmap_col_5,4 )] );
655 row6_index =
xy( x_dest+4, y_dest+5 );
mask[row6_index] = qadd8(
mask[row6_index], bit_table[bitRead( bitmap_col_5,5 )] );
656 row7_index =
xy( x_dest+4, y_dest+6 );
mask[row7_index] = qadd8(
mask[row7_index], bit_table[bitRead( bitmap_col_5,6 )] );
694void PixieChroma::write( uint8_t bitmap_col_1, uint8_t bitmap_col_2, uint8_t bitmap_col_3, uint8_t bitmap_col_4, uint8_t bitmap_col_5, uint8_t x_pos, uint8_t y_pos ){
695 write_pix( bitmap_col_1, bitmap_col_2, bitmap_col_3, bitmap_col_4, bitmap_col_5, x_pos, y_pos );
710 display_padding_x + ( display_width * x_pos ),
711 display_padding_y + ( display_height * y_pos )
726 itoa( input, char_buf, 10 );
730 display_padding_x + ( display_width * x_pos ),
731 display_padding_y + ( display_height * y_pos )
746 utoa( input, char_buf, 10 );
750 display_padding_x + ( display_width * x_pos ),
751 display_padding_y + ( display_height * y_pos )
766 ltoa( input, char_buf, 10 );
770 display_padding_x + ( display_width * x_pos ),
771 display_padding_y + ( display_height * y_pos )
786 ultoa( input, char_buf, 10 );
790 display_padding_x + ( display_width * x_pos ),
791 display_padding_y + ( display_height * y_pos )
805#ifndef ARDUINO_ARCH_TEENSY_3_X
808 ultoa( input, char_buf, 10 );
812 display_padding_x + ( display_width * x_pos ),
813 display_padding_y + ( display_height * y_pos )
851 dtoa( input, char_buf, places );
855 display_padding_x + ( display_width * x_pos ),
856 display_padding_y + ( display_height * y_pos )
876 int16_t offset_x = 0;
877 int16_t offset_y = 0;
879 just_wrapped =
false;
881 uint8_t len = strlen( message );
882 for( uint8_t i = 0; i < len; i++ ){
883 if( message[i] ==
'\n' ){
884 if(just_wrapped ==
true){
885 just_wrapped =
false;
889 x_dest = extra_space_left+display_padding_x;
891 offset_y = display_height;
894 else if( line_wrap ==
true && x_dest+offset_x+display_width >= (
matrix_width) ){
900 offset_x += display_width;
902 x_dest = extra_space_left+display_padding_x;
904 offset_y = display_height;
908 else if( message[i] == 0 || message[i] ==
'\0' ){
917 offset_x += display_width;
921 cursor_x_temp = x_dest+offset_x;
922 cursor_y_temp = y_dest+offset_y;
942void PixieChroma::write_pix( uint8_t bitmap_col_1, uint8_t bitmap_col_2, uint8_t bitmap_col_3, uint8_t bitmap_col_4, uint8_t bitmap_col_5, int16_t x_dest, int16_t y_dest ){
943 int16_t offset_x = 0;
944 int16_t offset_y = 0;
946 if( line_wrap ==
true && x_dest+offset_x >= ( display_width * chars_x ) ){
947 x_dest = display_padding_x;
949 offset_y = display_height;
961 offset_x += display_width;
964 cursor_x_temp = x_dest+offset_x;
965 cursor_y_temp = y_dest+offset_y;
1005void PixieChroma::print( uint8_t bitmap_col_1, uint8_t bitmap_col_2, uint8_t bitmap_col_3, uint8_t bitmap_col_4, uint8_t bitmap_col_5 ){
1006 cursor_x_temp = cursor_x;
1007 cursor_y_temp = cursor_y;
1009 write_pix( bitmap_col_1, bitmap_col_2, bitmap_col_3, bitmap_col_4, bitmap_col_5, cursor_x, cursor_y );
1012 cursor_x = cursor_x_temp;
1013 cursor_y = cursor_y_temp;
1031 cursor_x += display_width;
1033 if(line_wrap && cursor_x >= ( display_width * chars_x ) ){
1034 cursor_x = extra_space_left+display_padding_x;
1035 cursor_y += display_height;
1036 just_wrapped =
true;
1040 if(just_wrapped ==
false){
1041 cursor_x = extra_space_left+display_padding_x;
1042 cursor_y += display_height;
1045 just_wrapped =
false;
1065 uint16_t len = strlen(message);
1067 while (i < len - 1) {
1068 if (message[i] ==
'[' && message[i + 1] ==
':') {
1069 for (uint16_t j = i; j < len - 1; j++) {
1070 if (message[j] ==
':' && message[j + 1] ==
']') {
1071 fetch_shortcode( message, i + 2, j );
1083 if(message[len-1] !=
']'){
1084 print( message[len-1] );
1098 itoa( input, char_buf, 10 );
1099 write_pix( char_buf, cursor_x, cursor_y );
1102 cursor_x = cursor_x_temp;
1103 cursor_y = cursor_y_temp;
1116 utoa( input, char_buf, 10 );
1117 write_pix( char_buf, cursor_x, cursor_y );
1120 cursor_x = cursor_x_temp;
1121 cursor_y = cursor_y_temp;
1134 ltoa( input, char_buf, 10 );
1135 write_pix( char_buf, cursor_x, cursor_y );
1138 cursor_x = cursor_x_temp;
1139 cursor_y = cursor_y_temp;
1152 ultoa( input, char_buf, 10 );
1153 write_pix( char_buf, cursor_x, cursor_y );
1156 cursor_x = cursor_x_temp;
1157 cursor_y = cursor_y_temp;
1168#ifndef ARDUINO_ARCH_TEENSY_3_X
1171 ultoa( input, char_buf, 10 );
1172 write_pix( char_buf, cursor_x, cursor_y );
1175 cursor_x = cursor_x_temp;
1176 cursor_y = cursor_y_temp;
1190 print(
double( input ), places );
1193 cursor_x = cursor_x_temp;
1194 cursor_y = cursor_y_temp;
1208 dtoa( input, char_buf, places );
1209 write_pix( char_buf, cursor_x, cursor_y );
1212 cursor_x = cursor_x_temp;
1213 cursor_y = cursor_y_temp;
1233void PixieChroma::println( uint8_t bitmap_col_1, uint8_t bitmap_col_2, uint8_t bitmap_col_3, uint8_t bitmap_col_4, uint8_t bitmap_col_5 ){
1234 print( bitmap_col_1, bitmap_col_2, bitmap_col_3, bitmap_col_4, bitmap_col_5 );
1324#ifndef ARDUINO_ARCH_TEENSY_3_X
1343 println(
double(input), places );
1358 print( input, places );
1374 return cursor_x / display_width;
1396 return cursor_y / display_height;
1457 cursor_x = extra_space_left + display_padding_x + ( display_width * x_position );
1458 cursor_y = display_padding_y + ( display_height * y_position );
1508 uint32_t t_now = micros();
1509 float frame_delta_us = t_now-t_last;
1518 for(uint8_t i = 0; i < chars_y; i++){
1519 if(scrolling[i] ==
false){
1520 int16_t x_offset = calc_justification(justifications[i], i);
1522 if( custom_animation ==
false ){
1534 for( uint16_t i = 0; i <
led_count; i++ ){
1536 color_map_out[i].fadeLightBy( 255-mask_out[i] );
1539 if( correct_gamma ){
1540 color_map_out[i].r =
gamma8[ color_map_out[i].r ];
1541 color_map_out[i].g =
gamma8[ color_map_out[i].g ];
1542 color_map_out[i].b =
gamma8[ color_map_out[i].b ];
1547 FastLED.setBrightness( calculate_max_brightness_for_power_vmA( color_map_out,
led_count, brightness_level, max_V, max_mA ) );
1562 FastLED.delay( milliseconds );
1605 int16_t x_pos = x * display_width + display_padding_x;
1606 int16_t y_pos = y * display_height + display_padding_y;
1644 uint8_t x_temp = x2;
1649 uint8_t y_temp = y2;
1654 uint16_t x_delta = x2 - x1;
1655 uint16_t y_delta = y2 - y1;
1657 for( uint16_t y = 0; y < y_delta; y++ ){
1658 for( uint16_t x = 0; x < x_delta; x++ ){
1659 int16_t x2_pos = x1 + x;
1660 int16_t y2_pos = y1 + y;
1711 _temperature = constrain( temperature, 0, 65500 );
1713 _red = _green = _blue = 0;
1714 float t = _temperature * 0.01;
1718 _green = ( 99.4708025861 * log( t ) ) - 161.1195681661;
1720 _blue = ( 138.5177312231 * log( t - 10 ) ) - 305.0447927307;
1727 _red = 329.698727466 * pow( t - 60, -0.1332047592 );
1728 _green = 288.1221695283 * pow( t - 60, -0.0755148492 );
1732 float f = 0.01 * 100;
1734 _red = constrain( f * _red, 0, 255 );
1735 _green = constrain( f * _green, 0, 255 );
1736 _blue = constrain( f * _blue, 0, 255 );
1738 return CRGB( _red, _green, _blue );
1765 uint8_t keep = 255 - blur_amount;
1766 uint8_t seep = blur_amount >> 1;
1768 uint8_t carryover = 0;
1770 uint8_t cur =
mask[
xy( i,row )];
1772 part = scale8( part, seep );
1773 cur = scale8( cur, keep );
1774 cur = qadd8( cur,carryover );
1776 mask[
xy( i-1,row )] = qadd8(
mask[
xy( i-1,row )],part );
1793 uint8_t keep = 255 - blur_amount;
1794 uint8_t seep = blur_amount >> 1;
1796 uint8_t carryover = 0;
1798 uint8_t cur =
mask[
xy( col,i )];
1800 part = scale8( part, seep );
1801 cur = scale8( cur, keep );
1802 cur = qadd8( cur,carryover );
1804 mask[
xy( col,i-1 )] = qadd8(
mask[
xy( col,i-1 )],part );
1822 if( reset_cursor ==
true ){
1827 mask[i+0] = scale8(
mask[i+0], 255-amount );
1828 mask[i+1] = scale8(
mask[i+1], 255-amount );
1829 mask[i+2] = scale8(
mask[i+2], 255-amount );
1830 mask[i+3] = scale8(
mask[i+3], 255-amount );
1831 mask[i+4] = scale8(
mask[i+4], 255-amount );
1832 mask[i+5] = scale8(
mask[i+5], 255-amount );
1833 mask[i+6] = scale8(
mask[i+6], 255-amount );
1834 mask[i+7] = scale8(
mask[i+7], 255-amount );
1835 mask[i+8] = scale8(
mask[i+8], 255-amount );
1836 mask[i+9] = scale8(
mask[i+9], 255-amount );
1837 mask[i+10] = scale8(
mask[i+10], 255-amount );
1865 uint8_t keep = 255 - blur_amount;
1866 uint8_t seep = blur_amount >> 1;
1868 uint8_t carryover = 0;
1872 part.nscale8( seep );
1873 cur.nscale8( keep );
1891 uint8_t keep = 255 - blur_amount;
1892 uint8_t seep = blur_amount >> 1;
1894 CRGB carryover = CRGB::Black;
1898 part.nscale8( seep );
1899 cur.nscale8( keep );
1917 leds_temp.fadeToBlackBy( amount );
1939 int16_t x,y,dx,dy,dx1,dy1,px,py,xe,ye,i;
1958 for( i=0;x<xe;i++ ){
1964 if( ( dx<0 && dy<0 ) || ( dx>0 && dy>0 ) ){
1970 px=px+2*( dy1-dx1 );
1987 for( i=0;y<ye;i++ ){
1993 if( ( dx<0 && dy<0 ) || ( dx>0 && dy>0 ) ){
1999 py=py+2*( dx1-dy1 );
2021 int16_t x,y,dx,dy,dx1,dy1,px,py,xe,ye,i;
2040 for( i=0;x<xe;i++ ){
2046 if( ( dx<0 && dy<0 ) || ( dx>0 && dy>0 ) ){
2052 px=px+2*( dy1-dx1 );
2069 for( i=0;y<ye;i++ ){
2075 if( ( dx<0 && dy<0 ) || ( dx>0 && dy>0 ) ){
2081 py=py+2*( dx1-dy1 );
2184 Serial.print( xy_table[index] );
2185 Serial.print(
'\t' );
2202 scrolling[row] =
true;
2204 uint16_t len = strlen(message);
2206 while (i < len - 1) {
2207 if (message[i] ==
'[' && message[i + 1] ==
':') {
2208 for (uint16_t j = i; j < len - 1; j++) {
2209 if (message[j] ==
':' && message[j + 1] ==
']') {
2210 fetch_shortcode( message, i + 2, j,
true );
2211 scroll_char(temp_code, row);
2218 scroll_char(message[i], row);
2223 if(message[len-1] !=
']'){
2224 scroll_char(message[len-1], row);
2227 for(uint8_t i = 0; i < chars_x; i++){
2228 scroll_char(
' ', row);
2231 scrolling[row] =
false;
2270 int16_t y_start = 0;
2274 y_start = display_height*row;
2275 y_end = display_height*(row+1);
2280 for( uint16_t y = y_start; y < y_end; y++ ){
2281 int16_t x_dest = x - amount;
2282 int16_t y_dest = y - 0;
2293 else if(amount > 0){
2295 for( uint16_t y = y_start; y < y_end; y++ ){
2296 int16_t x_dest = x - amount;
2297 int16_t y_dest = y - 0;
2321 int16_t x_dest = x - 0;
2322 int16_t y_dest = y - amount;
2333 else if(amount > 0){
2336 int16_t x_dest = x - 0;
2337 int16_t y_dest = y - amount;
2360 int16_t y_start = 0;
2364 y_start = display_height*row;
2365 y_end = display_height*(row+1);
2370 for( uint16_t y = y_start; y < y_end; y++ ){
2371 int16_t x_dest = x - amount;
2372 int16_t y_dest = y - 0;
2384 else if(amount > 0){
2386 for( uint16_t y = y_start; y < y_end; y++ ){
2387 int16_t x_dest = x - amount;
2388 int16_t y_dest = y - 0;
2412 int16_t x_dest = x - 0;
2413 int16_t y_dest = y - amount;
2424 else if(amount > 0){
2427 int16_t x_dest = x - amount;
2428 int16_t y_dest = y - 0;
2582void PixieChroma::build_controller(
const uint8_t pin ){
2588 #ifdef ARDUINO_ARCH_ESP8266
2589 if ( pin == 0 ){FastLED.addLeds<WS2812B, 0, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2590 if ( pin == 1 ){FastLED.addLeds<WS2812B, 1, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2591 if ( pin == 2 ){FastLED.addLeds<WS2812B, 2, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2592 if ( pin == 3 ){FastLED.addLeds<WS2812B, 3, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2593 if ( pin == 4 ){FastLED.addLeds<WS2812B, 4, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2594 if ( pin == 5 ){FastLED.addLeds<WS2812B, 5, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2596 if ( pin == 12 ){FastLED.addLeds<WS2812B, 12, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2597 if ( pin == 13 ){FastLED.addLeds<WS2812B, 13, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2598 if ( pin == 14 ){FastLED.addLeds<WS2812B, 14, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2599 if ( pin == 15 ){FastLED.addLeds<WS2812B, 15, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2600 if ( pin == 16 ){FastLED.addLeds<WS2812B, 16, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2603 #ifdef ARDUINO_ARCH_ESP32
2604 if ( pin == 0 ){FastLED.addLeds<WS2812B, 0, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2605 if ( pin == 1 ){FastLED.addLeds<WS2812B, 1, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2606 if ( pin == 2 ){FastLED.addLeds<WS2812B, 2, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2607 if ( pin == 3 ){FastLED.addLeds<WS2812B, 3, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2608 if ( pin == 4 ){FastLED.addLeds<WS2812B, 4, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2609 if ( pin == 5 ){FastLED.addLeds<WS2812B, 5, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2610 if ( pin == 12 ){FastLED.addLeds<WS2812B, 12, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2611 if ( pin == 13 ){FastLED.addLeds<WS2812B, 13, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2612 if ( pin == 14 ){FastLED.addLeds<WS2812B, 14, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2613 if ( pin == 15 ){FastLED.addLeds<WS2812B, 15, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2614 if ( pin == 16 ){FastLED.addLeds<WS2812B, 16, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2615 if ( pin == 17 ){FastLED.addLeds<WS2812B, 17, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2616 if ( pin == 18 ){FastLED.addLeds<WS2812B, 18, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2617 if ( pin == 19 ){FastLED.addLeds<WS2812B, 19, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2618 if ( pin == 21 ){FastLED.addLeds<WS2812B, 21, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2619 if ( pin == 22 ){FastLED.addLeds<WS2812B, 22, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2620 if ( pin == 23 ){FastLED.addLeds<WS2812B, 23, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2621 if ( pin == 25 ){FastLED.addLeds<WS2812B, 25, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2622 if ( pin == 26 ){FastLED.addLeds<WS2812B, 26, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2623 if ( pin == 27 ){FastLED.addLeds<WS2812B, 27, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2624 if ( pin == 32 ){FastLED.addLeds<WS2812B, 32, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2625 if ( pin == 33 ){FastLED.addLeds<WS2812B, 33, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2628 #ifdef ARDUINO_ARCH_TEENSY_3_X
2629 if ( pin == 0 ){FastLED.addLeds<WS2812B, 0, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2630 if ( pin == 1 ){FastLED.addLeds<WS2812B, 1, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2631 if ( pin == 2 ){FastLED.addLeds<WS2812B, 2, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2632 if ( pin == 3 ){FastLED.addLeds<WS2812B, 3, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2633 if ( pin == 4 ){FastLED.addLeds<WS2812B, 4, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2634 if ( pin == 5 ){FastLED.addLeds<WS2812B, 5, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2635 if ( pin == 6 ){FastLED.addLeds<WS2812B, 6, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2636 if ( pin == 7 ){FastLED.addLeds<WS2812B, 7, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2637 if ( pin == 8 ){FastLED.addLeds<WS2812B, 8, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2638 if ( pin == 9 ){FastLED.addLeds<WS2812B, 9, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2639 if ( pin == 10 ){FastLED.addLeds<WS2812B, 10, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2640 if ( pin == 11 ){FastLED.addLeds<WS2812B, 11, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2641 if ( pin == 12 ){FastLED.addLeds<WS2812B, 12, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2642 if ( pin == 13 ){FastLED.addLeds<WS2812B, 13, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2643 if ( pin == 14 ){FastLED.addLeds<WS2812B, 14, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2644 if ( pin == 15 ){FastLED.addLeds<WS2812B, 15, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2645 if ( pin == 16 ){FastLED.addLeds<WS2812B, 16, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2646 if ( pin == 17 ){FastLED.addLeds<WS2812B, 17, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2647 if ( pin == 18 ){FastLED.addLeds<WS2812B, 18, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2648 if ( pin == 19 ){FastLED.addLeds<WS2812B, 19, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2649 if ( pin == 20 ){FastLED.addLeds<WS2812B, 20, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2650 if ( pin == 21 ){FastLED.addLeds<WS2812B, 21, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2651 if ( pin == 22 ){FastLED.addLeds<WS2812B, 22, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2652 if ( pin == 23 ){FastLED.addLeds<WS2812B, 23, GRB>( color_map_out,
led_count ).setCorrection( TypicalLEDStrip );}
2657void PixieChroma::calc_xy(){
2659 for( uint16_t yi = 0; yi < chars_y; yi++ ){
2660 for( uint16_t y = 0; y < 11; y++ ){
2661 for( uint16_t xi = 0; xi < chars_x; xi++ ){
2662 for( uint16_t x = 0; x < 7; x++ ){
2663 int16_t x_pos = ( xi*display_width )+x;
2664 int16_t y_pos = ( yi*display_height )+y;
2666 int16_t x_pos_mod = x_pos % display_width;
2667 int16_t y_pos_mod = y_pos % display_height;
2670 uint16_t i_template = ( y_pos_mod * display_width ) + x_pos_mod;
2672 if(xi != 0 && xi != chars_x-1){
2673 xy_table[i_table] = int8_t( pgm_read_byte( xy_template + i_template ) );
2676 xy_table[i_table] = -2;
2686 uint8_t visible_rows = 0;
2687 for( uint16_t row = 0; row < display_height; row++ ){
2688 uint16_t index = ( 5*visible_rows );
2689 bool found_visible =
false;
2690 int16_t last_data = 0;
2693 int16_t map_data = xy_table[i];
2695 if( map_data == -1 ){
2696 xy_table[i] = index;
2698 found_visible =
true;
2701 else if( map_data == -2 ){
2702 if( last_data == -1 ){
2707 last_data = map_data;
2710 if( found_visible ){
2719 uint8_t rows_left = chars_y-1;
2720 uint16_t row_length = ( display_width*display_height )*chars_x;
2721 for( uint8_t ii = 0; ii < rows_left; ii++ ){
2722 for( uint16_t r = 0; r < row_length; r++ ){
2723 uint16_t final_src_index = ( ii*row_length )+r;
2724 int16_t src_data = xy_table[final_src_index];
2725 if( src_data >= 0 ){
2726 src_data += ( 35*(chars_x-2) );
2731 xy_table[final_src_index+row_length] = src_data;
2743 uint16_t j = xy_table[i];
2745 if( xy_table[i] == -2 ){
2746 xy_table[i] = index;
2755void PixieChroma::fetch_shortcode(
char* message, uint16_t code_start, uint16_t code_end,
bool return_code ){
2756 if( message[code_start] ==
'#' ){
2757 parse_custom_shortcode( message, code_start+1, code_end, return_code );
2760 char bitmap_name[32];
2761 memset(bitmap_name, 0, 32);
2762 char bitmap_temp[32];
2763 memset(bitmap_temp, 0, 32);
2764 uint8_t bitmap_temp_index = 0;
2766 uint16_t code_length = code_end - code_start;
2767 for (uint16_t i = 0; i < code_length; i++) {
2768 bitmap_name[i] = message[code_start + i];
2772 for (uint16_t i = 0; i < code_length; i++) {
2773 if( uint8_t(bitmap_name[i]) >= 97 && uint8_t(bitmap_name[i]) <= 122 ){
2774 bitmap_name[i] -= 32;
2779 while (index <
sizeof(PIXIE_SHORTCODE_LIBRARY)) {
2780 if (PIXIE_SHORTCODE_LIBRARY[index] >= 200) {
2781 uint8_t skips = PIXIE_SHORTCODE_LIBRARY[index]-200;
2785 char first_name_char = PIXIE_SHORTCODE_LIBRARY[index];
2786 if(bitmap_name[0] == first_name_char){
2787 memset(bitmap_temp, 0, 32);
2788 bitmap_temp_index = 0;
2789 uint32_t bitmap_data_index = index - 6;
2791 bool end_found =
false;
2792 while (end_found ==
false) {
2793 uint8_t val = PIXIE_SHORTCODE_LIBRARY[index];
2795 bitmap_temp[bitmap_temp_index] = char(val);
2800 bitmap_temp_index += 1;
2804 if (strcmp(bitmap_temp, bitmap_name) == 0) {
2806 if(return_code ==
false){
2807 color(print_col, cursor_x/display_width, cursor_y/display_height);
2810 PIXIE_SHORTCODE_LIBRARY[bitmap_data_index + 0],
2811 PIXIE_SHORTCODE_LIBRARY[bitmap_data_index + 1],
2812 PIXIE_SHORTCODE_LIBRARY[bitmap_data_index + 2],
2813 PIXIE_SHORTCODE_LIBRARY[bitmap_data_index + 3],
2814 PIXIE_SHORTCODE_LIBRARY[bitmap_data_index + 4]
2818 temp_code[0] = PIXIE_SHORTCODE_LIBRARY[bitmap_data_index + 0];
2819 temp_code[1] = PIXIE_SHORTCODE_LIBRARY[bitmap_data_index + 1];
2820 temp_code[2] = PIXIE_SHORTCODE_LIBRARY[bitmap_data_index + 2];
2821 temp_code[3] = PIXIE_SHORTCODE_LIBRARY[bitmap_data_index + 3];
2822 temp_code[4] = PIXIE_SHORTCODE_LIBRARY[bitmap_data_index + 4];
2840void PixieChroma::parse_custom_shortcode(
char* message, uint16_t code_start, uint16_t code_end,
bool return_code ){
2843 for(uint8_t i = 0; i < (code_end-code_start); i++){
2844 char chr = message[code_start+i];
2846 if (chr ==
'0'){ input[i] = 0; }
2847 else if(chr ==
'1'){ input[i] = 1; }
2848 else if(chr ==
'2'){ input[i] = 2; }
2849 else if(chr ==
'3'){ input[i] = 3; }
2850 else if(chr ==
'4'){ input[i] = 4; }
2851 else if(chr ==
'5'){ input[i] = 5; }
2852 else if(chr ==
'6'){ input[i] = 6; }
2853 else if(chr ==
'7'){ input[i] = 7; }
2854 else if(chr ==
'8'){ input[i] = 8; }
2855 else if(chr ==
'9'){ input[i] = 9; }
2856 else if(chr ==
'A'){ input[i] = 10; }
2857 else if(chr ==
'B'){ input[i] = 11; }
2858 else if(chr ==
'C'){ input[i] = 12; }
2859 else if(chr ==
'D'){ input[i] = 13; }
2860 else if(chr ==
'E'){ input[i] = 14; }
2861 else if(chr ==
'F'){ input[i] = 15; }
2864 uint8_t column_1 = input[1] + (input[0]<<4);
2865 uint8_t column_2 = input[3] + (input[2]<<4);
2866 uint8_t column_3 = input[5] + (input[4]<<4);
2867 uint8_t column_4 = input[7] + (input[6]<<4);
2868 uint8_t column_5 = input[9] + (input[8]<<4);
2870 if(return_code ==
false){
2871 color(print_col, cursor_x/display_width, cursor_y/display_height);
2882 temp_code[0] = column_1;
2883 temp_code[1] = column_2;
2884 temp_code[2] = column_3;
2885 temp_code[3] = column_4;
2886 temp_code[4] = column_5;
2891void PixieChroma::scroll_char(
char c, uint8_t row){
2892 add_char(c, (chars_x * display_width)-6, 2+(row*display_height));
2893 for (uint8_t i = 0; i < 7; i++) {
2895 if(scroll_type != INSTANT){
2897 delay(scroll_frame_delay_ms);
2901 delay(scroll_hold_ms);
2905void PixieChroma::scroll_char(uint8_t* bitmap, uint8_t row){
2906 add_char(bitmap[0], bitmap[1], bitmap[2], bitmap[3], bitmap[4], (chars_x * display_width)-6, 2+(row*display_height));
2907 for (uint8_t i = 0; i < 7; i++) {
2909 if(scroll_type != INSTANT){
2911 delay(scroll_frame_delay_ms);
2915 delay(scroll_hold_ms);
2919int16_t PixieChroma::calc_justification(
t_justification justification, uint8_t row ){
2920 if(justification == LEFT){
2924 uint8_t x_disp_start = 0;
2925 uint8_t x_disp_end = 0;
2931 for(int16_t y = (display_height*row); y < (display_height*(row+1)); y++){
2932 if(
mask[
xy(x,y) ] != 0){
2939 if(x_led >= (display_width*display_height)){
2947 x_disp_start = x_pos;
2952 for(int16_t y = (display_height*row); y < (display_height*(row+1)); y++){
2953 if(
mask[
xy(x,y) ] != 0){
2960 if(x_led >= (display_width*display_height)){
2970 uint8_t length = x_disp_end - x_disp_start;
2971 int16_t x_offset_chars;
2973 if(length > (chars_x-2)){
2977 if(justification == CENTER){
2978 x_offset_chars = floor(((chars_x-2) - length) / 2.0);
2980 if((x_offset_chars*2) + length > (chars_x-2)){
2981 x_offset_chars -= 1;
2984 else if(justification == RIGHT){
2985 x_offset_chars = (chars_x-2)-length;
2988 return x_offset_chars * display_width;
3039 char* border =
"+---------------------------------------------+";
3041 char* testing =
"Testing: ";
3042 char* PASS =
"PASS";
3043 char* FAIL =
"FAIL\n--------------------------------------------------------- #####";
3044 bool success =
true;
3051 Serial.println( border );
3052 Serial.print ( testing );
3053 Serial.print(F(
"begin() ......................... "));
3054 uint8_t fail_step = 0;
3062 if( chars_x != 12 ){ fail_step = 1; }
3063 if( chars_y != 2 ){ fail_step = 2; }
3067 if(
led_count != 840 ){ fail_step = 6; }
3068 if( xy_table[0] != 840 ){ fail_step = 7; }
3069 if( xy_table[500] != 402 ){ fail_step = 8; }
3070 if(
color_map[0].g != 255 ){ fail_step = 9; }
3073 Serial.println(PASS);
3076 print(
"------------------------");
3079 Serial.println(FAIL);
3080 Serial.print(
"FAIL_STEP: ");
3081 Serial.println(fail_step);
3086 Serial.println(border);
3093 Serial.println( border );
3094 Serial.print ( testing );
3095 Serial.print(F(
"xy() ............................ "));
3098 if(
xy(0, 0 ) != 840 ){ fail_step = 1; }
3099 if(
xy(83,0 ) != 923 ){ fail_step = 2; }
3100 if(
xy(0, 21) != 1764 ){ fail_step = 3; }
3101 if(
xy(83,21) != 1847 ){ fail_step = 4; }
3102 if(
xy(41,10) != 1301 ){ fail_step = 5; }
3105 Serial.println(PASS);
3108 Serial.println(FAIL);
3109 Serial.print(
"FAIL_STEP: ");
3110 Serial.println(fail_step);
3115 Serial.println(border);
3122 Serial.println( border );
3123 Serial.print ( testing );
3124 Serial.print(F(
"set_brightness() ................ "));
3126 bool success_temp =
true;
3127 for(uint8_t i = 0; i < 100; i++){
3128 uint8_t rand_brightness = random( 0, 255 );
3132 if( brightness_level != rand_brightness ){
3133 success_temp =
false;
3137 if(success_temp ==
true){
3140 Serial.println(PASS);
3143 Serial.println(FAIL);
3147 Serial.println(border);
3156 Serial.println( border );
3157 Serial.print ( testing );
3158 Serial.print(F(
"set_palette() ................... "));
3160 print(
"------------------------");
3162 success_temp =
true;
3163 for(uint8_t i = 0; i < 100; i++){
3165 CRGB(random(0,255), random(0,255), random(0,255)),
3166 CRGB(random(0,255), random(0,255), random(0,255)),
3167 CRGB(random(0,255), random(0,255), random(0,255)),
3168 CRGB(random(0,255), random(0,255), random(0,255)),
3169 CRGB(random(0,255), random(0,255), random(0,255)),
3170 CRGB(random(0,255), random(0,255), random(0,255)),
3171 CRGB(random(0,255), random(0,255), random(0,255)),
3172 CRGB(random(0,255), random(0,255), random(0,255))
3175 CRGBPalette16 test_palette = CRGBPalette16(
3176 rands[0], rands[1], rands[2], rands[3],
3177 rands[4], rands[5], rands[6], rands[7],
3178 rands[0], rands[1], rands[2], rands[3],
3179 rands[4], rands[5], rands[6], rands[7]
3185 bool success_temp_b =
true;
3186 for(uint8_t i = 0; i < 8; i++){
3187 if(test_palette.entries[i] != rands[i] || test_palette.entries[i+8] != rands[i]){
3188 success_temp_b =
false;
3192 if(!success_temp_b){
3193 success_temp =
false;
3198 Serial.println(PASS);
3202 Serial.println(FAIL);
3206 Serial.println(border);
3213 Serial.println( border );
3214 Serial.print ( testing );
3215 Serial.print(F(
"set_update_mode() ............... "));
3219 if(!ticker_running){
3230 Serial.println(PASS);
3233 Serial.println(FAIL);
3234 Serial.println(fail_step);
3238 Serial.println(border);
3285 Serial.println( border );
3286 Serial.print ( testing );
3287 Serial.print(F(
"write(int16_t) .................. "));
3290 write(int16_t(-2),0,0);
3293 success_temp =
true;
3294 for(uint8_t x = 0; x < 5; x++){
3297 uint8_t column = pgm_read_byte( font + ( chr *
font_col_width + x ) );
3299 for(uint8_t y = 0; y < 7; y++){
3300 uint8_t char_val = bit_table[ bitRead( column, y ) ];
3302 uint16_t index =
xy(x+display_padding_x, y+display_padding_y);
3303 uint8_t mask_val =
mask[index];
3305 if(char_val != mask_val){
3306 success_temp =
false;
3310 for(uint8_t x = 0; x < 5; x++){
3313 uint8_t column = pgm_read_byte( font + ( chr *
font_col_width + x ) );
3315 for(uint8_t y = 0; y < 7; y++){
3316 uint8_t char_val = bit_table[ bitRead( column, y ) ];
3318 uint16_t index =
xy(x+display_padding_x+(display_width*1), y+display_padding_y);
3319 uint8_t mask_val =
mask[index];
3321 if(char_val != mask_val){
3322 success_temp =
false;
3326 for(uint8_t x = 0; x < 5; x++){
3329 uint8_t column = pgm_read_byte( font + ( chr *
font_col_width + x ) );
3331 for(uint8_t y = 0; y < 7; y++){
3332 uint8_t char_val = bit_table[ bitRead( column, y ) ];
3334 uint16_t index =
xy(x+display_padding_x+(display_width*2), y+display_padding_y);
3335 uint8_t mask_val =
mask[index];
3337 if(char_val != mask_val){
3338 success_temp =
false;
3344 Serial.println(PASS);
3347 Serial.println(FAIL);
3351 Serial.println(border);
3398 Serial.println( border );
3399 Serial.print ( testing );
3400 Serial.print(F(
"print(int16_t) .................. "));
3406 success_temp =
true;
3407 for(uint8_t x = 0; x < 5; x++){
3410 uint8_t column = pgm_read_byte( font + ( chr *
font_col_width + x ) );
3412 for(uint8_t y = 0; y < 7; y++){
3413 uint8_t char_val = bit_table[ bitRead( column, y ) ];
3415 uint16_t index =
xy(x+display_padding_x, y+display_padding_y);
3416 uint8_t mask_val =
mask[index];
3418 if(char_val != mask_val){
3419 success_temp =
false;
3423 for(uint8_t x = 0; x < 5; x++){
3426 uint8_t column = pgm_read_byte( font + ( chr *
font_col_width + x ) );
3428 for(uint8_t y = 0; y < 7; y++){
3429 uint8_t char_val = bit_table[ bitRead( column, y ) ];
3431 uint16_t index =
xy(x+display_padding_x+(display_width*1), y+display_padding_y);
3432 uint8_t mask_val =
mask[index];
3434 if(char_val != mask_val){
3435 success_temp =
false;
3439 for(uint8_t x = 0; x < 5; x++){
3442 uint8_t column = pgm_read_byte( font + ( chr *
font_col_width + x ) );
3444 for(uint8_t y = 0; y < 7; y++){
3445 uint8_t char_val = bit_table[ bitRead( column, y ) ];
3447 uint16_t index =
xy(x+display_padding_x+(display_width*2), y+display_padding_y);
3448 uint8_t mask_val =
mask[index];
3450 if(char_val != mask_val){
3451 success_temp =
false;
3457 Serial.println(PASS);
3460 Serial.println(FAIL);
3464 Serial.println(border);
3471 Serial.println( border );
3472 Serial.print ( testing );
3473 Serial.print(F(
"set_cursor(2,3) ................. "));
3477 if(cursor_x != 15 || cursor_y != 35){
3482 Serial.println(PASS);
3485 Serial.println(FAIL);
3486 Serial.print(
"cursor: (");
3487 Serial.print(cursor_x);
3489 Serial.println(
") != (15,35)");
3492 Serial.println(border);
3499 Serial.println( border );
3500 Serial.print ( testing );
3501 Serial.print(F(
"get_cursor_x() .................. "));
3504 Serial.println(PASS);
3507 Serial.println(FAIL);
3509 Serial.println(
" != 2");
3513 Serial.println(border);
3520 Serial.println( border );
3521 Serial.print ( testing );
3522 Serial.print(F(
"get_cursor_y() .................. "));
3525 Serial.println(PASS);
3528 Serial.println(FAIL);
3530 Serial.println(
" != 2");
3534 Serial.println(border);
3541 Serial.println( border );
3542 Serial.print ( testing );
3543 Serial.print(F(
"get_cursor_x_exact() ............ "));
3546 Serial.println(PASS);
3549 Serial.println(FAIL);
3551 Serial.println(
" != 15");
3555 Serial.println(border);
3562 Serial.println( border );
3563 Serial.print ( testing );
3564 Serial.print(F(
"get_cursor_y_exact() ............ "));
3567 Serial.println(PASS);
3570 Serial.println(FAIL);
3572 Serial.println(
" != 35");
3576 Serial.println(border);
3583 Serial.println( border );
3584 Serial.print ( testing );
3585 Serial.print(F(
"clear() ......................... "));
3597 if(cursor_x != display_padding_x || cursor_y != display_padding_y){
3603 Serial.println(PASS);
3606 Serial.println(FAIL);
3607 Serial.println(fail_step);
3611 Serial.println(border);
3614 Serial.println(
"\nXY MAP:");
#define UNIT_TEST_PIXIES_X
Developer use - unit testing defaults.
#define UNIT_TEST_PIXIES_PER_PIN
Developer use - unit testing defaults.
#define UNIT_TEST_PIXIES_Y
Developer use - unit testing defaults.
This is the software documentation for using Pixie Chroma functions on Arduino! For full example usag...
void color_blur(fract8 blur_amount)
Blurs the color buffer in both axes by blur_amount.
void set_scroll_type(t_scroll_type type)
Sets the scroll behavior:
void shift_color_map_y(int16_t amount)
Shifts the color map data by amount on the Y axis. Useful for scrolling!
void print(uint8_t bitmap_col_1, uint8_t bitmap_col_2, uint8_t bitmap_col_3, uint8_t bitmap_col_4, uint8_t bitmap_col_5)
Prints a bitmap to the displays at the current cursor position, taking five uint8_t as input for the ...
void draw_line_mask(int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t value=255)
Draws a line in the mask buffer using Bresenham's line algorithm.
void set_color_animation_speed(float speed)
Used to scale the animation speed of animation ISRs that can use pix.animation_speed() to scale their...
void color(CRGB col)
Sets the entire color buffer to a CRGB value.
float animation_speed
Used by animation functions to scale the apparent speed of animation.
void write(uint8_t bitmap_col_1, uint8_t bitmap_col_2, uint8_t bitmap_col_3, uint8_t bitmap_col_4, uint8_t bitmap_col_5, uint8_t x_pos=0, uint8_t y_pos=0)
Writes a bitmap to a specified X and Y cursor position, taking five uint8_t as input for the column d...
void write_pix(char *message, int16_t x_offset=0, int16_t y_offset=0)
Internal function for rendering char* strings to the mask buffer.
void set_brightness(uint8_t level)
Takes an 8-bit brightness value and passes it to FastLED internally, to provide global brightness con...
PixieChroma()
Construct a Pixie Chroma class object.
void set_color_animation(void(*action)(PixieChroma *, float))
Accepts a preset Color Animation or custom function to use for the animation ISR.
void print_color(CRGB col)
All print() calls after a print_color() will be colored with this value.
float delta
Used by animation functions as a way of self-regulating speed if performance drops,...
float get_uv_y(int32_t y_pixel)
Returns the Y-axis UV coordinate for a given Y-axis pixel position.
CRGB * color_map
Contains the entire color map, including "invisible" areas.
void set_line_wrap(bool enabled)
Sets the line wrapping behavior.
uint16_t led_count
Stores the total number of physical LEDs, not including invisible pixels. This is calculated for you ...
void shift_color_map_x(int16_t amount, int16_t row=-1)
Shifts the color_map data by amount on the X axis. Useful for scrolling or justification!
void print_xy_table()
Prints the index table for the calculated XY map. Requires Serial.begin() first to function.
uint8_t * mask
Contains the entire mask, including "invisible" areas.
void begin(const uint8_t data_pin, uint8_t pixies_x, uint8_t pixies_y)
Initializes the display buffer, populates the XY coordinate table, defaults the display colors to gre...
void free()
Unfreezes the current mask buffer in memory to allow showing updated text the next time show() is cal...
CRGB get_pixel_color(int32_t x, int32_t y)
Gets the RGB color value at a given pixel coordinate.
void blur(fract8 blur_amount)
Blurs the mask buffer in both axes by blur_amount.
void set_pixel_color(int32_t x, int32_t y, CRGB color)
Sets the RGB color value at a given pixel coordinate.
void println(uint8_t bitmap_col_1, uint8_t bitmap_col_2, uint8_t bitmap_col_3, uint8_t bitmap_col_4, uint8_t bitmap_col_5)
Prints a bitmap to the displays at the current cursor position, (taking five uint8_t as input for the...
void clear()
Clears (blackens) the current mask buffer and resets the cursor to 0,0.
uint16_t matrix_width
Stores the final width of the matrix, including invisible pixels.
CRGBPalette16 current_palette
The current FastLED CRGBPalette16 used for animations.
void show()
Processes 1D image data into truncated versions, sending them to the Pixie Chroma displays.
uint8_t get_pixel_mask(int32_t x, int32_t y)
Gets the mask value at a given pixel coordinate.
uint16_t uv(float x, float y, bool wrap=false)
This wrapper function returns the 1D color_map / mask index of a given OpenGL-style UV coordinate in ...
uint8_t get_cursor_y()
Returns the cursor's Y position.
void blur_x(fract8 blur_amount)
Blurs the mask buffer in the X axis by blur_amount.
void shift_mask_x(int16_t amount, int16_t row=-1)
Shifts the mask data by amount on the X axis. Useful for scrolling or justification!
int16_t get_cursor_x_exact()
Returns the cursor's X position in exact pixel coordinates.
uint16_t xy(int32_t x, int32_t y, bool wrap=false)
This function returns the 1D color_map / mask index of a given 2D coordinate in the display matrix.
float get_uv_x(int32_t x_pixel)
Returns the X-axis UV coordinate for a given X-axis pixel position.
void color_blur_y(fract8 blur_amount)
Blurs the color buffer in the Y axis by blur_amount.
bool unit_tests()
Developer use - automated unit testing of PixieChroma code.
void color_blur_x(fract8 blur_amount)
Blurs the color buffer in the X axis by blur_amount.
void draw_line_color(int16_t x1, int16_t y1, int16_t x2, int16_t y2, CRGB color)
Draws a line in the color map using Bresenham's line algorithm.
void color_dim(uint8_t amount)
Darkens the color buffer by an 8-bit amount.
void set_max_power(float volts, uint16_t milliamps)
Sets the maximum power budget in volts and milliamps.
uint16_t matrix_height
Stores the final height of the matrix, including invisible pixels.
void set_pixel_mask(int32_t x, int32_t y, uint8_t value)
Sets the mask value at a given pixel coordinate.
int16_t get_cursor_y_exact()
Returns the cursor's Y position in exact pixel coordinates.
float frame_rate
Allows the user to access a live frame rate calculation (1 frame latency)
void set_frame_rate_target(uint16_t target)
Sets the target frame rate for animation. This target frame rate is only used to calculate delta in c...
void set_palette(const uint8_t *pal)
Accepts a const uint8_t (8-bit) array to generate a FastLED Gradient Palette at runtime:
void dim(uint8_t amount, bool reset_cursor=false)
Darkens the mask buffer by an 8-bit amount. Optionally resets the cursor position.
void set_update_mode(t_update_mode mode, uint16_t FPS=60)
Allows for automatic show() calls at a specified frames per second if AUTOMATIC is used....
void set_cursor(uint8_t x_position, uint8_t y_position=0)
Sets the cursor position in a 2D context, in whole displays.
void shift_mask_y(int16_t amount)
Shifts the mask data by amount on the Y axis. Useful for scrolling!
void add_char(char chr, int16_t x_pos, int16_t y_pos)
Internal function for rendering a single char to the mask buffer.
void scroll_message(char *message, uint8_t row=0)
Scrolls a message across the matrix by constructing it one character at a time in the dead-space outs...
void set_gamma_correction(bool enabled)
Allows you to enable built-in automatic gamma correction, using a fast LUT in pixie_utility....
CRGB kelvin_to_rgb(uint16_t temperature)
Approximates the conversion of a blackbody radiation temperature (i.e. 3500K) to a CRGB color object.
void set_justification(t_justification justification, int16_t row=-1)
Sets the text justification globally, or by row.
void delay(uint32_t milliseconds)
Custom delay() function from FastLED that allows automatic refreshing of the displays during a delay(...
void begin_quad(uint8_t pixies_per_pin, uint8_t pixies_x, uint8_t pixies_y)
Initializes the display buffer, populates the XY coordinate table, defaults the display colors to gre...
uint8_t get_cursor_x()
Returns the cursor's X position.
void blur_y(fract8 blur_amount)
Blurs the mask buffer in the Y axis by blur_amount.
uint16_t pixel_count
Stores the total number of pixels, including invisible pixels.
void hold()
Freezes the current mask buffer in memory to prevent showing unfinished text if show() automaticall f...
void ANIMATION_STATIC(PixieChroma *_p, float delta)
Shows the current color palette without animation.
void ANIMATION_NULL(PixieChroma *_p, float delta)
It does nothing, but it does nothing REALLY WELL! You can enable this empty function with pix....
const uint8_t printable_ascii_offset
Constant defining the offset into the ASCII table that printable characters begin.
const uint8_t font_col_width
Constant defining the width of a character.
const uint8_t gamma8[]
Used as a fast lookup table for gamma correction.
void(* anim_func)(PixieChroma *_p, float delta)
Used to store the pointer to any preset/custom animation functions the library needs to call during s...
char * dtoa(double input, char *buffer, int precision)
Homebrew C function to convert double precision floats to char*. (Arduino Forum link)