Esempio n. 1
0
        public void SetNewConfig(CPortConfig c, StabilityExchangeConfig stabilityExchangeConfig)
        {
            var p = (CComPort)IoC.Resolve <IPort>();

            p.Reconfig(c);
            _device.ExchangeConfig = stabilityExchangeConfig;
        }
Esempio n. 2
0
        //public static double[] AlphaBetaKoefs { get; private set; }
        // public static InputFilterType FilterType { get; private set; }

        static MainConfig()
        {
            PortConfig     = new CPortConfig();
            WeightKoefs    = new double[4];
            ZeroAdcVals    = new double[4];
            ExchangeConfig = new StabilityExchangeConfig();
            //AlphaBetaKoefs = new double[4];

            if (ConfigurationManager.AppSettings.Count == 0)
            {
                Init();
            }

            Load();
        }
Esempio n. 3
0
        public static void Update(CPortConfig config)
        {
            Configuration currentConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            if (config != null)
            {
                currentConfig.AppSettings.Settings["PortName"].Value    = config.PortName;
                currentConfig.AppSettings.Settings["Baud"].Value        = config.Baud.ToString(CultureInfo.InvariantCulture);
                currentConfig.AppSettings.Settings["AutoConnect"].Value = config.AutoConnect.ToString();
                currentConfig.AppSettings.Settings["UseSLIP"].Value     = config.UseSLIP.ToString();
            }

            currentConfig.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection("appSettings");
            Load();
        }
Esempio n. 4
0
        public void GetWinState(out CPortConfig c, out StabilityExchangeConfig c1)
        {
            var name = combo_portName.SelectedValue;

            c = new CPortConfig()
            {
                AutoConnect = (bool)check_AutoConnect.IsChecked, Baud = MainConfig.PortConfig.Baud, UseSLIP = true, PortName = (string)name
            };

            var n = combo_RxPeriod.SelectedIndex;

            c1 = new StabilityExchangeConfig
            {
                FilterType        = (InputFilterType)combo_RxFilterType.SelectedIndex,
                SavePureADCs      = (bool)check_SavePureADCs.IsChecked,
                CorrectRxMistakes = (bool)check_CorrectMistakes.IsChecked,
                Period            = _periods[n],
                AlphaBetaKoefs    = w_koefs
            };
        }