diff --git a/octoprint_wled/__init__.py b/octoprint_wled/__init__.py index 60c0b09..01ec81c 100644 --- a/octoprint_wled/__init__.py +++ b/octoprint_wled/__init__.py @@ -355,6 +355,7 @@ def get_settings_defaults(self) -> Dict[str, Any]: "id": 0, "override_on": False, "unique_id": "yqvg8h0c", + "scrolling_text": False, } ], }, @@ -368,6 +369,7 @@ def get_settings_defaults(self) -> Dict[str, Any]: "id": 0, "override_on": False, "unique_id": "sduhc3fh", + "scrolling_text": False, } ], "tool": True, @@ -384,6 +386,7 @@ def get_settings_defaults(self) -> Dict[str, Any]: "id": 0, "override_on": False, "unique_id": "argrsh53", + "scrolling_text": False, } ], "bed_or_tool": "tool", diff --git a/octoprint_wled/progress.py b/octoprint_wled/progress.py index bef0e24..f363f89 100644 --- a/octoprint_wled/progress.py +++ b/octoprint_wled/progress.py @@ -65,6 +65,8 @@ def set_progress(self, value: int, progress_type: str): for segment in effect_settings: if segment["override_on"]: turn_lights_on = True + if segment["scrolling_text"]: + effect_scrolling_text = True self._logger.debug( f"Setting {progress_type} progress to segment {segment['id']}" @@ -77,9 +79,10 @@ def set_progress(self, value: int, progress_type: str): "brightness": int(segment["brightness"]), "color_primary": hex_to_rgb(segment["color_primary"]), "color_secondary": hex_to_rgb(segment["color_secondary"]), - "effect": "Percent", - "intensity": int(value), + "effect": "Scrolling Text" if effect_scrolling_text else "Percent", + "intensity": 128 if effect_scrolling_text else int(value), "on": lights_on, + "n": f"{value}% Complete" if effect_scrolling_text else None, }, ) diff --git a/octoprint_wled/static/src/wled.js b/octoprint_wled/static/src/wled.js index a820b30..7852643 100644 --- a/octoprint_wled/static/src/wled.js +++ b/octoprint_wled/static/src/wled.js @@ -53,7 +53,8 @@ $(function () { brightness: ko.observable(200), color_primary: ko.observable('#ffffff'), color_secondary: ko.observable('#000000'), - override_on: ko.observable(false) + override_on: ko.observable(false), + scrolling_text: ko.observable(false) }) self.setEditingObservables = (effect, data) => { @@ -111,6 +112,9 @@ $(function () { observables.override_on( settings.progress[name].settings()[index].override_on() ) + observables.scrolling_text( + settings.progress[name].settings()[index].scrolling_text() + ) self.progress[name].segments.push(observables) }) }) diff --git a/octoprint_wled/templates/wled-settings/sub/editmodal.jinja2 b/octoprint_wled/templates/wled-settings/sub/editmodal.jinja2 index 4bbb979..3e09e01 100644 --- a/octoprint_wled/templates/wled-settings/sub/editmodal.jinja2 +++ b/octoprint_wled/templates/wled-settings/sub/editmodal.jinja2 @@ -72,6 +72,7 @@ {{ settingsInput("Brightness", "number", "progress", identifier, "brightness") }} {{ settingsInput("Progress Color", "color", "progress", identifier, "color_primary") }} {{ settingsInput("Base Color", "color", "progress", identifier, "color_secondary") }} + {{ settingsInput("Scrolling Text", "checkbox", "progress", identifier, "scrolling_text") }} {{ settingsInput("Overrides on/off", "checkbox", "progress", identifier, "override_on", "When checked, this effect will always turn all the WLED LEDs back on, if they are off") }}