> > I wrote a driver for Davis Weather Monitor II during the weekend. I have > tested today and got rid of some bugs. > If anyone wants to help me debug it I have uploaded it to > github: https://github.com/jardiamj/weewx-wmII-driver >
On Wednesday, September 2, 2015 at 2:22:28 PM UTC-7, Mark Cheavens wrote: > > For those that might stumble upon this in the future. Here is a full > working test of one packet of data with a CRC test. > The packet of data is from a Davis Weather Monitor II. I also have a full > working python script to get one packet and decode it. It also creates a > valid APRS packet for use by APRX. > Further simplification could be done, but might not be as easy for a NOOB > to understand. > > Thank you for your help Tom! > > #!/usr/bin/python > # This is an example of checking a response packet from a Davis WMII > # weather station after requesting one packet (LOOP0xffff<CR>) > import crc16 > import binascii > > DataString = "0601ea022a030488009a551b1b952300007fb4" > # 06 is an "ACK" to the request, 01 is a "SOH" - Start of Heading" > # Per the Davis manual the "Data" is NON-Inclusive of the "01" and ends > just > # prior to the last two bytes, which is the CRC of the packet. > # --- Functions ---- > def hex2dec(s): # Function to create a std excel like hex to > decimal. > return int(s, 16) > > # --- End of Functions ---- > > print "start to decode the DataString..." > ChunkHeader = DataString[:4] > if ChunkHeader != "0601": > exit() > ChunkCRC = DataString[34:38] # These are the CRC bytes > ChunkData = DataString[4:34] > CRCofData = crc16.crc16(binascii.a2b_hex(ChunkData)) > print "Full Packet: " + DataString > print "ChunkData - Payload: " + ChunkData > print "CRC of ChunkData:(decimal) " + str(CRCofData) > print "Decimal of CRC ( "+ChunkCRC+" ): " + str(hex2dec(ChunkCRC)) > # Done with CRC >
