示例#1
0
        public void Node_Has_Valid_RfId_And_Does_Not_Requires_NewRdId_But_does_Not_Exists_InDb()
        {
            //Arrange
            var tp  = Mock <ITimeProvider> ();
            var now = DateTime.UtcNow.Round(TimeSpan.FromSeconds(1));

            tp.SetupGet(_ => _.UtcNow).Returns(now);

            //Act
            Gateway.MessageReceived(this, new NodeStartedReport {
                NeedNewRfAddress = false, FromNodeId = 1, Signature = 1234, Major = 1, Minor = 0
            });

            //Assert
            NodeAgent.Verify(_ => _.Send(It.IsAny <NodeConfigCommand> ()), Times.Never);

            var node = DbContext.Nodes
                       .Include(_ => _.NodeFacts)
                       .Include(_ => _.Configuration)
                       .SingleOrDefault(_ => _.Signature == 1234);

            Assert.Equal(1, node.RfId);
            Assert.Equal(1234, node.Signature);
            Assert.Equal("1.0", node.NodeFacts.Version);
            Assert.Equal(now, node.NodeFacts.LastStartupTime);
            Assert.Equal(0, node.NodeFacts.MaxUpTime);
            NodeAgent.Verify(_ => _.Send(It.IsAny <NodeConfigCommand> ()), Times.Never());
        }
示例#2
0
        public void NothingSentBackIfNodeExistsAndDontNeedNewNodeId()
        {
            Gateway.MessageReceived(this, new NodeStartedReport {
                FromNodeId = 12, Signature = 4567
            });

            NodeAgent.Verify(_ => _.Send(It.IsAny <NodeConfigCommand> ()), Times.Never);
        }
示例#3
0
        protected async Task <NodeAgent> StartNodeAgent()
        {
            var agent = new NodeAgent(theStore, Logger);

            await agent.StartAll();

            return(agent);
        }
示例#4
0
        public void UpdateUI()
        {
            App       p  = Application.Current as App;
            NodeAgent n  = curr_packer.agent;
            byte      vn = curr_packer.vib_addr;

            if (curr_node_index < 0)
            {
                return;
            }

            sub_freq_input.Content   = n.GetNodeReg((byte)curr_node_index, "magnet_freq");
            sub_amp_input.Content    = n.GetNodeReg((byte)curr_node_index, "magnet_amp");
            sub_time_input.Content   = n.GetNodeReg((byte)curr_node_index, "magnet_time");
            sub_filter_input.Content = n.GetNodeReg((byte)curr_node_index, "cs_gain_wordrate");
            wei_otime_input.Content  = n.GetNodeReg((byte)curr_node_index, "open_w");
            wei_dtime_input.Content  = n.GetNodeReg((byte)curr_node_index, "delay_w");
            col_dtime_input.Content  = n.GetNodeReg((byte)curr_node_index, "delay_s");
            col_otime_input.Content  = n.GetNodeReg((byte)curr_node_index, "open_s");
            openwei_input.Content    = n.GetNodeReg((byte)curr_node_index, "delay_f");


            motor_speed_input.Content = n.GetNodeReg((byte)curr_node_index, "motor_speed");

            run_freq.Content     = n.GetNodeReg(curr_packer.vib_addr, "magnet_freq");
            run_amp.Content      = n.GetNodeReg(curr_packer.vib_addr, "magnet_amp");
            run_time.Content     = n.GetNodeReg(curr_packer.vib_addr, "magnet_time");
            btn_prd_no.Content   = curr_packer.curr_cfg.product_no.ToString();
            btn_prd_desc.Content = curr_packer.curr_cfg.product_desc.ToString();
            btn_target.Content   = curr_packer.curr_cfg.target.ToString() + StringResource.str("gram");
            btn_uvar.Content     = curr_packer.curr_cfg.upper_var.ToString() + StringResource.str("gram");
            btn_dvar.Content     = curr_packer.curr_cfg.lower_var.ToString() + StringResource.str("gram");

            cb_autoamp.IsChecked = (curr_packer.curr_cfg.target_comb > 0);
            if (cb_autoamp.IsChecked.Value)
            {
                cb_autoamp.Content = StringResource.str("autoamp_on") + curr_packer.curr_cfg.target_comb.ToString();
            }
            else
            {
                cb_autoamp.Content = StringResource.str("autoamp_off");
            }

            lbl_currNode.Content = (curr_node_index).ToString();
            Rectangle rect = this.FindName("ellipseWithImageBrush") as Rectangle;

            //load the corresponding pictiure.
            if (File.Exists(ProdNum.baseDir + "\\prodpic\\" + StringResource.language + "\\" + curr_packer.curr_cfg.product_desc.ToString() + ".jpg"))
            {
                (rect.Fill as ImageBrush).ImageSource = new BitmapImage(new Uri(ProdNum.baseDir + "\\prodpic\\" + StringResource.language + "\\" + curr_packer.curr_cfg.product_desc.ToString() + ".jpg"));
            }
            else
            {
                (rect.Fill as ImageBrush).ImageSource = new BitmapImage(new Uri(ProdNum.baseDir + "\\prodpic\\default.jpg"));
            }
        }
