#!/usr/bin/env python # Say Hi to Juno from 18:00 UTC on October 9, 2013 until 20:40 UTC # author : Philippe ARLOTTO # University of Toulon # Departement of Electrical Engineering # rev 1.0 # Copyright 2013 ARLOTTO # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. # To use this programm (tested only on linux/ubuntu 13.04 with fldigi 3.21.68: # Change the variable mycall for your callsign # Have fldigi running and control your rig. # Set your rig to the frequency your are assigned (see ww.jpl.nasa.gov/hijuno/) # Set your rig to usb mode # Sync your computer clock with time server (ntp) # Run it on October 9, 2013 just a few minutes before 18:00 UTC # If something goes wrong type ctrl^C and rig will return to rx mode. # You can run it again, it will wait for the start of a new sequence. from __future__ import print_function mycall = 'f5owl' # change for your callsign import xmlrpclib import socket import signal import sys from time import gmtime,strftime,time,sleep #ANSI VT100 color codes def inred() : print ('\x1B[31m') def ingreen() : print ('\x1B[32m') def inblack() : print ('\x1B[30m') inblack() print('\x1B[2J') # clear screen # connection to fldigi xml_rpc_port = 7362 # fl default xml_rpc_ip = 'localhost' fl_server = 'http://'+xml_rpc_ip+':'+str(xml_rpc_port) print ('Connecting to xml-rpc server :' + fl_server) try : fl = xmlrpclib.ServerProxy(fl_server) if fl.fldigi.name() == 'fldigi' : ingreen() print ('Connected to xml-rpc server :' + fl_server+' ') inblack() except : inred() print('Sorry unable to connect !\nPlease verify fldigi is running.\n') inblack() sys.exit(-1) def TX() : fl.main.tune() def StandBy() : fl.main.rx() def Identify(mycall) : msg='juno de '+mycall fl.main.tx() fl.text.clear_tx() fl.text.clear_rx() fl.text.add_tx(msg) while 1 : l=fl.text.get_rx_length() if l >= len(msg) : break sleep(0.1) fl.main.rx() fl.text.clear_rx() def signal_handler(signal, frame): StandBy() print ('\x1B[31mEmergency stop !!\nreturn to stand by mode...') print ('\x1B[30m') # black sys.exit(-1) #catch ctrl^C to stop TX before exit signal.signal(signal.SIGINT, signal_handler) #Identify(mycall) StandBy() seq_num = 0 started = 0 # use to wait the start of a new period fl.modem.set_by_name('CW') # main loop while 1 : utc = gmtime() s=strftime("%a, %d %b %Y %H:%M:%S", utc) print('\x1B[1;0H\x1B[30m') # cursor home black print('Current time is %s UTC'%s) if utc.tm_min % 10 == 0 and utc.tm_sec == 0 and started == 0: seq_num += 1 started = 1 print('\x1B[3;0H') print('sequence %d :'%seq_num) Identify(mycall) print('\x1B[4;0H') print(60*' ') print('\x1B[4;0H') if started : if utc.tm_min % 10 in (0,1,2,3,5,6) : if utc.tm_sec < 30 : TX() print('\x1B[31mTXing for %02d seconds '%(30 - utc.tm_sec ) ) else : StandBy() print('\x1B[32mStandby for %02d seconds '%(60 - utc.tm_sec) ) else : StandBy() if utc.tm_min % 10 == 4 : print('\x1B[32mStandby for %02d seconds' % (60 - utc.tm_sec) ) elif utc.tm_min % 10 >= 7 : StandBy() remain = (10 - (utc.tm_min % 10) )*60 - utc.tm_sec print('\x1B[32mWaiting for sequence %d end in %02d seconds'% (seq_num,remain)) if utc.tm_min % 10 >= 9 and utc.tm_sec >= 58 : started = 0 if started == 0 : StandBy() m = 9 - utc.tm_min % 10 s = 60 - utc.tm_sec print('\x1B[4;0H\x1B[30m') print('Waiting for next sequence to start in %02d min %02d s' % (m,s) ) sleep(0.25)