Skip to content

Commit 88e8e03

Browse files
committed
🥅 Add check for "TF card" firmware bug
1 parent 1201ed4 commit 88e8e03

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

‎octoprint_firmware_check/checks/firmware_broken.py‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
__copyright__ = "Copyright (C) 2020 The OctoPrint Project - Released under terms of the AGPLv3 License"
66

77
from flask_babel import gettext
8+
from octoprint.settings import settings
89

910
from . import LineCheck, Severity
1011

@@ -13,7 +14,12 @@ class FirmwareBrokenChecks(object):
1314
@classmethod
1415
def as_dict(cls):
1516
return dict(
16-
checks=(CbdCheck(), ZwlfCheck(), CrealityDoubleTempCheck()),
17+
checks=(
18+
CbdCheck(),
19+
ZwlfCheck(),
20+
CrealityDoubleTempCheck(),
21+
CrealityTFCardCheck(),
22+
),
1723
message=gettext(
1824
"Your printer's firmware is known to have a broken implementation of the "
1925
"communication protocol. This may cause print failures or other annoyances. "
@@ -67,3 +73,25 @@ class CrealityEqualsTempCheck(CrealityDoubleTempCheck):
6773
def _is_match(self, line):
6874
# broken report: ==T:145.66 /210.00 ==B:60.15 /60.00 @:127 B@:0
6975
return "==T:" in line
76+
77+
78+
class CrealityTFCardCheck(LineCheck):
79+
name = "creality_tfcard"
80+
url = "https://faq.octoprint.org/warning-firmware-broken-creality-tfcard"
81+
82+
def m115(self, name, data):
83+
# we cannot stop scanning after an M115 report as we might not yet have seen an SD card report then
84+
pass
85+
86+
def _is_match(self, line):
87+
return "TF card ok" in line
88+
89+
def _is_ruled_out(self, line):
90+
# first thing that looks like a proper report stops scanning
91+
lower_line = line.lower()
92+
return not settings().getBoolean(["feature", "sdSupport"]) or any(
93+
map(
94+
lambda x: x in lower_line,
95+
("sd card ok", "sd init fail", "sd printing byte", "not sd printing"),
96+
)
97+
)

0 commit comments

Comments
 (0)