示例#5
0
        //update UI when a packer is hitted
        public void CombineNodeUI(CombineEventArgs ce)
        {
            foreach (byte naddr in currentApp().packers[ce.packer_id].weight_nodes)
            {
                string param = "wei_node" + naddr.ToString();
                Label  lb    = this.FindName(param) as Label;
                Button btn   = this.FindName(param.Replace("wei_node", "bucket")) as Button;

                NodeAgent agent = currentApp().packers[ce.packer_id].agent;

                //update weight first
                double wt = -100000;
                for (int i = 0; i < ce.release_addrs.Length; i++)
                {
                    if (ce.release_addrs[i] == naddr)
                    {
                        wt = ce.release_wts[i];
                        break;
                    }
                }

                if (wt > -1000 && wt <= WeighNode.MAX_VALID_WEIGHT)
                {
                    lb.Content = wt.ToString("F1");
                }

                //update status display
                if (agent.GetStatus(naddr) == NodeStatus.ST_LOST || agent.GetStatus(naddr) == NodeStatus.ST_DISABLED)
                {
                    btn.Template = this.FindResource("WeightBarError") as ControlTemplate;
                }
                else if (naddr != curr_packer.vib_addr)
                {
                    if (ce.release_addrs.Contains(naddr))
                    {
                        btn.Template = this.FindResource("WeightBarRelease") as ControlTemplate;
                    }
                    else
                    {
                        btn.Template = this.FindResource("WeightBar") as ControlTemplate;
                    }
                }
                btn.ApplyTemplate();
            }
            //Update speed information
            UIPacker p = currentApp().packers[ce.packer_id];

            if (p.status == PackerStatus.RUNNING)
            {
                lbl_speed.Content      = p.speed.ToString();
                lbl_lastweight.Content = p.last_pack_weight.ToString("F1");
                lbl_totalpack.Content  = p.total_packs.ToString();
                RefreshVibUI();
            }
        }
