//  private unsafe int getservostructsize()
        //{
        //  return sizeof(ServoStatus);
        //}

        private async void drawMaestroControls()
        {
            // get the number of servos on the board
            UInt16 count = maestroDevice.Maestro.ServoCount;

            // get all the settings stored on the board

            settings = await maestroDevice.Maestro.getUscSettings();

            await maestroDevice.Maestro.updateMaestroVariables();

            Task.WaitAll();  // wait until we have all the data
            Connected         = true;
            tbDeviceName.Text = maestroDevice.Name + " Connected";
            // Create an array of  controls
            maestroChannels = new MaestroControl[count];
            for (UInt16 i = 0; i < count; i++)
            {
                // add a speed , acceleration and target controls to the app
                maestroChannels[i] = new MaestroControl();
                maestroChannels[i].ChannelNumber = i;
                // update the controls to show current values from the board
                maestroChannels[i].Acceleration = Convert.ToUInt16(settings.channelSettings[i].acceleration);
                maestroChannels[i].Speed        = Convert.ToUInt16(settings.channelSettings[i].speed);
                // position / 4 as it returns it in 1/4 microseconds
                maestroChannels[i].Position = Convert.ToUInt16(MaestroDevice.positionToMicroseconds(maestroDevice.Maestro.servoStatus[i].position));
                maestroPanel.Children.Add(maestroChannels[i]);
                // add the callbacks for changes
                maestroChannels[i].positionChanged     += MainPage_positionChanged;
                maestroChannels[i].speedChanged        += MainPage_speedChanged;
                maestroChannels[i].accelerationChanged += MainPage_accelerationChanged;
            }
        }
        private async void updateServoData(byte channel)
        {
            if (maestroDevice.Maestro.microMaestro)
            {
                await maestroDevice.Maestro.updateMaestroVariables();

                maestroChannels[channel].Acceleration = Convert.ToUInt16(settings.channelSettings[channel].acceleration);
                maestroChannels[channel].Speed        = Convert.ToUInt16(settings.channelSettings[channel].speed);
                // position / 4 as it returns it in 1/4 microseconds
                maestroChannels[channel].Position = Convert.ToUInt16(MaestroDevice.positionToMicroseconds(maestroDevice.Maestro.servoStatus[channel].position));
            }
            else
            {
                servoStatus = await maestroDevice.Maestro.getServosMiniMaestro();

                maestroChannels[channel].Position = Convert.ToUInt16(MaestroDevice.positionToMicroseconds(servoStatus[channel].position));
            }
        }