示例#1
0
 void preheat_Update(TemperatureEntry ent)
 {
     if (ent.extruder >= this.loadingTemperature - this.temperatureBias)
     {
         labelPreheatingStatus.Text = Properties.Resources.PreheatLabel_NotHeating;
     }
 }
示例#2
0
        public async Task<ActionResult> Post([FromBody] Rootobject rootobject)
        {
            var playload = Convert.FromBase64String(rootobject.PayloadRaw);

            var cow = await _context.Cows.FirstOrDefaultAsync(x => x.HardwareSerial == rootobject.HardwareSerial);
            if (cow == null)
            {
                cow = new Cow
                {
                    Name = "Marguerite",
                    HardwareSerial = rootobject.HardwareSerial
                };

                await _context.Cows.AddAsync(cow);
            }

            var dateTime = new DateTime(rootobject.Metadata.Time.Ticks, DateTimeKind.Utc);

            var gpsEntry = new GpsEntry
            {
                Cow = cow,
                DateTime = dateTime,
                LatitudeDeg = Convert.ToInt32(playload[0]),
                LatitudeMinutes = Convert.ToInt32(playload[1]),
                LatitudeMinutesDecimals = Convert.ToInt32($"{Convert.ToInt32(playload[2]):00}" + $"{Convert.ToInt32(playload[3]):00}"),
                LatitudeDirection = Convert.ToChar(playload[4]),
                LongitudeDeg = Convert.ToInt32(playload[5]),
                LongitudeMinutes = Convert.ToInt32(playload[6]),
                LongitudeMinutesDecimals = Convert.ToInt32($"{Convert.ToInt32(playload[7]):00}" + $"{Convert.ToInt32(playload[8]):00}"),
                LongitudeDirection = Convert.ToChar(playload[9])
            };

            cow.GpsEntries.Add(gpsEntry);

            var temperatureEntry = new TemperatureEntry
            {
                Cow = cow,
                DateTime = dateTime,
                Temperature = Convert.ToSingle(Convert.ToInt32(playload[10]) + "." + Convert.ToInt32(playload[11]))
            };

            cow.TemperatureEntries.Add(temperatureEntry);

            var positionEntry = new PositionEntry
            {
                Cow = cow,
                DateTime = dateTime,
                IsUp = Convert.ToBoolean(Convert.ToInt32(playload[12])),
                X = Convert.ToInt32(playload[13]),
                Y = Convert.ToInt32(playload[14]),
                Z = Convert.ToInt32(playload[15])
            };

            cow.PositionEntries.Add(positionEntry);

            await _context.SaveChangesAsync();

            return Ok();
        }
		public void ProcessSensors()
		{
			var entry = new TemperatureEntry();
			entry.Id = Guid.NewGuid();
			entry.CreatedDateTime = DateTime.Now;
			entry.DeviceId = settings.DeviceId;
			entry.TemperatureCelsius = sensor.GetTemperatureCelsius();
			entry.Humidity = sensor.GetHumidity();
			entry.Pressure = sensor.GetPressure();
			entry.Synced = false;
			context.TemperatureEntries.Add(entry);
			context.SaveChanges();
			this.entry = entry;
		}
示例#4
0
        private async void loadUnloadProcedure_Continue(TemperatureEntry ent)
        {
            if (ent.extruder >= this.loadingTemperature - this.temperatureBias)
            {
                // Cannot cancel the move ...
                buttonCancel.Enabled = false;

                // Relative
                this.injectCommand("G91");

                // Then extrude
                if (this.loading == true)
                {
                    MessageBox.Show(Properties.Resources.LoadingMessageBox_Text, Properties.Resources.LoadingMessageBox_Title, MessageBoxButtons.OK, MessageBoxIcon.Information);

                    labelLoadingStatus.Text = Properties.Resources.LoadingLabel_Loading;
                    this.injectCommand("G1 E100 F300");
                }
                else if (this.unloading == true)
                {
                    MessageBox.Show(Properties.Resources.UnloadingMessageBox_Text, Properties.Resources.UnloadingMessageBox_Title, MessageBoxButtons.OK, MessageBoxIcon.Information);

                    labelLoadingStatus.Text = Properties.Resources.LoadingLabel_Unloading;
                    this.injectCommand("G1 E-70 F300");
                }
                // Absolute
                this.injectCommand("G90");

                // Remove event Handler for waiting
                host.Connection.eventTempHistory -= loadUnloadProcedure_Continue;

                // Wait for the move to finish
                await this.loadUnloadProcedure_Finish();

                // Stop heating a few minutes after
                await this.loadUnloadProcedure_StopHeating();
            }
        }
 void preheat_Update(TemperatureEntry ent)
 {
     if (ent.extruder >= this.loadingTemperature - this.temperatureBias)
     {
         labelPreheatingStatus.Text = Properties.Resources.PreheatLabel_NotHeating;
     }
 }
        private async void loadUnloadProcedure_Continue(TemperatureEntry ent)
        {
            if (ent.extruder >= this.loadingTemperature - this.temperatureBias)
            {
               
                // Cannot cancel the move ...
                buttonCancel.Enabled = false;

                // Relative
                this.injectCommand("G91");

                // Then extrude 
                if (this.loading == true)
                {
                    MessageBox.Show(Properties.Resources.LoadingMessageBox_Text, Properties.Resources.LoadingMessageBox_Title, MessageBoxButtons.OK, MessageBoxIcon.Information);
                
                    labelLoadingStatus.Text = Properties.Resources.LoadingLabel_Loading;
                    this.injectCommand("G1 E100 F300");
                }
                else if (this.unloading == true)
                {
                    MessageBox.Show(Properties.Resources.UnloadingMessageBox_Text, Properties.Resources.UnloadingMessageBox_Title, MessageBoxButtons.OK, MessageBoxIcon.Information);
                
                    labelLoadingStatus.Text = Properties.Resources.LoadingLabel_Unloading;
                    this.injectCommand("G1 E-70 F300");
                }
                // Absolute
                this.injectCommand("G90");

                // Remove event Handler for waiting
                host.Connection.eventTempHistory -= loadUnloadProcedure_Continue;

                // Wait for the move to finish
                await this.loadUnloadProcedure_Finish();
                // Stop heating a few minutes after
                await this.loadUnloadProcedure_StopHeating();
            }
        }