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

Add compatibility with Spoolman #87

Open
lettore opened this issue Aug 3, 2023 · 2 comments
Open

Add compatibility with Spoolman #87

lettore opened this issue Aug 3, 2023 · 2 comments

Comments

@lettore
Copy link

lettore commented Aug 3, 2023

Hello, I found an interesting project that can be used as Spool Manager, Spoolman. This is useful for managing and tracking filament usage, Moonraker is fully supporting it. Using Spoolman as spool data storage backend will be awesome and really easy, just set the spool ID number that is inserted in the gate, ERCF can then take filament info like material and color from Spoolman. When loading a specific tool ERCF should say to Moonraker which filament ID is using and Moonraker itself will update the filament usage on Spoolman.

@lettore
Copy link
Author

lettore commented Aug 18, 2023

For now I'm using this method, I set the material type as the ID number of the spool instead of setting PLA etc.
Then in ercf_software.cfg

[gcode_macro _ERCF_ACTION_CHANGED]
description: Called when an action has changed.
gcode:
    # This occurs when the ERCF action status changes.  `printer.ercf.action` will contain
    # the current action string. See Happy Hare README for full list
    #
    # This could be a place to set LED status or similar. The logic here
    # demonstrates the three major action states
    {% set ACTION = printer.ercf.action|string %}

    {% if ACTION|string == "Idle" %}
        # Add your logic here
        # _STATUS_STANDBY
        {% if printer.ercf.tool|int > -1 %}
            #if material loaded is a number, then it should be a Spoolman ID
            {% if printer.ercf.material|int > 0 %} 
                #if material loaded is a number, then it should be a Spoolman ID
                {% if printer.ercf.filament == "Loaded" %} 
                {% set id = printer.ercf.material|int %}
                #set the spool ID
                {action_call_remote_method("spoolman_set_active_spool",spool_id=id)}
                {% else %}
                #clear spool ID as filament is not loaded
                {action_call_remote_method("spoolman_set_active_spool",spool_id=None)}
                {% endif %}
            #clear spool ID as it's invalid
            {% else %}
                {action_call_remote_method("spoolman_set_active_spool",spool_id=None)}
            {% endif %}     
        {% endif %}     
    {% endif %}
    
    {% if ACTION|string == "Loading" %}
        # Add your logic here
        # _STATUS_LOADING
    {% endif %}

    {% if ACTION|string == "Unloading" %}
        # Add your logic here
        # _STATUS_UNLOADING
        {action_call_remote_method("spoolman_set_active_spool",spool_id=None)}
    {% endif %}

For now it's working quite well

@moggieuk
Copy link
Owner

moggieuk commented Sep 4, 2023

Thanks. This is on the intended feature list for Happy Hare v2. Soon....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants