Skip to content

Commit 88b54ca

Browse files
authored
Merge pull request #1889 from PetteriAimonen/master
AXIS: Add [DISPLAY] PREVIEW_TIMEOUT setting.
2 parents 4c233e4 + d07e217 commit 88b54ca

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

docs/src/config/ini-config.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ User Manual.
305305
If the update time is not set right the screen can become unresponsive or very jerky.
306306
A value of 100ms (0.1 seconds) is a common setting though a range of 50 - 200ms (.05 - .2 seconds) may be useable.
307307
An under powered CPU may see improvement with a longer setting. Usually the default is fine.
308+
* 'PREVIEW_TIMEOUT = 5' - Timeout (in seconds) for loading graphical preview of G-code. Currently AXIS only.
308309

309310
[NOTE]
310311
The following [DISPLAY] items are used by GladeVCP, see the

docs/src/gui/axis.adoc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,25 @@ For more information on INI file settings that can change how AXIS
3737
works see the <<sub:ini:sec:display,Display Section>> of the INI
3838
Configuration Chapter.
3939

40-
Adjust the response rate of the GUI in milliseconds. Typical 100, useable range 50 - 200 +
40+
* 'CYCLE_TIME' - Adjust the response rate of the GUI in milliseconds. Typical 100, useable range 50 - 200 +
4141
(will accept time in seconds (.05 -.2) for legacy reasons - milliseconds preferred to match other screens).
42-
42+
+
4343
[source,{ini}]
4444
----
4545
[DISPLAY]
4646
CYCLE_TIME = 100
4747
----
4848

49+
* 'PREVIEW_TIMEOUT' - Set timeout in seconds for loading G-code preview.
50+
If parsing the G-code lasts longer than this, a notice is shown and only the initial part of the program
51+
is drawn in the graphical display. Specifying 0 or leaving the setting out results in no timeout.
52+
+
53+
[source,{ini}]
54+
----
55+
[DISPLAY]
56+
PREVIEW_TIMEOUT = 5
57+
----
58+
4959
=== A Typical Session
5060

5161
. Launch LinuxCNC and select a configuration file.

src/emc/usr_intf/axis/scripts/axis.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,15 @@ def __init__(self, widget, text, linecount, progress, arcdivision):
10691069
self.progress = progress
10701070
self.aborted = False
10711071
self.arcdivision = arcdivision
1072+
self.timeout_time = None
1073+
1074+
def set_timeout(self, timeout):
1075+
'''Abort loading of G-code if it takes more than timeout seconds from
1076+
the time this method was called. Set timeout to None to disable.'''
1077+
if timeout is None or timeout <= 0:
1078+
self.timeout_time = None
1079+
else:
1080+
self.timeout_time = time.time() + timeout
10721081

10731082
def change_tool(self, pocket):
10741083
GLCanon.change_tool(self, pocket)
@@ -1081,6 +1090,11 @@ def do_cancel(self, event):
10811090

10821091
def check_abort(self):
10831092
root_window.update()
1093+
1094+
if self.timeout_time is not None and self.timeout_time < time.time():
1095+
notifications.add("info", _("G-code preview loading timed out"))
1096+
self.aborted = True
1097+
10841098
if self.aborted: raise KeyboardInterrupt
10851099

10861100
def next_line(self, st):
@@ -1217,6 +1231,10 @@ def open_file_guts(f, filtered=False, addrecent=True):
12171231
shutil.copy(parameter, temp_parameter)
12181232
canon.parameter_file = temp_parameter
12191233

1234+
timeout = inifile.find("DISPLAY", "PREVIEW_TIMEOUT") or ""
1235+
if timeout:
1236+
canon.set_timeout(float(timeout))
1237+
12201238
initcode = inifile.find("EMC", "RS274NGC_STARTUP_CODE") or ""
12211239
if initcode == "":
12221240
initcode = inifile.find("RS274NGC", "RS274NGC_STARTUP_CODE") or ""

0 commit comments

Comments
 (0)