June 22 Beta: Matrix Led Module speed reduction in 4.2

Yesterday, after installing the 4.2 beta on a Spider, I ran a quick test with the Matrix Led Module. My initial reaction was that the display was updating a lot slower than it did with the 4.1 SDK. On 4.1 the painting was almost instantaneous, while on 4.2 I could see each led getting updated.

This morning I ran some tests to verify/quantify what I though I was seeing. The results verified that the module is updating a lot slower in 4.2. In 4.1 the module updates in around 19+ milliseconds, while it takes 113 milliseconds in 4.2.

I suspect that the daisy link is running at a much slower speed under 4.2.

This is the code I ran to test the performance of the module:


using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

namespace Tester42
{
    public partial class Program
    {
        private byte[] clear = new byte[8] { 0, 0, 0, 0, 0, 0, 0, 0 };
        private byte[] allOn = new byte[8] { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };

        private Thread thread = null;

        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
        }

        void button_ButtonPressed(Button sender, Button.ButtonState state)
        {
            thread = new Thread(_Run);
            thread.Start();
        }

        private void _Run()
        {
            // calibrate loop
            DateTime start = DateTime.Now;
            for (int i = 0; i < 1000; i++)
            {

            }
            TimeSpan elapsedLoop = DateTime.Now - start;

            // do test
            start = DateTime.Now;
            for (int i = 0; i < 1000; i++)
            {
                lEDMatrix.DrawBitmap(allOn);
            }
            TimeSpan elapsedTest = DateTime.Now - start - elapsedLoop;

            Debug.Print(elapsedTest.ToString());


        }
    }
}

I suspect it is using managed i2c but it should be using the native version. Easy fix.

And as always thanks mike.