private void on_button_rhythm_default_clicked(object o, EventArgs args)
    {
        //have default values
        EncoderRhythm encoderRhythm = new EncoderRhythm();

        //But have rhythm active
        encoderRhythm.Active = true;

        //modify widgets
        encoder_rhythm_set_values(encoderRhythm);
    }
Пример #2
0
    /*
     * on inertial rest is after ecc.
     * on gravitatory rest can be after ecc or con (see RestAfterEcc)
     */


    // Constructor ---------------------

    public EncoderRhythmExecute(EncoderRhythm encoderRhythm, bool gravitatory)
    {
        this.encoderRhythm = encoderRhythm;
        //this.eccon_ec = eccon_ec;
        this.gravitatory = gravitatory;

        FirstPhaseDone = false;
        textRepetition = "";
        textRest       = "";

        phaseStartDT = DateTime.MinValue;
        nreps        = 1;  //start with 1 because it's the phase user will do before calling here
    }
    public void View(Constants.BellModes bellMode, bool volumeOn, Preferences.GstreamerTypes gstreamer,
                     Constants.EncoderVariablesCapture encoderMainVariable, EncoderRhythm encoderRhythm)
    {
        //when user "deleted_event" the window
        if (RepetitiveConditionsWindowBox == null)
        {
            RepetitiveConditionsWindowBox = new RepetitiveConditionsWindow();
        }
        RepetitiveConditionsWindowBox.showWidgets(bellMode, encoderMainVariable, encoderRhythm);

        RepetitiveConditionsWindowBox.repetitive_conditions.Show();
        RepetitiveConditionsWindowBox.volumeOn  = volumeOn;
        RepetitiveConditionsWindowBox.gstreamer = gstreamer;
    }
    private void encoder_rhythm_set_values(EncoderRhythm encoderRhythm)
    {
        check_rhythm_active.Active = encoderRhythm.Active;

        /*
         * if(encoderRhythm.RepsOrPhases)
         *      radio_rhythm_together.Active = true;
         * else
         *      radio_rhythm_separated.Active = true;
         */
        //just before 1.8.0 always use separated
        radio_rhythm_separated.Active = true;

        //spin_rhythm_rep.Value = encoderRhythm.RepSeconds;
        spin_rhythm_ecc.Value           = encoderRhythm.EccSeconds;
        spin_rhythm_con.Value           = encoderRhythm.ConSeconds;
        spin_rhythm_rest_reps.Value     = encoderRhythm.RestRepsSeconds;
        spin_rhythm_reps_cluster.Value  = encoderRhythm.RepsCluster;
        spin_rhythm_rest_clusters.Value = encoderRhythm.RestClustersSeconds;

        frame_rhythm.Visible = check_rhythm_active.Active;

        if (encoderRhythm.RepsOrPhases)
        {
            notebook_duration_repetition.CurrentPage = 0;
        }
        else
        {
            notebook_duration_repetition.CurrentPage = 1;
        }

        if (encoderRhythm.RestRepsSeconds < 0.1)
        {
            check_rhythm_rest_reps.Active = false;
        }

        if (encoderRhythm.UseClusters())
        {
            check_rhythm_use_clusters.Active = true;
            vbox_rhythm_cluster.Visible      = true;
        }
        else
        {
            check_rhythm_use_clusters.Active = false;
            vbox_rhythm_cluster.Visible      = false;
        }

        should_show_vbox_rhythm_rest_after();
    }
Пример #5
0
    protected internal static void initializeTable(string databaseVersion, bool creatingBlankDatabase)
    {
        using (SqliteTransaction tr = dbcon.BeginTransaction())
        {
            using (SqliteCommand dbcmdTr = dbcon.CreateCommand())
            {
                dbcmdTr.Transaction = tr;

                Insert("databaseVersion", databaseVersion, dbcmdTr);

                if (UtilAll.IsWindows() || creatingBlankDatabase)
                {
                    Insert("chronopicPort", Constants.ChronopicDefaultPortWindows, dbcmdTr);
                }
                else
                {
                    Insert("chronopicPort", Constants.ChronopicDefaultPortLinux, dbcmdTr);
                }

                //appearance
                Insert("maximized", Preferences.MaximizedTypes.NO.ToString(), dbcmdTr);
                Insert("personWinHide", "False", dbcmdTr);
                Insert("personPhoto", "True", dbcmdTr);
                Insert("encoderCaptureShowOnlyBars", "False", dbcmdTr);
                Insert("encoderCaptureShowNRepetitions", "-1", dbcmdTr);
                Insert("digitsNumber", "3", dbcmdTr);
                Insert("showPower", "True", dbcmdTr);
                Insert("showStiffness", "True", dbcmdTr);
                Insert("showInitialSpeed", "True", dbcmdTr);
                Insert("showAngle", "False", dbcmdTr);                  //for treeviewjumps
                Insert("showQIndex", "False", dbcmdTr);                 //for treeviewJumps
                Insert("showDjIndex", "False", dbcmdTr);                //for treeviewJumps
                Insert("simulated", "True", dbcmdTr);
                Insert("weightStatsPercent", "False", dbcmdTr);
                Insert("askDeletion", "True", dbcmdTr);
                Insert("heightPreferred", "False", dbcmdTr);
                Insert("metersSecondsPreferred", "True", dbcmdTr);
                Insert("language", "", dbcmdTr);
                Insert("crashLogLanguage", "", dbcmdTr);
                Insert("allowFinishRjAfterTime", "True", dbcmdTr);
                Insert("volumeOn", "True", dbcmdTr);
                Insert(Preferences.GstreamerStr, Preferences.GstreamerTypes.GST_0_1.ToString(), dbcmdTr);
                Insert("videoOn", "True", dbcmdTr);
                Insert("evaluatorServerID", "-1", dbcmdTr);
                Insert("versionAvailable", "", dbcmdTr);
                Insert("runSpeedStartArrival", "True", dbcmdTr);

                Insert("runDoubleContactsMode",
                       Constants.DoubleContact.LAST.ToString(), dbcmdTr);
                Insert("runDoubleContactsMS", "300", dbcmdTr);
                Insert("runIDoubleContactsMode",
                       Constants.DoubleContact.AVERAGE.ToString(), dbcmdTr);
                Insert("runIDoubleContactsMS", "300", dbcmdTr);

                Insert("thresholdJumps", "50", dbcmdTr);
                Insert("thresholdRuns", "10", dbcmdTr);
                Insert("thresholdOther", "50", dbcmdTr);

                Random rnd       = new Random();
                string machineID = rnd.Next().ToString();
                Insert("machineID", machineID, dbcmdTr);

                Insert("multimediaStorage", Constants.MultimediaStorage.BYSESSION.ToString(), dbcmdTr);

                //encoder
                Insert("encoderCaptureTime", "60", dbcmdTr);
                Insert("encoderCaptureInactivityEndTime", "3", dbcmdTr);
                Insert("encoderCaptureMainVariable", Constants.EncoderVariablesCapture.MeanPower.ToString(), dbcmdTr);
                Insert("encoderCaptureMinHeightGravitatory", "20", dbcmdTr);
                Insert("encoderCaptureMinHeightInertial", "5", dbcmdTr);
                Insert("encoderCaptureInertialDiscardFirstN", "3", dbcmdTr);
                Insert("encoderCaptureCheckFullyExtended", "True", dbcmdTr);
                Insert("encoderCaptureCheckFullyExtendedValue", "4", dbcmdTr);
                Insert("encoderCaptureBarplotFontSize", "14", dbcmdTr);
                Insert("encoderShowStartAndDuration", "False", dbcmdTr);
                Insert("encoderCaptureCutByTriggers", Preferences.TriggerTypes.NO_TRIGGERS.ToString(), dbcmdTr);
                Insert("encoderPropulsive", "True", dbcmdTr);
                Insert("encoderSmoothEccCon", "0.6", dbcmdTr);
                Insert("encoderSmoothCon", "0.7", dbcmdTr);
                Insert("encoder1RMMethod", Constants.Encoder1RMMethod.WEIGHTED2.ToString(), dbcmdTr);

                ArrayList encoderExercises =
                    SqliteEncoder.SelectEncoderExercises(true, -1, true);

                if (encoderExercises.Count > 0)
                {
                    EncoderExercise ex = (EncoderExercise)encoderExercises[0];
                    Insert(EncoderExerciseIDGravitatory, ex.uniqueID.ToString(), dbcmdTr);
                    Insert(EncoderExerciseIDInertial, ex.uniqueID.ToString(), dbcmdTr);
                }
                else
                {
                    Insert(EncoderExerciseIDGravitatory, "1", dbcmdTr);
                    Insert(EncoderExerciseIDInertial, "1", dbcmdTr);
                }

                Insert(EncoderContractionGravitatory, Constants.Concentric, dbcmdTr);
                Insert(EncoderContractionInertial, Constants.EccentricConcentric, dbcmdTr);
                Insert(EncoderLateralityGravitatory, "RL", dbcmdTr);
                Insert(EncoderLateralityInertial, "RL", dbcmdTr);
                Insert(EncoderMassGravitatory, "10", dbcmdTr);
                Insert(EncoderWeightsInertial, "0", dbcmdTr);

                //encoderRhythm
                EncoderRhythm er = new EncoderRhythm();
                Insert(EncoderRhythmActiveStr, er.Active.ToString(), dbcmdTr);
                Insert(EncoderRhythmRepsOrPhasesStr, er.RepsOrPhases.ToString(), dbcmdTr);
                Insert(EncoderRhythmRepSecondsStr, Util.ConvertToPoint(er.RepSeconds), dbcmdTr);
                Insert(EncoderRhythmEccSecondsStr, Util.ConvertToPoint(er.EccSeconds), dbcmdTr);
                Insert(EncoderRhythmConSecondsStr, Util.ConvertToPoint(er.ConSeconds), dbcmdTr);
                Insert(EncoderRhythmRestRepsSecondsStr, Util.ConvertToPoint(er.RestRepsSeconds), dbcmdTr);
                Insert(EncoderRhythmRestAfterEccStr, er.RestAfterEcc.ToString(), dbcmdTr);
                Insert(EncoderRhythmRepsClusterStr, Util.ConvertToPoint(er.RepsCluster), dbcmdTr);
                Insert(EncoderRhythmRestClustersSecondsStr, Util.ConvertToPoint(er.RestClustersSeconds), dbcmdTr);


                Insert("videoDevice", "", dbcmdTr);                  //first
                Insert("videoDeviceResolution", "", dbcmdTr);
                Insert("videoDeviceFramerate", "", dbcmdTr);
                Insert("videoStopAfter", "2", dbcmdTr);
                Insert("inertialmomentum", "0.01", dbcmdTr);
                Insert("CSVExportDecimalSeparator", Util.GetDecimalSeparatorFromLocale(), dbcmdTr);
                Insert("RGraphsTranslate", "True", dbcmdTr);
                Insert("useHeightsOnJumpIndexes", "True", dbcmdTr);
                Insert("encoderAutoSaveCurve", Constants.EncoderAutoSaveCurve.BEST.ToString(), dbcmdTr);
                Insert("email", "", dbcmdTr);
                Insert("muteLogs", "False", dbcmdTr);
                Insert(ForceSensorTareDateTimeStr, "", dbcmdTr);
                Insert(ForceSensorTareStr, "-1", dbcmdTr);                  //result value from sensor. Decimal is point!!
                Insert(ForceSensorCalibrationDateTimeStr, "", dbcmdTr);
                Insert(ForceSensorCalibrationWeightStr, "-1", dbcmdTr);
                Insert(ForceSensorCalibrationFactorStr, "-1", dbcmdTr);                  //result value from sensor. Decimal is point!!

                //removed on 1.37
                //Insert ("encoderConfiguration", new EncoderConfiguration().ToStringOutput(EncoderConfiguration.Outputs.SQL), dbcmdTr);
            }
            tr.Commit();
        }
    }
    void showWidgets(Constants.BellModes bellMode, Constants.EncoderVariablesCapture encoderMainVariable, EncoderRhythm encoderRhythm)
    {
        frame_best_and_worst.Hide();
        frame_conditions.Hide();
        hbox_jump_best_worst.Hide();
        hbox_run_best_worst.Hide();
        hbox_jump_conditions.Hide();
        hbox_run_conditions.Hide();
        frame_encoder_automatic_conditions.Hide();
        vbox_encoder_manual.Hide();
        notebook_encoder_conditions.Hide();
        vbox_encoder_stuff.Hide();

        notebook_main.GetNthPage(RHYTHMPAGE).Hide();
        notebook_main.ShowTabs = false;

        if (bellMode == Constants.BellModes.JUMPS)
        {
            frame_best_and_worst.Show();
            hbox_jump_best_worst.Show();
            hbox_jump_conditions.Show();
            frame_conditions.Show();
        }
        else if (bellMode == Constants.BellModes.RUNS)
        {
            frame_best_and_worst.Show();
            hbox_run_best_worst.Show();
            hbox_run_conditions.Show();
            frame_conditions.Show();
        }
        else             //encoder (grav and inertial)
        {
            vbox_encoder_stuff.Show();
            frame_encoder_automatic_conditions.Show();
            notebook_main.ShowTabs = true;

            vbox_encoder_manual.Show();
            if (checkbutton_encoder_show_manual_feedback.Active)
            {
                notebook_encoder_conditions.Show();
            }

            combo_encoder_main_variable.Active = UtilGtk.ComboMakeActive(combo_encoder_main_variable,
                                                                         Constants.GetEncoderVariablesCapture(encoderMainVariable));

            notebook_main.GetNthPage(RHYTHMPAGE).Show();
            encoder_rhythm_set_values(encoderRhythm);
        }

        label_test_sound_result.Text = "";
    }
