octoprint_compat: add webcam settings

Signed-off-by: Simon Germain <sgermain06@gmail.com>
This commit is contained in:
Simon Germain 2022-02-17 10:46:05 -05:00 committed by GitHub
parent f79439aedd
commit 11f4ae75cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 12 deletions

View File

@ -245,6 +245,21 @@ enable_ufp: True
# files will be uploaded in UFP format. When set to False Cura will
# upload files in .gcode format. This setting has no impact on other
# slicers. The default is True.
flip_h: False
# Set the webcam horizontal flip. The default is False.
flip_h: False
# Set the webcam vertical flip. The default is False.
rotate_90: False
# Set the webcam rotation by 90 degrees. The default is False.
stream_url: /webcam/?action=stream
# The URL to use for streaming the webcam. It can be set to an absolute
# URL if needed. In order to get the webcam to work in Cura through
# an Octoprint connection, you can set this value to
# http://<octoprint ip>/webcam/?action=stream. The default value is
# /webcam/?action=stream.
webcam_enabled: True
# Enables the webcam. The default is True.
```
!!! Tip

View File

@ -18,3 +18,9 @@ cors_domains:
# Supports Cura, Slic3r, and Slic3r dervivatives
# (PrusaSlicer, SuperSlicer)
[octoprint_compat]
# Default webcam config values:
# flip_h = false
# flip_v = false
# rotate_90 = false
# stream_url = /webcam/?action=stream
# webcam_enabled = true

View File

@ -2,6 +2,20 @@
This file will track changes that require user intervention,
such as a configuration change or a reinstallation.
### February 16th 2022
- Webcam settings can now be defined in the `moonraker.conf` file, under
the `[octoprint_compat]` section. The default values are being used as
default values.
Default values:
| Setting | Default value |
|---------|---------------|
| flip_h | False |
| flip_v | False |
| rotate_90 | False |
| stream_url | /webcam/?action=stream |
| webcam_enabled | True |
### January 22th 2022
- The `color_order` option in the `[wled]` section has been deprecated.
This is configured in wled directly. This is not a breaking change,

View File

@ -43,6 +43,15 @@ class OctoprintCompat:
'software_version')
self.enable_ufp: bool = config.getboolean('enable_ufp', True)
# Get webcam settings from config
self.webcam: Dict[str, Any] = {
'flipH': config.getboolean('flip_h', False),
'flipV': config.getboolean('flip_v', False),
'rotate90': config.getboolean('rotate_90', False),
'streamUrl': config.get('stream_url', '/webcam/?action=stream'),
'webcamEnabled': config.getboolean('webcam_enabled', True),
}
# Local variables
self.klippy_apis: APIComp = self.server.lookup_component('klippy_apis')
self.heaters: Dict[str, Dict[str, Any]] = {}
@ -216,9 +225,6 @@ class OctoprintCompat:
) -> Dict[str, Any]:
"""
Used to parse Octoprint capabilities
Hardcode capabilities to be basically there and use default
fluid/mainsail webcam path.
"""
settings = {
'plugins': {},
@ -226,15 +232,7 @@ class OctoprintCompat:
'sdSupport': False,
'temperatureGraph': False
},
# TODO: Get webcam settings from config file to allow user
# to customise this.
'webcam': {
'flipH': False,
'flipV': False,
'rotate90': False,
'streamUrl': '/webcam/?action=stream',
'webcamEnabled': True,
},
'webcam': self.webcam,
}
if self.enable_ufp:
settings['plugins'] = {