Skip to content

Commit

Permalink
GITBOOK-166: Macro Prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou authored and gitbook-bot committed Dec 16, 2023
1 parent 6fd9920 commit 0534e33
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 15 deletions.
Binary file added .gitbook/assets/image (27).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/image (28).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/image (29).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/image (30).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,24 @@
## overview

* [Features](overview/features/README.md)
* [Thumbnails](overview/features/thumbnails.md)
* [Bed Mesh](overview/features/bed-mesh.md)
* [Console](overview/features/console.md)
* [Dashboard Organisation](overview/features/dashboard-organisation.md)
* [Exclude Objects](overview/features/exclude-objects.md)
* [Hide macros, outputs or fans](overview/features/hide-macros-outputs-or-fans.md)
* [Print History and Statistics](overview/features/print-history-and-statistics.md)
* [Localization](overview/features/localization.md)
* [Presets](overview/features/presets.md)
* [Macro Management](overview/features/macro-management-stub.md)
* [Webcam](overview/features/webcam.md)
* [Macro Prompts](overview/features/macro-prompts.md)
* [Presets](overview/features/presets.md)
* [Print History and Statistics](overview/features/print-history-and-statistics.md)
* [Themes](overview/features/themes/README.md)
* [Prepare](overview/features/themes/prepare.md)
* [Backgrounds](overview/features/themes/backgrounds.md)
* [Logos and Icons](overview/features/themes/logos-and-icons.md)
* [Custom CSS](overview/features/themes/custom-css.md)
* [Community Themes](overview/features/themes/themes.md)
* [Thumbnails](overview/features/thumbnails.md)
* [Webcam](overview/features/webcam.md)
* [Settings](overview/settings/README.md)
* [General](overview/settings/general.md)
* [Console](overview/settings/console.md)
Expand Down
100 changes: 100 additions & 0 deletions overview/features/macro-prompts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
description: >-
It allows macros in Klipper to trigger dialog prompts to interact with the
Firmware and will enable the user to choose between options or to close the
dialog again in case it's no longer needed.
---

# Macro Prompts

<figure><img src="../../.gitbook/assets/image (28).png" alt="Example Filament Runout Prompt"><figcaption><p>Example: Filament runout prompt</p></figcaption></figure>

{% hint style="warning" %}
This feature needs the `[respond]` module of Klipper. So please check if this is enabled in your Klipper config.

This feature has been implemented since Mainsail v2.9.0. So, double-check your Mainsail version to be safe to use this feature.
{% endhint %}

## Supported Macro prompt commands:

With these command, you can build your own Macro-Prompt:

### // action:prompt\_begin \<headline>

This is the first command to define a prompt. The `<headline>`-Attribute will be the headline of the prompt dialog.

### // action:prompt\_text \<text>

This command is to add a description text in the prompt.

### // action:prompt\_button \<label>|\<gcode?>|\<color?>

With this command, you can add a button in the prompt.

* `<label>`: Is the text inside of the button
* `<gcode?>`: This attribute is optional to add a different G-Code to this button. (Default is the label text)
* `<color?>`: This attribute is optional and will change the color of the button. Possible options are `primary`, `secondary`, `info`, `warning`, `error`. (Default is dark gray)

<figure><img src="../../.gitbook/assets/image (29).png" alt=""><figcaption><p>Example of all button colors</p></figcaption></figure>

### // action:prompt\_button\_group\_start

With this command, you can start a "button group". This will allow you to display multiple buttons in the same row.

### // action:prompt\_button\_group\_end

With this command, you can close the current "button group"

### // action:prompt\_footer\_button \<label>|\<gcode?>|\<color?>

With this command, you can add a button in the footer of the prompt.

* `<label>`: Is the text inside of the button
* `<gcode?>`: This attribute is optional to add a different G-Code to this button. (Default is the label text)
* `<color?>`: This attribute is optional and will change the color of the button. Possible options are `primary`, `secondary`, `info`, `warning`, `error`. (Default is white)

<figure><img src="../../.gitbook/assets/image (30).png" alt=""><figcaption><p>Example of footer buttons</p></figcaption></figure>

### // action:prompt\_show

With this command, the prompt dialog will be displayed

### // action:prompt\_end

This command will close/hide the prompt dialog.

## Examples

Here some examples of Macro-Prompts

### Prompt with multiple Button-Groups

