diff --git a/src/octoprint/plugins/pi_support/__init__.py b/src/octoprint/plugins/pi_support/__init__.py index 721b2cdcd..b46e19820 100644 --- a/src/octoprint/plugins/pi_support/__init__.py +++ b/src/octoprint/plugins/pi_support/__init__.py @@ -252,8 +252,14 @@ class PiSupportPlugin( def on_api_get(self, request): if not Permissions.PLUGIN_PI_SUPPORT_STATUS.can(): return flask.abort(403) - result = {"throttle_state": self._throttle_state.as_dict()} - result.update(self.get_additional_environment()) + + environment = self.get_additional_environment() + + result = { + "throttle_state": self._throttle_state.as_dict(), + "model_unrecommended": "zero" in environment.get("model").lower(), + } + result.update(environment) return flask.jsonify(**result) # ~~ AssetPlugin @@ -309,6 +315,7 @@ class PiSupportPlugin( return { "vcgencmd_throttle_check_enabled": True, "vcgencmd_throttle_check_command": _VCGENCMD_THROTTLE, + "ignore_unrecommended_model": False, } def get_settings_restricted_paths(self): diff --git a/src/octoprint/plugins/pi_support/static/js/pi_support.js b/src/octoprint/plugins/pi_support/static/js/pi_support.js index 75388df75..95112fece 100644 --- a/src/octoprint/plugins/pi_support/static/js/pi_support.js +++ b/src/octoprint/plugins/pi_support/static/js/pi_support.js @@ -4,6 +4,7 @@ $(function () { self.loginState = parameters[0]; self.access = parameters[1]; + self.settings = parameters[2]; self.model = ko.observable(); @@ -27,6 +28,42 @@ $(function () { // Raspberry Pi model self.model(response.model); + // Unrecommended model + if ( + response.model_unrecommended && + !self.settings.settings.plugins.pi_support.ignore_unrecommended_model() + ) { + var warning = gettext( + "OctoPrint does not and never has supported the " + + "RPi Zero or Zero W. Use at least a Raspberry Pi 3, or " + + "risk bad performance and failed prints." + ); + var faq = gettext( + "" + + 'You can read more in the FAQ.' + ); + var remove = gettext( + "You can disable this message via Settings > " + + "Pi Support > Ignore warning on unsupported hardware" + ); + new PNotify({ + title: gettext("Unsupported hardware detected"), + text: + "

" + + warning + + "

" + + _.sprintf(faq, { + url: "https://faq.octoprint.org/recommended-hardware" + }) + + "

" + + "" + + remove + + "

", + type: "error", + hide: false + }); + } + // Throttle state self.fromThrottleState(response.throttle_state); @@ -130,6 +167,6 @@ $(function () { OCTOPRINT_VIEWMODELS.push({ construct: PiSupportViewModel, elements: ["#navbar_plugin_pi_support"], - dependencies: ["loginStateViewModel", "accessViewModel"] + dependencies: ["loginStateViewModel", "accessViewModel", "settingsViewModel"] }); }); diff --git a/src/octoprint/plugins/pi_support/templates/pi_support_settings.jinja2 b/src/octoprint/plugins/pi_support/templates/pi_support_settings.jinja2 index a8abffcc0..b16b8f17f 100644 --- a/src/octoprint/plugins/pi_support/templates/pi_support_settings.jinja2 +++ b/src/octoprint/plugins/pi_support/templates/pi_support_settings.jinja2 @@ -3,6 +3,15 @@

{{ _('Please restart OctoPrint after changing any of this plugin\'s settings.') }}

+
+
+ + {{ _('If you check this, you will no longer get warned if you run OctoPrint on Raspberry Pi models that are not officially supported due to bad performance that can lead to failed prints. Do so at your own risk.') }} +
+
+