public string ReadSD(ISDCard sdCard) { if (sdCard == null) { throw new NotImplementedException("sd card null"); } return(sdCard.ReadSD()); }
public TelemetryPresenter(ISDCard sdCard, Cpu.Pin pin) { _led = new OutputPort(pin, false); var reader = new PersistanceReader(new TelemetryFormatter()); sdCard.MountFileSystem(); var files = Directory.GetFiles("\\SD"); foreach (var file in files) { ParseToCsv(file,reader); //File.Delete(file); } sdCard.MountMassStorage(); while(true) { _led.Write(true); Thread.Sleep(1000); _led.Write(false); Thread.Sleep(1000); } }
public TelemetryPresenter(ISDCard sdCard, Cpu.Pin pin) { _led = new OutputPort(pin, false); var reader = new PersistanceReader(new TelemetryFormatter()); sdCard.MountFileSystem(); var files = Directory.GetFiles("\\SD"); foreach (var file in files) { ParseToCsv(file, reader); //File.Delete(file); } sdCard.MountMassStorage(); while (true) { _led.Write(true); Thread.Sleep(1000); _led.Write(false); Thread.Sleep(1000); } }
public static void Main() { //Initialize motors first MotorSettings motorSettings = GetMotorSettings(); Motor frontMotor = new PWMMotor(new PWM((Cpu.Pin)FezPin.PWM.Di8, 4000000), motorSettings); Motor rearMotor = new PWMMotor(new PWM((Cpu.Pin)FezPin.PWM.Di10, 4000000), motorSettings); Motor leftMotor = new PWMMotor(new PWM((Cpu.Pin)FezPin.PWM.Di9, 4000000), motorSettings); Motor rightMotor = new PWMMotor(new PWM((Cpu.Pin)FezPin.PWM.Di6, 4000000), motorSettings); MotorMixer mixer = new QuadMixer(frontMotor, rearMotor, leftMotor, rightMotor); //Telemetry ISDCard sdCard = (ISDCard) new SDCard(); if (Configuration.DebugInterface.GetCurrent() == Configuration.DebugInterface.Port.USB1) { sdCard.MountFileSystem(); } else { new TelemetryPresenter(sdCard, (Cpu.Pin)FezPin.Digital.LED); } ILogger logger = new PersistenceWriter(new FileStream(@"\SD\telemetry.bin", FileMode.OpenOrCreate), new TelemetryFormatter()); //Sensors I2CBus twiBus = new I2CBus(); Gyro gyro = new ITG3200(twiBus, GetGyroFactor()); Radio radio = new DefaultRadio(twiBus, GetRadioSettings()); //Control Algoriths PIDSettings[] pidSettings = GetPIDSettings(); AxesController axesController = new AxesController(pidSettings[0], pidSettings[1], pidSettings[2], true); ControllerLoopSettings loopSettings = GetLoopSettings(); Controller controller = new Controller(mixer, axesController, gyro, radio, loopSettings, GetMotorSettings(), logger); //controller.Start(); }