```yaml
[gcode_macro SHOW_PROMT_BUTTON_GROUPS]
gcode:
RESPOND TYPE=command MSG="action:prompt_begin MacroPrompt"
RESPOND TYPE=command MSG="action:prompt_text These are all button colors"
RESPOND TYPE=command MSG="action:prompt_button default|TEST"
RESPOND TYPE=command MSG="action:prompt_button_group_start"
RESPOND TYPE=command MSG="action:prompt_button primary|TEST|primary"
RESPOND TYPE=command MSG="action:prompt_button secondary|TEST|secondary"
RESPOND TYPE=command MSG="action:prompt_button_group_end"
RESPOND TYPE=command MSG="action:prompt_button_group_start"
RESPOND TYPE=command MSG="action:prompt_button info|TEST|info"
RESPOND TYPE=command MSG="action:prompt_button warning|TEST|warning"
RESPOND TYPE=command MSG="action:prompt_button error|TEST|error"
RESPOND TYPE=command MSG="action:prompt_button_group_end"
RESPOND TYPE=command MSG="action:prompt_show"
```
### Simple question prompt
```yaml
[gcode_macro SHOW_PROMT]
gcode:
RESPOND TYPE=command MSG="action:prompt_begin Question"
RESPOND TYPE=command MSG="action:prompt_text Do you wont to cancel the print?"
RESPOND TYPE=command MSG="action:prompt_footer_button continue|RESPOND TYPE=command MSG=action:prompt_end"
RESPOND TYPE=command MSG="action:prompt_footer_button CANCEL|CANCEL_PRINT|error"
RESPOND TYPE=command MSG="action:prompt_show"
```
4 changes: 2 additions & 2 deletions overview/settings/webcams.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ At first, you have to give the camera a name, and you can assign an icon to it.

You also need to specify stream and snapshot URL. For network cameras, please consult the manufacturer's manual or search the Internet.

