Esempio n. 1
0
        public static async Task <Eeprom> ReadEepromAsync(this ISerial serial)
        {
            uint[] values = await serial.GetEpromValuesAsync(SerialExtension.DefaultEpromTimeout);

            if (values != null)
            {
                var ee = new EepromV1 {
                    Values = values
                };

                if (ee.IsValid)
                {
                    File.WriteAllLines(Environment.ExpandEnvironmentVariables(@"%TEMP%\EepromRead.nc"), ee.ToGCode());
                    byte numAxis = ee[EepromV1.EValueOffsets8.NumAxis];

                    var eeprom = Eeprom.Create(ee[EepromV1.EValueOffsets32.Signature], numAxis);
                    eeprom.Values = values;
                    eeprom.ReadFrom(ee);

                    return(eeprom);
                }
            }

            return(null);
        }
Esempio n. 2
0
        public async Task <Eeprom> ReadEepromAsync()
        {
            UInt32[] values = await new MachineGCodeHelper().GetEpromValuesAsync(MachineGCodeHelper.DefaultEpromTimeout);
            if (values != null)
            {
                var ee = new EepromV1 {
                    Values = values
                };

                if (ee.IsValid)
                {
                    File.WriteAllLines(Environment.ExpandEnvironmentVariables(@"%TEMP%\EepromRead.nc"), ee.ToGCode());
                    byte numaxis = ee[EepromV1.EValueOffsets8.NumAxis];

                    var eeprom = Eeprom.Create(ee[EepromV1.EValueOffsets32.Signatrue], numaxis);
                    eeprom.Values = values;
                    eeprom.ReadFrom(ee);

                    return(eeprom);
                }
            }
            return(null);
        }