示例#1
0
    public ChronopicAutoDetect(ChronopicType type, Config.AutodetectPortEnum configAutoDetect)
    {
        /*
         * Try to detect a normal 4MHz Chronopic on a 20MHz encoder fails
         * but encoder can be used normally
         * In the other hand, try to detect an encoder on a 4MHz Chronopic fails
         * but encoder cannot be used until 'reset' or disconnect cable (and can be problems with Chronojump GUI)
         *
         * So the solution is:
         * if we are searching encoder, on every port first check if 4MHz connection can be stablished, if it's Found, then normal Chronopic is found
         * if is not Fount, then search for the encoder.
         *
         * The only problem is in normal Chronopics with old firmware (without the 'J' read/write
         * they will not work after trying to be recognised as an encoder, until reset or disconnect cable
         *
         */
        this.searched         = type;
        this.configAutoDetect = configAutoDetect;

        if (configAutoDetect == Config.AutodetectPortEnum.INACTIVE)
        {
            return;

            Detected = "";
        }

        //no matter if we are searching for 4MHz or 20MHz (encoder)
        //first see if 4MHz is connected
        ChronopicAuto caNormal = new ChronopicAutoCheck();

        caNormal.IsEncoder = false;            //for the bauds.

        autoDetect(caNormal);
    }
示例#2
0
 public void on_radio_autodetect_discard_first_toggled(object obj, EventArgs args)
 {
     if (autodetectSignalEnabled && radio_autodetect_discard_first.Active)
     {
         configAutodetectPort = Config.AutodetectPortEnum.DISCARDFIRST;
         Config.UpdateField("AutodetectPort", configAutodetectPort.ToString());
     }
 }
示例#3
0
 public void on_radio_autodetect_inactive_toggled(object obj, EventArgs args)
 {
     if (autodetectSignalEnabled && radio_autodetect_inactive.Active)
     {
         configAutodetectPort = Config.AutodetectPortEnum.INACTIVE;
         Config.UpdateField("AutodetectPort", configAutodetectPort.ToString());
     }
 }
示例#4
0
    public ChronopicDetect(SerialPort sp, Gtk.ProgressBar progressbar, Gtk.Button button_cancel, Gtk.Button button_info,
                           Config.AutodetectPortEnum configAutoDetect)
    {
        this.sp               = sp;
        this.progressbar      = progressbar;
        this.button_cancel    = button_cancel;
        this.configAutoDetect = configAutoDetect;

        button_cancel.Clicked += new EventHandler(on_button_cancel_clicked);
        button_info.Clicked   += new EventHandler(on_button_info_clicked);

        FakeButtonDone = new Gtk.Button();
        Detecting      = false;
    }
