• Not The Final Countdown

    davedarko02/17/2020 at 10:55 0 comments

    We had an event with short talks at the xHain Hackerspace recently and we wanted to use the club matrix as a timer for the presenter. I have yet to write a font generator and a script to do that though and the only thing I can kind of reliably do is playing a video. The sane solution: search on youtube for a 15min countdown video, which kind of worked. 

    But since we were at the hackerspace, one member wanted to try to let ffmpeg generate the countdown. The first version of the script by Niklas was almost perfect, but used a PNG as a background image. Then another member (danimo) took a look and removed the background image and let ffmpeg turn the background from green to red in the last minute.

    All done in a filter for ffmpeg. Very nice.

    https://gist.github.com/davedarko/956772590b413734c38af7f55b3eaa04

  • Showing the IP on startup

    davedarko12/27/2019 at 14:16 0 comments

    Here at 36C3 congress the "bla.local" bonjour stuff doesn't work. Incase you see 127.0.1.1 as the IP, you have to edit that out in the following file:

    sudo nano /etc/hosts

  • From 10 x 8x8 LEDs to 40 x 16 LEDs

    davedarko12/24/2019 at 18:30 0 comments

    So this took me a while. The library that I'm using stores the matrix data in a one dimensional array with the length of 40 * 16. 

    Each LED matrix is 8x8 and are connected in that order: 

    0 - 1 - 2 - 3 - 4
                    |
    9 - 8 - 7 - 6 - 5

     And each LED matrix is wired like this:

    0 - 1 - 2 - 3 - 4 - 5 - 6 - 7
    8 - 9 - . . . . . . . . . . .
    . . . . . . . . . . . . . . .
    . . . . . . . . . . . . .  63

    When I finally found the error in this function, I had already written a lookup table for all the 640 LEDs. This is fixed for my setup, but it should be possible to rearrange it for others.

    int matrix_arrangement[] = { 0,1,2,3,4,9,8,7,6,5 };
    void club_matrix_render(void)
    {
        for (int i=0; i<led_count; i++)
        {
            int led_real_x = i % width; // 0 to 39
            int led_real_y = i / width; // 0 to 1
    
            int matrix_number_x = led_real_x / 8; // should be 0 to 4
            int matrix_number_y = led_real_y / 8; // should be 0 or 1
    
            int matrix_number = matrix_number_y * 5 + matrix_number_x; // 0 to 9
    
            int matrix_x = led_real_x % 8; // 0 to 7
            int matrix_y = led_real_y % 8; // 0 to 7
    
            ledstring.channel[0].leds[matrix_arrangement[matrix_number] * 64 + matrix_y * 8 + matrix_x] = matrix[i];
        }
    }