diff --git a/docs/configuration.md b/docs/configuration.md index c6f4849..bf43ca5 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -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:///webcam/?action=stream. The default value is +# /webcam/?action=stream. +webcam_enabled: True +# Enables the webcam. The default is True. ``` !!! Tip diff --git a/docs/moonraker.conf b/docs/moonraker.conf index 0ae79f3..62f8276 100644 --- a/docs/moonraker.conf +++ b/docs/moonraker.conf @@ -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 diff --git a/docs/user_changes.md b/docs/user_changes.md index d135ce1..4569e0e 100644 --- a/docs/user_changes.md +++ b/docs/user_changes.md @@ -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, diff --git a/moonraker/components/octoprint_compat.py b/moonraker/components/octoprint_compat.py index bcfc67c..dff44a4 100644 --- a/moonraker/components/octoprint_compat.py +++ b/moonraker/components/octoprint_compat.py @@ -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'] = {