def main(): try: gpredict = TCP_server.server_socket() except Exception as e: print(e) print("Várakozás a Gpredict csatlakozására") gpredict.connect(TCP_server.Host, TCP_server.Port) print("Csatlakozva") config.usb_config() config.usb_open() command.position_read() while True: command.ant_az = str(command.ant_az) command.ant_el = str(command.ant_el) response = command.ant_az + '\n' + command.ant_el + '\n' response = bytes(response, 'utf-8') gpredict.respond(response) data = gpredict.receive() if data[0] == 'S': print("Kapcsolat megszakadt") print("Várakozás az újracsatlakozásra") gpredict.acceptNew() print("Csatlakozva") if data[0] == "": print("Várakozás a csatlakozásra") gpredict.acceptNew() print("Csatlakozva") if data[0] == 'P': az_el = str(data) az_el = az_el.replace(",", ".") az_el = az_el.split() az = int(float(az_el[1])) el = int(float(az_el[2])) command.position_set(az, el) command.position_read() print("muhold pozció(az,el):", az, el) config.usb_close()
def main(): print("Antenna_park_position") config.usb_config() config.usb_open() command.position_read() command.position_set(180, 90) while (command.ant_az != 180 or command.ant_el != 90): command.position_read() print(command.ant_az, command.ant_el) time.sleep(1.000) config.usb_close()
def main(): #demo positions--------------------------- az_demo = [1, 359, 180, 180] el_demo = [0, 0, 0, 90] config.usb_config() config.usb_open() command.position_read() for i in range(7): command.position_set(az_demo[i], el_demo[i]) time.sleep(.300) while (az_demo[i] != command.ant_az or el_demo[i] != command.ant_el): command.position_read() print(command.ant_az, command.ant_el, i) time.sleep(1.000) config.usb_close()