Commit 8ed949c373eb29f350865fa905f4ab1b17e46672
1 parent
576f4ae6
Exists in
master
Update of T1M
Showing
1 changed file
with
15 additions
and
6 deletions
Show diff stats
gui/t1m_guide1/t1m_guide1.py
... | ... | @@ -9,12 +9,17 @@ for path in paths: |
9 | 9 | if path not in sys.path: |
10 | 10 | sys.path.insert(0,path) |
11 | 11 | |
12 | +import guitastro | |
13 | + | |
12 | 14 | from guitastro_device_ascomcam import Device_Ascomcam |
13 | 15 | |
14 | -from pymodbus.client.sync import ModbusTcpClient | |
16 | +from pymodbus.client import ModbusTcpClient | |
15 | 17 | |
16 | 18 | if __name__ == "__main__": |
17 | 19 | |
20 | + ima = guitastro.Ima() | |
21 | + path_products = ima.copy_data2products() | |
22 | + | |
18 | 23 | client = ModbusTcpClient(host='172.16.10.10', port=502) |
19 | 24 | client.connect() |
20 | 25 | |
... | ... | @@ -35,6 +40,7 @@ if __name__ == "__main__": |
35 | 40 | cam.ima.extension = ".fit" |
36 | 41 | rootdir0 = cam.ima.rootdir |
37 | 42 | cam.ima.rootdir = os.path.join(rootdir0, "t1m") |
43 | + os.makedirs(cam.ima.rootdir, exist_ok=True) | |
38 | 44 | print(f"{cam.__repr__()}") |
39 | 45 | |
40 | 46 | # ------------------------ |
... | ... | @@ -161,11 +167,14 @@ if __name__ == "__main__": |
161 | 167 | m_delta = 50 |
162 | 168 | else: |
163 | 169 | m_delta = 51 |
164 | - client.write_coils(m_alpha, True, unit=0) | |
165 | - client.write_coils(m_delta, True, unit=0) | |
166 | - time.sleep(0.3) | |
167 | - client.write_coils(m_alpha, False, unit=0) | |
168 | - client.write_coils(m_delta, False, unit=0) | |
170 | + try: | |
171 | + client.write_coils(m_alpha, True, unit=0) | |
172 | + client.write_coils(m_delta, True, unit=0) | |
173 | + time.sleep(0.3) | |
174 | + client.write_coils(m_alpha, False, unit=0) | |
175 | + client.write_coils(m_delta, False, unit=0) | |
176 | + except: | |
177 | + print("Modbus error") | |
169 | 178 | # ---------------------------- |
170 | 179 | |
171 | 180 | ... | ... |