示例#5
0
    private void configInit()
    {
        //trying new Config class
        Config config = new Config();
        config.Read();
        LogB.Information("Config:\n" + config.ToString());

        /*
         * TODO: do an else to any option
         * is good to do the else here because user can import a configuration at any time
         * and things need to be restored to default position in glade
         *
         * But note this has to be executed only if it has changed!!
         */

        if(config.Maximized)
            app1.Maximize();
        if(config.CustomButtons) {

            //---- capture tab ----

            hbox_encoder_capture_extra_mass_no_raspberry.Visible = false;
            hbox_encoder_capture_extra_mass_raspberry.Visible = true;

            button_encoder_select.HeightRequest = 40;
            //this will make all encoder capture controls taller
            button_encoder_capture.SetSizeRequest(125,60);

            spin_encoder_im_weights_n.Visible = false;
            hbox_encoder_im_weights_n.Visible = true;

            //---- analyze tab ----

            hbox_encoder_analyze_signal_or_curves.HeightRequest = 40;
            button_encoder_analyze.SetSizeRequest(120,40);
        }
        if(! config.UseVideo) {
            useVideo = false;
            alignment_video_encoder.Visible = false;
        }

        //Auto-detect stuff
        configAutodetectPort = config.AutodetectPort;

        autodetectSignalEnabled = false; //do not raise signals that could rewrite the config file (loop)

        if(configAutodetectPort == Config.AutodetectPortEnum.ACTIVE)
            radio_autodetect_active.Active = true;
        else if(configAutodetectPort == Config.AutodetectPortEnum.INACTIVE)
            radio_autodetect_inactive.Active = true;
        else // (configAutodetectPort == Config.AutodetectPortEnum.DISCARDFIRST)
            radio_autodetect_discard_first.Active = true;

        autodetectSignalEnabled = true; //activate signals again

        //show only power
        if(config.OnlyEncoderGravitatory)
            select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERGRAVITATORY);
        else if(config.OnlyEncoderInertial)
            select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERINERTIAL);

        if(config.EncoderCaptureShowOnlyBars)
        {
            //attention: this makes encoder_capture_signal_drawingarea == null
            vpaned_encoder_capture_video_and_set_graph.Visible = false;

            vpaned_encoder_main.Remove(alignment_treeview_encoder_capture_curves);
            vbox_treeview_encoder_at_second_page.PackStart(alignment_treeview_encoder_capture_curves);
            notebook_encoder_capture_main.ShowTabs = true;
        } else {
            /*
             * is good to do the else here because user can import a configuration at any time
             * and things need to be restored to default position in glade
             *
             * But note this has to be executed only if it has changed!!
             */
            /*
            notebook_encoder_capture_main.ShowTabs = false;
            vbox_treeview_encoder_at_second_page.Remove(alignment_treeview_encoder_capture_curves);
            vpaned_encoder_main.PackStart(alignment_treeview_encoder_capture_curves);
            */
        }

        encoderUpdateTreeViewWhileCapturing = config.EncoderUpdateTreeViewWhileCapturing;

        if(config.PersonWinHide) {
            //vbox_persons.Visible = false;
            notebook_session_person.Visible = false;
            hbox_encoder_person.Visible = true;
        }

        if(config.EncoderAnalyzeHide) {
            hbox_encoder_sup_capture_analyze_two_buttons.Visible = false;
        }

        if(config.Econf != null) {
            encoderConfigurationDefinedFromFile = true;
            encoderConfigurationCurrent = config.Econf;
            encoderConfigurationGUIUpdate();
            //TODO: allow to see full data, but don't allow to change it (Open window content as unsensitive)
        }

        if(config.SessionMode == Config.SessionModeEnum.UNIQUE)
        {
            main_menu.Visible = false;
            button_preferences_not_menu.Visible = true;

            if(! Sqlite.Exists(false, Constants.SessionTable, "session")) {
                //this creates the session and inserts at DB
                currentSession = new Session(
                        "session", "", DateTime.Today,	//name, place, dateTime
                        Constants.SportUndefinedID, Constants.SpeciallityUndefinedID, Constants.LevelUndefinedID,
                        "", Constants.ServerUndefinedID); //comments, serverID
            } else
                currentSession = SqliteSession.SelectByName("session");

            on_load_session_accepted();
        }

        //TODO
        //RunScriptOnExit

        /*
        if(linuxType == linuxTypeEnum.NETWORKS) {
            //mostrar directament el power
            select_menuitem_mode_toggled(Constants.Menuitem_modes.POWER);

            //no mostrar menu
            main_menu.Visible = false;

            //no mostrar persones
            //vbox_persons.Visible = false;
            //TODO: rfid can be here, also machine, maybe weight, other features
            //time, gym, ...

            //show rfid
            hbox_rfid.Visible = true;

            //to test display, just make sensitive the top controls, but beware there's no session yet and no person
            notebook_sup.Sensitive = true;
            hbox_encoder_sup_capture_analyze.Sensitive = true;
            notebook_encoder_sup.Sensitive = false;
        }
        */
    }
示例#6
0
 public void on_radio_autodetect_inactive_toggled(object obj, EventArgs args)
 {
     if(autodetectSignalEnabled && radio_autodetect_inactive.Active)
     {
         configAutodetectPort = Config.AutodetectPortEnum.INACTIVE;
         Config.UpdateField("AutodetectPort", configAutodetectPort.ToString());
     }
 }
示例#7
0
 public void on_radio_autodetect_discard_first_toggled(object obj, EventArgs args)
 {
     if(autodetectSignalEnabled && radio_autodetect_discard_first.Active)
     {
         configAutodetectPort = Config.AutodetectPortEnum.DISCARDFIRST;
         Config.UpdateField("AutodetectPort", configAutodetectPort.ToString());
     }
 }
