Default UI gcode


#1

What is the problem?
Not really a problem. Would like to know how to see what gcodes the default UI icons send to the printer and how to edit them. I'd like to update the Z axis home icon gcode

What did you already try to solve it?
googled it and found this site

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)
Running version 1.13.10 / 0.15.1 connecting to an X5SA printer.


#2

When I was curious about what the Control tab's buttons did... I opened two browser windows and placed them in such a way that I could see both on the screen.

  1. push button in the first window
  2. observe Terminal in the second

Can you edit what they do? I'm not sure about that but I'd guess "no" other than perhaps forking OctoPrint or patching your installation in place. If you were a coder, you could create a plugin which changes the JavaScript for the native button using some sleight-of-hand but I don't think I'd suggest that.

A quick-and-dirty edit would be to add a custom Control tab button.

Custom Controls
Custom Control tab editor plugin


#3

Never thought about that technique - but it worked :slight_smile: Thank you.
I'm not a big-time coder, but do you know the file/script where these commands are defined? Shouldn't be too hard to search for a command and change it?


#4

Don't do that. If you change the OctoPrint code, you either have to do that again and again as you update to newer OctoPrint versions, or you can not update to newer versions at all.


#5

If I did want to monkeypatch my own copy of OctoPrint, I'd probably use the search feature on foosel's repository to look for the code in question.


#6

https://github.com/ntoff/OctoPrint-CustomZhoming Try this plugin as a place to get started making your own plugin (or just use it if it suits your needs). If octoprint pops up a dialog saying a reload is needed, close and ignore it, a restart of octoprint is required (just reloading the page won't work, octoprint needs to be restarted). Use the system menu and click "restart octoprint".


#7

Thank you. What directory/file will this plugin be located after it's installed?


#8

Wherever octoprint installs them to. You could just git clone the directory to wherever you want it.

ssh into the pi
cd ~
git clone https://github.com/ntoff/OctoPrint-CustomZhoming
source ~/oprint/bin/activate
cd OctoPrint-CustomZhoming
octoprint dev plugin:install

off the top of my head, that should clone the repository to your local user account on the pi, where you can modify the code as necessary and the last line will install it and run it from the source directory (so don't delete it).


#9

^ and then restart OctoPrint to see it in action.


#10

oh yeah, that too. I have a script I run in the dir "pluginstall" that I forgot auto restarts octoprint after installing.