internal SmcChannelSettings(SmcChannelSettingsStruct s) { this.invert = s.invert; this.scalingDegree = s.scalingDegree; this.alternateUse = s.alternateUse; this.pinMode = s.pinMode; this.errorMin = s.errorMin; this.errorMax = s.errorMax; this.inputMin = s.inputMin; this.inputMax = s.inputMax; this.inputNeutralMin = s.inputNeutralMin; this.inputNeutralMax = s.inputNeutralMax; }
private static void writeAlternateUse(StreamWriter sw, string name, SmcChannelAlternateUse use) { string str = ""; switch (use) { case SmcChannelAlternateUse.None: str = "none"; break; case SmcChannelAlternateUse.LimitForward: str = "limit_forward"; break; case SmcChannelAlternateUse.LimitReverse: str = "limit_reverse"; break; case SmcChannelAlternateUse.KillSwitch: str = "kill_switch"; break; } sw.WriteLine(name + ": " + str); }
/// <summary> /// Determines what the specified channel is used for (e.g. limit switch or /// controlling the motor speed). /// </summary> /// <param name="channel">Specifies the channel.</param> /// <param name="inputMode">The input mode of the device (Serial/USB, Analog, RC).</param> /// <param name="mixingMode">The mixing mode of the device (None, Left, Right).</param> /// <param name="alternateUse">The alternate use setting for the channel.</param> /// <returns>What the channel is used for.</returns> public static SmcChannelUse use(this SmcChannel channel, SmcInputMode inputMode, SmcMixingMode mixingMode, SmcChannelAlternateUse alternateUse) { if (channel.controlsMotorSpeed(inputMode, mixingMode)) { if (channel == SmcChannel.Analog2 || channel == SmcChannel.Rc2) { return(SmcChannelUse.Steering); } else { return(SmcChannelUse.Throttle); } } else { switch (alternateUse) { default: return(SmcChannelUse.None); case SmcChannelAlternateUse.KillSwitch: return(SmcChannelUse.KillSwitch); case SmcChannelAlternateUse.LimitForward: return(SmcChannelUse.LimitForward); case SmcChannelAlternateUse.LimitReverse: return(SmcChannelUse.LimitReverse); } } }
/// <summary> /// Determines what the specified channel is used for (e.g. limit switch or /// controlling the motor speed). /// </summary> /// <param name="channel">Specifies the channel.</param> /// <param name="inputMode">The input mode of the device (Serial/USB, Analog, RC).</param> /// <param name="mixingMode">The mixing mode of the device (None, Left, Right).</param> /// <param name="alternateUse">The alternate use setting for the channel.</param> /// <returns>What the channel is used for.</returns> public static SmcChannelUse use(this SmcChannel channel, SmcInputMode inputMode, SmcMixingMode mixingMode, SmcChannelAlternateUse alternateUse) { if (channel.controlsMotorSpeed(inputMode, mixingMode)) { if (channel == SmcChannel.Analog2 || channel == SmcChannel.Rc2) { return SmcChannelUse.Steering; } else { return SmcChannelUse.Throttle; } } else { switch (alternateUse) { default: return SmcChannelUse.None; case SmcChannelAlternateUse.KillSwitch: return SmcChannelUse.KillSwitch; case SmcChannelAlternateUse.LimitForward: return SmcChannelUse.LimitForward; case SmcChannelAlternateUse.LimitReverse: return SmcChannelUse.LimitReverse; } } }