MainMachine _IOMonitor.cs 1.5 KB
using CodeLibrary;
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DeviceLibrary
{
    partial class MainMachine
    {
        void ioMonitor()
        {
            if (IOValue(IO_Type.Airpressure_Check).Equals(IO_VALUE.LOW)) {
                Msg.add(crc.GetString("Res0166","未检测到气压信号."), MsgLevel.warning);
            }
        }
        bool lastTHoutRangeStatus = false;
        DateTime lastTHoutRangeTime = DateTime.MaxValue;
        bool IsTHoutRange()
        {
            if (HumitureController.LastData.Humidity > ServerCM.Max_Humidity// || HumitureController.LastData.Humidity < ServerCM.Min_Humidity
                || HumitureController.LastData.Temperate > ServerCM.Max_Temperature)
            {
                if (!lastTHoutRangeStatus)
                    lastTHoutRangeTime = DateTime.Now;
                lastTHoutRangeStatus = true;
                return true;
            }
            else
            {
                if (lastTHoutRangeStatus)
                    lastTHoutRangeTime = DateTime.MaxValue;
                lastTHoutRangeStatus = false;
                return false;
            }
        }
        bool IsTHoutRangeOver30m() {
            return (DateTime.Now - lastTHoutRangeTime).TotalMinutes > 30;
        }
    }
}