Esempio n. 1
0
 def __init__(self):
     """ Initialization.
     """
     self._position = Coordinates(0.0, 0.0, 0.0, 0.0)
     # init variables
     self._velocity = 0
     self._spindle_rpm = 0
     self._local = None
     self._convertCoordinates = 0
     self._absoluteCoordinates = 0
     self._plane = None
     self.reset()
     hal.init()
     self.watchdog = HardwareWatchdog()
Esempio n. 2
0
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...")