Compare View
Commits (3)
Showing
1 changed file
Show diff stats
gui/t1m_guide1/t1m_guide1.py
1 | +# pip install | |
1 | 2 | import numpy as np |
2 | 3 | import os |
3 | 4 | import sys |
... | ... | @@ -9,12 +10,17 @@ for path in paths: |
9 | 10 | if path not in sys.path: |
10 | 11 | sys.path.insert(0,path) |
11 | 12 | |
13 | +import guitastro | |
14 | + | |
12 | 15 | from guitastro_device_ascomcam import Device_Ascomcam |
13 | 16 | |
14 | -from pymodbus.client.sync import ModbusTcpClient | |
17 | +from pymodbus.client import ModbusTcpClient | |
15 | 18 | |
16 | 19 | if __name__ == "__main__": |
17 | 20 | |
21 | + ima = guitastro.Ima() | |
22 | + path_products = ima.copy_data2products() | |
23 | + | |
18 | 24 | client = ModbusTcpClient(host='172.16.10.10', port=502) |
19 | 25 | client.connect() |
20 | 26 | |
... | ... | @@ -35,6 +41,7 @@ if __name__ == "__main__": |
35 | 41 | cam.ima.extension = ".fit" |
36 | 42 | rootdir0 = cam.ima.rootdir |
37 | 43 | cam.ima.rootdir = os.path.join(rootdir0, "t1m") |
44 | + os.makedirs(cam.ima.rootdir, exist_ok=True) | |
38 | 45 | print(f"{cam.__repr__()}") |
39 | 46 | |
40 | 47 | # ------------------------ |
... | ... | @@ -161,11 +168,14 @@ if __name__ == "__main__": |
161 | 168 | m_delta = 50 |
162 | 169 | else: |
163 | 170 | 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) | |
171 | + try: | |
172 | + client.write_coils(m_alpha, True, unit=0) | |
173 | + client.write_coils(m_delta, True, unit=0) | |
174 | + time.sleep(0.3) | |
175 | + client.write_coils(m_alpha, False, unit=0) | |
176 | + client.write_coils(m_delta, False, unit=0) | |
177 | + except: | |
178 | + print("Modbus error") | |
169 | 179 | # ---------------------------- |
170 | 180 | |
171 | 181 | ... | ... |