using System; using System.Text; using System.Linq; using System.Drawing; using System.Diagnostics; using System.Windows.Forms; using System.Threading; using System.Threading.Tasks; using System.Collections.Generic; using Tango.PMR.Hardware; using Tango.PMR.Printing; using Tango.PMR.Stubs; using Tango.Stubs.UI; public void OnExecute(StubManager stubManager) { //SystemResetRequest systemResetRequest = new SystemResetRequest(); //var response1 = stubManager.Run(systemResetRequest); // stubManager.Run("StubGPIOWriteBitRequest" ,"P", 4, true);//ON Thread.Sleep(10); // stubManager.Run("StubGPIOWriteBitRequest" ,"P", 4, false);//OFF // stubManager.Run("StubGPIOWriteBitRequest" ,"P", 4, true);//ON UploadHardwareConfigurationRequest uploadHardwareConfigurationRequest = new UploadHardwareConfigurationRequest(); HardwareConfiguration hardwareConfiguration = new HardwareConfiguration(); HardwareMotor hardwareMotor1 = new HardwareMotor(); hardwareMotor1.HardwareMotorType = Tango.PMR.Hardware.HardwareMotorType.MotoRdriving; hardwareMotor1.MinFrequency = 0; hardwareMotor1.MaxFrequency = 30000; hardwareMotor1.SetMicroStep = 1; hardwareMotor1.MicroStep = 2; hardwareMotor1.MaxChangeSlope = 500; hardwareMotor1.HighLengthMicroSecond = 0; hardwareMotor1.SpeedMaster = false; hardwareMotor1.PulsePerRound = 200; hardwareMotor1.PulleyRadius = 1.3; hardwareMotor1.ConfigWord = 0; hardwareMotor1.DirectionThreadWize = true; hardwareMotor1.KvalHold = 0x28; hardwareMotor1.KvalRun = 0x5f; hardwareMotor1.KvalAcc = 0x5f; hardwareMotor1.KvalDec = 0x5f; hardwareMotor1.OverCurrentThreshold = 7; hardwareMotor1.StallThreshold = 0; hardwareMotor1.ThermalCompensationFactor = 0; hardwareMotor1.LowSpeedOptimization = false; hardwareMotor1.StSlp = 6; hardwareMotor1.IntSpd = 0x44B8; hardwareMotor1.FnSlpAcc = 0x14; hardwareMotor1.FnSlpDec = 0x14; hardwareConfiguration.Motors.Add(hardwareMotor1); stubManager.WriteLine("data.data length = " + hardwareConfiguration.CalculateSize()); uploadHardwareConfigurationRequest.HardwareConfiguration = hardwareConfiguration; var response = stubManager.Run(uploadHardwareConfigurationRequest); /*Thread.Sleep(5000); stubManager.Run("StubGPIOWriteBitRequest" ,"Q", 7, false);//OFF Thread.Sleep(10); stubManager.Run("StubGPIOWriteBitRequest" ,"Q", 4, true);//ON Thread.Sleep(10); stubManager.Run("StubGPIOWriteBitRequest" ,"Q", 4, false);//OFF Thread.Sleep(10); stubManager.Run("StubGPIOWriteBitRequest" ,"Q", 4, true);//ON */ }