Exemplo n.º 1
0
        public RequestHandler(IWheel wheel, IUltrasonic ultrasonic, ILidarDistance lidar, IEncoders encoders, ExampleLogicService exampleLogicService, StudentLogicService studentLogicService)
        {
            _wheel               = wheel;
            _ultrasonic          = ultrasonic;
            _lidar               = lidar;
            _encoders            = encoders;
            _exampleLogic        = exampleLogicService;
            _studentLogicService = studentLogicService;

            _lastActiveLogic = LastActiveLogicType.None;
        }
Exemplo n.º 2
0
        private string StopAnyActiveControlLogic()
        {
            if (_exampleLogic.ActiveExampleLogic.RunExampleLogic)
            {
                _exampleLogic.ActiveExampleLogic.RunExampleLogic = false;
                _lastActiveLogic = LastActiveLogicType.Demo;
                return($"Stopped demo logic: \'{_exampleLogic.ActiveExampleLogic.Details.Title}\'");
            }
            if (_studentLogicService.ActiveStudentLogic.RunStudentLogic)
            {
                _studentLogicService.ActiveStudentLogic.RunStudentLogic = false;
                _lastActiveLogic = LastActiveLogicType.Student;
                return($"Stopped student logic: \'{_studentLogicService.ActiveStudentLogic.Details.Title}\'");
            }

            _wheel.SetSpeed(0, 0, false);
            return("There are no running control logics that can be stopped.\nStopped wheels instead.");
        }