Beispiel #1
0
        /**
         * Gets all persistant settings.
         *
         * @param allConfigs        Object with all of the persistant settings
         * @param timeoutMs
         *              Timeout value in ms. If nonzero, function will wait for
         *              config success and report an error if it times out.
         *              If zero, no blocking or checking is performed.
         */
        public void GetAllConfigs(out CANifierConfiguration allConfigs, int timeoutMs = 50)
        {
            allConfigs = new CANifierConfiguration();

            allConfigs.velocityMeasurementPeriod = (CANifierVelocityMeasPeriod)ConfigGetParameter(ParamEnum.eSampleVelocityPeriod, 0, timeoutMs);
            allConfigs.velocityMeasurementWindow = (int)ConfigGetParameter(ParamEnum.eSampleVelocityWindow, 0, timeoutMs);
            allConfigs.clearPositionOnLimitF     = ConfigGetParameter(ParamEnum.eClearPositionOnLimitF, 0, timeoutMs) != 0.0;
            allConfigs.clearPositionOnLimitR     = ConfigGetParameter(ParamEnum.eClearPositionOnLimitR, 0, timeoutMs) != 0.0;
            allConfigs.clearPositionOnQuadIdx    = ConfigGetParameter(ParamEnum.eClearPositionOnQuadIdx, 0, timeoutMs) != 0.0;
            allConfigs.customParam_0             = (int)ConfigGetParameter(ParamEnum.eCustomParam, 0, timeoutMs);
            allConfigs.customParam_1             = (int)ConfigGetParameter(ParamEnum.eCustomParam, 1, timeoutMs);
        }
Beispiel #2
0
        /**
         * Configures all peristant settings.
         *
         * @param allConfigs        Object with all of the persistant settings
         * @param timeoutMs
         *              Timeout value in ms. If nonzero, function will wait for
         *              config success and report an error if it times out.
         *              If zero, no blocking or checking is performed.
         *
         * @return Error Code generated by function. 0 indicates no error.
         */
        public ErrorCode ConfigAllSettings(CANifierConfiguration allConfigs, int timeoutMs = 50)
        {
            ErrorCollection errorCollection = new ErrorCollection();

            errorCollection.NewError(ConfigVelocityMeasurementPeriod(allConfigs.velocityMeasurementPeriod, timeoutMs));
            errorCollection.NewError(ConfigVelocityMeasurementWindow(allConfigs.velocityMeasurementWindow, timeoutMs));
            errorCollection.NewError(ConfigClearPositionOnLimitF(allConfigs.clearPositionOnLimitF, timeoutMs));
            errorCollection.NewError(ConfigClearPositionOnLimitR(allConfigs.clearPositionOnLimitR, timeoutMs));
            errorCollection.NewError(ConfigClearPositionOnQuadIdx(allConfigs.clearPositionOnQuadIdx, timeoutMs));

            errorCollection.NewError(ConfigSetCustomParam(allConfigs.customParam_0, 0, timeoutMs));
            errorCollection.NewError(ConfigSetCustomParam(allConfigs.customParam_1, 1, timeoutMs));

            return(errorCollection._worstError);
        }
Beispiel #3
0
        /**
         * Configures all peristant settings to defaults.
         *
         * @param timeoutMs
         *              Timeout value in ms. If nonzero, function will wait for
         *              config success and report an error if it times out.
         *              If zero, no blocking or checking is performed.
         *
         * @return Error Code generated by function. 0 indicates no error.
         */
        public ErrorCode ConfigFactoryDefault(int timeoutMs = 50)
        {
            CANifierConfiguration defaults = new CANifierConfiguration();

            return(ConfigAllSettings(defaults, timeoutMs));
        }