Пример #1
0
        private static void writeSerialMode(StreamWriter sw, SmcSerialMode mode)
        {
            string str = "";

            switch (mode)
            {
            case SmcSerialMode.Binary: str = "binary"; break;

            case SmcSerialMode.Ascii: str = "ascii"; break;
            }
            sw.WriteLine("serial_mode: " + str);
        }
Пример #2
0
 internal SmcSettings(UInt16 productId, SmcSettingsStruct s)
 {
     this.productId = productId;
     // [Add-new-settings-here]
     this.neverSleep          = (s.b1 & SmcBoolSettings1.NeverSleep) != 0;
     this.uartResponseDelay   = (s.b1 & SmcBoolSettings1.UartResponseDelay) != 0;
     this.useFixedBaudRate    = (s.b1 & SmcBoolSettings1.UseFixedBaudRate) != 0;
     this.disableSafeStart    = (s.b1 & SmcBoolSettings1.DisableSafeStart) != 0;
     this.enableI2C           = (s.b1 & SmcBoolSettings1.EnableI2C) != 0;
     this.ignoreErrLineHigh   = (s.b1 & SmcBoolSettings1.IgnoreErrLineHigh) != 0;
     this.tempLimitGradual    = (s.b1 & SmcBoolSettings1.TempLimitGradual) != 0;
     this.ignorePotDisconnect = (s.b1 & SmcBoolSettings1.IgnorePotDisconnect) != 0;
     this.motorInvert         = (s.b1 & SmcBoolSettings1.MotorInvert) != 0;
     this.coastWhenOff        = (s.b1 & SmcBoolSettings1.CoastWhenOff) != 0;
     this.crcForCommands      = (s.b1 & SmcBoolSettings1.CrcForCommands) != 0;
     this.crcForResponses     = (s.b1 & SmcBoolSettings1.CrcForResponses) != 0;
     this.fixedBaudRateBps    = Smc.convertBaudRegisterToBps(s.fixedBaudRateRegister);
     this.speedUpdatePeriod   = s.speedUpdatePeriod;
     this.commandTimeout      = s.commandTimeout;
     this.serialDeviceNumber  = s.serialDeviceNumber;
     this.overTempCompleteShutoffThreshold = s.overTempCompleteShutoffThreshold;
     this.overTempNormalOperationThreshold = s.overTempNormalOperationThreshold;
     this.inputMode            = s.inputMode;
     this.pwmPeriodFactor      = s.pwmPeriodFactor;
     this.mixingMode           = s.mixingMode;
     this.minPulsePeriod       = s.minPulsePeriod;
     this.maxPulsePeriod       = s.maxPulsePeriod;
     this.rcTimeout            = s.rcTimeout;
     this.consecGoodPulses     = s.consecGoodPulses;
     this.vinScaleCalibration  = s.vinScaleCalibration;
     this.lowVinShutoffTimeout = s.lowVinShutoffTimeout;
     this.lowVinShutoffMv      = s.lowVinShutoffMv;
     this.lowVinStartupMv      = s.lowVinStartupMv;
     this.highVinShutoffMv     = s.highVinShutoffMv;
     this.serialMode           = s.serialMode;
     this.rc1                      = new SmcChannelSettings(s.rc1);
     this.rc2                      = new SmcChannelSettings(s.rc2);
     this.analog1                  = new SmcChannelSettings(s.analog1);
     this.analog2                  = new SmcChannelSettings(s.analog2);
     this.forwardLimits            = new SmcMotorLimits(s.forwardLimits);
     this.reverseLimits            = new SmcMotorLimits(s.reverseLimits);
     this.currentLimit             = s.currentLimit;
     this.currentOffsetCalibration = s.currentOffsetCalibration;
     this.currentScaleCalibration  = s.currentScaleCalibration;
 }
