Преглед изворни кода

Added some stuff to OctoTray

Thomas Buck пре 3 година
родитељ
комит
9ae55eede4
2 измењених фајлова са 62 додато и 2 уклоњено
  1. 28
    0
      input/projects/3d-printing/octoprint.md
  2. 34
    2
      input/projects/3d-printing/octotray.md

+ 28
- 0
input/projects/3d-printing/octoprint.md Прегледај датотеку

@@ -25,6 +25,34 @@ I've decided to simply use the GPIOs at the top of the Raspberry Pi pinheader no
25 25
 
26 26
 [Here are the instructions to add commands for controlling the printer power](https://github.com/foosel/OctoPrint/wiki/Controlling-a-relay-board-from-your-RPi#manual-way). I'd suggest using this way of adding some system actions to OctoPrint, as these can also be used from the Telegram Plugin for example. This is not the case when using the PSU Control Plugin in OctoPrint.
27 27
 
28
+The system commands are also described in the [OctoPrint docs](https://docs.octoprint.org/en/master/configuration/config_yaml.html#system).
29
+Mine look like this.
30
+
31
+    system:
32
+        actions:
33
+        -   action: all on
34
+            command: gpio -g mode 20 out && gpio -g write 20 0 && gpio -g mode 26 out
35
+                && gpio -g write 26 0
36
+            name: Turn on printer & lights
37
+        -   action: all off
38
+            command: gpio -g write 20 1 && gpio -g mode 20 in && gpio -g write 26 1 &&
39
+                gpio -g mode 26 in
40
+            confirm: You are about to turn off the printer and the lights.
41
+            name: Turn off printer & lights
42
+        -   action: lights on
43
+            command: gpio -g mode 20 out && gpio -g write 20 0
44
+            name: Turn on lights
45
+        -   action: lights off
46
+            command: gpio -g write 20 1 && gpio -g mode 20 in
47
+            name: Turn off lights
48
+        -   action: printer on
49
+            command: gpio -g mode 26 out && gpio -g write 26 0
50
+            name: Turn on printer
51
+        -   action: printer off
52
+            command: gpio -g write 26 1 && gpio -g mode 26 in
53
+            confirm: You are about to turn off the printer.
54
+            name: Turn off printer
55
+
28 56
 ### Automatically Connect to Printer
29 57
 
30 58
 [Bernd Zeimetz has a great writeup on how to auto-connect to the serial port](https://bzed.de/post/2017/11/octoprint_autoconnect_printer/) of your 3D printer.

+ 34
- 2
input/projects/3d-printing/octotray.md Прегледај датотеку

@@ -9,9 +9,9 @@ date: 2021-05-08
9 9
 
10 10
 <span class="listdesc">[...back to 3D-Printing overview](3d-printing.html)</span>
11 11
 
12
-To quickly print new stuff on one of my printers, I am using the OctoPrint integration of PrusaSlicer.
12
+To quickly print new stuff on one of my printers, I am using the [OctoPrint](https://octoprint.org) integration of [PrusaSlicer](https://github.com/prusa3d/PrusaSlicer).
13 13
 Unfortunately, it does not allow me to turn on the printers power supply using the Raspberry Pi.
14
-But it is possible to do that via the OctoPrint REST API.
14
+But it is possible to do that via the [OctoPrint REST API](https://docs.octoprint.org/en/master/api/index.html).
15 15
 Because of that, I wrote a small tool to trigger the power of my printers that lives in the system tray.
16 16
 It runs on Linux using the Python Qt5 bindings.
17 17
 
@@ -21,4 +21,36 @@ lightgallery([
21 21
 ])
22 22
 %-->
23 23
 
24
+You need to enter the hostnames / IPs and the API keys of your printers at the beginning of the python file in the repo.
25
+The program will automatically detect if you are using the [PSU Control OctoPrint Plugin](https://plugins.octoprint.org/plugins/psucontrol/) it will use that to toggle the power.
26
+Otherwise it looks for custom system commands, named "all on" and "all off", as described in the [OctoPrint docs](https://docs.octoprint.org/en/master/configuration/config_yaml.html#system).
27
+Mine look like this.
28
+
29
+    system:
30
+        actions:
31
+        -   action: all on
32
+            command: gpio -g mode 20 out && gpio -g write 20 0 && gpio -g mode 26 out
33
+                && gpio -g write 26 0
34
+            name: Turn on printer & lights
35
+        -   action: all off
36
+            command: gpio -g write 20 1 && gpio -g mode 20 in && gpio -g write 26 1 &&
37
+                gpio -g mode 26 in
38
+            confirm: You are about to turn off the printer and the lights.
39
+            name: Turn off printer & lights
40
+        -   action: lights on
41
+            command: gpio -g mode 20 out && gpio -g write 20 0
42
+            name: Turn on lights
43
+        -   action: lights off
44
+            command: gpio -g write 20 1 && gpio -g mode 20 in
45
+            name: Turn off lights
46
+        -   action: printer on
47
+            command: gpio -g mode 26 out && gpio -g write 26 0
48
+            name: Turn on printer
49
+        -   action: printer off
50
+            command: gpio -g write 26 1 && gpio -g mode 26 in
51
+            confirm: You are about to turn off the printer.
52
+            name: Turn off printer
53
+
24 54
 You can find the project [on my Gitea server](https://git.xythobuz.de/thomas/OctoTray) or on [GitHub](https://github.com/xythobuz/OctoTray).
55
+
56
+I also wrote a bit more about my OctoPrint setups [on this page](octoprint.html).

Loading…
Откажи
Сачувај