Custom controls - disable buttons/controls while printing

What is the problem?

I want to disable buttons/ controls while printing

What did you already try to solve it?

I have searched the internet and the documentation regarding config.yaml

Have you tried running in safe mode?

No

Did running in safe mode solve the problem?

I doubt it

Systeminfo Bundle

octoprint-systeminfo-20220302162036.zip (105.3 KB)

WRITE HERE

Additional information about your setup

This is a general problem I would think

I have made it like below in config.yaml, the controls works brilliant but I want them to be disabled when I print as it would create problems if I all of a sudden press one of those buttons in the middle of a print. Clumpsy fingers I guess... the "enable:" is where I have tried with false or true, will only disable or enable the control in general and does not affect the behaviour when the print starts (from what I can see).. Thx for helping out as I am a bit lost here... maybe @foosel can help out here?

controls:

  • children:
    • commands:
      • G28
      • G90
      • M104 S200
      • M109 S200
      • G1 X300.0 Z50.0 F3000
        enabled:
        name: Load filament position
    • commands:
      • G92 E0
      • G1 E60 F200
      • G92 E0
      • M84
        enabled:
        name: Load Filament
    • commands:
      • G92 E0
      • G1 E50 F100
      • G4 P2000
      • G1 E-200 F200
      • G92 E0
      • M84
        enabled:
        name: Unload Filament
        layout: horizontal
        name: Filament Loading

Am I the only one who would like this feature @foosel ?

Please don't just blindly drag me into threads, I'm drowning in work enough as is.

With the enabled section, it supports adding a JavaScript snippet to determine the value. It works in the context of the ControlViewModel. I will have a look at the options and get back with a possible option later (very possible I'll forget...)

Sorry Gina, I fully understand, it was not fair of me... I guess that is how it goes sometimes when one self(ish) is passionate about a particular function. Keep up the good work!

Awesome @Charlie_Powell , you rock, thx man!

Try:

enabled: self.isReady()

That should do it, though I haven't tested it.

That makes sense to me. Other option might be.

enabled: !self.isPrinting()

but that doesn't take into account a disconnected printer.

1 Like

Awesome, it worked just the way I wanted it to work :slight_smile:
Thank you so much @Charlie_Powell !
May I ask where one can find the documentation for that variable and way of working?

Thx, I went with what @Charlie_Powell wrote, but will test your way too for the sake of it :slight_smile:

They are not really documented - it runs in the context of the control tab viewmodel, and the code for that can be found here OctoPrint/control.js at e3e2d4dbeb7078e08325ebb46fd4a89f5cd8c574 Β· OctoPrint/OctoPrint Β· GitHub

Brilliant, thx @Charlie_Powell :+1:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.