using System; using Microsoft.SPOT; using Microsoft.VisualStudio.TestTools.UnitTesting; using CPF; using System.Text; using System.Threading; using HWModules; using SWModules; using CPF.Surface_States; using Microsoft.SPOT.Hardware; namespace CPFUnitTests { [TestClass] public class SurfaceOpsUnitTests { [TestMethod] public void TestSurfaceOps() { #region INIT MotherBoard motherboard = MotherBoard.Instance; motherboard.EnableChannelPower(MotherBoard.ChannelNames.GPSChannel); motherboard.EnableChannelPower(MotherBoard.ChannelNames.IridiumChannel); motherboard.EnableChannelPower(MotherBoard.ChannelNames.OptodeChannel); motherboard.EnableChannelPower(MotherBoard.ChannelNames.PTHSensorChannel); motherboard.EnableChannelPower(MotherBoard.ChannelNames.FLBBChannel); Thread.Sleep(1000); MessageQueue messageQ = MessageQueue.Instance; SurfaceOps stateSurfaceOps = new SurfaceOps("Surface Ops"); //BTConsole btConsole = BTConsole.Instance; //btConsole.powerUp(); //btConsole.init(); //EngrLogger.SendConsoleLine += btConsole.SendLine; BuoyancyEngine buoyancyEngine = BuoyancyEngine.Instance; buoyancyEngine.init(); IridiumModem1 iModem = IridiumModem1.Instance; iModem.init(); GPS1 gps = GPS1.Instance; Optode1 optode = Optode1.Instance; optode.init(); RMG185_PTHSensor pthSensor = new RMG185_PTHSensor(); pthSensor.init(); pthSensor.getPTH(); FLBB1 flbbSensor = FLBB1.Instance; flbbSensor.init(); #endregion Mission.createStandardMission(); Mission.documentMission(); SV.MissionStartTime = DateTime.Now; TimeSpan SMCycleStartTime; messageQ.processQ(); //Let's manually put some files in queue SciLogger.EnqueueFileForXfer(@"\SD\data\2018-8-10T0-12-57.eng"); SciLogger.EnqueueFileForXfer(@"\SD\data\2018-8-10T0-30-15.eng"); SciLogger.EnqueueFileForXfer(@"\SD\data\2018-8-10T0-34-32.eng"); EngrLogger.Comment("Starting Surface Ops" ); SV.CurrentState = CPFStates.surfaceOps; stateSurfaceOps.doStateEntryActions(); int stateReturn = 0; short ctr = 0; do { SMCycleStartTime = Utility.GetMachineTime(); stateSurfaceOps.doStateActions(); if (++ctr == 10) { ctr = 0; EngrLogger.Comment("Surface Ops current action = " + stateSurfaceOps.CurrentAction); } messageQ.processQ(); SV.NextState = stateSurfaceOps.checkEvents(); //SV.NextState = stateSurfaceOps.checkGlobalIssues(); StateBase.StateMachinePacer(SMCycleStartTime); } while (SV.NextState == SV.CurrentState && stateSurfaceOps.CurrentAction < (int)SurfaceOps.Action.lastAction); } } }