**Note:** In [MainsailOS](http://127.0.0.1:5000/o/O2j4rN2JOaGEeS1KBjXz/s/HZGYoL7ogomNyBLNEpEJ/), by default, four webcam ports are mapped to URLs. Notice that the first URL doesn't contain a number. Check which port you have configured in your streamer and add the URLs.
**Note:** In [MainsailOS](https://app.gitbook.com/o/O2j4rN2JOaGEeS1KBjXz/s/HZGYoL7ogomNyBLNEpEJ/), by default, four webcam ports are mapped to URLs. Notice that the first URL doesn't contain a number. Check which port you have configured in your streamer and add the URLs.

<table><thead><tr><th width="150">Port</th><th>Stream URL</th><th>Snapshot URL</th></tr></thead><tbody><tr><td>8080</td><td>/webcam/?action=stream</td><td>/webcam/?action=snapshot</td></tr><tr><td>8081</td><td>/webcam2/?action=stream</td><td>/webcam2/?action=snapshot</td></tr><tr><td>8082</td><td>/webcam3/?action=stream</td><td>/webcam3/?action=snapshot</td></tr><tr><td>8083</td><td>/webcam4/?action=stream</td><td>/webcam4/?action=snapshot</td></tr></tbody></table>

### Service

You also need to select a streaming mode. Below are descriptions of the different modes, so you can decide. Try out what works best for you.

<table><thead><tr><th width="213.55085622344592">Mode</th><th>Description</th></tr></thead><tbody><tr><td><strong>MJPEG-Streamer</strong></td><td><p>The streamer mode extracts individual frames from the stream URL and streams them. </p><p></p><p>This is to prevent the buildup of delay in case of insufficient bandwidth. <br><br><strong>IMPORTANT:</strong> This mode does currently not work on iOS devices for technical reasons.</p></td></tr><tr><td><strong>Adaptive MJPEG-Streamer</strong></td><td><p>The adaptive mode takes the snapshot URL and pulls individual images. </p><p></p><p>Also, this is intended to prevent a delay.</p></td></tr><tr><td><strong>UV4L-MJPEG</strong></td><td><p>The classic mode is the plain MJPEG stream embedded in an image tag. </p><p></p><p>In this case, it can happen that after some runtime a delay steadily builds up, because frames cannot be skipped. Only a browser reload will help.</p></td></tr><tr><td><strong>IP-Camera</strong></td><td>The stream URL is embedded in an HTML5 video element. We can't really provide support for this. Browser plugins may be required.</td></tr><tr><td><strong>WebRTC (camera-streamer)</strong></td><td>This stream is very bandwidth efficient.<br><br><strong>IMPORTANT</strong>: This mode is currently only available on Raspberry devices.</td></tr><tr><td><strong>WebRTC (MediaMTX)</strong></td><td>This stream is very bandwidth efficient. This mode can also be used for WYZE-Cams with the docker-WYZE-Bridge. Here you can find a tutorial: <a href="http://127.0.0.1:5000/s/qXE1OQLsr0XFNbT54RTY/faq/how-to-use-wyze-cams">LINK</a><br><br><strong>IMPORTANT:</strong> min. v0.23 of MediaMTX</td></tr><tr><td><strong>HLS Streamer</strong></td><td>This mode is for IP webcams with RTSP support.</td></tr></tbody></table>
<table><thead><tr><th width="213.55085622344592">Mode</th><th>Description</th></tr></thead><tbody><tr><td><strong>MJPEG-Streamer</strong></td><td><p>The streamer mode extracts individual frames from the stream URL and streams them. </p><p></p><p>This is to prevent the buildup of delay in case of insufficient bandwidth. <br><br><strong>IMPORTANT:</strong> This mode does currently not work on iOS devices for technical reasons.</p></td></tr><tr><td><strong>Adaptive MJPEG-Streamer</strong></td><td><p>The adaptive mode takes the snapshot URL and pulls individual images. </p><p></p><p>Also, this is intended to prevent a delay.</p></td></tr><tr><td><strong>UV4L-MJPEG</strong></td><td><p>The classic mode is the plain MJPEG stream embedded in an image tag. </p><p></p><p>In this case, it can happen that after some runtime a delay steadily builds up, because frames cannot be skipped. Only a browser reload will help.</p></td></tr><tr><td><strong>IP-Camera</strong></td><td>The stream URL is embedded in an HTML5 video element. We can't really provide support for this. Browser plugins may be required.</td></tr><tr><td><strong>WebRTC (camera-streamer)</strong></td><td>This stream is very bandwidth efficient.<br><br><strong>IMPORTANT</strong>: This mode is currently only available on Raspberry devices.</td></tr><tr><td><strong>WebRTC (MediaMTX)</strong></td><td>This stream is very bandwidth efficient. This mode can also be used for WYZE-Cams with the docker-WYZE-Bridge. Here you can find a tutorial: <a href="https://app.gitbook.com/s/qXE1OQLsr0XFNbT54RTY/faq/how-to-use-wyze-cams">LINK</a><br><br><strong>IMPORTANT:</strong> min. v0.23 of MediaMTX</td></tr><tr><td><strong>HLS Streamer</strong></td><td>This mode is for IP webcams with RTSP support.</td></tr></tbody></table>



Expand Down
4 changes: 2 additions & 2 deletions setup/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ _<mark style="color:red;">recommended for Raspberry Pi users</mark>_

MainsailOS is a prebuilt image for single board computers that already includes Mainsail, Moonraker and Klipper. The least amount of setup.

{% content-ref url="http://127.0.0.1:5000/o/O2j4rN2JOaGEeS1KBjXz/s/HZGYoL7ogomNyBLNEpEJ/" %}
[MainsailOS](http://127.0.0.1:5000/o/O2j4rN2JOaGEeS1KBjXz/s/HZGYoL7ogomNyBLNEpEJ/)
{% content-ref url="https://app.gitbook.com/o/O2j4rN2JOaGEeS1KBjXz/s/HZGYoL7ogomNyBLNEpEJ/" %}
[MainsailOS](https://app.gitbook.com/o/O2j4rN2JOaGEeS1KBjXz/s/HZGYoL7ogomNyBLNEpEJ/)
{% endcontent-ref %}

### KIAUH - _Klipper Installation And Update Helper_
Expand Down
7 changes: 0 additions & 7 deletions setup/installation/manual-setup.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
---
description: >-
This page contains step-by-step instructions on how to manually install
Mainsail on a Raspberry Pi. Manual installation is slightly more complex than
using a pre-built image, but more flexible.
---

# Manual setup

## Operating System <a href="#operating-system" id="operating-system"></a>
Expand Down

0 comments on commit 0534e33

Please sign in to comment.