|
|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
from serial import Serial
|
|
|
|
|
from math import inf
|
|
|
|
|
import sys
|
|
|
|
|
import binascii
|
|
|
|
|
#import binascii
|
|
|
|
|
|
|
|
|
|
def crap_to_number(num, unit, acdc, include_unit):
|
|
|
|
|
number_str = ""
|
|
|
|
|
@ -106,66 +106,7 @@ def read_peaktech(ser, include_unit=True):
|
|
|
|
|
#print(unit[3])
|
|
|
|
|
#print(unit[4])
|
|
|
|
|
|
|
|
|
|
#if line[0:2] == b'\x1C\x20':
|
|
|
|
|
# print("Ohm")
|
|
|
|
|
#if line[0:2] == b'\x18\x20':
|
|
|
|
|
# print("beep")
|
|
|
|
|
#if line[0:1] == b'\x1e':
|
|
|
|
|
# print("V DC")
|
|
|
|
|
#if line[0:1] == b'\x1d':
|
|
|
|
|
# print("V AC")
|
|
|
|
|
#if line[0:2] == b'\x1c\x2e':
|
|
|
|
|
# print("Hz")
|
|
|
|
|
#if line[0:2] == b'\x18\x2e':
|
|
|
|
|
# print("Temp")
|
|
|
|
|
|
|
|
|
|
return crap_to_number(num, unit, acdc, include_unit)
|
|
|
|
|
#if (len(line) == 14) and (line[5] == 0x20):
|
|
|
|
|
# try:
|
|
|
|
|
# value = float( line[0:5].decode("ascii") )
|
|
|
|
|
|
|
|
|
|
# if line[6] == 0x31:
|
|
|
|
|
# value /= 10
|
|
|
|
|
# elif line[6] == 0x32:
|
|
|
|
|
# value /= 100
|
|
|
|
|
# elif line[6] == 0x33:
|
|
|
|
|
# value /= 1000
|
|
|
|
|
# elif line[6] == 0x34:
|
|
|
|
|
# value /= 10000
|
|
|
|
|
# except:
|
|
|
|
|
# value = inf
|
|
|
|
|
|
|
|
|
|
# if (line[9] & 0x80) != 0:
|
|
|
|
|
# prefix = "µ"
|
|
|
|
|
# elif (line[9] & 0x40) != 0:
|
|
|
|
|
# prefix = "m"
|
|
|
|
|
# elif (line[9] & 0x20) != 0:
|
|
|
|
|
# prefix = "k"
|
|
|
|
|
# elif (line[9] & 0x20) != 0:
|
|
|
|
|
# prefix = "M"
|
|
|
|
|
# else:
|
|
|
|
|
# prefix = ""
|
|
|
|
|
|
|
|
|
|
# if (line[10] & 0x80) != 0:
|
|
|
|
|
# unit = "V"
|
|
|
|
|
# elif (line[10] & 0x40) != 0:
|
|
|
|
|
# unit = "A"
|
|
|
|
|
# elif (line[10] & 0x20) != 0:
|
|
|
|
|
# unit = "Ω"
|
|
|
|
|
# elif (line[10] & 0x10) != 0:
|
|
|
|
|
# unit = "hFE"
|
|
|
|
|
# elif (line[10] & 0x08) != 0:
|
|
|
|
|
# unit = "Hz"
|
|
|
|
|
# elif (line[10] & 0x04) != 0:
|
|
|
|
|
# unit = "F"
|
|
|
|
|
# elif (line[10] & 0x02) != 0:
|
|
|
|
|
# unit = "℃"
|
|
|
|
|
# elif (line[10] & 0x01) != 0:
|
|
|
|
|
# unit = "℉"
|
|
|
|
|
# else:
|
|
|
|
|
# unit = ""
|
|
|
|
|
|
|
|
|
|
# print( f"{value}{prefix}{unit}" )
|
|
|
|
|
|
|
|
|
|
def read():
|
|
|
|
|
ser = Serial("/dev/ttyUSB0", 2400)
|
|
|
|
|
|