Merge pull request #6 from marto87/device/009a

Minor fixes after refactoring
This commit is contained in:
uunicorn 2020-07-02 13:33:45 +12:00 committed by GitHub
commit 2a3e675a29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -1,6 +1,7 @@
from enum import Enum from enum import Enum
from hashlib import sha256
import os.path
from .tls import tls from .tls import tls
from .usb import usb from .usb import usb
from .db import db, subtype_to_string from .db import db, subtype_to_string
@ -214,7 +215,7 @@ class Sensor():
factory_bits = get_factory_bits(0x0e00) factory_bits = get_factory_bits(0x0e00)
self.factory_calibration_values = factory_bits[3][4:] self.factory_calibration_values = factory_bits[3][4:]
if load_calib_data and isfile(calib_data_path): if load_calib_data and os.path.isfile(calib_data_path):
with open(calib_data_path, 'rb') as f: with open(calib_data_path, 'rb') as f:
self.calib_data = f.read() self.calib_data = f.read()
print('Calibration data loaded from a file.') print('Calibration data loaded from a file.')

View file

@ -23,7 +23,7 @@ class Usb():
except: except:
pass pass
def open(self, vendor=0x138a, product=0x0097): def open(self, vendor=0x06cb, product=0x009a):
self.dev = ucore.find(idVendor=vendor, idProduct=product) self.dev = ucore.find(idVendor=vendor, idProduct=product)
self.dev.default_timeout = 15000 self.dev.default_timeout = 15000
self.thread = Thread(target=lambda: self.int_thread()) self.thread = Thread(target=lambda: self.int_thread())