diff --git a/CHANGELOG.md b/CHANGELOG.md
index b598149..1155422 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -243,17 +243,12 @@ Optional:
### Fixed
- Fixed places where gcode was not referencing AFC and would cause crashes
-
-## [2024-12-09]
-
-### Added
-- Added logic to pause print when filament goes past prep sensor. Verify that PAUSE macro move's toolhead off print when it's called.
-=======
## [2024-12-08]
### Added
- When updating the AFC software, the `install-afc.sh` script will now remove any instances of `[gcode_macro T#]` found in the `AFC_Macros.cfg`
file as the code now generates them automatically.
+- Added logic to pause print when filament goes past prep sensor. Verify that PAUSE macro move's toolhead off print when it's called.
## [2024-12-09]
@@ -270,4 +265,12 @@ file as the code now generates them automatically.
### Updated
- Updated Cut.cfg macro to have the ability to up stepper current when doing filament cutting,
- see layer shift troubleshooting section on what values need to be set
\ No newline at end of file
+ see layer shift troubleshooting section on what values need to be set
+
+## [2024-12-20]
+
+### Added
+- More error printouts to aid users
+
+### Fixes
+- Misc error fixes
\ No newline at end of file
diff --git a/config/macros/Cut.cfg b/config/macros/Cut.cfg
index a85233e..61f0c15 100644
--- a/config/macros/Cut.cfg
+++ b/config/macros/Cut.cfg
@@ -191,6 +191,8 @@ description: Helper to do a single horizontal cut movement
gcode:
{% set pin_park_x_loc = params.PIN_PARK_X_LOC|float %}
{% set pin_park_y_loc = params.PIN_PARK_Y_LOC|float %}
+ {% set rip_length = params.RIP_LENGTH|float %}
+
{% set vars = printer['gcode_macro _AFC_CUT_TIP_VARS'] %}
{% set cut_move_dist = vars['cut_move_dist']|float %}
{% set cut_direction = vars['cut_direction']|default('')|lower %}
@@ -200,7 +202,6 @@ gcode:
{% set cut_slow_move_speed = vars['cut_slow_move_speed'] * 60|float %}
{% set cut_dwell_time = vars['cut_dwell_time']|float %}
{% set evacuate_speed = vars['evacuate_speed'] * 60|float %}
- {% set rip_length = vars['rip_length']|float %}
{% set rip_speed = vars['rip_speed'] * 60|float %}
# Get printer bounds to make sure none of our cut moves fall outside of them
diff --git a/extras/AFC.py b/extras/AFC.py
index eb7b544..f59124d 100644
--- a/extras/AFC.py
+++ b/extras/AFC.py
@@ -171,7 +171,7 @@ def cmd_AFC_STATUS(self, gcmd):
for LANE in self.units[UNIT].keys():
lane_msg = ''
- CUR_LANE = self.AFC.stepper[LANE]
+ CUR_LANE = self.stepper[LANE]
CUR_HUB = self.printer.lookup_object('AFC_hub '+ UNIT)
CUR_EXTRUDER = self.printer.lookup_object('AFC_extruder ' + CUR_LANE.extruder_name)
if self.current != None:
@@ -231,7 +231,7 @@ def cmd_SET_BOWDEN_LENGTH(self, gcmd):
# If hub is not passed in try and get hub if a lane is currently loaded
if hub is None and self.current is not None:
- CUR_LANE = self.AFC.stepper[self.current]
+ CUR_LANE = self.stepper[self.current]
hub = CUR_LANE.unit
elif hub is None and self.current is None:
self.gcode.respond_info("A lane is not loaded please specify hub to adjust bowden length")
@@ -279,10 +279,10 @@ def cmd_LANE_MOVE(self, gcmd):
"""
lane = gcmd.get('LANE', None)
distance = gcmd.get_float('DISTANCE', 0)
- if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
- return
- CUR_LANE = self.AFC.stepper[lane.name]
+ if lane not in self.stepper:
+ self.gcode.respond_info('{} Unknown'.format(lane.upper()))
+ return
+ CUR_LANE = self.stepper[lane]
CUR_LANE.move(distance, self.short_moves_speed, self.short_moves_accel, True)
def save_pos(self):
@@ -361,10 +361,10 @@ def cmd_HUB_CUT_TEST(self, gcmd):
"""
lane = gcmd.get('LANE', None)
self.gcode.respond_info('Testing Hub Cut on Lane: ' + lane)
- if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
- return
- CUR_LANE = self.AFC.stepper[lane.name]
+ if lane not in self.stepper:
+ self.gcode.respond_info('{} Unknown'.format(lane.upper()))
+ return
+ CUR_LANE = self.stepper[lane]
CUR_HUB = self.printer.lookup_object('AFC_hub ' + CUR_LANE.unit)
CUR_HUB.hub_cut(CUR_LANE)
self.gcode.respond_info('Hub cut Done!')
@@ -394,10 +394,10 @@ def cmd_TEST(self, gcmd):
self.ERROR.AFC_error('Must select LANE', False)
return
self.gcode.respond_info('TEST ROUTINE')
- if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
- return
- CUR_LANE = self.AFC.stepper[lane.name]
+ if lane not in self.stepper:
+ self.gcode.respond_info('{} Unknown'.format(lane.upper()))
+ return
+ CUR_LANE = self.stepper[lane]
self.gcode.respond_info('Testing at full speed')
CUR_LANE.assist(-1)
self.reactor.pause(self.reactor.monotonic() + 1)
@@ -437,10 +437,10 @@ def cmd_HUB_LOAD(self, gcmd):
None
"""
lane = gcmd.get('LANE', None)
- if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
- return
- CUR_LANE = self.AFC.stepper[lane.name]
+ if lane not in self.stepper:
+ self.gcode.respond_info('{} Unknown'.format(lane.upper()))
+ return
+ CUR_LANE = self.stepper[lane]
CUR_HUB = self.printer.lookup_object('AFC_hub '+ CUR_LANE.unit)
if CUR_LANE.prep_state == False: return
@@ -477,11 +477,15 @@ def cmd_LANE_UNLOAD(self, gcmd):
Returns:
None
"""
+ if not self.is_homed():
+ self.ERROR.AFC_error("Please home printer before doing a tool unload", False)
+ return False
+
lane = gcmd.get('LANE', None)
- if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
- return
- CUR_LANE = self.AFC.stepper[lane.name]
+ if lane not in self.stepper:
+ self.gcode.respond_info('{} Unknown'.format(lane.upper()))
+ return
+ CUR_LANE = self.stepper[lane]
CUR_HUB = self.printer.lookup_object('AFC_hub '+ CUR_LANE.unit)
if CUR_LANE.name != self.current:
# Setting status as ejecting so if filament is removed and de-activates the prep sensor while
@@ -504,7 +508,7 @@ def cmd_LANE_UNLOAD(self, gcmd):
self.SPOOL.set_spoolID( CUR_LANE, "")
else:
- self.gcode.respond_info('LANE ' + CUR_LANE.name + ' IS TOOL LOADED')
+ self.gcode.respond_info("LANE {} is loaded in toolhead, can't unload.".format(CUR_LANE.name))
cmd_TOOL_LOAD_help = "Load lane into tool"
def cmd_TOOL_LOAD(self, gcmd):
@@ -525,10 +529,14 @@ def cmd_TOOL_LOAD(self, gcmd):
None
"""
lane = gcmd.get('LANE', None)
- if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
- return
- CUR_LANE = self.AFC.stepper[lane.name]
+ if lane not in self.stepper:
+ self.gcode.respond_info('{} Unknown'.format(lane.upper()))
+ return
+
+ if self.current is not None:
+ self.ERROR.AFC_error("Cannot load {}, {} currently loaded".format(lane.upper(), self.current.upper()), pause=False)
+ return
+ CUR_LANE = self.stepper[lane]
self.TOOL_LOAD(CUR_LANE)
def TOOL_LOAD(self, CUR_LANE):
@@ -545,6 +553,10 @@ def TOOL_LOAD(self, CUR_LANE):
Returns:
bool: True if load was successful, False if an error occurred.
"""
+ if not self.is_homed():
+ self.ERROR.AFC_error("Please home printer before doing a tool load", False)
+ return False
+
if CUR_LANE is None:
# Exit early if no lane is provided.
return False
@@ -613,7 +625,7 @@ def TOOL_LOAD(self, CUR_LANE):
tool_attempts += 1
CUR_LANE.move(self.short_move_dis, CUR_EXTRUDER.tool_load_speed, self.long_moves_accel)
if tool_attempts > 20:
- message = ('FAILED TO LOAD ' + CUR_LANE.name.upper() + ' TO TOOL, CHECK FILAMENT PATH\n||=====||====||==>--||\nTRG LOAD HUB TOOL')
+ message = ('FAILED TO LOAD TO TOOL, CHECK FILAMENT PATH\n||=====||====||==>--||\nTRG LOAD HUB TOOL')
self.ERROR.handle_lane_failure(CUR_LANE, message)
return False
@@ -671,11 +683,11 @@ def TOOL_LOAD(self, CUR_LANE):
else:
# Handle errors if the hub is not clear or the lane is not ready for loading.
if CUR_HUB.state:
- message = ('HUB NOT CLEAR TRYING TO LOAD ' + CUR_LANE.name.upper() + '\n||-----||----|x|-----||\nTRG LOAD HUB TOOL')
+ message = ('HUB NOT CLEAR WHEN TRYING TO LOAD\n||-----||----|x|-----||\nTRG LOAD HUB TOOL')
self.ERROR.handle_lane_failure(CUR_LANE, message)
return False
if not CUR_LANE.load_state:
- message = (CUR_LANE.name.upper() + ' NOT READY\n||==>--||----||-----||\nTRG LOAD HUB TOOL')
+ message = ('NOT READY, LOAD TRIGGER NOT TRIGGERED\n||==>--||----||-----||\nTRG LOAD HUB TOOL')
self.ERROR.handle_lane_failure(CUR_LANE, message)
return False
@@ -702,10 +714,10 @@ def cmd_TOOL_UNLOAD(self, gcmd):
lane = gcmd.get('LANE', self.current)
if lane == None:
return
- if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
- return
- CUR_LANE = self.AFC.stepper[lane.name]
+ if lane not in self.stepper:
+ self.gcode.respond_info('{} Unknown'.format(lane.upper()))
+ return
+ CUR_LANE = self.stepper[lane]
self.TOOL_UNLOAD(CUR_LANE)
# User manually unloaded spool from toolhead, remove spool from active status
@@ -724,6 +736,10 @@ def TOOL_UNLOAD(self, CUR_LANE):
Returns:
bool: True if unloading was successful, False if an error occurred.
"""
+ if not self.is_homed():
+ self.ERROR.AFC_error("Please home printer before doing a tool unload", False)
+ return False
+
if CUR_LANE is None:
# If no lane is provided, exit the function early with a failure.
return False
@@ -811,7 +827,7 @@ def TOOL_UNLOAD(self, CUR_LANE):
num_tries += 1
if num_tries > self.tool_max_unload_attempts:
# Handle failure if the filament cannot be unloaded.
- message = ('FAILED TO UNLOAD {}. FILAMENT STUCK IN TOOLHEAD.'.format(CUR_LANE.name.upper()))
+ message = ('FAILED TO UNLOAD. FILAMENT STUCK IN TOOLHEAD.')
self.ERROR.handle_lane_failure(CUR_LANE, message)
return False
CUR_LANE.extruder_stepper.sync_to_extruder(CUR_LANE.extruder_name)
@@ -834,6 +850,9 @@ def TOOL_UNLOAD(self, CUR_LANE):
# Clear toolhead's loaded state for easier error handling later.
CUR_LANE.tool_loaded = False
self.extruders[CUR_LANE.extruder_name]['lane_loaded'] = ''
+ CUR_LANE.status = None
+ self.current = None
+
self.save_vars()
# Ensure filament is fully cleared from the hub.
@@ -843,7 +862,7 @@ def TOOL_UNLOAD(self, CUR_LANE):
num_tries += 1
if num_tries > (CUR_HUB.afc_bowden_length / self.short_move_dis):
# Handle failure if the filament doesn't clear the hub.
- message = 'HUB NOT CLEARING'
+ message = 'HUB NOT CLEARING\n'
self.ERROR.handle_lane_failure(CUR_LANE, message)
return False
@@ -857,14 +876,15 @@ def TOOL_UNLOAD(self, CUR_LANE):
else:
self.gcode.run_script_from_command(CUR_HUB.cut_cmd)
- # Confirm the hub is clear after the cut.
- while CUR_HUB.state:
- CUR_LANE.move(self.short_move_dis * -1, self.short_moves_speed, self.short_moves_accel, True)
- num_tries += 1
- if num_tries > (CUR_HUB.afc_bowden_length / self.short_move_dis):
- message = 'HUB NOT CLEARING'
- self.ERROR.handle_lane_failure(CUR_LANE, message)
- return False
+ # Confirm the hub is clear after the cut.
+ while CUR_HUB.state:
+ CUR_LANE.move(self.short_move_dis * -1, self.short_moves_speed, self.short_moves_accel, True)
+ num_tries += 1
+ # TODO: Figure out max number of tries
+ if num_tries > (CUR_HUB.afc_bowden_length / self.short_move_dis):
+ message = 'HUB NOT CLEARING after hub cut\n'
+ self.ERROR.handle_lane_failure(CUR_LANE, message)
+ return False
# Finalize unloading and reset lane state.
CUR_LANE.hub_load = True
@@ -895,7 +915,7 @@ def cmd_CHANGE_TOOL(self, gcmd):
None
"""
if not self.is_homed():
- self.ERROR.AFC_error("Please home printer before doing a toolchange", False)
+ self.ERROR.AFC_error("Please home printer before doing a tool change", False)
return
tmp = gcmd.get_commandline()
@@ -933,10 +953,10 @@ def cmd_CHANGE_TOOL(self, gcmd):
self.in_toolchange = True
# Lookup the lane object for the requested lane.
- if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
+ if lane not in self.stepper:
+ self.gcode.respond_info('{} Unknown'.format(lane.upper()))
return
- CUR_LANE = self.AFC.stepper[lane.name]
+ CUR_LANE = self.stepper[lane]
# Check if the lane has completed the preparation process required for tool changes.
if CUR_LANE._afc_prep_done:
# Log the tool change operation for debugging or informational purposes.
@@ -944,10 +964,10 @@ def cmd_CHANGE_TOOL(self, gcmd):
# If a current lane is loaded, unload it first.
if self.current is not None:
- if self.current not in self.AFC.stepper:
- self.AFC.gcode.respond_info(self.current + ' Unknown')
+ if self.current not in self.stepper:
+ self.gcode.respond_info('{} Unknown'.format(self.current.upper()))
return
- CUR_LANE = self.AFC.stepper[self.current]
+ CUR_LANE = self.stepper[self.current]
if not self.TOOL_UNLOAD(CUR_LANE):
# Abort if the unloading process fails.
msg = (' UNLOAD ERROR NOT CLEARED')
@@ -955,15 +975,17 @@ def cmd_CHANGE_TOOL(self, gcmd):
return
# Switch to the new lane for loading.
- if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
+ if lane not in self.stepper:
+ self.gcode.respond_info('{} Unknown'.format(lane.upper()))
return
- CUR_LANE = self.AFC.stepper[lane.name]
+ CUR_LANE = self.stepper[lane]
# Load the new lane and restore the toolhead position if successful.
if self.TOOL_LOAD(CUR_LANE) and not self.error_state:
self.gcode.respond_info("{} is now loaded in toolhead".format(lane))
self.restore_pos()
self.in_toolchange = False
+ else:
+ self.gcode.respond_info("{} already loaded".format(lane))
def get_filament_status(self, LANE):
if LANE.prep_state:
diff --git a/extras/AFC_BoxTurtle.py b/extras/AFC_BoxTurtle.py
index 73a64fd..db6dda4 100644
--- a/extras/AFC_BoxTurtle.py
+++ b/extras/AFC_BoxTurtle.py
@@ -32,13 +32,13 @@ def system_Test(self, UNIT, LANE, delay):
msg = ''
succeeded = True
if LANE not in self.AFC.stepper:
- self.AFC.gcode.respond_info(LANE + ' Unknown')
+ self.AFC.gcode.respond_info('{} Unknown'.format(LANE.upper()))
return
- CUR_LANE = self.AFC.stepper[LANE]
+ CUR_LANE = self.AFC.stepper[LANE]
try: CUR_EXTRUDER = self.printer.lookup_object('AFC_extruder ' + CUR_LANE.extruder_name)
except:
error_string = 'Error: No config found for extruder: ' + CUR_LANE.extruder_name + ' in [AFC_stepper ' + CUR_LANE.name + ']. Please make sure [AFC_extruder ' + CUR_LANE.extruder_name + '] config exists in AFC_Hardware.cfg'
- self.AFC.AFC_error(error_string, False)
+ self.AFC.ERROR.AFC_error(error_string, False)
return False
# Run test reverse/forward on each lane
@@ -184,7 +184,7 @@ def calc_position(lane, state, pos, short_move, tolerance):
def calibrate_lane(LANE):
if LANE not in self.AFC.stepper:
- self.AFC.gcode.respond_info(LANE + ' Unknown')
+ self.AFC.gcode.respond_info('{} Unknown'.format(LANE.upper()))
return
CUR_LANE = self.AFC.stepper[LANE.name]
CUR_HUB = self.printer.lookup_object('AFC_hub {}'.format(CUR_LANE.unit))
diff --git a/extras/AFC_NightOwl.py b/extras/AFC_NightOwl.py
index 1426f7a..f753c72 100644
--- a/extras/AFC_NightOwl.py
+++ b/extras/AFC_NightOwl.py
@@ -25,13 +25,13 @@ def system_Test(self, UNIT, LANE, delay):
msg = ''
succeeded = True
if LANE not in self.AFC.stepper:
- self.AFC.gcode.respond_info(LANE + ' Unknown')
+ self.AFC.gcode.respond_info('{} Unknown'.format(LANE.upper()))
return
- CUR_LANE = self.AFC.stepper[LANE]
+ CUR_LANE = self.AFC.stepper[LANE]
try: CUR_EXTRUDER = self.printer.lookup_object('AFC_extruder ' + CUR_LANE.extruder_name)
except:
error_string = 'Error: No config found for extruder: ' + CUR_LANE.extruder_name + ' in [AFC_stepper ' + CUR_LANE.name + ']. Please make sure [AFC_extruder ' + CUR_LANE.extruder_name + '] config exists in AFC_Hardware.cfg'
- self.AFC.AFC_error(error_string, False)
+ self.AFC.ERROR.AFC_error(error_string, False)
return False
# Run test reverse/forward on each lane
@@ -52,8 +52,8 @@ def system_Test(self, UNIT, LANE, delay):
msg = 'CHECK FILAMENT Prep: False - Load: True'
succeeded = False
- else:
-
+ else:
+
self.AFC.afc_led(self.AFC.led_ready, CUR_LANE.led_index)
msg +="LOCKED"
if CUR_LANE.load_state == False:
diff --git a/extras/AFC_error.py b/extras/AFC_error.py
index 5dcf4cf..f4a6561 100644
--- a/extras/AFC_error.py
+++ b/extras/AFC_error.py
@@ -136,7 +136,7 @@ def handle_lane_failure(self, CUR_LANE, message, pause=True):
# Disable the stepper for this lane
CUR_LANE.do_enable(False)
CUR_LANE.status = 'Error'
- msg = (CUR_LANE.name.upper() + ' NOT READY' + message)
+ msg = "{} {}".format(CUR_LANE.name.upper(), message)
self.AFC_error(msg, pause)
self.AFC.afc_led(self.AFC.led_fault, CUR_LANE.led_index)
diff --git a/extras/AFC_prep.py b/extras/AFC_prep.py
index 903ce9e..dd9cbd1 100644
--- a/extras/AFC_prep.py
+++ b/extras/AFC_prep.py
@@ -6,11 +6,6 @@
import os
import json
-try:
- from urllib.request import urlopen
-except:
- # Python 2.7 support
- from urllib2 import urlopen
class afcPrep:
def __init__(self, config):
@@ -78,16 +73,10 @@ def PREP(self, gcmd):
if LANE.unit not in self.AFC.units: self.AFC.units[LANE.unit] = {}
if LANE.unit not in self.AFC.lanes: self.AFC.lanes[LANE.unit] = {}
if LANE.name not in self.AFC.units[LANE.unit]: self.AFC.units[LANE.unit][LANE.name]={}
- if 'spool_id' in self.AFC.lanes[LANE.unit][LANE.name]: LANE.spool_id = self.AFC.lanes[LANE.unit][LANE.name]['spool_id']
+ if 'spool_id' in self.AFC.lanes[LANE.unit][LANE.name]: LANE.spool_id = self.AFC.lanes[LANE.unit][LANE.name]['spool_id']
+
if self.AFC.spoolman_ip !=None and LANE.spool_id != None:
- try:
- url = 'http://' + self.AFC.spoolman_ip + ':'+ self.AFC.spoolman_port +"/api/v1/spool/" + self.AFC.lanes[LANE.unit][LANE.name]['spool_id']
- result = json.load(urlopen(url))
- LANE.material = result['filament']['material']
- LANE.color = '#' + result['filament']['color_hex']
- if 'remaining_weight' in result: LANE.weight = result['remaining_weight']
- except:
- self.AFC.ERROR.AFC_error("Error when trying to get Spoolman data for ID:{}".format(self.AFC.lanes[LANE.unit][LANE.name]['spool_id']), False)
+ self.AFC.SPOOL.set_spoolID(LANE, LANE.spool_id)
else:
if 'material' in self.AFC.lanes[LANE.unit][LANE.name]: LANE.material = self.AFC.lanes[LANE.unit][LANE.name]['material']
if 'color' in self.AFC.lanes[LANE.unit][LANE.name]: LANE.color = self.AFC.lanes[LANE.unit][LANE.name]['color']
@@ -113,7 +102,7 @@ def PREP(self, gcmd):
try: CUR_HUB = self.printer.lookup_object('AFC_hub '+ UNIT)
except:
error_string = 'Error: Hub for ' + UNIT + ' not found in AFC_Hardware.cfg. Please add the [AFC_Hub ' + UNIT + '] config section.'
- self.AFC.AFC_error(error_string, False)
+ self.AFC.ERROR.AFC_error(error_string, False)
return
self.AFC.gcode.respond_info(CUR_HUB.type + ' ' + UNIT +' Prepping lanes')
diff --git a/extras/AFC_spool.py b/extras/AFC_spool.py
index a081e41..15534ab 100644
--- a/extras/AFC_spool.py
+++ b/extras/AFC_spool.py
@@ -56,7 +56,7 @@ def cmd_SET_MAP(self, gcmd):
lane_switch=self.AFC.tool_cmds[map_cmd]
self.gcode.respond_info("lane to switch is " + lane_switch)
if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
+ self.AFC.gcode.respond_info('{} Unknown'.format(lane.upper()))
return
CUR_LANE = self.AFC.stepper[lane.name]
for UNIT_SERACH in self.AFC.units.keys():
@@ -98,7 +98,7 @@ def cmd_SET_COLOR(self, gcmd):
return
color = gcmd.get('COLOR', '#000000')
if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
+ self.AFC.gcode.respond_info('{} Unknown'.format(lane.upper()))
return
CUR_LANE = self.AFC.stepper[lane.name]
CUR_LANE.color = '#' + color
@@ -129,7 +129,7 @@ def cmd_SET_WEIGHT(self, gcmd):
return
weight = gcmd.get('WEIGHT', '')
if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
+ self.AFC.gcode.respond_info('{} Unknown'.format(lane.upper()))
return
CUR_LANE = self.AFC.stepper[lane.name]
CUR_LANE.weight = weight
@@ -160,7 +160,7 @@ def cmd_SET_MATERIAL(self, gcmd):
return
material = gcmd.get('MATERIAL', '')
if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
+ self.AFC.gcode.respond_info('{} Unknown'.format(lane.upper()))
return
CUR_LANE = self.AFC.stepper[lane.name]
CUR_LANE.material = material
@@ -205,7 +205,7 @@ def cmd_SET_SPOOLID(self, gcmd):
return
SpoolID = gcmd.get('SPOOL_ID', '')
if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
+ self.AFC.gcode.respond_info('{} Unknown'.format(lane.upper()))
return
CUR_LANE = self.AFC.stepper[lane.name]
self.set_spoolID(CUR_LANE, SpoolID)
@@ -220,8 +220,14 @@ def set_spoolID(self, CUR_LANE, SpoolID):
CUR_LANE.material = result['filament']['material']
CUR_LANE.color = '#' + result['filament']['color_hex']
if 'remaining_weight' in result: CUR_LANE.weight = result['remaining_weight']
- except:
- self.AFC.ERROR.AFC_error("Error when trying to get Spoolman data for ID:{}".format(SpoolID), False)
+ # Check to see if filament is defined as multi color and take the first color for now
+ # Once support for multicolor is added this needs to be updated
+ if "multi_color_hexes" in result['filament']:
+ CUR_LANE.color = '#' + result['filament']['multi_color_hexes'].split(",")[0]
+ else:
+ CUR_LANE.color = '#' + result['filament']['color_hex']
+ except Exception as e:
+ self.AFC.ERROR.AFC_error("Error when trying to get Spoolman data for ID:{}, Error: {}".format(SpoolID, e), False)
else:
CUR_LANE.spool_id = ''
CUR_LANE.material = ''
@@ -232,7 +238,7 @@ def set_spoolID(self, CUR_LANE, SpoolID):
cmd_SET_RUNOUT_help = "change filaments ID"
def cmd_SET_RUNOUT(self, gcmd):
"""
- This function handles setting the runout lane (infanet spool) for a specified lane. It retrieves the lane
+ This function handles setting the runout lane (infinite spool) for a specified lane. It retrieves the lane
specified by the 'LANE' parameter and updates its the lane to use if filament is empty
based on the information retrieved from the Spoolman API.
@@ -254,7 +260,7 @@ def cmd_SET_RUNOUT(self, gcmd):
return
runout = gcmd.get('RUNOUT', '')
if lane not in self.AFC.stepper:
- self.AFC.gcode.respond_info(lane + ' Unknown')
+ self.AFC.gcode.respond_info('{} Unknown'.format(lane.upper()))
return
CUR_LANE = self.AFC.stepper[lane.name]
CUR_LANE.runout_lane = runout
diff --git a/extras/AFC_stepper.py b/extras/AFC_stepper.py
index 16ef8b0..eff2a51 100644
--- a/extras/AFC_stepper.py
+++ b/extras/AFC_stepper.py
@@ -85,7 +85,7 @@ def __init__(self, config):
self.stepper_kinematics = ffi_main.gc(
ffi_lib.cartesian_stepper_alloc(b'x'), ffi_lib.free)
self.assist_activate=False
-
+
self.hub_dist = config.getfloat('hub_dist',20)
self.dist_hub = config.getfloat('dist_hub', 60)
# distance to retract filament from the hub
@@ -239,7 +239,7 @@ def prep_callback(self, eventtime, state):
self.reactor.pause(self.reactor.monotonic() + 0.1)
if x> 40:
msg = (' FAILED TO LOAD, CHECK FILAMENT AT TRIGGER\n||==>--||----||------||\nTRG LOAD HUB TOOL')
- self.AFC.AFC_error(msg, False)
+ self.AFC.ERROR.AFC_error(msg, False)
self.AFC.afc_led(self.AFC.led_fault, led)
self.status=''
break