超时到期后,Watchdog不会重启设备

时间:2014-04-08 23:29:28

标签: c++ watchdog .net-micro-framework

当我将其部署到单板计算机时,尽管Watchdog,指示灯仍会持续闪烁。我希望每十秒重启一次,因为WatchdogBehavior是HardReboot并且设置了Timeout。我错过了什么?

namespace WatchdogTest
{
    using Microsoft.SPOT.Hardware;
    using System;
    using System.Threading;

    public class Program
    {
        private static OutputPort led1 = 
            new OutputPort(GHI.Hardware.G120.Pin.P1_15, true);
        private static Timer timer;
        public static void Main()
        {
            Watchdog.Behavior = WatchdogBehavior.HardReboot;
            Watchdog.Enabled = true;
            Watchdog.Timeout = new TimeSpan(0, 0, 10); // ten seconds

            timer = new Timer(TimerCallback, new object(), 0, 250);

            Thread.Sleep(Timeout.Infinite);
        }

        private static void TimerCallback(object stateInfo)
        {
            Flash();
        }

        private static void Flash()
        {
            bool isOn = led1.Read();
            led1.Write(!isOn);
        }
    }
}

0 个答案:

没有答案