diff --git a/gui/t1m_guide1/t1m_guide1.py b/gui/t1m_guide1/t1m_guide1.py index 979979a..941c9a0 100644 --- a/gui/t1m_guide1/t1m_guide1.py +++ b/gui/t1m_guide1/t1m_guide1.py @@ -9,12 +9,17 @@ for path in paths: if path not in sys.path: sys.path.insert(0,path) +import guitastro + from guitastro_device_ascomcam import Device_Ascomcam -from pymodbus.client.sync import ModbusTcpClient +from pymodbus.client import ModbusTcpClient if __name__ == "__main__": + ima = guitastro.Ima() + path_products = ima.copy_data2products() + client = ModbusTcpClient(host='172.16.10.10', port=502) client.connect() @@ -35,6 +40,7 @@ if __name__ == "__main__": cam.ima.extension = ".fit" rootdir0 = cam.ima.rootdir cam.ima.rootdir = os.path.join(rootdir0, "t1m") + os.makedirs(cam.ima.rootdir, exist_ok=True) print(f"{cam.__repr__()}") # ------------------------ @@ -161,11 +167,14 @@ if __name__ == "__main__": m_delta = 50 else: m_delta = 51 - client.write_coils(m_alpha, True, unit=0) - client.write_coils(m_delta, True, unit=0) - time.sleep(0.3) - client.write_coils(m_alpha, False, unit=0) - client.write_coils(m_delta, False, unit=0) + try: + client.write_coils(m_alpha, True, unit=0) + client.write_coils(m_delta, True, unit=0) + time.sleep(0.3) + client.write_coils(m_alpha, False, unit=0) + client.write_coils(m_delta, False, unit=0) + except: + print("Modbus error") # ---------------------------- -- libgit2 0.21.2