示例#8
0
    private void configInit()
    {
        //trying new Config class
        Config config = new Config();

        config.Read();
        LogB.Information("Config:\n" + config.ToString());

        /*
         * TODO: do an else to any option
         * is good to do the else here because user can import a configuration at any time
         * and things need to be restored to default position in glade
         *
         * But note this has to be executed only if it has changed!!
         */

        if (config.Maximized)
        {
            app1.Maximize();
        }
        if (config.CustomButtons)
        {
            //---- capture tab ----

            hbox_encoder_capture_extra_mass_no_raspberry.Visible = false;
            hbox_encoder_capture_extra_mass_raspberry.Visible    = true;

            button_encoder_select.HeightRequest = 40;
            //this will make all encoder capture controls taller
            //88 then buttons will be the same height than button_encoder_select. The 8 extra is for the vertical space
            button_encoder_capture.SetSizeRequest(125, 88);
            //button_encoder_capture.HeightRequest = 88;

            spin_encoder_im_weights_n.Visible = false;
            hbox_encoder_im_weights_n.Visible = true;

            //---- analyze tab ----

            hbox_encoder_analyze_signal_or_curves.HeightRequest = 40;
            button_encoder_analyze.SetSizeRequest(120, 40);
        }
        if (!config.UseVideo)
        {
            useVideo = false;
            alignment_video_encoder.Visible = false;
        }

        //Auto-detect stuff
        configAutodetectPort = config.AutodetectPort;

        autodetectSignalEnabled = false;         //do not raise signals that could rewrite the config file (loop)

        if (configAutodetectPort == Config.AutodetectPortEnum.ACTIVE)
        {
            radio_autodetect_active.Active = true;
        }
        else if (configAutodetectPort == Config.AutodetectPortEnum.INACTIVE)
        {
            radio_autodetect_inactive.Active = true;
        }
        else         // (configAutodetectPort == Config.AutodetectPortEnum.DISCARDFIRST)
        {
            radio_autodetect_discard_first.Active = true;
        }

        autodetectSignalEnabled = true;         //activate signals again


        //show only power
        if (config.OnlyEncoderGravitatory)
        {
            select_menuitem_mode_toggled(menuitem_modes.POWERGRAVITATORY);
        }
        else if (config.OnlyEncoderInertial)
        {
            select_menuitem_mode_toggled(menuitem_modes.POWERINERTIAL);
        }

        if (config.EncoderCaptureShowOnlyBars)
        {
            vpaned_encoder_capture_video_and_set_graph.Visible = false;

            vpaned_encoder_main.Remove(alignment_treeview_encoder_capture_curves);
            vbox_treeview_encoder_at_second_page.PackStart(alignment_treeview_encoder_capture_curves);
            notebook_encoder_capture_main.ShowTabs = true;
        }
        else
        {
            /*
             * is good to do the else here because user can import a configuration at any time
             * and things need to be restored to default position in glade
             *
             * But note this has to be executed only if it has changed!!
             */
            /*
             * notebook_encoder_capture_main.ShowTabs = false;
             * vbox_treeview_encoder_at_second_page.Remove(alignment_treeview_encoder_capture_curves);
             * vpaned_encoder_main.PackStart(alignment_treeview_encoder_capture_curves);
             */
        }

        encoderUpdateTreeViewWhileCapturing = config.EncoderUpdateTreeViewWhileCapturing;

        if (config.PersonWinHide)
        {
            //vbox_persons.Visible = false;
            notebook_session_person.Visible = false;
            hbox_encoder_person.Visible     = true;
        }

        if (config.EncoderAnalyzeHide)
        {
            hbox_encoder_sup_capture_analyze_two_buttons.Visible = false;
        }

        if (config.Econf != null)
        {
            encoderConfigurationDefinedFromFile = true;
            encoderConfigurationCurrent         = config.Econf;
            encoderConfigurationGUIUpdate();
            //TODO: allow to see full data, but don't allow to change it (Open window content as unsensitive)
        }

        if (config.SessionMode == Config.SessionModeEnum.UNIQUE)
        {
            main_menu.Visible = false;
            button_preferences_not_menu.Visible = true;

            if (!Sqlite.Exists(false, Constants.SessionTable, "session"))
            {
                //this creates the session and inserts at DB
                currentSession = new Session(
                    "session", "", DateTime.Today,                              //name, place, dateTime
                    Constants.SportUndefinedID, Constants.SpeciallityUndefinedID, Constants.LevelUndefinedID,
                    "", Constants.ServerUndefinedID);                           //comments, serverID
            }
            else
            {
                currentSession = SqliteSession.SelectByName("session");
            }

            on_load_session_accepted();
        }

        //TODO
        //RunScriptOnExit

        /*
         * if(linuxType == linuxTypeEnum.NETWORKS) {
         *      //mostrar directament el power
         *      select_menuitem_mode_toggled(menuitem_modes.POWER);
         *
         *      //no mostrar menu
         *      main_menu.Visible = false;
         *
         *      //no mostrar persones
         *      //vbox_persons.Visible = false;
         *      //TODO: rfid can be here, also machine, maybe weight, other features
         *      //time, gym, ...
         *
         *      //show rfid
         *      hbox_rfid.Visible = true;
         *
         *      //to test display, just make sensitive the top controls, but beware there's no session yet and no person
         *      notebook_sup.Sensitive = true;
         *      hbox_encoder_sup_capture_analyze.Sensitive = true;
         *      notebook_encoder_sup.Sensitive = false;
         * }
         */
    }