Z-Bolt / OctoPrint-Z-Bolt-OctoScreen

Plugin provides settings management for OctoScreen
GNU Affero General Public License v3.0
20 stars 10 forks source link

2.6.0 Filament Length dosent appear to apply #11

Open distnz opened 3 years ago

distnz commented 3 years ago

Modifying the Filament in and out lengths in the plugin does not appear to affect the filament load and unload lengths when using the buttons from the touchscreen, evenb after multiple reboots of bnoth pi and printer.

Using ender 3 v2, and a pi4 with Version 1.5.2 Octoprint, octopi Version 0.17.0, running on Raspberry Pi 4 Model B Rev 1.1

JeffB42 commented 3 years ago

Thanks for reporting this @distnz . I looked into it and yep, there's a bug. The previous version (2.5) had two different panels, filament.go and filament_multitool.go, and each had their own implementation of loading and unloading (see createLoadButton() in filament.go, line 144 https://github.com/Z-Bolt/OctoScreen/blob/7d0fc084752d29b8c545b85d90e6e83637bd021e/ui/filament.go#L144

func (m *filamentPanel) createLoadButton() gtk.IWidget {

    return MustButtonImage("Load", "extrude.svg", func() {
        cmd := &octoprint.CommandRequest{}
        cmd.Commands = []string{"G91", "G0 E600 F5000", "G0 E120 F500", "G90"}

        Logger.Info("Sending filament load request")
        if err := cmd.Do(m.UI.Printer); err != nil {
            Logger.Error(err)
            return
        }
    })
}

...vs. createLoadButton() in filament_multitool.go, line 123:

func (m *extrudeMultitoolPanel) createLoadButton() gtk.IWidget {
    length := 750.0

    if m.UI.Settings != nil {
        length = m.UI.Settings.FilamentInLength
    }

    return MustButtonImage("Load", "extrude.svg", func() {
        cmd := &octoprint.CommandRequest{}
        cmd.Commands = []string{
            "G91",
            fmt.Sprintf("G0 E%.1f F5000", length*0.80),
            fmt.Sprintf("G0 E%.1f F500", length*0.20),
            "G90",
        }

        Logger.Info("Sending filament load request")
        if err := cmd.Do(m.UI.Printer); err != nil {
            Logger.Error(err)
            return
        }
    })
}

In 2.6, I consolidated the panels and used the version that was originally on filament.go, and isn't using Settings.FilamentInLength. I'll look into fixing this in 2.7.

Jeff