Пример #7
0
    public void UpdateEncoderRhythm(EncoderRhythm er)
    {
        if (
            encoderRhythmActive != er.Active ||
            encoderRhythmRepsOrPhases != er.RepsOrPhases ||
            encoderRhythmRepSeconds != er.RepSeconds ||
            encoderRhythmEccSeconds != er.EccSeconds ||
            encoderRhythmConSeconds != er.ConSeconds ||
            encoderRhythmRestRepsSeconds != er.RestRepsSeconds ||
            encoderRhythmRestAfterEcc != er.RestAfterEcc ||
            encoderRhythmRepsCluster != er.RepsCluster ||
            encoderRhythmRestClustersSeconds != er.RestClustersSeconds
            )
        {
            Sqlite.Open();
        }
        else
        {
            return;
        }

        if (encoderRhythmActive != er.Active)
        {
            encoderRhythmActive = er.Active;
            SqlitePreferences.Update(SqlitePreferences.EncoderRhythmActiveStr,
                                     er.Active.ToString(), true);    //bool
        }

        if (encoderRhythmRepsOrPhases != er.RepsOrPhases)
        {
            encoderRhythmRepsOrPhases = er.RepsOrPhases;
            SqlitePreferences.Update(SqlitePreferences.EncoderRhythmRepsOrPhasesStr,
                                     er.RepsOrPhases.ToString(), true);    //bool
        }

        if (encoderRhythmRepSeconds != er.RepSeconds)
        {
            encoderRhythmRepSeconds = er.RepSeconds;
            SqlitePreferences.Update(SqlitePreferences.EncoderRhythmRepSecondsStr,
                                     Util.ConvertToPoint(er.RepSeconds), true);    //double to point
        }

        if (encoderRhythmEccSeconds != er.EccSeconds)
        {
            encoderRhythmEccSeconds = er.EccSeconds;
            SqlitePreferences.Update(SqlitePreferences.EncoderRhythmEccSecondsStr,
                                     Util.ConvertToPoint(er.EccSeconds), true);    //double to point
        }

        if (encoderRhythmConSeconds != er.ConSeconds)
        {
            encoderRhythmConSeconds = er.ConSeconds;
            SqlitePreferences.Update(SqlitePreferences.EncoderRhythmConSecondsStr,
                                     Util.ConvertToPoint(er.ConSeconds), true);    //double to point
        }

        if (encoderRhythmRestRepsSeconds != er.RestRepsSeconds)
        {
            encoderRhythmRestRepsSeconds = er.RestRepsSeconds;
            SqlitePreferences.Update(SqlitePreferences.EncoderRhythmRestRepsSecondsStr,
                                     Util.ConvertToPoint(er.RestRepsSeconds), true);    //double to point
        }

        if (encoderRhythmRestAfterEcc != er.RestAfterEcc)
        {
            encoderRhythmRestAfterEcc = er.RestAfterEcc;
            SqlitePreferences.Update(SqlitePreferences.EncoderRhythmRestAfterEccStr,
                                     er.RestAfterEcc.ToString(), true);    //bool
        }

        if (encoderRhythmRepsCluster != er.RepsCluster)
        {
            encoderRhythmRepsCluster = er.RepsCluster;
            SqlitePreferences.Update(SqlitePreferences.EncoderRhythmRepsClusterStr,
                                     er.RepsCluster.ToString(), true);    //int
        }

        if (encoderRhythmRestClustersSeconds != er.RestClustersSeconds)
        {
            encoderRhythmRestClustersSeconds = er.RestClustersSeconds;
            SqlitePreferences.Update(SqlitePreferences.EncoderRhythmRestClustersSecondsStr,
                                     Util.ConvertToPoint(er.RestClustersSeconds), true);    //double to point
        }

        Sqlite.Close();
    }