Esempio n. 1
0
        public static async Task WriteEepromValuesAsync(this ISerial serial, EepromV1 ee)
        {
            await serial.SendCommandAsync(@"$!", DefaultEpromTimeout);

            await serial.SendCommandsAsync(ee.ToGCode(), DefaultEpromTimeout);
        }
 /// <summary>
 /// Send command and wait until the command is transferred and we got a reply (no command pending)
 /// </summary>
 /// <param name="serial"></param>
 /// <param name="line">command line to send</param>
 /// <param name="waitForMilliseconds"></param>
 public static async Task <IEnumerable <SerialCommand> > SendCommandAsync(this ISerial serial, string line, int waitForMilliseconds = DefaultTimeout)
 {
     return(await serial.SendCommandsAsync(new[] { line }, waitForMilliseconds));
 }
 /// <summary>
 /// Send multiple command lines to the arduino. Wait until the commands are transferred and we got a reply (no command pending)
 /// </summary>
 /// <param name="serial"></param>
 /// <param name="commands"></param>
 public static IEnumerable <SerialCommand> SendCommands(this ISerial serial, IEnumerable <string> commands)
 {
     return(serial.SendCommandsAsync(commands, DefaultTimeout).ConfigureAwait(false).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Send command and wait until the command is transferred and we got a reply (no command pending)
 /// </summary>
 /// <param name="serial"></param>
 /// <param name="line">command line to send</param>
 public static IEnumerable <SerialCommand> SendCommand(this ISerial serial, string line)
 {
     return(serial.SendCommandsAsync(new[] { line }, DefaultTimeout).ConfigureAwait(false).GetAwaiter().GetResult());
 }