mirror of
https://github.com/sinseman44/PyCNC.git
synced 2026-01-12 02:40:04 +00:00
26 lines
562 B
Python
26 lines
562 B
Python
import threading
|
|
import time
|
|
|
|
from cnc import hal
|
|
|
|
|
|
class HardwareWatchdog(threading.Thread):
|
|
def __init__(self):
|
|
""" Run feed loop for hardware watchdog.
|
|
"""
|
|
super(HardwareWatchdog, self).__init__()
|
|
self.setDaemon(True)
|
|
self.start()
|
|
|
|
def run(self):
|
|
while True:
|
|
hal.watchdog_feed()
|
|
time.sleep(3)
|
|
|
|
# for test purpose
|
|
if __name__ == "__main__":
|
|
hal.init()
|
|
hal.fan_control(True)
|
|
print("Fan is on, it should turn off automatically in ~15 seconds."
|
|
"\nExiting...")
|