public RoboteqOutputSettings(Devices dev, bool invert, RoboteqChannel channel)
 {
     device = dev;
     invert_flag = invert;
     this.channel = channel;
 }
示例#2
0
        private void SetMotorValue(Dictionary<Devices, int> state, RoboteqChannel channel)
        {
            int val;
            RoboteqOutputSettings outputSettings;
            if (channel_map.TryGetValue(channel, out outputSettings)) //check if this roboteq has config for this channel
            {
                if (state.TryGetValue(outputSettings.Device, out val)) //see if the state contains updated value
                {
                    if (outputSettings.Invert)
                        val *= -1;

                    switch (channel) //set the appropriate backing variable, set ignore flags
                    {
                        case RoboteqChannel.Motor1:
                            motor1Value = val;
                            Interlocked.Exchange(ref watch_motor1_ignore, 1);
                            break;
                        case RoboteqChannel.Motor2:
                            motor2Value = val;
                            Interlocked.Exchange(ref watch_motor2_ignore, 1);
                            break;
                        default:
                            break;
                    }
                }
            }
            //if not using motor channel, do nothing
        }