Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split of unit types #144

Merged
merged 7 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion extras/AFC.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from urllib.request import urlopen
except:
# Python 2.7 support
from urllib2 import urlopen

Check failure on line 13 in extras/AFC.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (F401)

extras/AFC.py:13:25: F401 `urllib2.urlopen` imported but unused


from configparser import Error as error
Expand Down Expand Up @@ -100,7 +100,7 @@
self.gcode.register_command('HUB_CUT_TEST', self.cmd_HUB_CUT_TEST, desc=self.cmd_HUB_CUT_TEST_help)

self.gcode.register_mux_command('SET_BOWDEN_LENGTH', 'AFC', None, self.cmd_SET_BOWDEN_LENGTH, desc=self.cmd_SET_BOWDEN_LENGTH_help)

Check failure on line 103 in extras/AFC.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (W293)

extras/AFC.py:103:1: W293 Blank line contains whitespace
self.gcode.register_command('AFC_STATUS', self.cmd_AFC_STATUS, desc=self.cmd_AFC_STATUS_help)
self.VarFile = config.get('VarFile')
# Get debug and cast to boolean
Expand Down Expand Up @@ -813,7 +813,8 @@
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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought so but the buffer status function had been moved to AFC_buffer status on the dev

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main has these same changes as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore this comment for now

str["system"]["extruders"][EXTRUDE]['buffer_status'] = CUR_BUFFER.buffer_status()
else:
str["system"]["extruders"][EXTRUDE]['buffer'] = 'None'

Expand Down
23 changes: 23 additions & 0 deletions extras/AFC_BoxTurtle.py
Original file line number Diff line number Diff line change
@@ -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 = '<span class=warning--text>|</span><span class=error--text>_</span>'
secondLeg = firstLeg + '<span class=warning--text>|</span>'
self.logo ='<span class=success--text>R _____ ____\n'
self.logo+='E / \ | </span><span class=info--text>o</span><span class=success--text> | \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 ='<span class=error--text>E _ _ _ _\n'
self.logo_error+='R |_|_|_|_|_|\n'
self.logo_error+='R | \____\n'
self.logo_error+='O | \ \n'
self.logo_error+='R | |\ <span class=secondary--text>X</span> |\n'
self.logo_error+='! \_________/ |___|</error>\n'

def load_config(config):
return afcBoxTurtle(config)
18 changes: 18 additions & 0 deletions extras/AFC_NightOwl.py
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 4 additions & 0 deletions extras/AFC_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 10 additions & 29 deletions extras/AFC_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,35 +115,16 @@
self.AFC.AFC_error(error_string, False)
return
self.gcode.respond_info(CUR_HUB.type + ' ' + UNIT +' Prepping lanes')

if CUR_HUB.type == 'Box_Turtle':
firstLeg = '<span class=warning--text>|</span><span class=error--text>_</span>'
secondLeg = firstLeg + '<span class=warning--text>|</span>'
logo ='<span class=success--text>R _____ ____\n'
logo+='E / \ | </span><span class=info--text>o</span><span class=success--text> | \n'
logo+='A | |/ ___/ \n'
logo+='D |_________/ \n'
logo+='Y {first}{second} {first}{second}\n'.format(first=firstLeg, second=secondLeg)
logo+=' ' + UNIT + '\n'

logo_error ='<span class=error--text>E _ _ _ _\n'
logo_error+='R |_|_|_|_|_|\n'
logo_error+='R | \____\n'
logo_error+='O | \ \n'
logo_error+='R | |\ <span class=secondary--text>X</span> |\n'
logo_error+='! \_________/ |___|</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'

Check failure on line 118 in extras/AFC_prep.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (W293)

extras/AFC_prep.py:118:1: W293 Blank line contains whitespace
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))

Check failure on line 121 in extras/AFC_prep.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (F523)

extras/AFC_prep.py:121:42: F523 `.format` call has unused arguments at position(s): 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops typed this wrong in my example

Suggested change
self.ERROR.AFC_error("{} not supported".format(CUR_HUB.type, False))
self.ERROR.AFC_error("{} not supported".format(CUR_HUB.type), False)

continue

Check failure on line 123 in extras/AFC_prep.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (W293)

extras/AFC_prep.py:123:1: W293 Blank line contains whitespace
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
Expand Down
2 changes: 1 addition & 1 deletion extras/AFC_spool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
Loading