Skip to content

Commit 751a9eb

Browse files
committed
🐛 Fix false positive for the Zero 2
1 parent 29f927e commit 751a9eb

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

octoprint_pi_support/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
_FLAG_PAST_FREQ_CAPPED = 1 << 17
6464
_FLAG_PAST_THROTTLED = 1 << 18
6565

66+
_UNRECOMMENDED_MODELS = ("Zero", "Zero W")
67+
6668

6769
class ThrottleState(object):
6870
@classmethod
@@ -197,6 +199,14 @@ def is_octopi():
197199
return os.path.exists(_OCTOPI_VERSION_PATH)
198200

199201

202+
def is_model_any_of(model, *args):
203+
model = model.lower()
204+
for arg in map(lambda x: x.lower(), args):
205+
if "{} rev".format(arg) in model or model.endswith(arg):
206+
return True
207+
return False
208+
209+
200210
_octopi_version = None
201211

202212

@@ -277,7 +287,9 @@ def on_api_get(self, request):
277287
result.update(
278288
{
279289
"throttle_state": self._throttle_state.as_dict(),
280-
"model_unrecommended": "zero" in result.get("model").lower(),
290+
"model_unrecommended": is_model_any_of(
291+
result.get("model"), *_UNRECOMMENDED_MODELS
292+
),
281293
}
282294
)
283295
return flask.jsonify(**result)

octoprint_pi_support/static/js/pi_support.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $(function () {
3535
) {
3636
var warning = gettext(
3737
"OctoPrint does not and never has supported the " +
38-
"RPi Zero or Zero W. Use at least a Raspberry Pi 3, or " +
38+
"RPi Zero or Zero W. Use at least a Raspberry Pi 3 or Zero 2, or " +
3939
"risk bad performance and failed prints."
4040
);
4141
var faq = gettext(

0 commit comments

Comments
 (0)