Пример #3
0
 internal SmcSettings(SmcSettingsStruct s)
 {
     // [Add-new-settings-here]
     this.neverSuspend         = s.neverSuspend;
     this.uartResponseDelay    = s.uartResponseDelay;
     this.useFixedBaudRate     = s.useFixedBaudRate;
     this.disableSafeStart     = s.disableSafeStart;
     this.fixedBaudRateBps     = Smc.convertBaudRegisterToBps(s.fixedBaudRateRegister);
     this.speedUpdatePeriod    = s.speedUpdatePeriod;
     this.commandTimeout       = s.commandTimeout;
     this.serialDeviceNumber   = s.serialDeviceNumber;
     this.crcMode              = s.crcMode;
     this.overTempMin          = s.overTempMin;
     this.overTempMax          = s.overTempMax;
     this.inputMode            = s.inputMode;
     this.pwmMode              = s.pwmMode;
     this.pwmPeriodFactor      = s.pwmPeriodFactor;
     this.mixingMode           = s.mixingMode;
     this.minPulsePeriod       = s.minPulsePeriod;
     this.maxPulsePeriod       = s.maxPulsePeriod;
     this.rcTimeout            = s.rcTimeout;
     this.ignorePotDisconnect  = s.ignorePotDisconnect;
     this.tempLimitGradual     = s.tempLimitGradual;
     this.consecGoodPulses     = s.consecGoodPulses;
     this.motorInvert          = s.motorInvert;
     this.speedZeroBrakeAmount = s.speedZeroBrakeAmount;
     this.ignoreErrLineHigh    = s.ignoreErrLineHigh;
     this.vinMultiplierOffset  = s.vinMultiplierOffset;
     this.lowVinShutoffTimeout = s.lowVinShutoffTimeout;
     this.lowVinShutoffMv      = s.lowVinShutoffMv;
     this.lowVinStartupMv      = s.lowVinStartupMv;
     this.highVinShutoffMv     = s.highVinShutoffMv;
     this.serialMode           = s.serialMode;
     this.rc1           = new SmcChannelSettings(s.rc1);
     this.rc2           = new SmcChannelSettings(s.rc2);
     this.analog1       = new SmcChannelSettings(s.analog1);
     this.analog2       = new SmcChannelSettings(s.analog2);
     this.forwardLimits = new SmcMotorLimits(s.forwardLimits);
     this.reverseLimits = new SmcMotorLimits(s.reverseLimits);
 }
Пример #4
0
 internal SmcSettings(SmcSettingsStruct s)
 {
     // [Add-new-settings-here]
     this.neverSuspend = s.neverSuspend;
     this.uartResponseDelay = s.uartResponseDelay;
     this.useFixedBaudRate = s.useFixedBaudRate;
     this.disableSafeStart = s.disableSafeStart;
     this.fixedBaudRateBps = Smc.convertBaudRegisterToBps(s.fixedBaudRateRegister);
     this.speedUpdatePeriod = s.speedUpdatePeriod;
     this.commandTimeout = s.commandTimeout;
     this.serialDeviceNumber = s.serialDeviceNumber;
     this.crcMode = s.crcMode;
     this.overTempMin = s.overTempMin;
     this.overTempMax = s.overTempMax;
     this.inputMode = s.inputMode;
     this.pwmMode = s.pwmMode;
     this.pwmPeriodFactor = s.pwmPeriodFactor;
     this.mixingMode = s.mixingMode;
     this.minPulsePeriod = s.minPulsePeriod;
     this.maxPulsePeriod = s.maxPulsePeriod;
     this.rcTimeout = s.rcTimeout;
     this.ignorePotDisconnect = s.ignorePotDisconnect;
     this.tempLimitGradual = s.tempLimitGradual;
     this.consecGoodPulses = s.consecGoodPulses;
     this.motorInvert = s.motorInvert;
     this.speedZeroBrakeAmount = s.speedZeroBrakeAmount;
     this.ignoreErrLineHigh = s.ignoreErrLineHigh;
     this.vinMultiplierOffset = s.vinMultiplierOffset;
     this.lowVinShutoffTimeout = s.lowVinShutoffTimeout;
     this.lowVinShutoffMv = s.lowVinShutoffMv;
     this.lowVinStartupMv = s.lowVinStartupMv;
     this.highVinShutoffMv = s.highVinShutoffMv;
     this.serialMode = s.serialMode;
     this.rc1 = new SmcChannelSettings(s.rc1);
     this.rc2 = new SmcChannelSettings(s.rc2);
     this.analog1 = new SmcChannelSettings(s.analog1);
     this.analog2 = new SmcChannelSettings(s.analog2);
     this.forwardLimits = new SmcMotorLimits(s.forwardLimits);
     this.reverseLimits = new SmcMotorLimits(s.reverseLimits);
 }