예제 #1
0
    private void on_button_auto_change_debounce_clicked(object o, EventArgs args)
    {
        ChronopicAuto ca = new ChronopicAutoChangeDebounce();

        ca.Write(sp, (int)spin_auto_change_debounce.Value);

        ca = new ChronopicAutoCheckDebounce();
        label_auto_change_debounce.Text = ca.Read(sp);
    }
예제 #2
0
    public int ChangeMultitestFirmware(int debounceChange)
    {
        LogB.Information("change_multitest_firmware 3 a");
        try {
            //write change
            ChronopicAuto ca = new ChronopicAutoChangeDebounce();
            ca.Write(sp, debounceChange);

            //read if ok
            string ms      = "";
            bool   success = false;
            int    tryNum  = 7;         //try to connect seven times
            do
            {
                ca = new ChronopicAutoCheckDebounce();
                ms = ca.Read(sp);

                if (ms.Length == 0)
                {
                    LogB.Error("multitest firmware. ms is null");
                }
                else if (ms[0] == '-')                //is negative
                {
                    LogB.Error("multitest firmware. ms = " + ms);
                }
                else
                {
                    success = true;
                }
                tryNum--;
            } while (!success && tryNum > 0);

            LogB.Debug("multitest firmware. ms = " + ms);

            if (ms == "50 ms")
            {
                return(50);
            }
            else if (ms == "10 ms")
            {
                return(10);
            }
        } catch {
            LogB.Error("Could not change debounce");
        }

        return(-1);
    }
예제 #3
0
    private bool changeMultitestFirmwareDo(int debounceChange)
    {
        LogB.Information("ChangeMultitestFirmwareDo");
        try {
            ChronopicAuto ca = new ChronopicAutoChangeDebounce();
            //write change
            if(cpDoing == 1)
                ca.Write(sp, debounceChange);
            else
                ca.Write(sp2, debounceChange);

            string ms = "";
            bool success = false;
            int tryNum = 10; //try to connect ten times
            do {
                //read if ok
                ca = new ChronopicAutoCheckDebounce();

                if(cpDoing == 1)
                    ms = ca.Read(sp); //ms wil be eg. "50 ms"
                else
                    ms = ca.Read(sp2); //ms wil be eg. "50 ms"
                LogB.Information("ChronopicAutoCheckDebounce: " + ms);

                if(ms.Length == 0)
                    LogB.Error("multitest firmware. ms is null");
                else if(ms[0] == '-') //is negative
                    LogB.Error("multitest firmware. ms = " + ms);
                else if(debounceChange.ToString() + " ms" == ms)
                    success = true;

                tryNum --;
            } while (! success && tryNum > 0);

            LogB.Information("multitest firmware CHANGED to ms = " + ms);

            if(success)
                return true;
        } catch {
            LogB.Error("Could not change debounce");
        }

        return false;
    }
예제 #4
0
 private void on_button_auto_check_debounce_clicked(object o, EventArgs args)
 {
     ChronopicAuto ca = new ChronopicAutoCheckDebounce();
     label_auto_check_debounce.Text = ca.Read(sp);
 }
예제 #5
0
    private void on_button_auto_change_debounce_clicked(object o, EventArgs args)
    {
        ChronopicAuto ca = new ChronopicAutoChangeDebounce();
        ca.Write(sp, (int) spin_auto_change_debounce.Value);

        ca = new ChronopicAutoCheckDebounce();
        label_auto_change_debounce.Text = ca.Read(sp);
    }
예제 #6
0
    private void on_button_auto_check_debounce_clicked(object o, EventArgs args)
    {
        ChronopicAuto ca = new ChronopicAutoCheckDebounce();

        label_auto_check_debounce.Text = ca.Read(sp);
    }
예제 #7
0
    private bool changeMultitestFirmwareDo(int debounceChange)
    {
        LogB.Information("ChangeMultitestFirmwareDo");
        try {
            ChronopicAuto ca = new ChronopicAutoChangeDebounce();
            //write change
            if (cpDoing == 1)
            {
                ca.Write(sp, debounceChange);
            }
            else
            {
                ca.Write(sp2, debounceChange);
            }

            string ms      = "";
            bool   success = false;
            int    tryNum  = 10;         //try to connect ten times
            do
            {
                //read if ok
                ca = new ChronopicAutoCheckDebounce();

                if (cpDoing == 1)
                {
                    ms = ca.Read(sp);                     //ms wil be eg. "50 ms"
                }
                else
                {
                    ms = ca.Read(sp2);                     //ms wil be eg. "50 ms"
                }
                LogB.Information("ChronopicAutoCheckDebounce: " + ms);

                if (ms.Length == 0)
                {
                    LogB.Error("multitest firmware. ms is null");
                }
                else if (ms[0] == '-')                //is negative
                {
                    LogB.Error("multitest firmware. ms = " + ms);
                }
                else if (debounceChange.ToString() + " ms" == ms)
                {
                    success = true;
                }

                tryNum--;
            } while (!success && tryNum > 0);

            LogB.Information("multitest firmware CHANGED to ms = " + ms);

            if (success)
            {
                return(true);
            }
        } catch {
            LogB.Error("Could not change debounce");
        }

        return(false);
    }