using System.Threading;
using HWModules;
using Microsoft.SPOT;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CPFUnitTests.Core
{
    class StringPotUT
    {
        private BuoyancyEngine buoyancyEngine;

        [TestMethod]
        public void TestPositionSensor()
        {
            var motherboard = MotherBoard.Instance;
            buoyancyEngine = BuoyancyEngine.Instance;

            Debug.Print("Disabling position sensor channel power");
            motherboard.DisableChannelPower(MotherBoard.ChannelNames.PositionSensorChannel);
            Thread.Sleep(3000);

            Debug.Print("Enabling position sensor channel power");
            motherboard.EnableChannelPower(MotherBoard.ChannelNames.PositionSensorChannel);
            //Thread.Sleep(1000);

            for (int i=0; i < 10000; i++)
            {
                var bellowsADC = buoyancyEngine.getBellowsADCValue();
                var bellowsPosition = buoyancyEngine.getBellowsPositionStringPot();
                EngrLogger.Comment(i + "\tUnit Test Bellows Position = " +
                            bellowsPosition.ToString("f3") +
                            " ADC = " + bellowsADC);
                Thread.Sleep(100);
            }
        }
    }
}