示例#6
0
        public void RefreshRunNodeUI() //node ui update at run time
        {
            lbl_status.Content = "";
            foreach (UIPacker pk in currentApp().packers)
            {
                foreach (byte naddr in pk.weight_nodes)
                {
                    string    param = "wei_node" + naddr.ToString();
                    Label     lb    = this.FindName(param) as Label;
                    Button    btn   = this.FindName(param.Replace("wei_node", "bucket")) as Button;
                    byte      n     = (byte)(RunMode.StringToId(param));
                    NodeAgent agent = pk.agent;

                    double wt = agent.weight(n);
                    if (wt > -1000 && wt <= WeighNode.MAX_VALID_WEIGHT)
                    {
                        lb.Content = agent.weight(n).ToString("F1");
                    }

                    if (agent.GetStatus(n) == NodeStatus.ST_LOST || agent.GetStatus(n) == NodeStatus.ST_DISABLED)
                    {
                        btn.Template = this.FindResource("WeightBarError") as ControlTemplate;
                        btn.ApplyTemplate();
                    }
                    string err = agent.GetErrors(n);
                    if (err != "" && AlertWnd.b_turnon_alert && AlertWnd.b_show_alert)
                    {
                        lbl_status.Content = n.ToString() + ":" + StringResource.str(err.Substring(0, err.IndexOf(';'))) + "\n";
                    }
                }
                if (pk.status == PackerStatus.RUNNING)
                {
                    lbl_speed.Content      = pk.speed.ToString();
                    lbl_lastweight.Content = pk.last_pack_weight.ToString("F1");
                    lbl_totalpack.Content  = pk.total_packs.ToString();

                    RefreshVibUI();
                }
            }
            if (lbl_status.Content.ToString() == "")
            {
                lbl_status.Content    = StringResource.str("normal");
                lbl_status.Foreground = Brushes.Green;
            }
            else
            {
                lbl_status.Foreground = Brushes.Red;
                if (AlertWnd.b_turnon_alert && AlertWnd.b_stop_onalert && (curr_packer.status == PackerStatus.RUNNING))
                {
                    btn_start_click(null, null);
                }
            }
        }
示例#7
0
        private void RefreshNodeUI()
        {
            foreach (UIPacker pk in currentApp().packers)
            {
                foreach (byte naddr in pk.weight_nodes)
                {
                    string    param = "wei_node" + naddr.ToString();
                    Label     lb    = this.FindName(param) as Label;
                    Button    btn   = this.FindName(param.Replace("wei_node", "bucket")) as Button;
                    byte      n     = (byte)(RunMode.StringToId(param));
                    NodeAgent agent = currentApp().packers[pk._pack_id].agent;

                    double wt = agent.weight(n);
                    if (wt > -1000 && wt <= WeighNode.MAX_VALID_WEIGHT)
                    {
                        lb.Content = agent.weight(n).ToString("F1");
                    }
                    else
                    {
                        if (wt > WeighNode.MAX_VALID_WEIGHT && wt < 65537)
                        {
                            lb.Content = "ERR";
                        }
                    }

                    if (agent.GetStatus(n) == NodeStatus.ST_LOST || agent.GetStatus(n) == NodeStatus.ST_DISABLED)
                    {
                        btn.Template = this.FindResource("WeightBarError") as ControlTemplate;
                    }
                    if (agent.GetStatus(n) == NodeStatus.ST_IDLE)
                    {
                        if (btn == curr_btn || bSelectAll)
                        {
                            btn.Template = this.FindResource("WeightBarFocus") as ControlTemplate;
                        }
                        else
                        {
                            btn.Template = this.FindResource("WeightBar") as ControlTemplate;
                        }
                    }
                    btn.ApplyTemplate();
                }
            }
            UIPacker p = curr_packer;

            if (p.status == PackerStatus.RUNNING)
            {
                lbl_speed.Content        = p.speed.ToString();
                lbl_lastweight.Content   = p.last_pack_weight.ToString("F1");
                lbl_totalpack.Content    = p.total_sim_packs.ToString();
                lbl_totalweights.Content = p.total_sim_weights.ToString("F1");
            }
        }
