Skip to content

Commit

Permalink
Update to match Marlin 2 changes.
Browse files Browse the repository at this point in the history
Update to match changes done by
MarlinFirmware/Marlin#24879
  • Loading branch information
arekm committed Dec 8, 2022
1 parent 3bd90d6 commit f428bb8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 49 deletions.
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,7 @@ SILENT MODE: Percent done: 21; print time remaining in mins: 34; Change in mins:
* [Marlin 2](https://github.com/MarlinFirmware/Marlin) (v2.1.2+)

```
echo: M73 Percent done: 10; Print time remaining in mins: 20; Change in mins: 7;
```

but also other variant (when default M73_REPORT_PRUSA option is disabled)

```
echo: M73 Progress: 10%; Time left: 20.0m; Change: 7m
echo: M73 Progress: 10%; Time left: 20.0m; Change: 7m;
```

(each part of report is optional and configurable in Marlin 2)
Expand Down
8 changes: 2 additions & 6 deletions octoprint_PrusaETAOverride/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ def __init__(self):
re.compile(
r"(?P<mode>\w+) MODE: Percent done: (?P<progress>-?\d+); print time remaining in mins: (?P<eta>-?\d+)(?:; Change in mins: (?P<eta_interaction>-?\d+))?"
),
# Marlin 2.1.2+ with M73_REPORT_PRUSA option
# Marlin 2.1.2+ (>= 20221208)
re.compile(
r"M73 Percent done:\s+(?P<progress>\d+(?:\.\d+)?);(?: Print time remaining in mins:\s+(?P<eta>\d+(?:\.\d+)?);)?(?: Change in mins:\s+(?P<eta_interaction>\d+(?:\.\d+)?);)?"
),
# Marlin 2.1.2+ without M73_REPORT_PRUSA option
re.compile(
r"M73 Progress:\s+(?P<progress>\d+(?:\.\d+)?)%{0,1};{0,1}(?: Time left:\s+(?P<eta>\d+(?:\.\d+)?)m;{0,1})?(?: Change:\s+(?P<eta_interaction>\d+(?:\.\d+)?)m)?"
r"M73 Progress:\s+(?P<progress>\d+(?:\.\d+)?)%;(?: Time left:\s+(?P<eta>\d+(?:\.\d+)?)m;)?(?: Change:\s+(?P<eta_interaction>\d+(?:\.\d+)?)m;)?"
),
]
self.m114_pattern = re.compile(r"^X:\d+\.\d+ Y:\d+\.\d+ Z:(?P<z>\d+\.\d+) ")
Expand Down
43 changes: 7 additions & 36 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,62 +62,33 @@ def test_mode(plugin):
"SILENT MODE: Percent done: -1; print time remaining in mins: -1",
{"mode": "SILENT", "progress": "-1", "eta": "-1"},
),
# Marlin, with M73_REPORT_PRUSA
# Marlin
(
"echo: M73 Percent done: 10; Print time remaining in mins: 20; Change in mins: 7;",
"echo: M73 Progress: 10%; Time left: 20m; Change: 7m;",
{"progress": "10", "eta": "20", "eta_interaction": "7"},
),
(
"echo: M73 Percent done: 10; Print time remaining in mins: 20;",
"echo: M73 Progress: 10%; Time left: 20m;",
{"progress": "10", "eta": "20"},
),
(
"echo: M73 Percent done: 10; Change in mins: 7;",
{"progress": "10", "eta_interaction": "7"},
),
(
"echo: M73 Percent done: 10;",
{"progress": "10"},
),
(
"echo: M73 Percent done: 5; Print time remaining in mins: 10; Change in mins: 3;",
{"progress": "5", "eta": "10", "eta_interaction": "3"},
),
(
"echo: M73 Percent done: 7.0; Print time remaining in mins: 10; Change in mins: 3;",
{"progress": "7.0", "eta": "10", "eta_interaction": "3"},
),
(
"echo: M73 Percent done: 7.0; Print time remaining in mins: 10.0; Change in mins: 3.0;",
{"progress": "7.0", "eta": "10.0", "eta_interaction": "3.0"},
),
# Marlin, without M73_REPORT_PRUSA
(
"echo: M73 Progress: 10%; Time left: 20m; Change: 7m",
{"progress": "10", "eta": "20", "eta_interaction": "7"},
),
(
"echo: M73 Progress: 10%; Time left: 20m",
{"progress": "10", "eta": "20"},
),
(
"echo: M73 Progress: 10%; Change: 7m",
"echo: M73 Progress: 10%; Change: 7m;",
{"progress": "10", "eta_interaction": "7"},
),
(
"echo: M73 Progress: 10%;",
{"progress": "10"},
),
(
"echo: M73 Progress: 5%; Time left: 10m; Change: 3m",
"echo: M73 Progress: 5%; Time left: 10m; Change: 3m;",
{"progress": "5", "eta": "10", "eta_interaction": "3"},
),
(
"echo: M73 Progress: 7.0%; Time left: 10m; Change: 3m",
"echo: M73 Progress: 7.0%; Time left: 10m; Change: 3m;",
{"progress": "7.0", "eta": "10", "eta_interaction": "3"},
),
(
"echo: M73 Progress: 7.0%; Time left: 10.0m; Change: 3.0m",
"echo: M73 Progress: 7.0%; Time left: 10.0m; Change: 3.0m;",
{"progress": "7.0", "eta": "10.0", "eta_interaction": "3.0"},
),
],
Expand Down

0 comments on commit f428bb8

Please sign in to comment.