Exemple #1
0
    def __init__(self, args, ioloop, id):
        self.args = args
        self.ioloop = bbctrl.IOLoop(ioloop)
        self.id = id
        self.timeout = None # Used in demo mode

        if id and not os.path.exists(id): os.mkdir(id)

        # Start log
        if args.demo: log_path = self.get_path(filename = 'bbctrl.log')
        else: log_path = args.log
        self.log = bbctrl.log.Log(args, self.ioloop, log_path)

        self.state = bbctrl.State(self)
        self.config = bbctrl.Config(self)

        self.log.get('Ctrl').info('Starting %s' % self.id)

        try:
            if args.demo: self.avr = bbctrl.AVREmu(self)
            else: self.avr = bbctrl.AVR(self)

            self.i2c = bbctrl.I2C(args.i2c_port, args.demo)
            self.lcd = bbctrl.LCD(self)
            self.mach = bbctrl.Mach(self, self.avr)
            self.preplanner = bbctrl.Preplanner(self)
            if not args.demo: self.jog = bbctrl.Jog(self)
            self.pwr = bbctrl.Pwr(self)

            self.mach.connect()

            self.lcd.add_new_page(bbctrl.MainLCDPage(self))
            self.lcd.add_new_page(bbctrl.IPLCDPage(self.lcd))

        except Exception: self.log.get('Ctrl').exception()
Exemple #2
0
    def __init__(self, args, ioloop):
        self.args = args
        self.ioloop = ioloop

        self.msgs = bbctrl.Messages(self)
        self.state = bbctrl.State(self)
        self.config = bbctrl.Config(self)
        self.web = bbctrl.Web(self)

        try:
            self.i2c = bbctrl.I2C(args.i2c_port)
            self.lcd = bbctrl.LCD(self)
            self.mach = bbctrl.Mach(self)
            self.preplanner = bbctrl.Preplanner(self)
            self.planTimer = bbctrl.PlanTimer(self)
            self.jog = bbctrl.Jog(self)
            self.pwr = bbctrl.Pwr(self)

            self.mach.connect()

            self.lcd.add_new_page(bbctrl.MainLCDPage(self))
            self.lcd.add_new_page(bbctrl.IPLCDPage(self.lcd))

            self.camera = bbctrl.Camera(self)

        except Exception as e:
            log.exception(e)