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

namespace CPFUnitTests
{
   [TestClass] 
    public class UnitTest_MotherBoard_EnergyMonitor
    {
        [TestMethod]
        public void TestEnergyMonitorVI()
        {
            HWModules.MotherBoard motherboard = MotherBoard.Instance;

            var em = EnergyMonitorHotel.Instance;

            motherboard.DisableChannelPower(MotherBoard.ChannelNames.IridiumChannel);

            for (int i = 0; i < 50; i++)
            {
                EngrLogger.writeToColumns("Iridium off BATTERY EM DATA V/I:" + em.getVoltsAndMilliAmps());
                Thread.Sleep(100);
            }

            motherboard.EnableChannelPower(MotherBoard.ChannelNames.IridiumChannel);
            Thread.Sleep(2000);

            for (int i = 0; i < 50; i++)
            {
                EngrLogger.writeToColumns("Iridium on BATTERY EM DATA V/I:" + em.getVoltsAndMilliAmps());
                Thread.Sleep(100);
            }

            motherboard.DisableChannelPower(MotherBoard.ChannelNames.IridiumChannel);
            Thread.Sleep(2000);

            for (int i = 0; i < 50; i++)
            {
                EngrLogger.writeToColumns("Iridium off BATTERY EM DATA V/I:" + em.getVoltsAndMilliAmps());
                Thread.Sleep(100);
            }

        }

       /** No longer using this with LHE
        [TestMethod]
        public void TestEnergyMonitorPump()
        {
            EnergyMonitorLTC2946 em = new EnergyMonitorLTC2946(new I2CDevice.Configuration(0xDC>>1, 400),
                EnergyMonitorLTC2946.VoltageSource.Vdd, 0.025, 5.00);
            int i = 10;

            while (--i >0 )
            {
                EnergyMonitorLTC2946.EM_VandI data = em.getVandI();
                EngrLogger.writeToColumns("PUMP V/I:" + data.volts.ToString() + " / " + data.amps.ToString());
                Thread.Sleep(100);
            }
        }
       */

    }
}
