1- # Armored Turtle Automated Filament Changer
2- #
3- # Copyright (C) 2024 Armored Turtle
4- #
5- # This file may be distributed under the terms of the GNU GPLv3 license.
6- from configparser import Error as error
7- try :
8- from extras .AFC_NightOwl import afcNightOwl
9- except :
10- raise error ("Error trying to import AFC_NightOwl, please rerun install-afc.sh script in your AFC-Klipper-Add-On directory then restart klipper" )
11-
12- class afcQuattroBox (afcNightOwl ):
13- def __init__ (self , config ):
14- super ().__init__ (config )
15- self .type = config .get ('type' , 'Quattro_Box' )
16-
17- def handle_connect (self ):
18- """
19- Handle the connection event.
20- This function is called when the printer connects. It looks up AFC info
21- and assigns it to the instance variable `self.AFC`.
22- """
23- super ().handle_connect ()
24-
25- self .logo = '<span class=success--text>Quattro Box Ready</span>'
26-
27- self .logo_error = '<span class=error--text>Quattro Box Not Ready</span>\n '
28- self .set_logo_color (self .led_logo_color )
29-
30- def lane_loaded (self , lane ):
31- """
32- Sets QuattroBox lanes led when lane is loaded and illuminates spool led's
33- once a spool is loaded
34-
35- :param lane: Lane object to set led
36- """
37- super ().lane_loaded (lane )
38- self .afc .function .afc_led (lane .led_spool_illum , lane .led_spool_index )
39-
40- def lane_unloaded (self , lane ):
41- """
42- Sets QuattroBox lanes led when lane is unloaded, and turns off spool
43- illumination once a spool is ejected
44-
45- :param lane: Lane object to set led
46- """
47- super ().lane_loaded (lane )
48- self .afc .function .afc_led (self .afc .led_off , lane .led_spool_index )
49-
50- def lane_loading (self , lane ):
51- """
52- Sets QuattroBox lanes led when lane is loading, and sets logo led's to
53- `led_logo_loading` color
54-
55- :param lane: Lane object to set led
56- """
57- super ().lane_loading (lane )
58- self .set_logo_color ( self .led_logo_loading )
59-
60- def lane_tool_loaded (self , lane ):
61- """
62- Sets QuattroBox lanes led when lane is tool loaded, and sets logo to
63- lanes color
64-
65- :param lane: Lane object to set led
66- """
67- super ().lane_tool_loaded (lane )
68- self .set_logo_color (lane .color )
69-
70- def lane_tool_unloaded (self , lane ):
71- """
72- Sets QuattroBox lanes led when lane is tool unloaded, and sets logo
73- color back to `led_logo_color` color
74-
75- :param lane: Lane object to set led
76- """
77- super ().lane_tool_unloaded (lane )
78- self .set_logo_color (self .led_logo_color )
79-
80- def load_config_prefix (config ):
1+ # Armored Turtle Automated Filament Changer
2+ #
3+ # Copyright (C) 2024 Armored Turtle
4+ #
5+ # This file may be distributed under the terms of the GNU GPLv3 license.
6+ from configparser import Error as error
7+ try :
8+ from extras .AFC_NightOwl import afcNightOwl
9+ except :
10+ raise error ("Error trying to import AFC_NightOwl, please rerun install-afc.sh script in your AFC-Klipper-Add-On directory then restart klipper" )
11+
12+ class afcQuattroBox (afcNightOwl ):
13+ def __init__ (self , config ):
14+ super ().__init__ (config )
15+ self .type = config .get ('type' , 'Quattro_Box' )
16+
17+ def handle_connect (self ):
18+ """
19+ Handle the connection event.
20+ This function is called when the printer connects. It looks up AFC info
21+ and assigns it to the instance variable `self.AFC`.
22+ """
23+ super ().handle_connect ()
24+
25+ self .logo = '<span class=success--text>Quattro Box Ready</span>'
26+
27+ self .logo_error = '<span class=error--text>Quattro Box Not Ready</span>\n '
28+ self .set_logo_color (self .led_logo_color )
29+
30+ def lane_loaded (self , lane ):
31+ """
32+ Sets QuattroBox lanes led when lane is loaded and illuminates spool led's
33+ once a spool is loaded
34+
35+ :param lane: Lane object to set led
36+ """
37+ super ().lane_loaded (lane )
38+ self .afc .function .afc_led (lane .led_spool_illum , lane .led_spool_index )
39+
40+ def lane_unloaded (self , lane ):
41+ """
42+ Sets QuattroBox lanes led when lane is unloaded, and turns off spool
43+ illumination once a spool is ejected
44+
45+ :param lane: Lane object to set led
46+ """
47+ super ().lane_loaded (lane )
48+ self .afc .function .afc_led (self .afc .led_off , lane .led_spool_index )
49+
50+ def lane_loading (self , lane ):
51+ """
52+ Sets QuattroBox lanes led when lane is loading, and sets logo led's to
53+ `led_logo_loading` color
54+
55+ :param lane: Lane object to set led
56+ """
57+ super ().lane_loading (lane )
58+ self .set_logo_color ( self .led_logo_loading )
59+
60+ def lane_tool_loaded (self , lane ):
61+ """
62+ Sets QuattroBox lanes led when lane is tool loaded, and sets logo to
63+ lanes color
64+
65+ :param lane: Lane object to set led
66+ """
67+ super ().lane_tool_loaded (lane )
68+ self .set_logo_color (lane .color )
69+
70+ def lane_tool_unloaded (self , lane ):
71+ """
72+ Sets QuattroBox lanes led when lane is tool unloaded, and sets logo
73+ color back to `led_logo_color` color
74+
75+ :param lane: Lane object to set led
76+ """
77+ super ().lane_tool_unloaded (lane )
78+ self .set_logo_color (self .led_logo_color )
79+
80+ def load_config_prefix (config ):
8181 return afcQuattroBox (config )
0 commit comments