diff --git a/extras/AFC.py b/extras/AFC.py index cf212b4..be30ca8 100644 --- a/extras/AFC.py +++ b/extras/AFC.py @@ -813,7 +813,8 @@ def get_status(self, eventtime): str["system"]["extruders"][EXTRUDE]['tool_end_sensor'] = True == CUR_EXTRUDER.tool_end_state if CUR_EXTRUDER.tool_end is not None else False if CUR_EXTRUDER.buffer_name != None: str["system"]["extruders"][EXTRUDE]['buffer'] = CUR_EXTRUDER.buffer_name - str["system"]["extruders"][EXTRUDE]['buffer_status'] = CUR_EXTRUDER.buffer.buffer_status() + CUR_BUFFER = self.printer.lookup_object('AFC_buffer ' + CUR_EXTRUDER.buffer_name) + str["system"]["extruders"][EXTRUDE]['buffer_status'] = CUR_BUFFER.buffer_status() else: str["system"]["extruders"][EXTRUDE]['buffer'] = 'None' diff --git a/extras/AFC_BoxTurtle.py b/extras/AFC_BoxTurtle.py new file mode 100644 index 0000000..49af7c3 --- /dev/null +++ b/extras/AFC_BoxTurtle.py @@ -0,0 +1,23 @@ +class afcBoxTurtle: + def __init__(self, config): + self.printer = config.get_printer() + self.reactor = self.printer.get_reactor() + self.gcode = self.printer.lookup_object('gcode') + + firstLeg = '|_' + secondLeg = firstLeg + '|' + self.logo ='R _____ ____\n' + self.logo+='E / \ | o | \n' + self.logo+='A | |/ ___/ \n' + self.logo+='D |_________/ \n' + self.logo+='Y {first}{second} {first}{second}\n'.format(first=firstLeg, second=secondLeg) + + self.logo_error ='E _ _ _ _\n' + self.logo_error+='R |_|_|_|_|_|\n' + self.logo_error+='R | \____\n' + self.logo_error+='O | \ \n' + self.logo_error+='R | |\ X |\n' + self.logo_error+='! \_________/ |___|\n' + +def load_config(config): + return afcBoxTurtle(config) \ No newline at end of file diff --git a/extras/AFC_NightOwl.py b/extras/AFC_NightOwl.py new file mode 100644 index 0000000..3750449 --- /dev/null +++ b/extras/AFC_NightOwl.py @@ -0,0 +1,18 @@ +class afcNightOwl: + def __init__(self, config): + self.printer = config.get_printer() + self.reactor = self.printer.get_reactor() + self.gcode = self.printer.lookup_object('gcode') + + self.logo = 'Night Owl Ready' + self.logo ='R , ,\n' + self.logo+='E )\___/(\n' + self.logo+='A {(@)v(@)}\n' + self.logo+='D {|~~~|}\n' + self.logo+='Y {/^^^\}\n' + self.logo+='! `m-m`\n' + + self.logo_error = 'Night Owl Not Ready\n' + +def load_config(config): + return afcNightOwl(config) \ No newline at end of file diff --git a/extras/AFC_hub.py b/extras/AFC_hub.py index 955c797..c09788c 100644 --- a/extras/AFC_hub.py +++ b/extras/AFC_hub.py @@ -11,6 +11,10 @@ def __init__(self, config): self.AFC = self.printer.lookup_object('AFC') self.type = config.get('type', None) + if self.type =='Box_Turtle': + self.ERROR = self.printer.load_object(config, 'AFC_BoxTurtle') + if self.type =='Night_Owl': + self.ERROR = self.printer.load_object(config, 'AFC_NightOwl') # HUB Cut variables # Next two variables are used in AFC diff --git a/extras/AFC_prep.py b/extras/AFC_prep.py index 9b65fa8..783660d 100644 --- a/extras/AFC_prep.py +++ b/extras/AFC_prep.py @@ -116,34 +116,15 @@ def PREP(self, gcmd): return self.gcode.respond_info(CUR_HUB.type + ' ' + UNIT +' Prepping lanes') - if CUR_HUB.type == 'Box_Turtle': - firstLeg = '|_' - secondLeg = firstLeg + '|' - logo ='R _____ ____\n' - logo+='E / \ | o | \n' - logo+='A | |/ ___/ \n' - logo+='D |_________/ \n' - logo+='Y {first}{second} {first}{second}\n'.format(first=firstLeg, second=secondLeg) - logo+=' ' + UNIT + '\n' - - logo_error ='E _ _ _ _\n' - logo_error+='R |_|_|_|_|_|\n' - logo_error+='R | \____\n' - logo_error+='O | \ \n' - logo_error+='R | |\ X |\n' - logo_error+='! \_________/ |___|\n' - logo_error+=' ' + UNIT + '\n' - - if CUR_HUB.type == 'Night_Owl': - logo = 'Night Owl Ready' - logo_error = 'Night Owl Not Ready' - logo ='R , ,\n' - logo+='E )\___/(\n' - logo+='A {(@)v(@)}\n' - logo+='D {|~~~|}\n' - logo+='Y {/^^^\}\n' - logo+='! `m-m`\n' - logo+=' ' + UNIT + '\n' + try: unit_type = self.printer.lookup_object('AFC_{}'.format(CUR_HUB.type.replace('_', ''))) + except: + self.ERROR.AFC_error("{} not supported".format(CUR_HUB.type), False) + continue + + logo=unit_type.logo + logo+=' ' + UNIT + '\n' + logo_error=unit_type.logo_error + logo_error+=' ' + UNIT + '\n' for LANE in self.AFC.lanes[UNIT].keys(): check_success = True diff --git a/extras/AFC_spool.py b/extras/AFC_spool.py index d3795cb..cc5f202 100644 --- a/extras/AFC_spool.py +++ b/extras/AFC_spool.py @@ -4,7 +4,6 @@ except: # Python 2.7 support from urllib2 import urlopen -from configparser import Error as error class afcSpool: def __init__(self, config): @@ -24,6 +23,7 @@ def handle_connect(self): and assigns it to the instance variable `self.AFC`. """ self.AFC = self.printer.lookup_object('AFC') + self.ERROR = self.printer.lookup_object('AFC_error') cmd_SET_COLOR_help = "change filaments color" def cmd_SET_COLOR(self, gcmd):