001/*
002 * Copyright (C) Cross The Road Electronics.  All rights reserved.
003 * License information can be found in CTRE_LICENSE.txt
004 * For support and suggestions contact support@ctr-electronics.com or file
005 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
006 */
007package com.ctre.phoenixpro.configs;
008
009import com.ctre.phoenixpro.StatusCode;
010import com.ctre.phoenixpro.configs.jni.ConfigJNI;
011import com.ctre.phoenixpro.spns.*;
012
013/**
014 *  Configs that directly affect motor-output.
015 * <p>
016 *  Includes Motor Invert and various limit features.
017 */
018public class OpenLoopRampsConfigs implements ParentConfiguration
019{
020    /**
021     * If non-zero, this determines how much time to ramp from 0% output
022     * to 100% during open-loop modes.
023     *
024     *  <ul>
025     *  <li> <b>Minimum Value:</b> 0
026     *  <li> <b>Maximum Value:</b> 1
027     *  <li> <b>Default Value:</b> 0
028     *  <li> <b>Units:</b> sec
029     *  </ul>
030     */
031    public double DutyCycleOpenLoopRampPeriod = 0;
032    /**
033     * If non-zero, this determines how much time to ramp from 0V output
034     * to 12V during open-loop modes.
035     *
036     *  <ul>
037     *  <li> <b>Minimum Value:</b> 0
038     *  <li> <b>Maximum Value:</b> 1
039     *  <li> <b>Default Value:</b> 0
040     *  <li> <b>Units:</b> sec
041     *  </ul>
042     */
043    public double VoltageOpenLoopRampPeriod = 0;
044    /**
045     * If non-zero, this determines how much time to ramp from 0A output
046     * to 300A during open-loop modes.
047     *
048     *  <ul>
049     *  <li> <b>Minimum Value:</b> 0
050     *  <li> <b>Maximum Value:</b> 10
051     *  <li> <b>Default Value:</b> 0
052     *  <li> <b>Units:</b> sec
053     *  </ul>
054     */
055    public double TorqueOpenLoopRampPeriod = 0;
056
057    @Override
058    public String toString()
059    {
060        String ss = "Config Group: OpenLoopRamps\n";
061        ss += "Name: \"DutyCycleOpenLoopRampPeriod\" Value: \"" + DutyCycleOpenLoopRampPeriod + "sec\"" + "\n";
062        ss += "Name: \"VoltageOpenLoopRampPeriod\" Value: \"" + VoltageOpenLoopRampPeriod + "sec\"" + "\n";
063        ss += "Name: \"TorqueOpenLoopRampPeriod\" Value: \"" + TorqueOpenLoopRampPeriod + "sec\"" + "\n";
064        return ss;
065    }
066
067    /**
068     *
069     */
070    public StatusCode deserialize(String string)
071    {
072        DutyCycleOpenLoopRampPeriod = ConfigJNI.Deserializedouble(SpnValue.Config_DutyCycleOpenLoopRampPeriod.value, string);
073        VoltageOpenLoopRampPeriod = ConfigJNI.Deserializedouble(SpnValue.Config_VoltageOpenLoopRampPeriod.value, string);
074        TorqueOpenLoopRampPeriod = ConfigJNI.Deserializedouble(SpnValue.Config_TorqueOpenLoopRampPeriod.value, string);
075        return  StatusCode.OK;
076    }
077
078    /**
079     *
080     */
081    public String serialize()
082    {
083        String ss = "";
084        ss += ConfigJNI.Serializedouble(1443, DutyCycleOpenLoopRampPeriod);
085        ss += ConfigJNI.Serializedouble(1444, VoltageOpenLoopRampPeriod);
086        ss += ConfigJNI.Serializedouble(1445, TorqueOpenLoopRampPeriod);
087        return ss;
088    }
089}
090