Adam,

I know this thread is from almost 3 years ago but here goes anyway...... 
I'm using YAAC and weewx on a Ubuntu machine, saw you efforts and code to 
use the CWOP to output to APRS. I'm trying to configure my Acurite 5 in 1 
wx station to do the same since I don't see a driver in YAAC that supports 
it directly. If I understand your code correctly you dropped that into the 
weewx.conf, in place of or in addition to the CWOP code already there. Any 
additional thoughts or pointers from you or anyone would be 
appreciated.............Gary   

On Monday, July 20, 2015 at 5:05:09 PM UTC-5, Adam Griffiths wrote:
>
> Thanks Tom,
>
> using your suggestions, and the hints I was able to gain from Nate's code 
> I was able to get the code running.
>
> Issues included
> -my own syntax issues in python
> -issues with serial port, flow control, and write timeouts
> -issues with my tinytrak4 operating as a radio TNC,requiring change from 
> KISS mode to TEXT mode.
>
> I've hardcoded most of the serial variables for now.  It's work in 
> progress to incorporate then properly into configuration files but 
> basically I can now use the code below as a drop in replacement for the 
> send_tnc_packet() function in the CWOP. 
>
>     def send_serial_packet(self, tnc_packet):
>         # Send packet to serial port
>         try:
>             _ser = serial.Serial('/dev/ttyUSB0')
>             _ser.baudrate = int(19200)
>             _ser.bytesize = int(8)
>             _ser.parity = "N"
>             _ser.writeTimeout = int(1)
>             _ser.stopbits = int(1)
>             #syslog.syslog(syslog.LOG_DEBUG, "APRS: able to set serial 
> speed %s " %_ser)
>             _ser.open()
>             _ser.flushOutput()
>             _ser.flushInput()
>             _ser.write(tnc_packet + "\r")
>             time.sleep(1)
>             _ser.flushInput()
>             _ser.flushOutput()
>             _ser.close()
>             syslog.syslog(syslog.LOG_DEBUG, "restx: APRSTNC: %s " 
> %tnc_packet)
>         except serial.SerialException, e:
>             syslog.syslog(syslog.LOG_DEBUG, "APRS: Unable to open serial 
> port")
>         return
>         try:
>             _ser.close()
>         except:
>             pass
>  
> Data is now being uploaded every 30 mins via radio and can be found at: 
> http://aprs.fi/weather/a/VK3AGD-9
>
> Cheers,
>
> Adam Griffiths
>
>
> On Tuesday, June 30, 2015 at 11:15:27 PM UTC+10, Tom Keffer wrote:
>>
>> Good reason to put all I/O statements inside a "try" block.
>>
>> Something like (NOT TESTED):
>>
>> import serial
>> import termios
>>
>> try:
>>   _ser = serial.Serial(self.port)
>> except serial.SerialException, e:
>>   syslog.syslog(syslog.LOG_ERR, "APRS: Unable to open port %s" % 
>> self.port)
>>   return
>>
>> try:
>>     # Send packet to serial port
>>     _ser.baudrate = self.baudrate
>>     _ser.bytesize = self.databits
>>     _ser.parity = self.parity
>>     _ser.stopbits = self.stopbits
>>     _ser.flushOutput()
>>     _ser.flushInput()
>>     # put the tnc in command mode, equivalent to ctrl-C
>>     _ser.write("\x03")
>>     time.sleep(1)
>>     _ser.write("mycall " + self.station + "\r")
>>     time.sleep(1)
>>     _ser.write("unproto " + self.unproto + "\r")
>>     time.sleep(1)
>>     _ser.write("conv\r")
>>     time.sleep(1)
>>     _ser.write(_aprstnc_packet + "\r")
>>     time.sleep(1)
>>     _ser.write(">" + self.status_message + "\r")
>>     _ser.write("\x03")
>>     _ser.flushInput()
>>     _ser.flushOutput()
>> except (serial.SerialException, termios.error), e:
>>     syslog.syslog(syslog.LOG_ERR,"APRS exception: "%e)
>> finally:
>>     _ser.close()
>>
>>
>> (Functions flushInput() and flushOutput() can raise an undocumented 
>> exception termios.error)
>>
>> -tk
>>
>>
>> On Tue, Jun 30, 2015 at 4:31 AM, Adam Griffiths <adam.gr...@gmail.com> 
>> wrote:
>>
>>> Thanks Tom and Nate,
>>>
>>> The code is failing in the serial output area, and just dropping the 
>>> thread.  
>>>
>>> In this section below, more troubleshooting to come.
>>>
>>> <         # Send packet to serial port
>>> <         _ser = serial.Serial(self.port)
>>> <         _ser.baudrate = self.baudrate
>>> <         _ser.bytesize = self.databits
>>> <         _ser.parity = self.parity
>>> <         _ser.stopbits = self.stopbits
>>> <         _ser.flushOutput()
>>> <         _ser.flushInput()
>>> <         # put the tnc in command mode, equivalent to ctrl-C
>>> <         _ser.write("\x03")
>>> <         time.sleep(1)
>>> <         _ser.write("mycall " + self.station + "\r")
>>> <         time.sleep(1)
>>> <         _ser.write("unproto " + self.unproto + "\r")
>>> <         time.sleep(1)
>>> <         _ser.write("conv\r")
>>> <         time.sleep(1)
>>> <         _ser.write(_aprstnc_packet + "\r")
>>> <         time.sleep(1)
>>> <         _ser.write(">" + self.status_message + "\r")
>>> <         _ser.write("\x03")
>>> <         _ser.flushInput()
>>> <         _ser.flushOutput()
>>>
>>>
>>>
>>> On Monday, June 29, 2015 at 1:50:42 PM UTC+10, Tom Keffer wrote:
>>>>
>>>> You're just going to have to instrument the code. Put in print 
>>>> statements at regular intervals and watch what happens. 
>>>>
>>>> Run it from the command line, otherwise stdout will get swallowed.
>>>>
>>>> -tk
>>>>
>>>> On Sun, Jun 28, 2015 at 8:44 PM, Adam Griffiths <adam.gr...@gmail.com> 
>>>> wrote:
>>>>
>>>>> Thanks Tom,
>>>>>
>>>>> Still no luck, and no errors running from either console or as a 
>>>>> daemon. Debug logs showing the new APRSTNC service loading but no 
>>>>> messages 
>>>>> regarding sending data.
>>>>>
>>>>> On console, I'm just getting copies of the record when generated but 
>>>>> no other messages which appears to be expected behaviour.
>>>>>
>>>>> Again, just appears like it's not entering the self.process_record() 
>>>>> process (ie stdAPRNSTNC.process_record().
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Adam
>>>>>
>>>>>
>>>>> On Monday, June 29, 2015 at 8:33:17 AM UTC+10, Tom Keffer wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sun, Jun 28, 2015 at 3:30 PM, Adam Griffiths <adam.gr...@gmail.com
>>>>>> > wrote:
>>>>>>
>>>>>>> would that have stopped it processing the records? 
>>>>>>>
>>>>>>
>>>>>> If the program was run as a daemon, it would silently kill the thread.
>>>>>>
>>>>>> If it was run from the console, it would have printed out an 
>>>>>> exception stack.
>>>>>>
>>>>>> Another good reason to try things from the console first!
>>>>>>
>>>>>> -tk‚Äč
>>>>>>  
>>>>>>
>>>>>
>>>>
>>

Reply via email to