示例#8
0
        private void sub_applyall()
        {
            App       p     = Application.Current as App;
            UIPacker  pack  = curr_packer;
            NodeAgent agent = pack.agent;
            byte      cn    = (byte)curr_node_index;

            bool star = true;

            foreach (byte n in curr_packer.weight_nodes)
            {
                foreach (string reg in apply_regs.Distinct())
                {
                    if (agent.GetStatus(n) == NodeStatus.ST_LOST)
                    {
                        continue;
                    }
                    if (agent.GetStatus(n) == NodeStatus.ST_DISABLED)
                    {
                        continue;
                    }

                    if (n == cn)
                    {
                        continue;
                    }
                    UInt32 val = UInt32.Parse(curr_packer.agent.GetNodeReg(cn, reg));
                    if (!curr_packer.agent.SetNodeReg(n, reg, val))
                    {
                        return;
                    }

                    if (star)
                    {
                        Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background, (Action) delegate
                        {
                            txt_oper.Content = StringResource.str("modifying") + " " + n.ToString() + "*";
                        });
                    }
                    else
                    {
                        Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background, (Action) delegate
                        {
                            txt_oper.Content = StringResource.str("modifying") + " " + n.ToString();
                        });
                    }
                    star = !star;
                }
            }
            apply_regs.Clear();
        }
示例#9
0
        private void HitCombineNodeUI(CombineEventArgs ce)
        {
            foreach (byte naddr in currentApp().packers[ce.packer_id].weight_nodes)
            {
                string    param = "wei_node" + naddr.ToString();
                Label     lb    = this.FindName(param) as Label;
                Button    btn   = this.FindName(param.Replace("wei_node", "bucket")) as Button;
                byte      n     = (byte)(RunMode.StringToId(param));
                NodeAgent agent = currentApp().packers[ce.packer_id].agent;

                if (!ce.release_addrs.Contains(n))
                {
                    continue;
                }
                double wt = agent.weight(n);
                if (wt > -1000 && wt <= WeighNode.MAX_VALID_WEIGHT)
                {
                    lb.Content = agent.weight(n).ToString("F1");
                }

                if (agent.GetStatus(n) == NodeStatus.ST_LOST || agent.GetStatus(n) == NodeStatus.ST_DISABLED)
                {
                    btn.Template = this.FindResource("WeightBarError") as ControlTemplate;
                }
                else
                {
                    if (n != curr_packer.vib_addr)
                    {
                        if (ce.release_addrs.Contains(n))
                        {
                            btn.Template = this.FindResource("WeightBarRelease") as ControlTemplate;
                        }
                        else
                        {
                            btn.Template = this.FindResource("WeightBar") as ControlTemplate;
                            if (agent.GetStatus(n) == NodeStatus.ST_IDLE)
                            {
                                if (btn == curr_btn || bSelectAll)
                                {
                                    btn.Template = this.FindResource("WeightBarFocus") as ControlTemplate;
                                }
                            }
                        }
                    }
                }

                btn.ApplyTemplate();
            }
        }
示例#10
0
        public App()
        {
            System.Diagnostics.Process[] pses = System.Diagnostics.Process.GetProcessesByName("ioex-cs");
            if (pses.Length > 0)
            {
//                System.Diagnostics.Process.GetCurrentProcess().Kill();
//              return;
            }

            if (Environment.CommandLine.IndexOf("/debug") > 0)
            {
                NodeAgent.IsDebug = true;
            }
            StringResource.SetLanguage();
            //app_cfg = new XmlConfig(ProdNum.baseDir +"\\app_config.xml");
            app_cfg = new SqlConfig("app");
            app_cfg.LoadConfigFromFile();

            curr_cfg = app_cfg.Current;

            agent   = new NodeAgent();
            packers = new List <UIPacker>();
            for (int i = 0; i < Int32.Parse(curr_cfg.Element("machine_number").Value); i++)
            {
                UIPacker p = new UIPacker(i, agent);
                p.agent = agent;
                p.InitConfig();
                packers.Add(p);
            }

            singlewnd = new SingleMode(Int32.Parse(curr_cfg.Element("node_number").Value));
            runwnd    = new RunMode(Int32.Parse(curr_cfg.Element("node_number").Value));


            histwnd   = new ProdHistory();
            helpwnd   = new Help();
            kbdwnd    = new kbd();
            bottomwnd = new BottomWnd();
            alertwnd  = new AlertWnd();
            alertwnd.UpdateUI(); //load alert configuration which is in app_config.xml too

            pwdwnd    = new PwdWnd();
            engwnd    = new EngConfigWnd();
            configwnd = new ConfigMenuWnd();
            prodwnd   = new ProdWnd();
            prodnum   = new ProdNum();
        }
