Skip to content

Commit 5262cd0

Browse files
committed
qtplasmac: remove link in config directory
1 parent 935ec22 commit 5262cd0

28 files changed

Lines changed: 1396 additions & 358 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/M190

configs/by_machine/qtplasmac/qtplasmac/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/python3.9
2+
'''
3+
M190
4+
5+
Copyright (C) 2019, 2020, 2021 Phillip A Carter
6+
Copyright (C) 2020, 2021 Gregory D Carl
7+
8+
This program is free software; you can redistribute it and/or modify it
9+
under the terms of the GNU General Public License as published by the
10+
Free Software Foundation; either version 2 of the License, or
11+
(at your option) any later version.
12+
13+
This program is distributed in the hope that it will be useful, but
14+
WITHOUT ANY WARRANTY; without even the implied warranty of
15+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
GNU General Public License for more details.
17+
18+
You should have received a copy of the GNU General Public License along
19+
with this program; if not, write to the Free Software Foundation, Inc.,
20+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21+
'''
22+
23+
import sys
24+
import time
25+
from subprocess import run as RUN
26+
27+
materialNum = int(float(sys.argv[1]))
28+
timeout = 0.5
29+
30+
def get_material():
31+
response = RUN(['halcmd', 'getp', 'qtplasmac.material_change_number'], capture_output = True)
32+
return int(response.stdout.decode())
33+
34+
def set_material(material):
35+
RUN(['halcmd', 'setp', 'qtplasmac.material_change_number', '{}'.format(material)])
36+
37+
def get_change():
38+
response = RUN(['halcmd', 'getp', 'qtplasmac.material_change'], capture_output = True)
39+
return int(response.stdout.decode())
40+
41+
def set_change(value):
42+
RUN(['halcmd', 'setp', 'qtplasmac.material_change', '{}'.format(value)])
43+
44+
def set_timeout():
45+
RUN(['halcmd', 'setp', 'qtplasmac.material_change_timeout', 1])
46+
47+
try:
48+
if materialNum != get_material():
49+
set_change(1)
50+
set_material(materialNum)
51+
else:
52+
set_change(3)
53+
start = time.time()
54+
while get_change() == 1 or get_change() == 3:
55+
if time.time() > start + timeout:
56+
set_timeout()
57+
break
58+
set_change(0)
59+
except:
60+
pass
61+
exit()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
The files in this directory are used for the transition away
3+
from a qtplasmac subdirectory in the machine config directory.
4+
5+
This complete directory will be deleted in the future.

0 commit comments

Comments
 (0)