示例#11
0
        public UIPacker(int pack_id, NodeAgent nagent)
        {
            agent    = nagent;
            vib_addr = 0xff;
            bot_addr = 0xff;

            _pack_id = pack_id;
            status   = PackerStatus.IDLE;


            weight_nodes = new List <byte>();
            nodes_config = new Dictionary <byte, SqlConfig>();


            pkg_confs = new SqlConfig("pack" + pack_id.ToString());

            pkg_confs.LoadConfigFromFile();

            _curr_cfg = new PackerConfig();
            packhist  = new Queue <onepack>();
        }
示例#12
0
        private void calibrate(string calreg)
        {
            App  p = Application.Current as App;
            Byte i = Convert.ToByte(curr_sel);

            if (curr_sel == -1)
            {
                return;
            }
            if (calreg == "cali0")
            {
                NodeAgent n = p.agent;
                if (curr_sel >= 0)
                {
                    if (MessageBox.Show(StringResource.str("put_empty"), "", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel)
                    {
                        return;
                    }

                    n.ClearNodeReg(i, "cs_mtrl");
                    string cs_mtrl_val = n.GetNodeReg(i, "cs_mtrl");
                    UInt32 val         = UInt32.Parse(cs_mtrl_val);
                    if (val <= WeighNode.MAX_VALID_WEIGHT)
                    {
                        n.SetNodeReg(i, "cs_zero", UInt32.Parse(cs_mtrl_val));
                        n.Action(i, "flash");
                        MessageBox.Show(StringResource.str("calidone"));
                        label3_MouseLeftButtonUp(null, null);
                    }
                    else
                    {
                        MessageBox.Show(StringResource.str("tryagain"));
                    }
                }
            }
            if (calreg == "empty")
            {
                NodeAgent n = p.agent;
                if (curr_sel >= 0)
                {
                    n.Action(i, "empty");
                }
                return;
            }
            if (calreg == "cali1")
            {
                KbdData(calreg, "20");
            }
            if (calreg == "cali2")
            {
                KbdData(calreg, "50");
            }
            if (calreg == "cali3")
            {
                KbdData(calreg, "100");
            }
            if (calreg == "cali4")
            {
                KbdData(calreg, "200");
            }
            if (calreg == "cali5")
            {
                KbdData(calreg, "300");
            }
            if (calreg == "cali6")
            {
                KbdData(calreg, "400");
            }
            if (calreg == "cali7")
            {
                KbdData(calreg, "500");
            }
            if (calreg == "cali8")
            {
                KbdData(calreg, "700");
            }
            if (calreg == "cali9")
            {
                KbdData(calreg, "900");
            }
            if (calreg == "cali10")
            {
                KbdData(calreg, "1000");
            }
            //p.WeightAction(i, "query"); //update the readings
        }
示例#13
0
        public void KbdData(string param, string data)
        {
            App      p   = Application.Current as App;
            XElement cfg = p.curr_cfg;

            if (param == "entersys")
            {
                if (Password.compare_pwd("admin", data))
                {
                    Process app = new Process();
                    app.StartInfo.FileName  = "Explorer.exe";
                    app.StartInfo.Arguments = "";
                    app.Start();
                    Thread.Sleep(2000);
                    Type   shellType   = Type.GetTypeFromProgID("Shell.Application");
                    object shellObject = System.Activator.CreateInstance(shellType);
                    shellType.InvokeMember("ToggleDesktop", System.Reflection.BindingFlags.InvokeMethod, null, shellObject, null);
                }
                return;
            }
            if (param == "quitlock")
            {
                if (Password.compare_pwd("lock", data))
                {
                    b_lockon = false;
                    Password.set_pwd("lock", "0");
                    b_lockon = false;
                    (Application.Current as App).runwnd.Disable(Visibility.Visible);
                    (Application.Current as App).singlewnd.Disable(Visibility.Visible);
                    UpdateDisplay(true);
                }
            }
            if (param == "enterlock")
            {
                //App should expire after desired packer number reached , data is the actual packer count
                Password.set_pwd("lock_on", data);
                DeleteRegist("lock_on");
                WTRegedit("lock_on", data);
                Password.set_pwd("lock", data);
                p.SaveAppConfig();
                b_lockon = true;
                UpdateDisplay(false);
            }
            if (param.IndexOf("reg_") == 0)
            {
                Button  btn;
                SubNode n = null;
                if (curr_sel == -1)
                {
                    return;
                }
                Byte i = Convert.ToByte(curr_sel);

                if (i < 17)
                {
                    btn = IdToButton(i.ToString());
                    n   = p.agent[i];
                }
                else
                {
                    btn = IdToButton("36");
                    n   = p.agent.missingnode;
                }
                if (n["addr"] != null)
                {
                    param    = param.Remove(0, 4);
                    n[param] = UInt32.Parse(data);
                    Thread.Sleep(1000);


                    btn_refreshreg_Click(null, null);
                }
            }
            if (param.IndexOf("chgnd_") == 0)
            {
                Byte oldaddr = Byte.Parse(param.Remove(0, 6));
                Byte newaddr = Byte.Parse(data);

                Button btn = IdToButton(newaddr.ToString());
                if (btn != null && newaddr < 36) //valid new address
                {
                    if (btn.Visibility != Visibility.Visible)
                    {
                        SubNode oldn;
                        SubNode newn;
                        if (oldaddr == 36)
                        {
                            oldn = p.agent.missingnode;
                        }
                        else
                        {
                            oldn = p.agent[oldaddr];
                        }
                        newn                   = p.agent[newaddr];
                        newaddr               += 0xC0;
                        newn.status            = NodeStatus.ST_IDLE;
                        oldn["test_mode_reg2"] = newaddr;

                        Thread.Sleep(500);
                        newn.status  = NodeStatus.ST_IDLE;
                        newn["addr"] = null;
                        oldn.status  = NodeStatus.ST_LOST;
                        Thread.Sleep(100);
                        if (newn["addr"].HasValue)
                        {
                            MessageBox.Show(StringResource.str("change_addr_success"));
                            return;
                        }
                    }
                }

                MessageBox.Show(StringResource.str("change_addr_fail"));
            }
            if (param != "cali0" && (param.IndexOf("cali") == 0)) //cali1 to cali10
            {
                string msg = StringResource.str("put_poise") + "(" + data + StringResource.str("gram") + ")";

                if (MessageBox.Show(msg, "", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel)
                {
                    return;
                }
                NodeAgent n = p.agent;
                int       i = RunMode.StringToId(param) - 1;
                if (curr_sel >= 0)
                {
                    n.ClearNodeReg((byte)curr_sel, "cs_mtrl");
                    string cs_mtrl_val = n.GetNodeReg((byte)curr_sel, "cs_mtrl");
                    UInt32 val;
                    if (UInt32.TryParse(cs_mtrl_val, out val))
                    {
                        if (val <= WeighNode.MAX_VALID_WEIGHT)
                        {
                            if (i < 5)
                            {
                                n.SetNodeReg((byte)curr_sel, "poise_weight_gram" + i.ToString(), UInt32.Parse(cs_mtrl_val));
                            }
                            else
                            {
                                n.SetNodeReg((byte)curr_sel, "cs_poise" + (i - 5).ToString(), UInt32.Parse(cs_mtrl_val));
                            }
                            n.Action((byte)curr_sel, "flash");
                            MessageBox.Show(StringResource.str("calidone"));
                            label3_MouseLeftButtonUp(null, null);
                            return;
                        }
                    }
                    MessageBox.Show(StringResource.str("tryagain"));
                }
                return;
            }
        }
示例#14
0
        public void KbdData(string param, string data)
        {
            //update the display based on keyboard input
            App  p = Application.Current as App;
            bool bNeedUpdateComb = false; //whether target weight of each node is required

            try
            {
                UIPacker  pack = curr_packer;
                NodeAgent n    = curr_packer.agent;
                if (param == "sub_freq_input")
                {
                    n.SetNodeReg((byte)curr_node_index, "magnet_freq", UInt32.Parse(data));
                    apply_regs.Insert(0, "magnet_freq");
                }
                if (param == "sub_amp_input")
                {
                    n.SetNodeReg((byte)curr_node_index, "magnet_amp", UInt32.Parse(data));
                    apply_regs.Insert(0, "magnet_amp");
                }
                if (param == "sub_time_input")
                {
                    n.SetNodeReg((byte)curr_node_index, "magnet_time", UInt32.Parse(data));
                    apply_regs.Insert(0, "magnet_time");
                }
                if (param == "sub_filter_input")
                {
                    n.SetNodeReg((byte)curr_node_index, "cs_gain_wordrate", UInt32.Parse(data));
                    apply_regs.Insert(0, "cs_gain_wordrate");
                }

                if (param == "wei_otime_input")
                {
                    n.SetNodeReg((byte)curr_node_index, "open_w", UInt32.Parse(data));
                    apply_regs.Insert(0, "open_w");
                }
                if (param == "wei_dtime_input")
                {
                    n.SetNodeReg((byte)curr_node_index, "delay_w", UInt32.Parse(data));
                    apply_regs.Insert(0, "delay_w");
                }
                if (param == "col_dtime_input")
                {
                    n.SetNodeReg((byte)curr_node_index, "delay_s", UInt32.Parse(data));
                    apply_regs.Insert(0, "delay_s");
                }
                if (param == "col_otime_input")
                {
                    n.SetNodeReg((byte)curr_node_index, "open_s", UInt32.Parse(data));
                    apply_regs.Insert(0, "open_s");
                }
                if (param == "openwei_input")
                {
                    n.SetNodeReg((byte)curr_node_index, "delay_f", UInt32.Parse(data));
                    apply_regs.Insert(0, "delay_f");
                }
                if (param == "motor_speed_input")
                {
                    n.SetNodeReg((byte)curr_node_index, "motor_speed", UInt32.Parse(data));
                    apply_regs.Insert(0, "motor_speed");
                }
                if (param == "run_freq")
                {
                    n.SetNodeReg(curr_packer.vib_addr, "magnet_freq", UInt32.Parse(data));
                }
                if (param == "run_time")
                {
                    n.SetNodeReg(curr_packer.vib_addr, "magnet_time", UInt32.Parse(data));
                }

                if (param == "run_amp")
                {
                    n.SetNodeReg(curr_packer.vib_addr, "magnet_amp", UInt32.Parse(data));
                }
                if (param == "autoamp")
                {
                    curr_packer.curr_cfg.target_comb = Double.Parse(data);
                    cb_autoamp.IsChecked             = (curr_packer.curr_cfg.target_comb > 1);
                    bNeedUpdateComb = true;
                }
                if (param == "target")
                {
                    curr_packer.curr_cfg.target = Double.Parse(data);
                    bNeedUpdateComb             = true;
                }
                if (param == "uvar")
                {
                    curr_packer.curr_cfg.upper_var = Double.Parse(data);
                }
                if (param == "dvar")
                {
                    curr_packer.curr_cfg.lower_var = Double.Parse(data);
                }


                ShowStatus("modifying");
                if (bNeedUpdateComb)
                {
                    curr_packer.UpdateEachNodeTarget();
                }
                lastcall = "UpdateUI";
            }
            catch (System.Exception e)
            {
                //MessageBox.Show("Invalid Parameter");
                return;
            }
        }